aboutsummaryrefslogtreecommitdiff
path: root/org/blog/generate-phlog.scm
diff options
context:
space:
mode:
authornathan <nathansmith@disroot.org>2025-06-06 06:24:01 -0600
committernathan <nathansmith@disroot.org>2025-06-06 06:24:01 -0600
commit484895e052ba88804f470a7cf26961d2f5cc7d0a (patch)
treecfa69725397d978defe6eb0ba391a8ed722951a3 /org/blog/generate-phlog.scm
parent03f020fd64071d5f000fcd0c326a7d1c71b96917 (diff)
phlog working
Diffstat (limited to 'org/blog/generate-phlog.scm')
-rwxr-xr-xorg/blog/generate-phlog.scm22
1 files changed, 15 insertions, 7 deletions
diff --git a/org/blog/generate-phlog.scm b/org/blog/generate-phlog.scm
index 3b24da5..8d7445b 100755
--- a/org/blog/generate-phlog.scm
+++ b/org/blog/generate-phlog.scm
@@ -4,7 +4,7 @@
(use-modules (sxml simple))
-(define (format-gophermap-filename file)
+(define (format-article-filename file)
(let ((file-length (string-length file)))
(string-append (substring file
0
@@ -15,10 +15,11 @@
(let ((title (cadr (list-ref article 0)))
(pub-date (cadr (list-ref article 4)))
(file (cadr (list-ref article 6))))
- (string-append "0" pub-date " - " title "\t" file)))
+ (string-append "0" pub-date " - " title "\t"
+ (format-article-filename file))))
(define (make-gophermap articles)
- (call-with-output-file "phlog/gophermap"
+ (call-with-output-file "gophermap"
(lambda (fp)
(for-each
(lambda (article)
@@ -27,16 +28,23 @@
(newline fp)))
(cdr (cadr articles))))))
+(define (make-blog-file article)
+ (let ((file (cadr (list-ref article 6))))
+ (system
+ (string-append "html2text " file " > "
+ (format-article-filename file)))))
+
(define (make-blogs articles)
- '())
+ (for-each
+ (lambda (article)
+ (if (list? article)
+ (make-blog-file (cddr article))))
+ (cdr (cadr articles))))
(define (generate-phlog)
(call-with-input-file "articles.xml"
(lambda (fp)
(let ((articles (xml->sxml fp)))
- (unless (file-exists? "phlog")
- (mkdir "phlog")
- (mkdir "phlog/articles"))
(make-gophermap articles)
(make-blogs articles)))))