1
0
Fork 0

Merge branch 'svg-support' into customizations

This commit is contained in:
Tom Willemse 2021-07-02 02:32:22 -07:00
commit a502f2ce9c

View file

@ -80,15 +80,24 @@
(define (wordpress->sxml text) (define (wordpress->sxml text)
(let ((sxml (cadr (with-input-from-string* (string-append "<div>" text "</div>") (let ((sxml (cadr (with-input-from-string* (string-append "<div>" text "</div>")
xml->sxml)))) (lambda () (xml->sxml #:namespaces '((svg . "http://www.w3.org/2000/svg"))))))))
(pre-post-order (pre-post-order
sxml sxml
`((*default* . ,(lambda (tag . body) `((*default* . ,(lambda (tag . body)
(if (can-contain-p? tag) (let ((tag (if (string-prefix? "svg:" (symbol->string tag))
(wpautop tag body) (string->symbol (substring (symbol->string tag) 4))
(cons tag body)))) tag)))
(if (can-contain-p? tag)
(wpautop tag body)
(cons tag body)))))
(*text* . ,(lambda (tag text) (*text* . ,(lambda (tag text)
text)))))) text))
(svg:svg . ,(lambda (tag . body)
(cons 'svg
(cons `(@ (xmlns "http://www.w3.org/2000/svg")
(xmlns:xlink "http://www.w3.org/1999/xlink")
,@(cdar body))
(cdr body)))))))))
(define *allowed-tags* (define *allowed-tags*
`((a (href . ,urlish?) title) `((a (href . ,urlish?) title)