diff options
Diffstat (limited to 'org/blog/generate-phlog.scm')
-rwxr-xr-x | org/blog/generate-phlog.scm | 22 |
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))))) |