diff options
author | Adrian Kummerlaender | 2014-10-17 22:59:45 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2014-10-17 22:59:45 +0200 |
commit | acacfda54016cbd4437d1ccaa609a52e9c1739d0 (patch) | |
tree | 6429c262d2e33fe215613e6b0ac69a0af5f0492b /source | |
download | Overview-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
Diffstat (limited to 'source')
-rw-r--r-- | source/00_content/repositories.xml | 23 | ||||
-rw-r--r-- | source/01_raw/commits.xsl | 24 | ||||
-rw-r--r-- | source/02_augment/formatted_commits.xsl | 45 | ||||
-rw-r--r-- | source/03_merge/timeline.xsl | 21 | ||||
-rw-r--r-- | source/04_meta/paginated_timeline.xsl | 24 | ||||
-rw-r--r-- | source/99_result/repositories/repository_log.xsl | 20 | ||||
-rw-r--r-- | source/99_result/stream.xsl | 54 |
7 files changed, 211 insertions, 0 deletions
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 < @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> |