Handle CR/LF in marxdown; fix trailing ! in paragraphs
This commit is contained in:
parent
4a9766c6c1
commit
5f1620e0e7
1 changed files with 13 additions and 4 deletions
|
@ -213,6 +213,8 @@
|
||||||
(#\newline
|
(#\newline
|
||||||
;; Sure. Trailing whitespace can be any indent.
|
;; Sure. Trailing whitespace can be any indent.
|
||||||
(kt))
|
(kt))
|
||||||
|
(#\return
|
||||||
|
(lp n))
|
||||||
(ch
|
(ch
|
||||||
(unless (eof-object? ch) (unget1 ch))
|
(unless (eof-object? ch) (unget1 ch))
|
||||||
(kf)))))))
|
(kf)))))))
|
||||||
|
@ -347,12 +349,14 @@
|
||||||
(let lp ((chars '()))
|
(let lp ((chars '()))
|
||||||
(match (next-not-eof "backticks")
|
(match (next-not-eof "backticks")
|
||||||
(#\` (continue `(code ,(reverse-list->string chars))))
|
(#\` (continue `(code ,(reverse-list->string chars))))
|
||||||
|
(#\return (lp chars))
|
||||||
(#\newline
|
(#\newline
|
||||||
(consume-indent
|
(consume-indent
|
||||||
indent
|
indent
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(match (next-not-eof "code")
|
(match (next-not-eof "code")
|
||||||
(#\newline (error "end of block while reading code"))
|
((or #\return #\newline)
|
||||||
|
(error "end of block while reading code"))
|
||||||
(ch (unget1 ch) (lp (cons #\space chars)))))
|
(ch (unget1 ch) (lp (cons #\space chars)))))
|
||||||
(lambda () (error "end of block while reading code"))))
|
(lambda () (error "end of block while reading code"))))
|
||||||
(ch (lp (cons ch chars))))))
|
(ch (lp (cons ch chars))))))
|
||||||
|
@ -375,6 +379,7 @@
|
||||||
(lp elts (cons elt out))))))
|
(lp elts (cons elt out))))))
|
||||||
(match (next)
|
(match (next)
|
||||||
((? eof-object?) (finish on-block-end))
|
((? eof-object?) (finish on-block-end))
|
||||||
|
(#\return (lp elts))
|
||||||
(#\newline
|
(#\newline
|
||||||
(consume-indent
|
(consume-indent
|
||||||
indent
|
indent
|
||||||
|
@ -403,7 +408,9 @@
|
||||||
(match link
|
(match link
|
||||||
(('link dest . alt)
|
(('link dest . alt)
|
||||||
(continue `(image ,dest . ,alt)))))))
|
(continue `(image ,dest . ,alt)))))))
|
||||||
(ch (lp (cons* ch #\! elts)))))
|
(ch
|
||||||
|
(unget1 ch)
|
||||||
|
(lp (cons #\! elts)))))
|
||||||
(ch (lp (cons ch elts))))))
|
(ch (lp (cons ch elts))))))
|
||||||
|
|
||||||
(define (read-para indent kup knext)
|
(define (read-para indent kup knext)
|
||||||
|
@ -413,6 +420,7 @@
|
||||||
(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
|
||||||
|
@ -446,11 +454,9 @@
|
||||||
(append marker-outer
|
(append marker-outer
|
||||||
(list (+ marker-inner marker-size outer))
|
(list (+ marker-inner marker-size outer))
|
||||||
inner)))
|
inner)))
|
||||||
(pk 'hey marker marker-indent marker-size indent body-indent ch)
|
|
||||||
(read-indented-block
|
(read-indented-block
|
||||||
ch marker-indent body-indent
|
ch marker-indent body-indent
|
||||||
(lambda (elt ch indent)
|
(lambda (elt ch indent)
|
||||||
(pk ch marker-indent indent elt)
|
|
||||||
(read-indented-block ch marker-indent indent kup
|
(read-indented-block ch marker-indent indent kup
|
||||||
(lambda (nodelist)
|
(lambda (nodelist)
|
||||||
(knext (cons elt nodelist)))))
|
(knext (cons elt nodelist)))))
|
||||||
|
@ -480,6 +486,7 @@
|
||||||
(kblock
|
(kblock
|
||||||
(lambda (indent kup knext)
|
(lambda (indent kup knext)
|
||||||
(read-heading level (make-continue indent kup knext)))))
|
(read-heading level (make-continue indent kup knext)))))
|
||||||
|
(#\return (lp level))
|
||||||
(#\newline
|
(#\newline
|
||||||
(kblock
|
(kblock
|
||||||
(lambda (indent kup knext)
|
(lambda (indent kup knext)
|
||||||
|
@ -552,6 +559,8 @@
|
||||||
(match (parse-one-xml-element port)
|
(match (parse-one-xml-element port)
|
||||||
(#f (read-block-list indent kup knext))
|
(#f (read-block-list indent kup knext))
|
||||||
(elt ((make-continue indent kup knext) `(block-xml ,elt))))))))
|
(elt ((make-continue indent kup knext) `(block-xml ,elt))))))))
|
||||||
|
(#\return
|
||||||
|
(read-block-type (next-not-eof "newline") in-text? kblock ktext))
|
||||||
(#\newline
|
(#\newline
|
||||||
;; fixme: record loose li
|
;; fixme: record loose li
|
||||||
(kblock read-block-list))
|
(kblock read-block-list))
|
||||||
|
|
Loading…
Reference in a new issue