Generate protocol relative links to w3.org style sheets and the MathJax script.
authorCameron McCormack <cam@mcc.id.au>
Fri, 18 May 2012 13:09:15 +1000
changeset 22 909ed78242c1
parent 21 ca49ad17977a
child 23 d7f042a0cb65
Generate protocol relative links to w3.org style sheets and the MathJax script.
publish.xsl
--- a/publish.xsl	Fri May 18 12:38:52 2012 +1000
+++ b/publish.xsl	Fri May 18 13:09:15 2012 +1000
@@ -170,10 +170,10 @@
         </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='{if ($local-style-sheets) then "style/" else "http://www.w3.org/StyleSheets/TR/"}W3C-{$maturity-short}{if ($local-style-sheets) then ".css" else ""}' type='text/css' media='screen'/>
+        <link rel='stylesheet' href='{if ($local-style-sheets) then "style/" else //www.w3.org/StyleSheets/TR/"}W3C-{$maturity-short}{if ($local-style-sheets) then ".css" else ""}' type='text/css' media='screen'/>
         <xsl:if test='body//m:*'>
           <!-- If there were an "MML_SVG" config we should use that, to avoid the overhead of looking for TeX-style math. -->
-          <script src="http://cdn.mathjax.org/mathjax/2.0-latest/MathJax.js?config=TeX-AMS-MML_SVG"><xsl:text> </xsl:text></script>
+          <script>(function() { var e = document.createElement("script"); e.src = (location.protocol == "file:" ? "https:" : location.protocol) + "//d3eoax9i5htok0.cloudfront.net/mathjax/2.0-latest/MathJax.js?config=TeX-AMS-MML_SVG"; document.head.appendChild(e); })()</script>
         </xsl:if>
       </head>
       <body>