From ed4e86f47935994fb424c977e4123bde625ddff1 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 3 Jun 2024 16:56:30 -0500 Subject: Fix html/other sourcing; re-scramble Makefile --- src/read.scm | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src/read.scm') diff --git a/src/read.scm b/src/read.scm index 94708ef..1b611bb 100644 --- a/src/read.scm +++ b/src/read.scm @@ -36,19 +36,34 @@ ((null? words) ; empty line (parse-lines (cdr lines) doc)) ((equal? (car words) "```") ; verbatim - (parse-verbatim (cdr lines) doc '())) + ;; Format for verbatim header: + ;; ``` ?html | command ... + ;; -- only run command on block with html output. + ;; other outputs process the block normally + ;; ``` ?!html | command ... + ;; -- only run command on block when *not* outputting html. + ;; html processes the block normally + ;; ``` ?:html | command ... + ;; -- like ?html, but ignore the block in non-html outputs. + ;;;; FIXME: I think this necessitates a special emit-verbatim + ;;;; function. + (parse-verbatim (cdr lines) doc '() + #; (if (< 1 (length words)) + (cons 'verb (cdr words)) + 'verb) + 'verb)) (else ; another line type (apply parse-stanza lines doc '() (line-type words))))))) -(define (parse-verbatim lines doc block) - (define (close-verbatim) (cons (cons 'verb (reverse block)) doc)) +(define (parse-verbatim lines doc block bhead) + (define (close-verbatim) (cons (cons bhead (reverse block)) doc)) (cond - ((null? lines) ; end of document + ((null? lines) ; end of document (parse-lines lines (close-verbatim))) - ((equal? (car lines) "```") ; end of verbatim block + ((equal? (car lines) "```") ; end of verbatim block (parse-lines (cdr lines) (close-verbatim))) - (else ; verbatim block continues - (parse-verbatim (cdr lines) doc (cons (list (car lines)) block))))) + (else ; verbatim block continues + (parse-verbatim (cdr lines) doc (cons (list (car lines)) block) bhead)))) (define (parse-stanza lines doc stanza st-type #!optional (st-inlines '()) (st-words cdr)) -- cgit 1.4.1-21-gabe81