List:Internals« Previous MessageNext Message »
From:paul Date:November 9 2005 11:56pm
Subject:svn commit - mysqldoc@docsrva: r306 - in trunk: . xsl.d
View as plain text  
Author: paul
Date: 2005-11-09 23:56:36 +0100 (Wed, 09 Nov 2005)
New Revision: 306

Log:
 r3620@frost:  paul | 2005-11-09 16:36:10 -0600
 Handle <ulink>, <email>, <quote> for help-text generation.
 Other minor tweaks.


Modified:
   trunk/
   trunk/xsl.d/expand-links.xsl
   trunk/xsl.d/help-prep1.xsl
   trunk/xsl.d/help-prep2.xsl
   trunk/xsl.d/resolve-xref.xsl


Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:3604
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:922
   + b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:3620
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:922

Modified: trunk/xsl.d/expand-links.xsl
===================================================================
--- trunk/xsl.d/expand-links.xsl	2005-11-09 20:39:36 UTC (rev 305)
+++ trunk/xsl.d/expand-links.xsl	2005-11-09 22:56:36 UTC (rev 306)
@@ -1,23 +1,25 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:stylesheet
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
 <!--
-expand-links.xsl - get rid of hyperlinks
+  expand-links.xsl - get rid of hyperlinks
 
-This transform is used when generating plain text files.
+  This transform is used when generating plain text files.
 
-This is like an identity transform with the following exceptions:
-- <xref> elements represent cross-references; they are resolved and
-  replaced with the proper text of the cross-reference.
-- <ulink> elements are replaced with the link contents as described
-  below.
-- <mailto> elements are replaced with their contents.
-- Some elements are deleted: <index>, <indexterm>
+  This is like an identity transform with the following exceptions:
+  - <xref> elements represent cross-references; they are resolved and
+    replaced with the proper text of the cross-reference.
+  - Replace <ulink> elements with the link contents as described below.
+  - Replace <mailto> elements with their contents.
+  - <quote>xxx</quote> becomes "xxx".
+  - Some elements are deleted: <index>, <indexterm>
 
-Templates in included files REQUIRE that the $toc.entry.file string
-parameter be set to the name of the file that contains table of
-contents information so that the links can be resolved.  In xsltproc,
-you can do that with a stringparam option on the command line.
+  Templates in included files REQUIRE that the $toc.entry.file string
+  parameter be set to the name of the file that contains table of
+  contents information so that the links can be resolved.  In xsltproc,
+  you can do that with a stringparam option on the command line.
 -->
 
 <xsl:include href="resolve-xref.xsl"/>
@@ -32,10 +34,10 @@
 <xsl:variable name="retain-link-tag" select="0"/>
 
 <!--
-Special rule to handle the case of text that follows a <xref> element.
-If the text begins with a punctuation character , the xref rule will
-have taken it and placed it inside the quotes surrounding the xref
-title, so make sure not to repeat the punctuation character here.
+  Special rule to handle the case of text that follows a <xref> element.
+  If the text begins with a punctuation character , the xref rule will
+  have taken it and placed it inside the quotes surrounding the xref
+  title, so make sure not to repeat the punctuation character here.
 -->
 
 <xsl:template match="text()[preceding-sibling::*[1][self::xref]]">
@@ -72,22 +74,21 @@
 </xsl:template>
 
 <!--
-Expand a <ulink>:
+  Expand a <ulink>:
 
-1) If the @url attribute and the content are the same
-(that is, <ulink url="str">str</ulink>), write this out as
-    str
+  1) If the @url attribute and the content are the same (that
+     is, <ulink url="str">str</ulink>), or there is no content,
+     write this out as
 
-2) If the @url attribute and the content differ
-(that is, <ulink url="str1">str2</ulink>), write this out as
-    str2 (str1)
-
+  2) If the @url attribute and the content differ (that is,
+     <ulink url="str1">str2</ulink>), write this out as
+       str2 (str1)
 -->
 
 <xsl:template match="ulink">
   <!-- determine whether @url is same as content -->
   <xsl:choose>
-    <xsl:when test="@url=normalize-space(.)">
+    <xsl:when test="@url=normalize-space(.) or normalize-space(.) = ''">
       <!-- just write out @url -->
       <xsl:value-of select="@url"/>
     </xsl:when>

Modified: trunk/xsl.d/help-prep1.xsl
===================================================================
--- trunk/xsl.d/help-prep1.xsl	2005-11-09 20:39:36 UTC (rev 305)
+++ trunk/xsl.d/help-prep1.xsl	2005-11-09 22:56:36 UTC (rev 306)
@@ -1,17 +1,18 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <xsl:stylesheet
-   version="1.0"
-   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
 <!--
   help-prep1.xsl - prep a DocBook document for extracting
   help-table information, stage 1.
 
-  Some help tags are written using paired <remark> elements that use the
+  Some help tags occur as paired <remark> elements that use the
   @role attribute to indicate the beginning or end of a particular
