#!/usr/bin/guile \ -e main -s De-Blogger script for cleaning up data exported from blogger and downloading linked images from the Blogger CDN. Copyright (C) 2024 Ray Miller . This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . !# (use-modules (srfi srfi-26) (srfi srfi-71) (srfi srfi-197) (ice-9 regex) (ice-9 textual-ports) (ice-9 binary-ports) (ice-9 ftw) (ice-9 format) (ice-9 string-fun) (web client) (web response)) (define base-dir "/home/ray/Workspace/personal/start-again-at-zero/") (define posts-dir (string-append base-dir "content/posts/")) (define image-dir (string-append base-dir "static/img/")) (define md-img-rx (make-regexp "!\\[[^]]*\\]\\((https?[^)]+)\\)")) (define md-img-link-rx (make-regexp "\\((https?[^)]+\\.(png|jpg))\\)" regexp/icase)) (define img-src-rx (make-regexp " doc)))) (define (main args) (for-each process-file (map (cute string-append posts-dir <>) (scandir posts-dir (cute string-suffix? ".md" <>)))))