svn commit: r48778 - in head/share: mk xml

Warren Block <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
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'"/>
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-doc-all
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.