summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Ludikovsky <peter@ludikovsky.name>2016-02-15 19:28:37 +0000
committerPeter Ludikovsky <peter@ludikovsky.name>2016-02-15 19:28:37 +0000
commitc2547e0b684e61539666ec6d130145fe1c59f341 (patch)
treea034f2ac86d5bdb637aa01adefe5cd3e5a69c970
parentcd10c52edb146a0542cce6a65cfb3ae134c232dc (diff)
Added support for Atom feeds, improved validation for RSS feeds
-rw-r--r--README.html20
-rw-r--r--default-files/atom.xml22
-rw-r--r--default-files/rss.xml (renamed from default-files/feed.xml)4
-rw-r--r--default-files/top.html3
-rw-r--r--html-gen.sh21
-rw-r--r--install.sh10
6 files changed, 62 insertions, 18 deletions
diff --git a/README.html b/README.html
index 58d7435..309c2dd 100644
--- a/README.html
+++ b/README.html
@@ -128,7 +128,8 @@ fugitive: README
<li>it regenerates static html files for articles that are just before and
after newly added and deleted articles (this to maintain the
&quot;previous&quot; and &quot;next&quot; links alive),</li>
- <li>it regenerates the archives.html, tags.html, and feed.xml files,</li>
+ <li>it regenerates the archives.html, tags.html, atom.xml, and rss.xml
+ files,</li>
<li>and finally it copies the static html file of the last article to
&quot;index.html&quot;.</li>
</ul>
@@ -175,9 +176,9 @@ fugitive: README
anything else.
</p>
<p>
- The foreach loop construct is specific to the archives.html, tags.html, and
- feed.xml templates and will therefore be described at the same time. Where
- available, the loops are processed right after the includes.
+ The foreach loop construct is specific to the archives.html, tags.html,
+ atom.xml, and rss.xml templates and will therefore be described at the same
+ time. Where available, the loops are processed right after the includes.
</p>
<p>
The syntax of the conditional construct is as follows:
@@ -195,8 +196,8 @@ fugitive: README
<dt>page_title</dt>
<dd>
Its value is &quot;archives&quot; in the archives.html template,
- &quot;feed&quot; in the feed.xml template, or the article title in the
- article.html template.
+ &quot;feed&quot; in the atom.xml and rss.xml template, or the article title
+ in the article.html template.
</dd>
<dt>blog_url</dt>
<dd>
@@ -373,7 +374,7 @@ fugitive: README
Its value is the title of the next article ordered by publication date.
</dd>
</dl>
-<h4>foreach loops in archives.html and feed.xml:</h4>
+<h4>foreach loops in archives.html, atom.xml, and rss.xml:</h4>
<p>
Two foreach loops are available: <code>foreach:article</code>
and <code>foreach:commit</code>. The syntax is as follows:
@@ -389,8 +390,9 @@ fugitive: README
set in accordance with the commit each time.
&lt;<span class="keyword">?fugitive</span> endforeach:commit ?&gt;</pre>
<p>
- The only difference between the archives.html and feed.xml templates is that
- in feed.xml these constructs only loop on the five last articles and commits.
+ The only difference between the archives.html, atom.xml, and rss.xml
+ templates is that in atom.xml and rss.xml these constructs only loop on the
+ five last articles and commits.
</p>
<h2 id="hacking">Hacking fugitive</h2>
diff --git a/default-files/atom.xml b/default-files/atom.xml
new file mode 100644
index 0000000..2cfc918
--- /dev/null
+++ b/default-files/atom.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
+ <title><?fugitive-install name ?>'s blog atom feed</title>
+ <link rel="self" href="<?fugitive blog_url ?>atom.xml" />
+ <link href="<?fugitive blog_url ?>" />
+ <id><?fugitive blog_url ?>atom.xml</id>
+ <updated><?fugitive commit_datetime_html5 ?></updated>
+ <generator>fugitive - http://gitorious.org/fugitive</generator>
+ <?fugitive foreach:article ?>
+ <entry>
+ <title><?fugitive article_title ?></title>
+ <link href="<?fugitive blog_url ?><?fugitive article_file ?>.html" />
+ <id><?fugitive blog_url ?><?fugitive article_file ?>.html</id>
+ <updated><?fugitive article_mdatetime_html5 ?></updated>
+ <published><?fugitive article_cdatetime_html5 ?></published>
+ <author>
+ <name><?fugitive article_cauthor ?></name>
+ </author>
+ <content type="html"><![CDATA[ <?fugitive article_content ?> ]]></content>
+ </entry>
+ <?fugitive endforeach:article ?>
+</feed>
diff --git a/default-files/feed.xml b/default-files/rss.xml
index b971b55..cc48d00 100644
--- a/default-files/feed.xml
+++ b/default-files/rss.xml
@@ -6,7 +6,7 @@
<link><?fugitive blog_url ?></link>
<description>5 last published articles</description>
<generator>fugitive - http://gitorious.org/fugitive</generator>
- <lastBuildDate><?fugitive commit_date ?></lastBuildDate>
+ <lastBuildDate><?fugitive commit_date_html5 ?></lastBuildDate>
<?fugitive foreach:article ?>
<item>
@@ -15,7 +15,7 @@
<description><![CDATA[<?fugitive article_content ?>]]></description>
<author><?fugitive article_cauthor ?></author>
<guid><?fugitive blog_url ?><?fugitive article_file ?>.html</guid>
- <pubDate><?fugitive article_cdatetime ?></pubDate>
+ <pubDate><?fugitive article_cdatetime_html5 ?></pubDate>
</item>
<?fugitive endforeach:article ?>
diff --git a/default-files/top.html b/default-files/top.html
index 5a2ea1b..6dc93a4 100644
--- a/default-files/top.html
+++ b/default-files/top.html
@@ -6,7 +6,8 @@
<meta name="author" content="<?fugitive-install name ?>" />
<meta name="description" content="<?fugitive-install name ?>'s blog" />
<meta name="viewport" content="width=device-width" />
- <link rel="alternate" type="application/rss+xml" href="<?fugitive blog_url ?>feed.xml" title="5 last articles RSS feed" />
+ <link rel="alternate" type="application/rss+xml" href="<?fugitive blog_url ?>rss.xml" title="5 last articles RSS feed" />
+ <link rel="alternate" type="application/atom+xml" href="<?fugitive blog_url ?>atom.xml" title="5 last articl es Atom feed">
<link rel="stylesheet" href="fugitive.css" type="text/css" media="screen" />
<link rel="stylesheet" href="print.css" type="text/css" media="print" />
<link rel="contents" href="archives.html" />
diff --git a/html-gen.sh b/html-gen.sh
index 6974d80..a98a1d7 100644
--- a/html-gen.sh
+++ b/html-gen.sh
@@ -377,12 +377,12 @@ if [ $modification -gt 0 ]; then
sed "/^[[:space:]]*$/d" > "$temp"
cp "$temp" "$public_dir/archives.html"
echo "done."
- echo -n "[fugitive] Generating $public_dir/feed.xml... "
+ echo -n "[fugitive] Generating $public_dir/rss.xml... "
last_5_articles=`mktemp fugitiveXXXXXX`
head -5 "$articles_sorted" > "$last_5_articles"
last_5_commits=`mktemp fugitiveXXXXXX`
head -5 "$commits" > "$last_5_commits"
- cat "$templates_dir/feed.xml" | \
+ cat "$templates_dir/rss.xml" | \
replace_includes | \
replace_foreach "article" "$last_5_articles" | \
replace_foreach "commit" "$last_5_commits" | \
@@ -390,7 +390,22 @@ if [ $modification -gt 0 ]; then
replace_str "blog_url" "$blog_url" | \
replace_commit_info "-1" | \
sed "/^[[:space:]]*$/d" > "$temp"
- cp "$temp" "$public_dir/feed.xml"
+ cp "$temp" "$public_dir/rss.xml"
+ echo "done."
+ echo -n "[fugitive] Generating $public_dir/atom.xml... "
+ last_5_articles=`mktemp fugitiveXXXXXX`
+ head -5 "$articles_sorted" > "$last_5_articles"
+ last_5_commits=`mktemp fugitiveXXXXXX`
+ head -5 "$commits" > "$last_5_commits"
+ cat "$templates_dir/atom.xml" | \
+ replace_includes | \
+ replace_foreach "article" "$last_5_articles" | \
+ replace_foreach "commit" "$last_5_commits" | \
+ replace_str "page_title" "feed" | \
+ replace_str "blog_url" "$blog_url" | \
+ replace_commit_info "-1" | \
+ sed "/^[[:space:]]*$/d" > "$temp"
+ cp "$temp" "$public_dir/atom.xml"
echo "done."
rm "$last_5_articles" "$last_5_commits" "$temp"
echo -n "[fugitive] Using last published article as index page... "
diff --git a/install.sh b/install.sh
index 9185665..20c84c2 100644
--- a/install.sh
+++ b/install.sh
@@ -69,7 +69,8 @@ fugitive_install() {
*~
_public/index.html
_public/archives.html
-_public/feed.xml
+_public/rss.xml
+_public/atom.xml
EOF
echo "done."
if [ "$1" = "local" ]; then
@@ -89,8 +90,11 @@ EOF
fugitive_write_template > _templates/bottom.html <<EOF
#INCLUDE:default-files/bottom.html#
EOF
- fugitive_write_template > _templates/feed.xml <<EOF
-#INCLUDE:default-files/feed.xml#
+ fugitive_write_template > _templates/rss.xml <<EOF
+#INCLUDE:default-files/rss.xml#
+EOF
+ fugitive_write_template > _templates/atom.xml <<EOF
+#INCLUDE:default-files/atom.xml#
EOF
echo "done."
echo -n "Writing default css files... "