W3C home > Mailing lists > Public > public-html-commits@w3.org > July 2010

html5/markup/tools generate-spec-source.xsl,1.281,1.282

From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
Date: Sat, 31 Jul 2010 14:18:20 +0000
To: public-html-commits@w3.org
Message-Id: <E1OfCtI-0005sb-Jq@lionel-hutz.w3.org>
Update of /sources/public/html5/markup/tools
In directory hutz:/tmp/cvs-serv21932/tools

Modified Files:
	generate-spec-source.xsl 
Log Message:
make URLs for hyperlinks in IDL copies point directly to corresponding files in the multipage version of the full spec


Index: generate-spec-source.xsl
===================================================================
RCS file: /sources/public/html5/markup/tools/generate-spec-source.xsl,v
retrieving revision 1.281
retrieving revision 1.282
diff -u -d -r1.281 -r1.282
--- generate-spec-source.xsl	31 Jul 2010 11:32:26 -0000	1.281
+++ generate-spec-source.xsl	31 Jul 2010 14:18:18 -0000	1.282
@@ -16,7 +16,7 @@
   <xsl:param name="header" select="document('../src/header.src.html')"/>
   <xsl:key name="elements" match="*" use="@id"/>
   <xsl:key name="filename-map" match="ul" use="li"/>
-  <xsl:key name="interface-name" match="pre[@class='idl']" use="dfn"/>
+  <xsl:key name="interface-name" match="pre[@class='idl']" use="dfn/@id"/>
   <xsl:variable name="assertions">
     <!-- * FIXME: really should be doing this with keys... -->
     <xsl:for-each
@@ -1858,7 +1858,21 @@
                   <b><xsl:value-of select="."/></b>
                 </xsl:when>
                 <xsl:when test="self::a">
-                  <a href="{$spec-url}{@href}" title="{@title}"><xsl:value-of select="."/></a>
+                  <xsl:choose>
+                    <xsl:when test="starts-with(@href,'#')">
+                      <xsl:variable name="filename">
+                        <xsl:call-template name="get-spec-filename">
+                          <xsl:with-param name="ref" select="@href"/>
+                          <xsl:with-param name="base">http://dev.w3.org/html5/spec/</xsl:with-param>
+                          <xsl:with-param name="fragment-file">../fragment-links-full.html</xsl:with-param>
+                        </xsl:call-template>
+                      </xsl:variable>
+                      <a href="{$filename}{@href}" title="{@title}"><xsl:value-of select="."/></a>
+                    </xsl:when>
+                    <xsl:otherwise>
+                      <a href="{@href}" title="{@title}"><xsl:value-of select="."/></a>
+                    </xsl:otherwise>
+                  </xsl:choose>
                 </xsl:when>
                 <xsl:otherwise>
                   <xsl:copy-of select="."/>
@@ -2399,7 +2413,7 @@
             <a
               class="spec-link"
               title="Read about this attribute in the HTML5 spec"
-              href="{$filename}.html{$spec-target}">&#9432;</a>
+              href="{$filename}{$spec-target}">&#9432;</a>
             <xsl:text>&#10;</xsl:text>
           </xsl:if>
           <xsl:choose>
@@ -2630,9 +2644,6 @@
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
-  <!-- * -->
-  <!-- * special-case handling for area attributes  -->
-  <!-- * -->
   <xsl:template name="make.area.shape.attribute.definition">
     <xsl:param name="ref"/>
     <xsl:variable name="shape" select="substring-after($ref,'area.attrs.shape.')"/>
@@ -2950,7 +2961,7 @@
     <xsl:param name="target"/>
     <span class="spec-link">
       <a title="Read about the {$element-name} element in the HTML5 spec"
-        href="{$filename}.html{$target}">&#9432;</a>
+        href="{$filename}{$target}">&#9432;</a>
     </span>
     <xsl:text> </xsl:text>
   </xsl:template>
@@ -3005,16 +3016,18 @@
   </xsl:template>
   <xsl:template name="get-spec-filename">
     <xsl:param name="ref"/>
-    <xsl:for-each select="document('../fragment-links.html')">
+    <xsl:param name="base">http://dev.w3.org/html5/spec-author-view/</xsl:param>
+    <xsl:param name="fragment-file">../fragment-links.html</xsl:param>
+    <xsl:for-each select="document($fragment-file)">
       <xsl:choose>
         <xsl:when test="key('filename-map',$ref)">
-          <xsl:value-of select="concat('http://dev.w3.org/html5/spec-author-view/',key('filename-map',$ref)/*[2])"/>
+          <xsl:value-of select="concat($base,key('filename-map',$ref)/*[2],'.html')"/>
         </xsl:when>
         <xsl:otherwise>
           <xsl:for-each select="document('../fragment-links-full.html')">
             <xsl:choose>
               <xsl:when test="key('filename-map',$ref)">
-                <xsl:value-of select="concat('http://dev.w3.org/html5/spec/',key('filename-map',$ref)/*[2])"/>
+                <xsl:value-of select="concat('http://dev.w3.org/html5/spec/',key('filename-map',$ref)/*[2],'.html')"/>
               </xsl:when>
               <xsl:otherwise>
                 <xsl:message>
@@ -3030,10 +3043,24 @@
   </xsl:template>
   <xsl:template name="get-idl">
     <xsl:param name="interface"/>
-    <xsl:for-each select="document('../webapps.html')">
+    <xsl:param name="lowercase-interface"
+      select="translate($interface,
+      'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+      'abcdefghijklmnopqrstuvwxyz')"/>
+    <xsl:param name="base">../spec-author-view/</xsl:param>
+    <xsl:variable name="filename">
+      <xsl:call-template name="get-spec-filename">
+        <xsl:with-param name="ref" select="concat('#',$lowercase-interface)"/>
+        <xsl:with-param name="base"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="target">
+      <xsl:value-of select="concat($base,$filename)"/>
+    </xsl:variable>
+    <xsl:for-each select="document($target)">
       <xsl:choose>
-        <xsl:when test="key('interface-name',$interface)">
-          <xsl:copy-of select="key('interface-name',$interface)"/>
+        <xsl:when test="key('interface-name',$lowercase-interface)">
+          <xsl:copy-of select="key('interface-name',$lowercase-interface)"/>
         </xsl:when>
         <xsl:otherwise>
           <xsl:message>    ** INTERFACE NOT FOUND: <xsl:value-of select="$interface"/></xsl:message>
Received on Saturday, 31 July 2010 14:18:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 31 July 2010 14:18:22 GMT