aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-10-17 22:59:45 +0200
committerAdrian Kummerlaender2014-10-17 22:59:45 +0200
commitacacfda54016cbd4437d1ccaa609a52e9c1739d0 (patch)
tree6429c262d2e33fe215613e6b0ac69a0af5f0492b
downloadOverview-acacfda54016cbd4437d1ccaa609a52e9c1739d0.tar
Overview-acacfda54016cbd4437d1ccaa609a52e9c1739d0.tar.gz
Overview-acacfda54016cbd4437d1ccaa609a52e9c1739d0.tar.bz2
Overview-acacfda54016cbd4437d1ccaa609a52e9c1739d0.tar.lz
Overview-acacfda54016cbd4437d1ccaa609a52e9c1739d0.tar.xz
Overview-acacfda54016cbd4437d1ccaa609a52e9c1739d0.tar.zst
Overview-acacfda54016cbd4437d1ccaa609a52e9c1739d0.zip
Added basic commit timeline aggregator implementation
* another application based on StaticXSLT * git is instructed to export XML through a special log format definition * the commit messages are processed as Markdown * currently implemented result views are commits-by-repo and a paginated timeline of all commits in every repository * repositories to be read have to be defined in the `repositories.xml` file in the `00_content` level
-rw-r--r--make.xml11
-rw-r--r--source/00_content/repositories.xml23
-rw-r--r--source/01_raw/commits.xsl24
-rw-r--r--source/02_augment/formatted_commits.xsl45
-rw-r--r--source/03_merge/timeline.xsl21
-rw-r--r--source/04_meta/paginated_timeline.xsl24
-rw-r--r--source/99_result/repositories/repository_log.xsl20
-rw-r--r--source/99_result/stream.xsl54
-rw-r--r--utility/datasource.xsl24
-rwxr-xr-xutility/git_log.sh7
-rw-r--r--utility/master.xsl34
-rw-r--r--utility/reference_commit.xsl25
-rw-r--r--utility/xhtml.xsl18
13 files changed, 330 insertions, 0 deletions
diff --git a/make.xml b/make.xml
new file mode 100644
index 0000000..89637dc
--- /dev/null
+++ b/make.xml
@@ -0,0 +1,11 @@
+<task type="module">
+ <input mode="embedded">
+ <datasource>
+ <meta>
+ <source>source</source>
+ <target>target</target>
+ </meta>
+ </datasource>
+ </input>
+ <definition mode="file">[StaticXSLT.xml]</definition>
+</task>
diff --git a/source/00_content/repositories.xml b/source/00_content/repositories.xml
new file mode 100644
index 0000000..fc4d47e
--- /dev/null
+++ b/source/00_content/repositories.xml
@@ -0,0 +1,23 @@
+<datasource>
+ <entry handle="InputXSLT">
+ <path>~/projects/dev/InputXSLT</path>
+ </entry>
+ <entry handle="blog.kummerlaender.eu">
+ <path>~/projects/dev/blog.kummerlaender.eu</path>
+ </entry>
+ <entry handle="SimpleParser">
+ <path>~/projects/dev/parser</path>
+ </entry>
+ <entry handle="StaticXSLT">
+ <path>~/projects/dev/StaticXSLT</path>
+ </entry>
+ <entry handle="BuildXSLT">
+ <path>~/projects/dev/BuildXSLT</path>
+ </entry>
+ <entry handle="GraphStorage">
+ <path>~/projects/dev/graphdb</path>
+ </entry>
+ <entry handle="BinaryMapping">
+ <path>~/projects/dev/BinaryMapping</path>
+ </entry>
+</datasource>
diff --git a/source/01_raw/commits.xsl b/source/01_raw/commits.xsl
new file mode 100644
index 0000000..bfc265b
--- /dev/null
+++ b/source/01_raw/commits.xsl
@@ -0,0 +1,24 @@
+<?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:variable name="meta">
+ <datasource type="main" mode="full" source="00_content/repositories.xml" target="repositories"/>
+ <target mode="plain" value="commits.xml"/>
+</xsl:variable>
+
+<xsl:template match="repositories/entry">
+ <entry handle="{@handle}">
+ <xsl:copy-of select="InputXSLT:external-command(
+ concat('./utility/git_log.sh ', path)
+ )/self::command/commit"/>
+ </entry>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/source/02_augment/formatted_commits.xsl b/source/02_augment/formatted_commits.xsl
new file mode 100644
index 0000000..555e0d8
--- /dev/null
+++ b/source/02_augment/formatted_commits.xsl
@@ -0,0 +1,45 @@
+<?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:variable name="meta">
+ <datasource type="main" mode="full" source="01_raw/commits.xml" target="repositories"/>
+ <target mode="plain" value="formatted_commits.xml"/>
+</xsl:variable>
+
+<xsl:template name="formatter">
+ <xsl:param name="format"/>
+ <xsl:param name="source"/>
+
+ <xsl:copy-of select="InputXSLT:external-command(
+ $format,
+ $source
+ )/self::command/node()"/>
+</xsl:template>
+
+<xsl:template match="message/text()" mode="commit">
+ <xsl:call-template name="formatter">
+ <xsl:with-param name="format">markdown</xsl:with-param>
+ <xsl:with-param name="source" select="."/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="@*|node()" mode="commit">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" mode="commit"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="repositories/entry">
+ <entry handle="{@handle}">
+ <xsl:apply-templates select="commit" mode="commit"/>
+ </entry>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/source/03_merge/timeline.xsl b/source/03_merge/timeline.xsl
new file mode 100644
index 0000000..b26f11d
--- /dev/null
+++ b/source/03_merge/timeline.xsl
@@ -0,0 +1,21 @@
+<?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:include href="[utility/reference_commit.xsl]"/>
+
+<xsl:variable name="meta">
+ <datasource type="main" mode="full" source="02_augment/formatted_commits.xml" target="repositories"/>
+ <target mode="plain" value="timeline.xml"/>
+</xsl:variable>
+
+<xsl:template match="repositories">
+ <xsl:apply-templates select="entry/commit" mode="commit">
+ <xsl:sort select="date" data-type="text" order="descending"/>
+ </xsl:apply-templates>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/source/04_meta/paginated_timeline.xsl b/source/04_meta/paginated_timeline.xsl
new file mode 100644
index 0000000..cb25d3b
--- /dev/null
+++ b/source/04_meta/paginated_timeline.xsl
@@ -0,0 +1,24 @@
+<?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:include href="[utility/reference_commit.xsl]"/>
+
+<xsl:variable name="meta">
+ <datasource type="main" mode="full" source="03_merge/timeline.xml" target="timeline"/>
+ <target mode="plain" value="paginated_timeline.xml"/>
+</xsl:variable>
+
+<xsl:variable name="commits_per_page">20</xsl:variable>
+<xsl:variable name="total" select="ceiling(count(datasource/timeline/commit) div $commits_per_page)"/>
+
+<xsl:template match="timeline/commit[position() mod $commits_per_page = 1]">
+ <entry index="{floor(position() div $commits_per_page)}" total="{$total}">
+ <xsl:apply-templates select=". | following-sibling::commit[not(position() > ($commits_per_page - 1))]" mode="commit"/>
+ </entry>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/source/99_result/repositories/repository_log.xsl b/source/99_result/repositories/repository_log.xsl
new file mode 100644
index 0000000..9ffd173
--- /dev/null
+++ b/source/99_result/repositories/repository_log.xsl
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:include href="[utility/xhtml.xsl]"/>
+<xsl:include href="[utility/master.xsl]"/>
+
+<xsl:variable name="meta">
+ <datasource type="main" mode="iterate" source="02_augment/formatted_commits.xml" target="repositories"/>
+ <target mode="xpath" value="concat($datasource/repositories/entry/@handle, '/index.html')"/>
+</xsl:variable>
+
+<xsl:template match="repositories/entry/commit/message">
+ <xsl:copy-of select="node()"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/source/99_result/stream.xsl b/source/99_result/stream.xsl
new file mode 100644
index 0000000..4f1bfde
--- /dev/null
+++ b/source/99_result/stream.xsl
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:include href="[utility/master.xsl]"/>
+<xsl:include href="[utility/xhtml.xsl]"/>
+
+<xsl:variable name="meta">
+ <datasource type="main" mode="iterate" source="04_meta/paginated_timeline.xml" target="page"/>
+ <datasource type="support" mode="full" source="02_augment/formatted_commits.xml" target="commits"/>
+ <target mode="xpath" value="concat($datasource/page/entry/@index, '/index.html')"/>
+</xsl:variable>
+
+<xsl:template name="get_commit">
+ <xsl:param name="repository"/>
+ <xsl:param name="hash"/>
+
+ <xsl:variable name="commit" select="$root/commits/entry[@handle = $repository]/commit[@hash = $hash]"/>
+
+ <xsl:apply-templates select="$commit/message/node()" mode="xhtml"/>
+</xsl:template>
+
+<xsl:template match="page/entry">
+ <xsl:apply-templates />
+
+ <div id="pagination">
+ <xsl:if test="@index > 0">
+ <span>
+ <a class="pagination-previous" href="/{@index - 1}">
+ <xsl:text>« newer</xsl:text>
+ </a>
+ </span>
+ </xsl:if>
+ <xsl:if test="@index &lt; @total - 1">
+ <span>
+ <a class="pagination-next" href="/{@index + 1}">
+ <xsl:text>older »</xsl:text>
+ </a>
+ </span>
+ </xsl:if>
+ </div>
+</xsl:template>
+
+<xsl:template match="page/entry/commit">
+ <xsl:call-template name="get_commit">
+ <xsl:with-param name="repository" select="@repository"/>
+ <xsl:with-param name="hash" select="@hash"/>
+ </xsl:call-template>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/utility/datasource.xsl b/utility/datasource.xsl
new file mode 100644
index 0000000..411086a
--- /dev/null
+++ b/utility/datasource.xsl
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:output
+ method="xml"
+ omit-xml-declaration="no"
+ encoding="UTF-8"
+ indent="no"
+/>
+
+<xsl:variable name="root" select="/datasource"/>
+
+<xsl:template match="/">
+ <datasource>
+ <xsl:apply-templates />
+ </datasource>
+</xsl:template>
+
+<xsl:template match="text()|@*"/>
+
+</xsl:stylesheet>
diff --git a/utility/git_log.sh b/utility/git_log.sh
new file mode 100755
index 0000000..2dfb0bd
--- /dev/null
+++ b/utility/git_log.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+format="<commit hash=\"%h\"><date>%cd</date><message><![CDATA[# %B]]></message></commit>"
+
+ git --no-pager -C $1 log --date=iso --pretty=tformat:"$format" \
+| tidy --input-xml yes --escape-cdata true --wrap 0 \
+| sed -e 's~^\([\*]\)\{3\}~\t\t\*~g' -e 's~^\([\*]\)\{2\}~\t\*~g'
diff --git a/utility/master.xsl b/utility/master.xsl
new file mode 100644
index 0000000..077c9e3
--- /dev/null
+++ b/utility/master.xsl
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:output
+ method="xml"
+ doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+ doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+ omit-xml-declaration="yes"
+ encoding="UTF-8"
+ indent="no"
+/>
+
+<xsl:variable name="root" select="/datasource"/>
+
+<xsl:template match="/">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta name="robots" content="all"/>
+ <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
+</head>
+<body>
+ <xsl:apply-templates />
+</body>
+</html>
+</xsl:template>
+
+<xsl:template match="text()|@*"/>
+
+</xsl:stylesheet>
diff --git a/utility/reference_commit.xsl b/utility/reference_commit.xsl
new file mode 100644
index 0000000..63cb064
--- /dev/null
+++ b/utility/reference_commit.xsl
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:template match="@* | node()" mode="commit">
+ <xsl:copy>
+ <xsl:apply-templates select="@* | node()" mode="commit"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="commit" mode="commit">
+ <xsl:copy>
+ <xsl:attribute name="repository">
+ <xsl:value-of select="../@handle"/>
+ </xsl:attribute>
+
+ <xsl:apply-templates select="@* | node()" mode="commit"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="message | date | text()" mode="commit"/>
+
+</xsl:stylesheet>
diff --git a/utility/xhtml.xsl b/utility/xhtml.xsl
new file mode 100644
index 0000000..7347962
--- /dev/null
+++ b/utility/xhtml.xsl
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+<xsl:template match="*" mode="xhtml">
+ <xsl:element name="{local-name()}" namespace="http://www.w3.org/1999/xhtml">
+ <xsl:copy-of select="@*"/>
+ <xsl:apply-templates select="node()" mode="xhtml"/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template match="comment() | processing-instruction()" mode="xhtml">
+ <xsl:copy/>
+</xsl:template>
+
+</xsl:stylesheet>