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