make rss feed a valid atom feed

This commit is contained in:
Lucy 2020-07-18 01:13:13 +02:00
parent f504cd34ff
commit af773b4de2

View File

@ -20,10 +20,11 @@ add_header() {
----|----:"
output_rss '<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<author><name>Lucy</name></author>
<title>Lucys blog</title>'
output_rss " <link href=\"https://lucy.moe/rss.xml\" rel=\"self\" type=\"application/atom+xml\"/>
<description>Lucys blog</description>"
<author><name>Lucy</name></author>
<title type="text">Lucys blog</title>'
output_rss " <updated>$(date --rfc-3339=seconds | sed 's/ /T/')</updated>
<id>https://lucy.moe/rss.xml</id>
<link href=\"https://lucy.moe/rss.xml\" rel=\"self\" type=\"application/atom+xml\"/>"
}
add_footer() {
@ -50,13 +51,14 @@ rss_entry() {
output_rss " <entry>
<title type=\"text\">$1</title>
<published>$(date --rfc-3339=seconds -d $4 | sed 's/ /T/')</published>
<updated>$(date --rfc-3339=seconds -r $3 | sed 's/ /T/')</updated>
<id>$blog_domain$2</id>
<link href=\"$blog_domain$2\" type=\"text/html\" title=\"$1\"/>
<summary type=\"html\">
$(grep -h '^<p>' "dist/$2" | head -n 1 | sed 's/^/ /')
$(grep -h '^<p>' "dist/$2" | head -n 1 | sed 's/<p>//;s/<\/p>//;/<!--/d;s/^/ /')
</summary>
<content type=\"html\" xml:base=\"$blog_domain$2\">
$(pandoc $3 | sed 's/^/ /')
<content type=\"html\" xml:base=\"$blog_domain$2\"><![CDATA[
$(pandoc $3 | sed '/<!--/d;s/^/ /')]]>
</content>
</entry>"
# $(tail -n+2 "$2" | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g')