Allow the SVG_BUILD_LOCAL_STYLE_SHEETS environment variable to be set
authorCameron McCormack <cam@mcc.id.au>
Wed, 09 May 2012 19:34:50 +0200
changeset 9 5dc78496ac46
parent 8 af7daab6a90d
child 10 f933c6bc78a9
Allow the SVG_BUILD_LOCAL_STYLE_SHEETS environment variable to be set
to have the generated spec reference the W3C TR style sheets locally
rather than on www.w3.org. (This is good for spec development while
on a plane!)
build.py
publish.xsl
--- a/build.py	Wed May 09 19:18:10 2012 +0200
+++ b/build.py	Wed May 09 19:34:50 2012 +0200
@@ -177,8 +177,10 @@
   os.chdir(master_dir)
   run("java -classpath " + join(tools_dir, 'saxonb', 'saxon9.jar') +
       " net.sf.saxon.Transform -ext:on -dtd:off -expand:off -l:on " +
-      join(master_dir, "publish.xml") + " " + join(tools_dir, "publish.xsl")+
-      " chapters-to-build=\"" + " ".join(tobuild_names) + "\"")
+      join(master_dir, "publish.xml") + " " + join(tools_dir, "publish.xsl") +
+      " chapters-to-build=\"" + " ".join(tobuild_names) + "\"" +
+      (" local-style-sheets=\"yes\""
+       if os.environ.get("SVG_BUILD_LOCAL_STYLE_SHEETS") else ""))
   toremove = []
   os.chdir(repo_dir) # chdir back
 
--- a/publish.xsl	Wed May 09 19:18:10 2012 +0200
+++ b/publish.xsl	Wed May 09 19:34:50 2012 +0200
@@ -60,6 +60,8 @@
   <xsl:param name='chapters-to-build' select='string-join($conf/(x:index | x:chapter | x:appendix | x:page)/@name, " ")'/>
   <xsl:variable name='to-build' select='tokenize($chapters-to-build, " ")'/>
 
+  <xsl:param name='local-style-sheets'/>
+
   <xsl:variable name='publish-dir'>
     <xsl:choose>
       <xsl:when test='$conf/x:output/@use-publish-directory != "true"'>/</xsl:when>
@@ -167,10 +169,7 @@
         </title>
         <xsl:apply-templates select='head/*[not(self::link) and not(self::meta) and not(self::title)]'/>
         <xsl:apply-templates select='head/link[not(@rel="stylesheet" and contains(@href, "StyleSheets/TR") or @media="print")]'/>
-<!--
-        <link rel='stylesheet' href='http://www.w3.org/StyleSheets/TR/W3C-{$maturity-short}' type='text/css' media='screen'/>
--->
-        <link rel='stylesheet' href='W3C-{$maturity-short}' type='text/css' media='screen'/>
+        <link rel='stylesheet' href='{if ($local-style-sheets) then "styles/" else "http://www.w3.org/StyleSheets/TR/"}W3C-{$maturity-short}' type='text/css' media='screen'/>
       </head>
       <body>
         <xsl:attribute name='class'>