aboutsummaryrefslogtreecommitdiff
path: root/docs/xslt/changes.xslt
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2011-08-29 13:57:43 +0000
committerIgor Sysoev <igor@sysoev.ru>2011-08-29 13:57:43 +0000
commitef0316bb824f024a7317d2098ceba3af8ecda54f (patch)
tree568b444f6a7a10e6097dbf2a170bbce9ee0aee3e /docs/xslt/changes.xslt
parentee7216bfa68ecc204f4a9b9154f18a9f284a7c3a (diff)
downloadnginx-ef0316bb824f024a7317d2098ceba3af8ecda54f.tar.gz
nginx-ef0316bb824f024a7317d2098ceba3af8ecda54f.zip
Merge of r3996, r3998, r4015, r4023, r4025, r4026, r4027:
Changes log build procedure fixes: *) using sed instead of perl *) support <br/> in the middle of input *) fixed "<br>" lookup (eliminates the need in " <br/>" hacks) *) fixed maximum length for unbreakable input *) fixed space lookup (allows a space at column 77 to break a line) *) traling spaces removal in text CHANGES files.
Diffstat (limited to 'docs/xslt/changes.xslt')
-rw-r--r--docs/xslt/changes.xslt56
1 files changed, 40 insertions, 16 deletions
diff --git a/docs/xslt/changes.xslt b/docs/xslt/changes.xslt
index 8b1cd0a8b..89c348d4d 100644
--- a/docs/xslt/changes.xslt
+++ b/docs/xslt/changes.xslt
@@ -4,23 +4,29 @@
<xsl:output encoding="koi8-r" method="text"/>
<xsl:param select="'en'" name="lang"/>
+
<xsl:param select="'../xml/change_log_conf.xml'" name="configuration"/>
<xsl:variable select="document($configuration)/configuration" name="conf"/>
+
<xsl:variable select="$conf/start" name="start"/>
+
<xsl:variable select="$conf/indent" name="indent"/>
+
<xsl:variable select="$conf/length" name="max"/>
+
<xsl:variable name="br">&lt;br&gt;</xsl:variable>
-
+
<xsl:template match="/">
<xsl:apply-templates select="change_log"/>
</xsl:template>
-
+
<xsl:template match="change_log">
<xsl:apply-templates select="changes"/>
</xsl:template>
-
+
<xsl:template match="changes">
+
<xsl:text>
</xsl:text>
@@ -31,10 +37,14 @@
</xsl:if>
<xsl:if test="$lang='en'">
+
<xsl:value-of select="substring(@date, 1, 2)"/>
+
<xsl:value-of select="$conf/changes[@lang=$lang]/month[number(substring(current()/@date, 4, 2))]"/>
+
<xsl:value-of select="substring(@date, 7, 4)"/>
</xsl:if>
+
<xsl:text>
</xsl:text>
@@ -44,8 +54,8 @@
</xsl:text>
</xsl:template>
-
<xsl:template match="change">
+
<xsl:variable select="$conf/changes[@lang=$lang]/*[local-name(.)=current()/@type]" name="prefix"/>
<xsl:variable name="postfix">
@@ -59,9 +69,9 @@
</xsl:apply-templates>
</xsl:template>
-
<xsl:template match="para" name="para">
<xsl:param name="prefix"/>
+
<xsl:variable name="text">
<xsl:apply-templates/>
</xsl:variable>
@@ -73,6 +83,7 @@
<xsl:with-param select="normalize-space($text)" name="text"/>
<xsl:with-param name="prefix">
<xsl:choose>
+
<xsl:when test="position() = 1">
<xsl:value-of select="$prefix"/>
</xsl:when>
@@ -84,31 +95,38 @@
</xsl:call-template>
</xsl:template>
-
<xsl:template name="wrap">
<xsl:param name="text"/>
<xsl:param name="prefix"/>
+
<xsl:if test="$text">
+
<xsl:variable name="offset">
+
<xsl:choose>
<xsl:when test="starts-with($text, concat($br, ' '))">
<xsl:value-of select="string-length($br) + 2"/>
</xsl:when>
+ <xsl:when test="starts-with($text, $br)">
+ <xsl:value-of select="string-length($br) + 1"/>
+ </xsl:when>
<xsl:otherwise>
- 1</xsl:otherwise>
+ 1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="length">
+
<xsl:call-template name="length">
<xsl:with-param select="substring($text, $offset)" name="text"/>
<xsl:with-param select="string-length($prefix)" name="prefix"/>
<xsl:with-param select="$max" name="length"/>
</xsl:call-template>
</xsl:variable>
+
<xsl:value-of select="$prefix"/>
- <xsl:value-of select="translate(substring($text, $offset, $length), ' ', ' ')"/>
+ <xsl:value-of select="normalize-space(translate(substring($text, $offset, $length), ' ', ' '))"/>
<xsl:text>
</xsl:text>
@@ -119,23 +137,29 @@
</xsl:call-template>
</xsl:if>
</xsl:template>
-
+
<xsl:template name="length">
<xsl:param name="text"/>
<xsl:param name="prefix"/>
<xsl:param name="length"/>
- <xsl:variable select="substring-before(substring($text, 1, $length - $prefix), $br)" name="break"/>
+
+ <xsl:variable select="substring-before(substring($text, 1, $length - $prefix + string-length($br)), $br)" name="break"/>
+
<xsl:choose>
<xsl:when test="$break">
<xsl:value-of select="string-length($break)"/>
</xsl:when>
<xsl:when test="$length = 0">
- <xsl:value-of select="$max"/>
+ <xsl:value-of select="$max - $prefix"/>
</xsl:when>
- <xsl:when test="string-length($text) + $prefix &lt;= $length or substring($text, $length - $prefix, 1) = ' '">
+ <xsl:when test="string-length($text) + $prefix &lt;= $length">
<xsl:value-of select="$length - $prefix"/>
</xsl:when>
+ <xsl:when test="substring($text, $length - $prefix + 1, 1) = ' '">
+ <xsl:value-of select="$length - $prefix + 1"/>
+ </xsl:when>
<xsl:otherwise>
+
<xsl:call-template name="length">
<xsl:with-param select="$text" name="text"/>
<xsl:with-param select="$prefix" name="prefix"/>
@@ -145,14 +169,14 @@
</xsl:choose>
</xsl:template>
-
<xsl:template match="at">@</xsl:template>
-
+
<xsl:template match="br">
<xsl:value-of select="$br"/>
</xsl:template>
-
+
<xsl:template match="nobr">
<xsl:value-of select="translate(., ' ', ' ')"/>
</xsl:template>
-</xsl:stylesheet> \ No newline at end of file
+
+</xsl:stylesheet>