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)))
|
sxml)))
|
||||||
(let lp ((sxml sxml))
|
(let lp ((sxml sxml))
|
||||||
(cond
|
(cond
|
||||||
((pair? sxml)
|
((proper-list? sxml)
|
||||||
(let ((tag (car sxml)))
|
(let ((tag (car sxml)))
|
||||||
(cond
|
(cond
|
||||||
;; skip headers and the menu
|
;; skip headers and the menu
|
||||||
|
@ -176,16 +176,18 @@
|
||||||
(pair? (cdr sxml))
|
(pair? (cdr sxml))
|
||||||
(pair? (cadr sxml))
|
(pair? (cadr sxml))
|
||||||
(eq? '@ (car (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
|
;; recurse other tags, appending newlines for new sections
|
||||||
((symbol? tag)
|
((symbol? tag)
|
||||||
(if (memq tag '(h1 h2 h3 h4 h5 h6))
|
(if (memq tag '(h1 h2 h3 h4 h5 h6))
|
||||||
(newline out))
|
(newline out))
|
||||||
(for-each
|
(let ((ls (if (and (pair? (cdr sxml))
|
||||||
lp
|
(pair? (cadr sxml))
|
||||||
(if (and (pair? (cdr sxml)) (eq? '@ (cadr sxml)))
|
(eq? '@ (car (cadr sxml))))
|
||||||
(cddr sxml)
|
(cddr sxml)
|
||||||
(cdr sxml)))
|
(cdr sxml))))
|
||||||
|
(for-each lp ls))
|
||||||
(if (memq tag '(p li br h1 h2 h3 h4 h5 h6))
|
(if (memq tag '(p li br h1 h2 h3 h4 h5 h6))
|
||||||
(newline out)))
|
(newline out)))
|
||||||
(else
|
(else
|
||||||
|
|
|
@ -4,5 +4,5 @@
|
||||||
(define-library (chibi sxml)
|
(define-library (chibi sxml)
|
||||||
(export sxml->xml sxml-display-as-html sxml-display-as-text sxml-strip
|
(export sxml->xml sxml-display-as-html sxml-display-as-text sxml-strip
|
||||||
html-escape html-tag->string)
|
html-escape html-tag->string)
|
||||||
(import (scheme base) (scheme write))
|
(import (scheme base) (scheme list) (scheme write))
|
||||||
(include "sxml.scm"))
|
(include "sxml.scm"))
|
||||||
|
|
Loading…
Add table
Reference in a new issue