diff options
-rw-r--r-- | docs/Makefile | 9 | ||||
-rw-r--r-- | docs/changes.xml | 2 | ||||
-rw-r--r-- | docs/changes.xsls | 47 | ||||
-rw-r--r-- | docs/changes.xslt | 47 |
4 files changed, 84 insertions, 21 deletions
diff --git a/docs/Makefile b/docs/Makefile index aa8aeb9b..db63eec4 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -14,6 +14,9 @@ PACKAGES= unit \ unit-ruby \ unit-jsc-common unit-jsc8 unit-jsc10 unit-jsc11 +CURDATE:=$(shell date +"%Y-%m-%d") +CURTIME:=$(shell date +"%H:%M:%S %z") + all: changes changelogs @@ -31,6 +34,8 @@ $(DEST)/CHANGES: changes.dtd \ xmllint --noout --valid changes.xml xsltproc --stringparam format generic \ + --stringparam curdate '$(CURDATE)' \ + --stringparam curtime '$(CURTIME)' \ -o $@ changes.xslt changes.xml $(DEST)/%.rpm-changelog: changes.dtd \ @@ -40,6 +45,8 @@ $(DEST)/%.rpm-changelog: changes.dtd \ mkdir -p $(DEST) xmllint --noout --valid changes.xml xsltproc --stringparam pkgname $* --stringparam format rpm \ + --stringparam curdate '$(CURDATE)' \ + --stringparam curtime '$(CURTIME)' \ -o $@ changes.xslt changes.xml $(DEST)/%.deb-changelog: changes.dtd \ @@ -49,6 +56,8 @@ $(DEST)/%.deb-changelog: changes.dtd \ mkdir -p $(DEST) xmllint --noout --valid changes.xml xsltproc --stringparam pkgname $* --stringparam format deb \ + --stringparam curdate '$(CURDATE)' \ + --stringparam curtime '$(CURTIME)' \ -o $@ changes.xslt changes.xml changes.xslt: changes.xsls diff --git a/docs/changes.xml b/docs/changes.xml index bec07ec2..11032a02 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -6,7 +6,7 @@ <changes apply="unit" ver="1.22.0" rev="1" - date="" time="18:00:00 +0300" + date="" time="" packager="Andrei Belov <defan@nginx.com>"> <change type="bugfix"> diff --git a/docs/changes.xsls b/docs/changes.xsls index 2f3bcc46..9ff6a7e2 100644 --- a/docs/changes.xsls +++ b/docs/changes.xsls @@ -5,6 +5,8 @@ X:output method="text"; X:param format="'generic'"; X:param pkgname="'unit'"; X:param configuration="'change_log_conf.xml'"; +X:param curdate; +X:param curtime; X:var conf = "document($configuration)/configuration"; @@ -58,8 +60,10 @@ X:template = "change_log" { !! "changes"; } X:template = "changes" { - X:var pday = { !padded_day(date="@date") } - X:var dow = { !day_of_week(date="@date") } + X:var date_ = { !getdate(date="@date", curdate="$curdate") } + X:var time_ = { !gettime(time="@time", curtime="$curtime") } + X:var pday = { !padded_day(date="$date_") } + X:var dow = { !day_of_week(date="$date_") } X:var apply = { !string_in_list(list="@apply", string="$pkgname") } X:var pkgname_ = { !beautify(pkgname="$pkgname") } @@ -77,17 +81,16 @@ X:template = "changes" { ' '), 1, $conf/changes/length)} - !{substring(@date, 9, 2)} - !{$conf/changes/month[number(substring(current()/@date, - 6, 2))]} - !{substring(@date, 1, 4)} + !{substring($date_, 9, 2)} + !{$conf/changes/month[number(substring($date_, 6, 2))]} + !{substring($date_, 1, 4)} } X:if "$format='rpm'" { !{concat('* ', $conf/changes/day[number($dow)], - $conf/changes/month[number(substring(current()/@date, 6, 2))], + $conf/changes/month[number(substring($date_, 6, 2))], $pday, ' ', - substring(@date, 1, 4), ' ', @packager, ' - ', + substring($date_, 1, 4), ' ', @packager, ' - ', @ver, '-', @rev, '%{?dist}.ngx')} } @@ -108,8 +111,8 @@ X:template = "changes" { !{concat(' -- ', @packager, ' ', $conf/changes/day[number($dow)], ', ', $pday, - $conf/changes/month[number(substring(current()/@date, 6, 2))], - substring(@date, 1, 4), ' ', @time)} + $conf/changes/month[number(substring($date_, 6, 2))], + substring($date_, 1, 4), ' ', $time_)} X:text { } X:text { } @@ -254,6 +257,30 @@ X:template beautify(pkgname) { } +X:template getdate(date, curdate) { + X:choose { + X:when "$date=''" { + !{$curdate} + } + X:otherwise { + !{$date} + } + } +} + + +X:template gettime(time, curtime) { + X:choose { + X:when "$time=''" { + !{$curtime} + } + X:otherwise { + !{$time} + } + } +} + + X:template = "at" {@} X:template = "br" { !{$br} } X:template = "nobr" { !{translate(., ' ', ' ')} } diff --git a/docs/changes.xslt b/docs/changes.xslt index 032d5c37..08f2f800 100644 --- a/docs/changes.xslt +++ b/docs/changes.xslt @@ -6,6 +6,8 @@ <xsl:param select="'generic'" name="format"/> <xsl:param select="'unit'" name="pkgname"/> <xsl:param select="'change_log_conf.xml'" name="configuration"/> +<xsl:param name="curdate"/> +<xsl:param name="curtime"/> <xsl:variable select="document($configuration)/configuration" name="conf"/> @@ -59,8 +61,10 @@ <xsl:template match="changes"> - <xsl:variable name="pday"> <xsl:call-template name="padded_day"><xsl:with-param select="@date" name="date"/></xsl:call-template></xsl:variable> - <xsl:variable name="dow"> <xsl:call-template name="day_of_week"><xsl:with-param select="@date" name="date"/></xsl:call-template></xsl:variable> + <xsl:variable name="date_"> <xsl:call-template name="getdate"><xsl:with-param select="@date" name="date"/><xsl:with-param select="$curdate" name="curdate"/></xsl:call-template></xsl:variable> + <xsl:variable name="time_"> <xsl:call-template name="gettime"><xsl:with-param select="@time" name="time"/><xsl:with-param select="$curtime" name="curtime"/></xsl:call-template></xsl:variable> + <xsl:variable name="pday"> <xsl:call-template name="padded_day"><xsl:with-param select="$date_" name="date"/></xsl:call-template></xsl:variable> + <xsl:variable name="dow"> <xsl:call-template name="day_of_week"><xsl:with-param select="$date_" name="date"/></xsl:call-template></xsl:variable> <xsl:variable name="apply"> <xsl:call-template name="string_in_list"><xsl:with-param select="@apply" name="list"/><xsl:with-param select="$pkgname" name="string"/></xsl:call-template></xsl:variable> <xsl:variable name="pkgname_"> <xsl:call-template name="beautify"><xsl:with-param select="$pkgname" name="pkgname"/></xsl:call-template></xsl:variable> @@ -78,17 +82,16 @@ ' '), 1, $conf/changes/length)"/> - <xsl:value-of select="substring(@date, 9, 2)"/> - <xsl:value-of select="$conf/changes/month[number(substring(current()/@date, - 6, 2))]"/> - <xsl:value-of select="substring(@date, 1, 4)"/> + <xsl:value-of select="substring($date_, 9, 2)"/> + <xsl:value-of select="$conf/changes/month[number(substring($date_, 6, 2))]"/> + <xsl:value-of select="substring($date_, 1, 4)"/> </xsl:if> <xsl:if test="$format='rpm'"> <xsl:value-of select="concat('* ', $conf/changes/day[number($dow)], - $conf/changes/month[number(substring(current()/@date, 6, 2))], + $conf/changes/month[number(substring($date_, 6, 2))], $pday, ' ', - substring(@date, 1, 4), ' ', @packager, ' - ', + substring($date_, 1, 4), ' ', @packager, ' - ', @ver, '-', @rev, '%{?dist}.ngx')"/> </xsl:if> @@ -109,8 +112,8 @@ <xsl:value-of select="concat(' -- ', @packager, ' ', $conf/changes/day[number($dow)], ', ', $pday, - $conf/changes/month[number(substring(current()/@date, 6, 2))], - substring(@date, 1, 4), ' ', @time)"/> + $conf/changes/month[number(substring($date_, 6, 2))], + substring($date_, 1, 4), ' ', $time_)"/> <xsl:text> </xsl:text> <xsl:text> </xsl:text> @@ -246,6 +249,30 @@ </xsl:template> +<xsl:template name="getdate"><xsl:param name="date"/><xsl:param name="curdate"/> + <xsl:choose> + <xsl:when test="$date=''"> + <xsl:value-of select="$curdate"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$date"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + + +<xsl:template name="gettime"><xsl:param name="time"/><xsl:param name="curtime"/> + <xsl:choose> + <xsl:when test="$time=''"> + <xsl:value-of select="$curtime"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$time"/> + </xsl:otherwise> + </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> |