1
0
Fork 0

Merge remote-tracking branch 'sourcehut/customizations' into customizations

This commit is contained in:
Tom Willemse 2023-09-06 15:25:54 -07:00
commit f880847f15
2 changed files with 21 additions and 9 deletions

View file

@ -81,15 +81,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 (marxdown->sxml text) (define (marxdown->sxml text)
(smarxdown->shtml (call-with-input-string text marxdown->smarxdown))) (smarxdown->shtml (call-with-input-string text marxdown->smarxdown)))

View file

@ -301,10 +301,13 @@
(post-from-key index key)) (post-from-key index key))
(hash-ref tags tag '())))) (hash-ref tags tag '()))))
(if (pair? posts) (if (pair? posts)
(respond `(,(tag-sidebar tag index) (respond `((h2 "posts tagged \"" ,tag "\" ("
(h2 "posts tagged \"" ,tag "\"") ,(rellink '("feed" "atom") "feed"
,@(map (lambda (post) (show-post post #f)) #:query `(("with" . ,tag)))
(take-max (reverse posts) 10))) ")")
,@(map (lambda (post) `(p ,(post-link post)))
(take-max (reverse posts) 10))
,(related-tag-cloud tag index))
#:etag (assq-ref index 'master) #:etag (assq-ref index 'master)
#:title (string-append "posts tagged \"" tag "\"")) #:title (string-append "posts tagged \"" tag "\""))
(respond `((h2 "Unknown tag " ,tag) (respond `((h2 "Unknown tag " ,tag)