Implement heading parsing
This commit is contained in:
parent
5f1620e0e7
commit
7652cb17cf
1 changed files with 9 additions and 4 deletions
|
@ -420,7 +420,6 @@
|
||||||
(knext (cons para nodelist))))))
|
(knext (cons para nodelist))))))
|
||||||
(define (done? ch)
|
(define (done? ch)
|
||||||
(match ch
|
(match ch
|
||||||
(#\return (done? (next)))
|
|
||||||
(#\newline
|
(#\newline
|
||||||
(let ((ch (next)))
|
(let ((ch (next)))
|
||||||
(match ch
|
(match ch
|
||||||
|
@ -440,8 +439,14 @@
|
||||||
(unget chars)
|
(unget chars)
|
||||||
(read-para indent kup knext))
|
(read-para indent kup knext))
|
||||||
|
|
||||||
(define (read-heading level knext)
|
(define (read-heading level indent continue)
|
||||||
(error "unimplemented"))
|
(let ((continue (lambda (heading)
|
||||||
|
(match heading
|
||||||
|
(('heading . body)
|
||||||
|
(continue `(heading ,level . ,body)))))))
|
||||||
|
(read-text 'heading indent (lambda (ch)
|
||||||
|
(and (eqv? ch #\newline) continue))
|
||||||
|
continue)))
|
||||||
|
|
||||||
(define (read-li marker marker-indent marker-size kup knext)
|
(define (read-li marker marker-indent marker-size kup knext)
|
||||||
(read-indent
|
(read-indent
|
||||||
|
@ -485,7 +490,7 @@
|
||||||
(#\space
|
(#\space
|
||||||
(kblock
|
(kblock
|
||||||
(lambda (indent kup knext)
|
(lambda (indent kup knext)
|
||||||
(read-heading level (make-continue indent kup knext)))))
|
(read-heading level indent (make-continue indent kup knext)))))
|
||||||
(#\return (lp level))
|
(#\return (lp level))
|
||||||
(#\newline
|
(#\newline
|
||||||
(kblock
|
(kblock
|
||||||
|
|
Loading…
Reference in a new issue