diff options
-rw-r--r-- | source/00_content/meta.xml | 5 | ||||
-rw-r--r-- | source/00_content/repositories.xml | 1 | ||||
-rw-r--r-- | source/01_raw/commits.xsl | 7 | ||||
-rw-r--r-- | source/02_augment/commits.xsl (renamed from source/02_augment/formatted_commits.xsl) | 2 | ||||
-rw-r--r-- | source/03_merge/timeline.xsl | 2 | ||||
-rw-r--r-- | source/04_meta/paginated_timeline.xsl | 24 | ||||
-rw-r--r-- | source/99_result/main.css | 20 | ||||
-rw-r--r-- | source/99_result/repository/atom.xsl (renamed from source/99_result/feed/atom.xsl) | 8 | ||||
-rw-r--r-- | source/99_result/stream.xsl | 110 | ||||
-rw-r--r-- | source/99_result/timeline.xsl | 101 | ||||
-rw-r--r-- | utility/master.xsl | 35 |
11 files changed, 116 insertions, 199 deletions
diff --git a/source/00_content/meta.xml b/source/00_content/meta.xml index b802002..56bbb9d 100644 --- a/source/00_content/meta.xml +++ b/source/00_content/meta.xml @@ -1,4 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> <datasource> + <title>CommitLog</title> + <url>http://localhost:8000</url> + <commit_count>20</commit_count> + <mirror> <repository>http://code.kummerlaender.eu</repository> <commit>commit/?id=</commit> diff --git a/source/00_content/repositories.xml b/source/00_content/repositories.xml index fc4d47e..d7b0f05 100644 --- a/source/00_content/repositories.xml +++ b/source/00_content/repositories.xml @@ -1,3 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> <datasource> <entry handle="InputXSLT"> <path>~/projects/dev/InputXSLT</path> diff --git a/source/01_raw/commits.xsl b/source/01_raw/commits.xsl index c606030..b5fe201 100644 --- a/source/01_raw/commits.xsl +++ b/source/01_raw/commits.xsl @@ -9,16 +9,15 @@ <xsl:include href="[utility/datasource.xsl]"/> <xsl:variable name="meta"> - <datasource type="main" mode="full" source="00_content/repositories.xml" target="repositories"/> + <datasource type="main" 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="commits.xml"/> </xsl:variable> -<xsl:variable name="commit_count">20</xsl:variable> - <xsl:template match="repositories/entry"> <entry handle="{@handle}"> <xsl:copy-of select="InputXSLT:external-command( - concat('./utility/git_log.sh ', path, ' ', $commit_count) + concat('./utility/git_log.sh ', path, ' ', $root/meta/commit_count) )/self::command/commit"/> </entry> </xsl:template> diff --git a/source/02_augment/formatted_commits.xsl b/source/02_augment/commits.xsl index fed8c94..27f9bcd 100644 --- a/source/02_augment/formatted_commits.xsl +++ b/source/02_augment/commits.xsl @@ -10,7 +10,7 @@ <xsl:variable name="meta"> <datasource type="main" mode="full" source="01_raw/commits.xml" target="repositories"/> - <target mode="plain" value="formatted_commits.xml"/> + <target mode="plain" value="commits.xml"/> </xsl:variable> <xsl:template name="formatter"> diff --git a/source/03_merge/timeline.xsl b/source/03_merge/timeline.xsl index 0bed670..ebf7b44 100644 --- a/source/03_merge/timeline.xsl +++ b/source/03_merge/timeline.xsl @@ -8,7 +8,7 @@ <xsl:include href="[utility/reference_commit.xsl]"/> <xsl:variable name="meta"> - <datasource type="main" mode="full" source="02_augment/formatted_commits.xml" target="repositories"/> + <datasource type="main" mode="full" source="02_augment/commits.xml" target="repositories"/> <target mode="plain" value="timeline.xml"/> </xsl:variable> diff --git a/source/04_meta/paginated_timeline.xsl b/source/04_meta/paginated_timeline.xsl deleted file mode 100644 index cb25d3b..0000000 --- a/source/04_meta/paginated_timeline.xsl +++ /dev/null @@ -1,24 +0,0 @@ -<?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/main.css b/source/99_result/main.css deleted file mode 100644 index 0452889..0000000 --- a/source/99_result/main.css +++ /dev/null @@ -1,20 +0,0 @@ -body{margin:1em;padding:0;font:1em Droid Sans,sans-serif,Verdana,Arial,FreeSans;color:#272828;word-wrap:break-word} -a{text-decoration:underline;color:#272828} -a:hover{color:black} -p{padding:0;margin:0} -h2{font-size:1.4em;margin:0;color:#F80} -h2 a{font-size:.8em;text-decoration:none;color:#272828;font-weight:normal;display:inline-block;vertical-align:middle;max-width:95%} -h2 a:hover{text-decoration:underline} -ul{padding:0;margin:0 0 0 2.5em} -ul li{list-style-type:circle;margin:.2em 0 .2em 0} -ul li a{background:0} -p.info{font-size:.8em;margin-bottom:.5em;margin-left:1.5em} -p.info a{text-decoration:none;color:#272828;margin:0 .1em 0 .1em} -p.info a:hover{text-decoration:underline} -.commit{border-bottom:.3em dotted #e3e8e8;padding-bottom:.5em;overflow:hidden} -#pagination{height:1.5em;margin-top:.5em} -#pagination span.disabled{display:none} -#pagination span a{text-decoration:none;color:#272828} -#pagination span a:hover{text-decoration:underline} -#pagination span a.pagination-previous{float:left} -#pagination span a.pagination-next{float:right} diff --git a/source/99_result/feed/atom.xsl b/source/99_result/repository/atom.xsl index e59a3a6..f858dea 100644 --- a/source/99_result/feed/atom.xsl +++ b/source/99_result/repository/atom.xsl @@ -15,14 +15,14 @@ <xsl:include href="[utility/xhtml.xsl]"/> <xsl:variable name="meta"> - <datasource type="main" mode="iterate" source="02_augment/formatted_commits.xml" target="repository"/> - <datasource type="support" mode="full" source="00_content/meta.xml" target="meta"/> + <datasource type="main" mode="iterate" source="02_augment/commits.xml" target="repository"/> + <datasource type="support" mode="full" source="00_content/meta.xml" target="meta"/> <target mode="xpath" value="concat($datasource/repository/entry/@handle, '.xml')"/> </xsl:variable> <xsl:variable name="root" select="/datasource"/> <xsl:variable name="title" select="datasource/repository/entry/@handle"/> -<xsl:variable name="url" select="concat('/feed/', $title, '.xml')"/> +<xsl:variable name="url" select="concat($root/meta/url, '/feed/', $title, '.xml')"/> <xsl:variable name="latest" select="repository/entry/commit[1]"/> <xsl:template match="datasource"> @@ -58,7 +58,7 @@ <xsl:attribute name="href"> <xsl:value-of select="concat( $root/meta/mirror/repository, '/', - ../@handle, '/', + ../@handle, '/', $root/meta/mirror/commit, @hash )"/> diff --git a/source/99_result/stream.xsl b/source/99_result/stream.xsl deleted file mode 100644 index 5c037d6..0000000 --- a/source/99_result/stream.xsl +++ /dev/null @@ -1,110 +0,0 @@ -<?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:include href="[utility/date-time.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"/> - <datasource type="support" mode="full" source="00_content/meta.xml" target="meta"/> - <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]"/> - - <div class="commit"> - <h2> - <xsl:text>» </xsl:text> - <a href=""> - <xsl:value-of select="$commit/message/h1"/> - </a> - </h2> - <p class="info"> - <xsl:call-template name="format-date"> - <xsl:with-param name="date" select="$commit/date"/> - <xsl:with-param name="format" select="'M x, Y'"/> - </xsl:call-template> - <xsl:text> at </xsl:text> - <xsl:value-of select="$commit/date/@time"/> - <xsl:text> | </xsl:text> - <a> - <xsl:attribute name="href"> - <xsl:value-of select="concat( - $root/meta/mirror/repository, '/', - $repository - )"/> - </xsl:attribute> - - <xsl:value-of select="$repository"/> - </a> - <xsl:text> | </xsl:text> - <a> - <xsl:attribute name="href"> - <xsl:value-of select="concat( - $root/meta/mirror/repository, '/', - $repository, '/', - $root/meta/mirror/commit, - $commit/@hash - )"/> - </xsl:attribute> - - <xsl:value-of select="$commit/@hash"/> - </a> - </p> - - <xsl:apply-templates select="$commit/message/*[name() != 'h1']" mode="xhtml"/> - </div> -</xsl:template> - -<xsl:template match="page/entry"> - <xsl:apply-templates /> - - <div id="pagination"> - <xsl:if test="@index > 0"> - <span> - <a class="pagination-previous" href="/0"> - <xsl:text>« first</xsl:text> - </a> - </span> - - <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="/{@total - 1}"> - <xsl:text>last »</xsl:text> - </a> - </span> - - <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/source/99_result/timeline.xsl b/source/99_result/timeline.xsl new file mode 100644 index 0000000..4793e8c --- /dev/null +++ b/source/99_result/timeline.xsl @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet + version="1.0" + xmlns="http://www.w3.org/2005/Atom" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +> + +<xsl:output + method="xml" + omit-xml-declaration="no" + encoding="UTF-8" + indent="no" +/> + +<xsl:include href="[utility/xhtml.xsl]"/> + +<xsl:variable name="meta"> + <datasource type="main" mode="full" source="03_merge/timeline.xml" target="timeline"/> + <datasource type="support" mode="full" source="02_augment/commits.xml" target="repositories"/> + <datasource type="support" mode="full" source="00_content/meta.xml" target="meta"/> + <target mode="plain" value="timeline.xml"/> +</xsl:variable> + +<xsl:variable name="root" select="/datasource"/> +<xsl:variable name="url" select="concat($root/meta/url, '/timeline.xml')"/> +<xsl:variable name="latest" select="$root/repositories/entry[ + @handle = $root/timeline/commit[1]/@repository +]/commit[ + @hash = $root/timeline/commit[1]/@hash +]"/> + +<xsl:template name="get_commit"> + <xsl:param name="repository"/> + <xsl:param name="hash"/> + + <xsl:variable name="commit" select="$root/repositories/entry[ + @handle = $repository + ]/commit[ + @hash = $hash + ]"/> + + <entry xmlns="http://www.w3.org/2005/Atom"> + <id> + <xsl:value-of select="$hash"/> + </id> + <title> + <xsl:value-of select="$commit/message/h1"/> + </title> + <link rel="alternate" title="{@hash}"> + <xsl:attribute name="href"> + <xsl:value-of select="concat( + $root/meta/mirror/repository, '/', + $repository, '/', + $root/meta/mirror/commit, + $hash + )"/> + </xsl:attribute> + </link> + <content type="xhtml"> + <div xmlns="http://www.w3.org/1999/xhtml"> + <xsl:apply-templates select="$commit/message/*[name() != 'h1']" mode="xhtml"/> + </div> + </content> + <updated> + <xsl:value-of select="$commit/date"/> + <xsl:text>T</xsl:text> + <xsl:value-of select="$commit/date/@time"/> + <xsl:text>:00+02:00</xsl:text> + </updated> + </entry> +</xsl:template> + +<xsl:template match="datasource"> + <feed> + <link href="{$url}" rel="self" title="{$root/meta/title}" type="application/atom+xml"/> + + <id> + <xsl:value-of select="$url"/> + </id> + <title> + <xsl:value-of select="$root/meta/title"/> + </title> + <updated> + <xsl:value-of select="$latest/date"/> + <xsl:text>T</xsl:text> + <xsl:value-of select="$latest/date/@time"/> + <xsl:text>:00+02:00</xsl:text> + </updated> + + <xsl:apply-templates select="timeline/commit[position() <= $root/meta/commit_count]"/> + </feed> +</xsl:template> + +<xsl:template match="timeline/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/master.xsl b/utility/master.xsl deleted file mode 100644 index 4f3597c..0000000 --- a/utility/master.xsl +++ /dev/null @@ -1,35 +0,0 @@ -<?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="viewport" content="width=device-width,initial-scale=1.0"/> - - <link rel="stylesheet" type="text/css" href="/main.css" /> - </head> - <body> - <xsl:apply-templates /> - </body> -</html> -</xsl:template> - -<xsl:template match="text()|@*"/> - -</xsl:stylesheet> |