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:
		
				
					committed by
					
						
						David Thompson
					
				
			
			
				
	
			
			
			
						parent
						
							e25ed2d569
						
					
				
				
					commit
					142006f884
				
			@@ -105,8 +105,17 @@ post."
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
(define (read-html-post port)
 | 
					(define (read-html-post port)
 | 
				
			||||||
  (values (read-metadata-headers port)
 | 
					  (values (read-metadata-headers port)
 | 
				
			||||||
          (match (xml->sxml port)
 | 
					          (let loop ()
 | 
				
			||||||
            (('*TOP* sxml) sxml))))
 | 
					            (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) (cons sxml (loop))))))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define html-reader
 | 
					(define html-reader
 | 
				
			||||||
  (make-reader (make-file-extension-matcher "html")
 | 
					  (make-reader (make-file-extension-matcher "html")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user