Commit debaca16 authored by Muto's avatar Muto 🌸

Read HTML files, too.

parent e3dd9eb3
......@@ -56,6 +56,16 @@
((ls dir ...) ; strcat all strings together.
(cddr (scandir (string-append dir ...))))))
;; Tests to see if a file is SXML or HTML
(define (is-html? file)
(or
(string-contains-ci file ".html")
(string-contains-ci file ".htm")))
(define (is-sxml? file)
(or
(string-contains-ci file ".scm")
(string-contains-ci file ".sxml")))
(define current-title '()) ; Title of a blog post.
(define current-date '()) ; Date of a blog post.
......@@ -99,6 +109,7 @@
(set! count (1+ count))
(unless (file-exists? out-folder)
(mkdir out-folder)) ; Make sure the output folder exists.
(if (is-sxml? file)
(let ((port
(open-output-file ; The outputted HTML file
(string-append
......@@ -107,7 +118,19 @@
".html")))) ; Add HTML, so test.scm -> test.html
(display "<!DOCTYPE html>" port) ;That kinda stinks.
(sxml->xml (load file) port) ; Main conversion.
(display "\n" port)))))) ; UNIX newline.
(display "\n" port)))
(if (is-html? file)
(let ((port
(open-output-file ; The outputted HTML file
(string-append
out-folder ; site/ is the usual.
(basename file)))))
(display "<!DOCTYPE html>" port)
(sxml->xml
(page #:title "Spook"
#:body (xml->sxml (open-input-file file))) port)
(display "\n" port)))))))
(display " \x1B[1;91mReading ")
(display count)
(display " files. \x1B[m")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment