Merge remote-tracking branch 'sourcehut/customizations' into customizations
This commit is contained in:
commit
f880847f15
2 changed files with 21 additions and 9 deletions
|
@ -81,15 +81,24 @@
|
|||
|
||||
(define (wordpress->sxml text)
|
||||
(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
|
||||
sxml
|
||||
`((*default* . ,(lambda (tag . body)
|
||||
(let ((tag (if (string-prefix? "svg:" (symbol->string tag))
|
||||
(string->symbol (substring (symbol->string tag) 4))
|
||||
tag)))
|
||||
(if (can-contain-p? tag)
|
||||
(wpautop tag body)
|
||||
(cons tag body))))
|
||||
(cons tag body)))))
|
||||
(*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 (marxdown->sxml text)
|
||||
(smarxdown->shtml (call-with-input-string text marxdown->smarxdown)))
|
||||
|
|
|
@ -301,10 +301,13 @@
|
|||
(post-from-key index key))
|
||||
(hash-ref tags tag '()))))
|
||||
(if (pair? posts)
|
||||
(respond `(,(tag-sidebar tag index)
|
||||
(h2 "posts tagged \"" ,tag "\"")
|
||||
,@(map (lambda (post) (show-post post #f))
|
||||
(take-max (reverse posts) 10)))
|
||||
(respond `((h2 "posts tagged \"" ,tag "\" ("
|
||||
,(rellink '("feed" "atom") "feed"
|
||||
#:query `(("with" . ,tag)))
|
||||
")")
|
||||
,@(map (lambda (post) `(p ,(post-link post)))
|
||||
(take-max (reverse posts) 10))
|
||||
,(related-tag-cloud tag index))
|
||||
#:etag (assq-ref index 'master)
|
||||
#:title (string-append "posts tagged \"" tag "\""))
|
||||
(respond `((h2 "Unknown tag " ,tag)
|
||||
|
|
Loading…
Reference in a new issue