squeeze

A static site generator that can put the toothpaste back in the tube.
git clone https://git.stjo.hn/squeeze
Log | Files | Refs | README | LICENSE

commit 8a0fec48e9d7fb619050ca0b7559630201e32b7f
parent d4f0c1255fb63988a0cd370b15eb4bbc1757f8ba
Author: St John Karp <contact@stjo.hn>
Date:   Mon,  5 Jul 2021 07:43:36 -0500

Replace named entities with numeric entities in the RSS title

Named entities don't work here because they're not defined,
but numeric XML entities will work fine. Previously I'd just
been replacing them with unsmart punctuation, but there's no
reason not to keep he punctuation smart.

Diffstat:
Mgenerate_rss.pl | 16+++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/generate_rss.pl b/generate_rss.pl @@ -64,13 +64,15 @@ files_to_articles([Filename|Filenames], [article(FormattedDate, FormattedTitle, replace("&", "&amp;", Entry, EntryAmp), replace("<", "&lt;", EntryAmp, EntryLT), replace(">", "&gt;", EntryLT, Description), - % Strip HTML entities from the title. - replace("&amp;", "&", Title, TitleAmp), - replace("&lsquo;", "'", TitleAmp, TitleLSQuo), - replace("&rsquo;", "'", TitleLSQuo, TitleRSQuo), - replace("&ldquo;", "\"", TitleRSQuo, TitleLDQuo), - replace("&rdquo;", "\"", TitleLDQuo, TitleRDQuo), - replace("&hellip;", "...", TitleRDQuo, FormattedTitle), + % Convert named HTML entities to numeric entities in the title. + % Named entities don't work because they're not defined, + % but numeric ones are fine. + replace("&amp;", "&#38;", Title, TitleAmp), + replace("&lsquo;", "&#8216;", TitleAmp, TitleLSQuo), + replace("&rsquo;", "&#8217;", TitleLSQuo, TitleRSQuo), + replace("&ldquo;", "&#8220;", TitleRSQuo, TitleLDQuo), + replace("&rdquo;", "&#8221;", TitleLDQuo, TitleRDQuo), + replace("&hellip;", "&#8230;", TitleRDQuo, FormattedTitle), files_to_articles(Filenames, Articles).