summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2023-10-14 23:51:56 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2023-10-14 23:51:56 +0200
commit9acd46cc990b6d4a9cfc47b72b19f5f3e988464c (patch)
treedbd20552b793a09cbbe69a571bb0058639ed4230
parentbfda1fb93e8c8f42be3844db0cd69c9ad6c652b7 (diff)
atom: escape the html summary and content
-rw-r--r--src/atom.scm8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/atom.scm b/src/atom.scm
index 13bb89f..d7b3ce8 100644
--- a/src/atom.scm
+++ b/src/atom.scm
@@ -152,6 +152,10 @@
(define (render-category cat)
`(category (@(term ,cat))))
+(define (sxml->string/rendered content)
+ (call-with-output-string
+ (lambda (p) (sxml->xml content p))))
+
(define (render-entry ent)
`(entry
(id ,(entry-id ent))
@@ -159,8 +163,8 @@
(published ,(date->string/RFC3339 (entry-published ent)))
(updated ,(date->string/RFC3339 (entry-updated ent)))
,@(map render-author (entry-authors ent))
- (summary (@(type html)) ,(entry-summary ent))
- (content (@(type html)) ,(entry-content ent))
+ (summary (@(type html)) ,(sxml->string/rendered (entry-summary ent)))
+ (content (@(type html)) ,(sxml->string/rendered (entry-content ent)))
,@(map render-category (entry-categories ent))
,@(map render-contributor (entry-contributors ent))
,@(map render-media (entry-media ent))))