Date: Wed, 4 May 2016 22:04:56 +0000 (UTC) From: Warren Block <wblock@FreeBSD.org> To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r48778 - in head/share: mk xml Message-ID: <201605042204.u44M4ulN045275@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: wblock Date: Wed May 4 22:04:56 2016 New Revision: 48778 URL: https://svnweb.freebsd.org/changeset/doc/48778 Log: Replace revision and publication date in generated documentation with the actual date of last update. This fixes the problems with misleading "last update" dates that only reflect the change in a single rarely-changed file. Note that hrs had reservations about doing this in the Makefile rather than with a stylesheet. However, not all our source files are XML. For now, this change works, and can be replaced by a more elegant solution later. We should also consider checking dates on other files that affect the content or appearance of documents, like images. Submitted by: grembo Modified: head/share/mk/doc.commands.mk head/share/mk/doc.docbook.mk head/share/xml/freebsd-common.xsl head/share/xml/freebsd-xhtml-common.xsl Modified: head/share/mk/doc.commands.mk ============================================================================== --- head/share/mk/doc.commands.mk Wed May 4 21:38:28 2016 (r48777) +++ head/share/mk/doc.commands.mk Wed May 4 22:04:56 2016 (r48778) @@ -32,6 +32,7 @@ SED?= /usr/bin/sed SETENV?= /usr/bin/env SH?= /bin/sh SORT?= /usr/bin/sort +TAIL?= /usr/bin/tail TOUCH?= /usr/bin/touch TRUE?= /usr/bin/true XARGS?= /usr/bin/xargs Modified: head/share/mk/doc.docbook.mk ============================================================================== --- head/share/mk/doc.docbook.mk Wed May 4 21:38:28 2016 (r48777) +++ head/share/mk/doc.docbook.mk Wed May 4 22:04:56 2016 (r48778) @@ -84,6 +84,18 @@ CSS_SHEET?= ${DOC_PREFIX}/share/misc/doc # NO_SUBDIR= YES +# +# Determine latest revision +# +LATESTREVISION!=${GREP} -Ehos '\$$[F]reeBSD: ([^\$$ ]+ ){5}\$$' ${SRCS} | \ + ${AWK} '{ print \ + " --param latestrevision.timestamp \"'\''"$$4" "$$5"'\''\"" \ + " --param latestrevision.committer \"'\''"$$6"'\''\"" \ + " --param latestrevision.number \"'\''"$$3"'\''\"" \ + }' | ${SORT} | ${TAIL} -n1 + +XSLTPROCOPTS+= ${LATESTREVISION} + # ------------------------------------------------------------------------ # # Look at ${FORMATS} and work out which documents need to be generated. Modified: head/share/xml/freebsd-common.xsl ============================================================================== --- head/share/xml/freebsd-common.xsl Wed May 4 21:38:28 2016 (r48777) +++ head/share/xml/freebsd-common.xsl Wed May 4 22:04:56 2016 (r48778) @@ -53,7 +53,7 @@ <xsl:variable name="pubdate"> <xsl:choose> <xsl:when test="contains(., '$FreeBSD')"> - <xsl:value-of select="str:split(., ' ')[4]"/> + <xsl:value-of select="$latestrevision.timestamp"/> </xsl:when> <xsl:otherwise> @@ -64,7 +64,7 @@ <xsl:variable name="committer"> <xsl:if test="contains(., '$FreeBSD')"> - <xsl:value-of select="str:split(., ' ')[6]"/> + <xsl:value-of select="$latestrevision.committer"/> </xsl:if> </xsl:variable> @@ -91,7 +91,7 @@ <xsl:template name="svnref.genlink"/> <xsl:template name="titlepage.releaseinfo"> - <xsl:variable name="rev" select="str:split(., ' ')[3]"/> + <xsl:variable name="rev" select="$latestrevision.number"/> <xsl:call-template name="gentext"> <xsl:with-param name="key" select="'Revision'"/> Modified: head/share/xml/freebsd-xhtml-common.xsl ============================================================================== --- head/share/xml/freebsd-xhtml-common.xsl Wed May 4 21:38:28 2016 (r48777) +++ head/share/xml/freebsd-xhtml-common.xsl Wed May 4 22:04:56 2016 (r48778) @@ -264,7 +264,7 @@ </xsl:template> <xsl:template name="titlepage.releaseinfo"> - <xsl:variable name="rev" select="str:split(., ' ')[3]"/> + <xsl:variable name="rev" select="$latestrevision.number"/> <xsl:call-template name="gentext"> <xsl:with-param name="key" select="'Revision'"/>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605042204.u44M4ulN045275>