aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-10-27 13:17:43 +0100
committerAdrian Kummerlaender2014-10-27 13:17:43 +0100
commite4ae586170229de78aaf00963e2f0c49427a9926 (patch)
tree5e8fdf8fb7acba7e09cdfee941a739ac61fed30e
parent7116f8fd112d721fac44b2bafa23023b9f0f9234 (diff)
downloadOverview-e4ae586170229de78aaf00963e2f0c49427a9926.tar
Overview-e4ae586170229de78aaf00963e2f0c49427a9926.tar.gz
Overview-e4ae586170229de78aaf00963e2f0c49427a9926.tar.bz2
Overview-e4ae586170229de78aaf00963e2f0c49427a9926.tar.lz
Overview-e4ae586170229de78aaf00963e2f0c49427a9926.tar.xz
Overview-e4ae586170229de78aaf00963e2f0c49427a9926.tar.zst
Overview-e4ae586170229de78aaf00963e2f0c49427a9926.zip
Implemented latest article view
* the first paragraph of the three latest articles of my blog are now displayed on the overview page * feed is fetched via `curl` in `01_raw/article_feed.xsl` ** as with all commit feeds the article feed is processed further in the `02_augment` level ** the count of articles to be displayed is defined in `00_content/meta.xml` as `article_count` * CSS was updated to correctly display the article summary
-rw-r--r--source/00_content/meta.xml1
-rw-r--r--source/01_raw/article_feed.xsl23
-rw-r--r--source/02_augment/articles.xsl50
-rw-r--r--source/02_augment/commits.xsl2
-rw-r--r--source/99_result/main.css7
-rw-r--r--source/99_result/overview.xsl54
6 files changed, 123 insertions, 14 deletions
diff --git a/source/00_content/meta.xml b/source/00_content/meta.xml
index b3facb1..4c4c2a9 100644
--- a/source/00_content/meta.xml
+++ b/source/00_content/meta.xml
@@ -3,4 +3,5 @@
<title>kummerlaender.eu</title>
<url>http://localhost:8000</url>
<commit_count>20</commit_count>
+ <article_count>3</article_count>
</datasource>
diff --git a/source/01_raw/article_feed.xsl b/source/01_raw/article_feed.xsl
new file mode 100644
index 0000000..ab652b7
--- /dev/null
+++ b/source/01_raw/article_feed.xsl
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:InputXSLT="function.inputxslt.application"
+ exclude-result-prefixes="InputXSLT"
+>
+
+<xsl:include href="[utility/datasource.xsl]"/>
+<xsl:include href="[utility/remove_namespace.xsl]"/>
+
+<xsl:variable name="meta">
+ <datasource type="main" mode="full" source="00_content/meta.xml" target="meta"/>
+ <target mode="plain" value="article_feed.xml"/>
+</xsl:variable>
+
+<xsl:template match="meta">
+ <xsl:apply-templates mode="remove_namespace" select="InputXSLT:external-command(
+ 'curl http://blog.kummerlaender.eu/atom.xml'
+ )/self::command/feed/entry[position() &lt;= $root/meta/article_count]"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/source/02_augment/articles.xsl b/source/02_augment/articles.xsl
new file mode 100644
index 0000000..36e1c7c
--- /dev/null
+++ b/source/02_augment/articles.xsl
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:include href="[utility/datasource.xsl]"/>
+
+<xsl:variable name="meta">
+ <datasource type="main" mode="full" source="01_raw/article_feed.xml" target="articles"/>
+ <target mode="plain" value="articles.xml"/>
+</xsl:variable>
+
+<xsl:template match="id" mode="article"/>
+
+<xsl:template match="author" mode="article">
+ <xsl:copy>
+ <xsl:value-of select="name"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="updated" mode="article">
+ <date>
+ <xsl:value-of select="substring(., 0, 11)"/>
+ </date>
+</xsl:template>
+
+<xsl:template match="link" mode="article">
+ <link>
+ <xsl:value-of select="@href"/>
+ </link>
+</xsl:template>
+
+<xsl:template match="content[@type = 'xhtml']" mode="article">
+ <content>
+ <xsl:apply-templates select="div/p[1]" mode="article"/>
+ </content>
+</xsl:template>
+
+<xsl:template match="@* | node()" mode="article">
+ <xsl:copy>
+ <xsl:apply-templates select="@* | node()" mode="article"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="articles">
+ <xsl:apply-templates select="entry" mode="article"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/source/02_augment/commits.xsl b/source/02_augment/commits.xsl
index c5caeb9..e9c4ae8 100644
--- a/source/02_augment/commits.xsl
+++ b/source/02_augment/commits.xsl
@@ -63,7 +63,7 @@
<xsl:template match="@* | node()" mode="commit">
<xsl:copy>
- <xsl:apply-templates select="@*|node()" mode="commit"/>
+ <xsl:apply-templates select="@* | node()" mode="commit"/>
</xsl:copy>
</xsl:template>
diff --git a/source/99_result/main.css b/source/99_result/main.css
index 882204f..5f473a7 100644
--- a/source/99_result/main.css
+++ b/source/99_result/main.css
@@ -3,11 +3,12 @@ body{font:1em Droid Sans,sans-serif,Verdana,Arial,FreeSans;color:#272828}
h1{width:100%;border-bottom:0.2em solid #e3e8e8}
a{text-decoration:underline;color:#272828}
a:hover{color:black}
-h2{font-size:1.5em;color:#F80;margin:.5em 0 .5em 0}
+h2{font-size:1.3em;text-decoration:none;color:#272828;font-weight:bold}
h2 a{text-decoration:none}
-h2 span{font-size:0.9em;text-decoration:none;color:#272828;font-weight:normal}
-h3{font-size:1.05em;font-weight:normal;margin-bottom:.2em;border-bottom:.1em solid #e3e8e8}
+h3{font-size:1.2em;color:#F80;font-weight:bold;margin-bottom:.2em;border-bottom:.1em solid #e3e8e8}
+h3 span{font-size:0.9em;color:#272828;font-weight:normal}
h3 a{text-decoration:none}
+p{margin:0 0 .5em 0;text-align:justify}
ul{margin:0;text-align:justify}
ul li{list-style-type:circle}
dt {float:left;clear:left;width:7em}
diff --git a/source/99_result/overview.xsl b/source/99_result/overview.xsl
index 918a9dd..d16906e 100644
--- a/source/99_result/overview.xsl
+++ b/source/99_result/overview.xsl
@@ -18,10 +18,11 @@
<xsl:include href="[utility/date-time.xsl]"/>
<xsl:variable name="meta">
- <datasource type="main" mode="full" source="03_merge/timeline.xml" target="timeline"/>
+ <datasource type="main" mode="full" source="00_content/meta.xml" target="meta"/>
+ <datasource type="support" mode="full" source="02_augment/articles.xml" target="articles"/>
+ <datasource type="support" mode="full" source="03_merge/timeline.xml" target="timeline"/>
<datasource type="support" mode="full" source="02_augment/commits.xml" target="commits"/>
<datasource type="support" mode="full" source="00_content/repositories.xml" target="repositories"/>
- <datasource type="support" mode="full" source="00_content/meta.xml" target="meta"/>
<target mode="plain" value="index.html"/>
</xsl:variable>
@@ -43,9 +44,11 @@
<h3>
<xsl:text>» </xsl:text>
- <a href="{$commit/link}">
- <xsl:value-of select="$commit/title"/>
- </a>
+ <span>
+ <a href="{$commit/link}">
+ <xsl:value-of select="$commit/title"/>
+ </a>
+ </span>
</h3>
<span class="info">
@@ -63,6 +66,8 @@
<a href="{$commit/link}">
<xsl:value-of select="$commit/@hash"/>
</a>
+ <xsl:text> | </xsl:text>
+ <xsl:value-of select="$commit/author"/>
</span>
<xsl:apply-templates select="$commit/message/*" mode="xhtml"/>
@@ -75,6 +80,28 @@
</xsl:call-template>
</xsl:template>
+<xsl:template match="articles/entry">
+ <h3>
+ <xsl:text>» </xsl:text>
+ <span>
+ <a href="{link}">
+ <xsl:value-of select="title"/>
+ </a>
+ </span>
+ </h3>
+
+ <span class="info">
+ <xsl:call-template name="format-date">
+ <xsl:with-param name="date" select="date"/>
+ <xsl:with-param name="format" select="'M x, Y'"/>
+ </xsl:call-template>
+ <xsl:text> | </xsl:text>
+ <xsl:value-of select="author"/>
+ </span>
+
+ <xsl:apply-templates select="content/*" mode="xhtml"/>
+</xsl:template>
+
<xsl:template match="datasource">
<html>
<head>
@@ -92,11 +119,18 @@
<xsl:value-of select="$root/meta/title"/>
</h1>
- <h2>» <span>
- <a href="{$root/meta/url}/timeline.xml">
- <xsl:text>Latest commits</xsl:text>
- </a>
- </span>
+ <h2>
+ <a href="http://blog.kummerlaender.eu">
+ <xsl:text>Latest articles</xsl:text>
+ </a>
+ </h2>
+
+ <xsl:apply-templates select="articles/entry"/>
+
+ <h2>
+ <a href="{$root/meta/url}/timeline.xml">
+ <xsl:text>Latest commits</xsl:text>
+ </a>
</h2>
<xsl:apply-templates select="timeline/commit[position() &lt;= 5]"/>