mirror of
https://git.ludikovsky.name/git/fugitive.git
synced 2024-06-28 12:35:27 +02:00
Added support for Atom feeds, improved validation for RSS feeds
This commit is contained in:
parent
cd10c52edb
commit
c2547e0b68
20
README.html
20
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
|
||||
"previous" and "next" 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
|
||||
"index.html".</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 "archives" in the archives.html template,
|
||||
"feed" in the feed.xml template, or the article title in the
|
||||
article.html template.
|
||||
"feed" 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.
|
||||
<<span class="keyword">?fugitive</span> endforeach:commit ?></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>
|
||||
|
|
22
default-files/atom.xml
Normal file
22
default-files/atom.xml
Normal file
|
@ -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>
|
|
@ -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 ?>
|
||||
|
|
@ -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" />
|
||||
|
|
21
html-gen.sh
21
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... "
|
||||
|
|
10
install.sh
10
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... "
|
||||
|
|
Loading…
Reference in a new issue