Rename functions for clarity.

This commit is contained in:
Ray Miller 2024-08-28 16:17:45 +01:00
parent b2e883105c
commit 7c9774e11a

View file

@ -70,7 +70,7 @@
(list-matches md-img-rx doc))
doc)
(define (replace-links doc)
(define (replace-image-links doc)
(for-each (lambda (m)
(let* ((url (match:substring m 1))
(filename (download-image url))
@ -79,7 +79,7 @@
(list-matches md-img-link-rx doc))
doc)
(define (replace-amazon-tracking-images doc)
(define (remove-amazon-tracking-images doc)
(for-each (lambda (m)
(set! doc (string-replace-substring doc (match:substring m) "")))
(list-matches amazon-assoc-img-rx doc))
@ -102,10 +102,10 @@
(define (process-file path)
(format #t "process-file ~a~%" path)
(let ((doc (chain (call-with-input-file path get-string-all)
(replace-amazon-tracking-images _)
(remove-amazon-tracking-images _)
(remove-amazon-links _)
(replace-images _)
(replace-links _)
(replace-image-links _)
(replace-self-links _))))
(call-with-output-file path (cut put-string <> doc))))