reader: html: Add support for multiple top-level elements.
Currently, if given a file containing more than one top-level elements, 'read-html-post will only return the first.
This commit is contained in:
parent
e25ed2d569
commit
142006f884
|
@ -105,8 +105,17 @@ post."
|
|||
|
||||
(define (read-html-post port)
|
||||
(values (read-metadata-headers port)
|
||||
(let loop ()
|
||||
(let ((next-char (peek-char port)))
|
||||
(cond
|
||||
((eof-object? next-char)
|
||||
'())
|
||||
((char-set-contains? char-set:whitespace next-char)
|
||||
(read-char port)
|
||||
(loop))
|
||||
(else
|
||||
(match (xml->sxml port)
|
||||
(('*TOP* sxml) sxml))))
|
||||
(('*TOP* sxml) (cons sxml (loop))))))))))
|
||||
|
||||
(define html-reader
|
||||
(make-reader (make-file-extension-matcher "html")
|
||||
|
|
Loading…
Reference in New Issue