alexkarle.com

Source for alexkarle.com
git clone git://git.alexkarle.com/alexkarle.com.git
Log | Files | Refs | README | LICENSE

commit 6f900f426299c4b9945b0d0fc576c4c226a9ffeb (patch)
parent 285bbff7d8e4df3505a1e5d8af271c249ae9eb81
Author: Alex Karle <alex@alexkarle.com>
Date:   Sun,  7 Feb 2021 16:49:38 -0500

make: Change atom generation to use CDATA over escaping

escaping via sed was proving difficult to get right (doubly nested
escapes, since the HTML is also escaped by mandoc).

The use of CDATA should hopefully be more correct (we'll see).

Diffstat:
Mgenatom.sh | 19++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/genatom.sh b/genatom.sh @@ -33,17 +33,14 @@ for p in $POSTS; do <updated>${d}T00:00Z</updated> <published>${d}T00:00Z</published> <content type="html"> + <![CDATA[ ENTRY - # Print fragment, with XML escaped properly: - # https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents - # Note that & is already escaped in the HTML content by mandoc - mandoc -Thtml -O'fragment,man=%N.html;https://man.openbsd.org/%N.%S' $p.7 \ - | sed \ - -e 's/^/ /' \ - -e 's/"/\&quot;/g' \ - -e "s/'/\\&apos;/g" \ - -e 's/</\&lt;/g' \ - -e 's/>/\&gt;/g' - printf " </content>\n </entry>\n" + # Print fragment (no need for escapes -- in CDATA + mandoc -Thtml -O'fragment,man=%N.html;https://man.openbsd.org/%N.%S' $p.7 + cat <<EOENTRY + ]]> + </content> + </entry> +EOENTRY done printf "</feed>\n"