-  kind of help information.  Some begin tags have a @condition
-  attribute.  Examples:
+  kind of help information.  Examples:
 
+  Some help tags have a @condition attribute.  Examples:
+
     <remark role="help-syntax-begin"/>
     <remark role="help-syntax-end"/>
 
@@ -23,9 +24,7 @@
 
   Paired remarks are used when the help information might span multiple
   input elements.  This transform converts each pair of begin and end
-  remarks into a single XML element that contains the spanned input.
-  If the begin remark has is a @condition attribute, it becomes the
-  @name attribute of the element begin tag.
+  remarks into a single XML element that contains the spanned input:
 
     <help-syntax> ... </help-syntax>
 
@@ -33,6 +32,14 @@
 
     <help-example> ... </help-example>
 
+  Some help tags have a @condition attribute.  Examples:
+
+    <remark role="help-category" condition="Functions"/>
+    <remark role="help-topic" condition="AUTO_INCREMENT"/>
+
+  If a remark has is a @condition attribute, it becomes the @name
+  attribute of the output element.
+
   Some single-tag constructs are used:
 
   <remark role="help-category"/> indicates the beginning of information
@@ -60,11 +67,15 @@
   extract their contents in the next processing stage.
 
   Other actions:
-  - For each topic, add <help-url-id name="XXX"/> element containing the
+  - For each topic, add a <help-url-id name="XXX"/> element containing the
     @id attribute of the containing section.  This is used for generating
     the URL of the corresponding page in the online manual.
+  - Process some elements to convert them to plainer format:
   - "Resolve" cross-references by converting <xref linkend="target-id"/>
     into [target-id].
+  - Replace <ulink> elements with the link contents as described below.
+  - Replace <mailto> elements with their contents.
+  - <quote>xxx</quote> becomes "xxx".
 -->
 
 <!--
@@ -292,6 +303,11 @@
   <xsl:value-of select="$newline"/>
 </xsl:template>
 
+
+<!--
+  Cross-reference.  Replace with @linkend attribute value in square brackets.
+-->
+
 <xsl:template match="xref">
   <xsl:text>[</xsl:text>
   <xsl:value-of select="@linkend"/>
@@ -299,6 +315,54 @@
 </xsl:template>
 
 <!--
+  Quoted text.  Add quotes around text.  (Pick this up specifically
+  because we want presence of this element to generate characters.)
+-->
+
+<xsl:template match="quote">
+  <xsl:text>"</xsl:text>
+  <xsl:apply-templates/>
+  <xsl:text>"</xsl:text>
+</xsl:template>
+
+<!--
+  Expand a <ulink>:
+
+  1) If the @url attribute and the content are the same (that
+     is, <ulink url="str">str</ulink>), or there is no content,
+     write this out as
+       str
+
+  2) If the @url attribute and the content differ (that is,
+     <ulink url="str1">str2</ulink>), write this out as
+       str2 (str1)
+-->
+
+<xsl:template match="ulink">
+  <!-- determine whether @url is same as content -->
+  <xsl:choose>
+    <xsl:when test="@url=normalize-space(.) or normalize-space(.) = ''">
+      <!-- just write out @url -->
+      <xsl:value-of select="@url"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- process element content first -->
+      <xsl:apply-templates/>
+      <!-- add (url) afterward -->
+      <xsl:text> (</xsl:text>
+      <xsl:value-of select="@url"/>
+      <xsl:text>)</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- replace <email>xxx</email> with xxx -->
+
+<xsl:template match="email">
+  <xsl:apply-templates select="@* | node()"/>
+</xsl:template>
+
+<!--
   Strip stuff that we know we won't ever use
 -->
 

Modified: trunk/xsl.d/help-prep2.xsl
===================================================================
--- trunk/xsl.d/help-prep2.xsl	2005-11-09 20:39:36 UTC (rev 305)
+++ trunk/xsl.d/help-prep2.xsl	2005-11-09 22:56:36 UTC (rev 306)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <xsl:stylesheet
-   version="1.0"
-   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
 <!--
   To do:

Modified: trunk/xsl.d/resolve-xref.xsl
===================================================================
--- trunk/xsl.d/resolve-xref.xsl	2005-11-09 20:39:36 UTC (rev 305)
+++ trunk/xsl.d/resolve-xref.xsl	2005-11-09 22:56:36 UTC (rev 306)
@@ -31,7 +31,7 @@
 
 Process the toc-entry with an id attribute that matches the linkend
 attribute from the <xref> If no linkend is found, warn that the
-cross-reference couldn't be resolved.  resolved. If the linkend is found
+cross-reference couldn't be resolved. If the linkend is found
 multiple times, warn about that, too.
 
 This template can either retain the <xref> tags and attributes, or not.

Thread
svn commit - mysqldoc@docsrva: r306 - in trunk: . xsl.dpaul9 Nov