mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
Fix attribute skipping for chibi-doc text rendering.
Closes #996. Also guard against bad input with proper-list?.
This commit is contained in:
parent
020469bdbd
commit
e09fdb7e31
2 changed files with 10 additions and 8 deletions
|
@ -167,7 +167,7 @@
|
|||
sxml)))
|
||||
(let lp ((sxml sxml))
|
||||
(cond
|
||||
((pair? sxml)
|
||||
((proper-list? sxml)
|
||||
(let ((tag (car sxml)))
|
||||
(cond
|
||||
;; skip headers and the menu
|
||||
|
@ -176,16 +176,18 @@
|
|||
(pair? (cdr sxml))
|
||||
(pair? (cadr sxml))
|
||||
(eq? '@ (car (cadr sxml)))
|
||||
(equal? '(id . "menu") (assq 'id (cdr (cadr sxml)))))))
|
||||
(equal? '(id . "menu") (assq 'id (cdr (cadr sxml))))))
|
||||
)
|
||||
;; recurse other tags, appending newlines for new sections
|
||||
((symbol? tag)
|
||||
(if (memq tag '(h1 h2 h3 h4 h5 h6))
|
||||
(newline out))
|
||||
(for-each
|
||||
lp
|
||||
(if (and (pair? (cdr sxml)) (eq? '@ (cadr sxml)))
|
||||
(cddr sxml)
|
||||
(cdr sxml)))
|
||||
(let ((ls (if (and (pair? (cdr sxml))
|
||||
(pair? (cadr sxml))
|
||||
(eq? '@ (car (cadr sxml))))
|
||||
(cddr sxml)
|
||||
(cdr sxml))))
|
||||
(for-each lp ls))
|
||||
(if (memq tag '(p li br h1 h2 h3 h4 h5 h6))
|
||||
(newline out)))
|
||||
(else
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
(define-library (chibi sxml)
|
||||
(export sxml->xml sxml-display-as-html sxml-display-as-text sxml-strip
|
||||
html-escape html-tag->string)
|
||||
(import (scheme base) (scheme write))
|
||||
(import (scheme base) (scheme list) (scheme write))
|
||||
(include "sxml.scm"))
|
||||
|
|
Loading…
Add table
Reference in a new issue