Skip to content

Commit 43df893

Browse files
author
Andre Malo
committed
- simplify and cleanup comment integration script
- make comment version tag configurable git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1335773 13f79535-47bb-0310-9956-ffa450edef68
1 parent 144aab8 commit 43df893

2 files changed

Lines changed: 25 additions & 19 deletions

File tree

docs/manual/style/version.ent

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@
2222
<!ENTITY httpd.patch "0">
2323

2424
<!ENTITY httpd.docs "trunk">
25+
26+
<!-- Version tag for disqus comments -->
27+
<!ENTITY httpd.disqus "2.4">

docs/manual/style/xsl/common.xsl

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
<!DOCTYPE xsl:stylesheet [
2121
<!ENTITY nbsp SYSTEM "util/nbsp.xml">
2222
<!ENTITY lf SYSTEM "util/lf.xml">
23+
<!ENTITY % HTTPD-VERSION SYSTEM "../version.ent">
24+
%HTTPD-VERSION;
2325
]>
2426
<xsl:stylesheet version="1.0"
2527
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -169,7 +171,7 @@
169171
rel="stylesheet"
170172
href="{$path}/style/css/manual-print.css"/>
171173
<link href="{$path}/style/css/prettify.css" type="text/css" rel="stylesheet" />&lf;
172-
<script type="text/javascript" src="{$path}/style/scripts/prettify.js">&lf; </script> &lf;
174+
<script type="text/javascript" src="{$path}/style/scripts/prettify.js">&lf;</script>&lf;
173175
<!-- chm files do not need a favicon -->
174176
<xsl:if test="not($is-chm or $is-zip)">&lf;
175177
<link rel="shortcut icon" href="{$path}/images/favicon.ico" />
@@ -294,23 +296,24 @@
294296
<h2><a name="comments_section" id="comments_section"><xsl:value-of select="$message[@id='comments']" /></a></h2>
295297
<div class="warning"><strong>This section is experimental!</strong><br/>Comments placed here should not be expected
296298
to last beyond the testing phase of this system, nor do we in any way guarantee that we'll read them.</div>&lf;
297-
<div id="disqus_thread">&lf;</div>
298299
<script type="text/javascript">
299-
<xsl:text disable-output-escaping="yes"><![CDATA[<!--//--><![CDATA[//><!--]]></xsl:text>
300-
var lang = '<xsl:value-of select="$doclang"/>';<![CDATA[
300+
<xsl:text disable-output-escaping="yes"><![CDATA[<!--//--><![CDATA[//><!--
301301
var disqus_shortname = 'httpd';
302-
var disqus_identifier = window.location.href.replace(/(current|trunk)/, "2.4").replace(/\/[a-z]{2}\//, "/").replace(window.location.protocol, "http:") + '.' + lang;
303-
if (disqus_identifier.indexOf("httpd.apache.org") != -1) {
304-
(function() {
305-
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
306-
dsq.src = window.location.protocol + '//' + disqus_shortname + '.disqus.com/embed.js';
307-
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
308-
})();
309-
} else {
310-
var text = document.createTextNode("Comments have been disabled for offline viewing.");
311-
document.getElementById('disqus_thread').appendChild(text);
312-
}
313-
]]><xsl:text disable-output-escaping="yes"><![CDATA[//--><!]]]]>></xsl:text></script>
302+
var disqus_identifier = 'http://httpd.apache.org/docs/]]></xsl:text>&httpd.disqus;<xsl:value-of select="concat($metafile/path, $metafile/basename, '.html.', $doclang)" disable-output-escaping="yes" /><xsl:text disable-output-escaping="yes"><![CDATA[';
303+
(function(w, d) {
304+
if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
305+
d.write('<div id="disqus_thread"><\/div>');
306+
var s = d.createElement('script');
307+
s.type = 'text/javascript';
308+
s.async = true;
309+
s.src = 'http' + '://' + disqus_shortname + '.disqus.com/embed.js';
310+
(d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
311+
}
312+
else {
313+
d.write('<div id="disqus_thread">Comments have been disabled for offline viewing.<\/div>');
314+
}
315+
})(window, document);
316+
//--><!]]]]>></xsl:text></script>
314317
</div>
315318
</xsl:when>
316319
</xsl:choose>
@@ -340,11 +343,11 @@ if (disqus_identifier.indexOf("httpd.apache.org") != -1) {
340343
</div> <!-- /footer -->
341344

342345
<script type="text/javascript">
343-
<xsl:text disable-output-escaping="yes"><![CDATA[<!--//--><![CDATA[//><!--]]></xsl:text><![CDATA[
344-
if (typeof(prettyPrint) !== undefined) {
346+
<xsl:text disable-output-escaping="yes"><![CDATA[<!--//--><![CDATA[//><!--
347+
if (typeof(prettyPrint) !== 'undefined') {
345348
prettyPrint();
346349
}
347-
]]><xsl:text disable-output-escaping="yes"><![CDATA[//--><!]]]]>></xsl:text></script>
350+
//--><!]]]]>></xsl:text></script>
348351
</xsl:template>
349352
<!-- /bottom -->
350353

0 commit comments

Comments
 (0)