From: Michael Smith Date: Mon, 10 Apr 2006 14:15:28 +0000 (+0000) Subject: Added message-prolog and message-epilog and X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=45f575be76f55446db7344f1499969df6ead1bd2;p=docbook-dsssl Added message-prolog and message-epilog and suppress-context-node-name local params to the write.chunk and write.text.chunk templates. They enable additional info to be emitted before/after the "Writing..." message, and enable they context-node name to be suppressed in output. The reason for these additions is that the write.text.chunk template is "repurposed" in manpages output for writing the names of soelim stub files as well as "real" man pages, and also is used for writing the manifest file, and it is useful to emit details about the type of file it is writing each time. --- diff --git a/xsl/common/refentry.xsl b/xsl/common/refentry.xsl index 21a1c3a25..416c875e3 100644 --- a/xsl/common/refentry.xsl +++ b/xsl/common/refentry.xsl @@ -165,12 +165,6 @@ - - Note - To suppress "meta" messages, set $refentry.emit.messages to 0. - <xsl:call-template name="get.refentry.title"> <xsl:with-param name="refname" select="$refname"/> @@ -197,6 +191,12 @@ <xsl:with-param name="prefs" select="$prefs/ManualPrefs"/> </xsl:call-template> </manual> + <xsl:call-template name="refentry.emit.message"> + <xsl:with-param name="level">Note</xsl:with-param> + <xsl:with-param + name="message" + >To suppress "meta" messages, set $refentry.emit.messages to 0.</xsl:with-param> + </xsl:call-template> </xsl:template> <!-- ====================================================================== --> @@ -258,32 +258,46 @@ commands"].</para> </refdescription> - <refparameter><para>[none]</para></refparameter> + <refparameter> + <variablelist> + <varlistentry> + <term>quiet</term> + <listitem> + <para>If non-zero, no "missing" message is emitted</para> + </listitem> + </varlistentry> + </variablelist> + </refparameter> <refreturn> - <para>Returns a <tag>section</tag> node.</para></refreturn> + <para>Returns a string representing a section number.</para></refreturn> </doc:template> <xsl:template name="get.refentry.section"> + <xsl:param name="quiet" select="0"/> <xsl:choose> <xsl:when test="refmeta/manvolnum"> <xsl:value-of select="refmeta/manvolnum"/> </xsl:when> <xsl:otherwise> - <xsl:call-template name="refentry.emit.message"> - <xsl:with-param name="level">Note</xsl:with-param> - <xsl:with-param - name="message" - >meta manvolnum: No manvolnum.</xsl:with-param> - </xsl:call-template> + <xsl:if test="$quiet = 0"> + <xsl:call-template name="refentry.emit.message"> + <xsl:with-param name="level">Note</xsl:with-param> + <xsl:with-param + name="message" + >meta manvolnum: No manvolnum.</xsl:with-param> + </xsl:call-template> + </xsl:if> <xsl:choose> <xsl:when test=".//funcsynopsis"> - <xsl:call-template name="refentry.emit.message"> - <xsl:with-param name="level">Note</xsl:with-param> - <xsl:with-param - name="message" - >meta manvolnum: Found funcsynopsis. Setting section number to 3.</xsl:with-param> - </xsl:call-template> - <xsl:text>3</xsl:text> + <xsl:if test="$quiet = 0"> + <xsl:call-template name="refentry.emit.message"> + <xsl:with-param name="level">Note</xsl:with-param> + <xsl:with-param + name="message" + >meta manvolnum: Found funcsynopsis. Setting man section to 3.</xsl:with-param> + </xsl:call-template> + <xsl:text>3</xsl:text> + </xsl:if> </xsl:when> <xsl:otherwise> <xsl:text>1</xsl:text> diff --git a/xsl/html/chunker.xsl b/xsl/html/chunker.xsl index 76a9956f5..bbd3da205 100644 --- a/xsl/html/chunker.xsl +++ b/xsl/html/chunker.xsl @@ -76,6 +76,9 @@ <xsl:template name="write.chunk"> <xsl:param name="filename" select="''"/> <xsl:param name="quiet" select="$chunker.output.quiet"/> + <xsl:param name="suppress-context-node-name" select="0"/> + <xsl:param name="message-prolog"/> + <xsl:param name="message-epilog"/> <xsl:param name="method" select="$chunker.output.method"/> <xsl:param name="encoding" select="$chunker.output.encoding"/> @@ -93,9 +96,12 @@ <xsl:if test="$quiet = 0"> <xsl:message> + <xsl:if test="not($message-prolog = '')"> + <xsl:value-of select="$message-prolog"/> + </xsl:if> <xsl:text>Writing </xsl:text> <xsl:value-of select="$filename"/> - <xsl:if test="name(.) != ''"> + <xsl:if test="name(.) != '' and $suppress-context-node-name = 0"> <xsl:text> for </xsl:text> <xsl:value-of select="name(.)"/> <xsl:if test="@id"> @@ -104,6 +110,9 @@ <xsl:text>)</xsl:text> </xsl:if> </xsl:if> + <xsl:if test="not($message-epilog = '')"> + <xsl:value-of select="$message-epilog"/> + </xsl:if> </xsl:message> </xsl:if> @@ -399,6 +408,9 @@ <xsl:template name="write.text.chunk"> <xsl:param name="filename" select="''"/> <xsl:param name="quiet" select="$chunker.output.quiet"/> + <xsl:param name="suppress-context-node-name" select="0"/> + <xsl:param name="message-prolog"/> + <xsl:param name="message-epilog"/> <xsl:param name="method" select="'text'"/> <xsl:param name="encoding" select="$chunker.output.encoding"/> <xsl:param name="media-type" select="$chunker.output.media-type"/> @@ -407,6 +419,9 @@ <xsl:call-template name="write.chunk"> <xsl:with-param name="filename" select="$filename"/> <xsl:with-param name="quiet" select="$quiet"/> + <xsl:with-param name="suppress-context-node-name" select="$suppress-context-node-name"/> + <xsl:with-param name="message-prolog" select="$message-prolog"/> + <xsl:with-param name="message-epilog" select="$message-epilog"/> <xsl:with-param name="method" select="$method"/> <xsl:with-param name="encoding" select="$encoding"/> <xsl:with-param name="indent" select="'no'"/> diff --git a/xsl/manpages/docbook.xsl b/xsl/manpages/docbook.xsl index 2315549cc..7a6318a81 100644 --- a/xsl/manpages/docbook.xsl +++ b/xsl/manpages/docbook.xsl @@ -75,7 +75,7 @@ <!-- * document; if so, process them. --> <xsl:apply-templates select="//refentry"/> <!-- * if $generate.manifest is non-zero, generate a manifest file --> - <xsl:if test="not($generate.manifest = '0')"> + <xsl:if test="not($generate.manifest = 0)"> <xsl:call-template name="generate.manifest"> <xsl:with-param name="filename"> <xsl:choose> @@ -97,6 +97,10 @@ </xsl:with-param> </xsl:call-template> </xsl:if> + <xsl:if test="$man.output.quietly = 0"> + <xsl:message + >Note: To suppress "Writing..." messages, set $man.output.quietly to 1.</xsl:message> + </xsl:if> </xsl:when> <xsl:otherwise> <!-- * Otherwise, the document does not contain any --> diff --git a/xsl/manpages/other.xsl b/xsl/manpages/other.xsl index 3f6357274..a8798876e 100644 --- a/xsl/manpages/other.xsl +++ b/xsl/manpages/other.xsl @@ -283,6 +283,7 @@ <xsl:call-template name="write.text.chunk"> <xsl:with-param name="filename" select="$filename"/> <xsl:with-param name="quiet" select="$man.output.quietly"/> + <xsl:with-param name="message-prolog">Note: </xsl:with-param> <xsl:with-param name="encoding" select="$man.output.encoding"/> <xsl:with-param name="content" select="$content"/> </xsl:call-template> @@ -318,6 +319,9 @@ </xsl:call-template> </xsl:with-param> <xsl:with-param name="quiet" select="$man.output.quietly"/> + <xsl:with-param name="suppress-context-node-name" select="1"/> + <xsl:with-param name="message-prolog">Note: </xsl:with-param> + <xsl:with-param name="message-epilog"> (soelim stub)</xsl:with-param> <xsl:with-param name="content"> <xsl:value-of select="concat('.so man', $section, '/')"/> <xsl:call-template name="make.adjusted.man.filename"> @@ -333,10 +337,10 @@ <!-- ============================================================== --> - <!-- * A manifest file is useful for doing “make clean” during --> + <!-- * A manifest file is useful for doing "make clean" during --> <!-- * builds and for other purposes. When we make the manifest --> <!-- * file, we need to include in it a filename for each man-page --> - <!-- * generated, including any “stub” pages. --> + <!-- * generated, including any "stub" pages. --> <xsl:template name="generate.manifest"> <xsl:param name="filename">MAN.MANIFEST</xsl:param> <xsl:variable name="filelist"> @@ -345,7 +349,9 @@ <!-- * numbers from the parent Refentry; so we only need to get --> <!-- * the section once per Refentry, not once per Refname --> <xsl:variable name="section"> - <xsl:call-template name="get.refentry.section"/> + <xsl:call-template name="get.refentry.section"> + <xsl:with-param name="quiet" select="1"/> + </xsl:call-template> </xsl:variable> <xsl:for-each select="refnamediv/refname"> <xsl:call-template name="make.adjusted.man.filename"> @@ -364,6 +370,8 @@ <xsl:value-of select="$man.manifest.filename"/> </xsl:with-param> <xsl:with-param name="quiet" select="$man.output.quietly"/> + <xsl:with-param name="message-prolog">Note: </xsl:with-param> + <xsl:with-param name="message-epilog"> (manifest file)</xsl:with-param> <xsl:with-param name="content"> <xsl:value-of select="$filelist"/> </xsl:with-param>