You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by nd...@apache.org on 2012/05/08 23:18:41 UTC
svn commit: r1335773 - in /httpd/httpd/trunk/docs/manual/style: version.ent
xsl/common.xsl
Author: nd
Date: Tue May 8 21:18:40 2012
New Revision: 1335773
URL: http://svn.apache.org/viewvc?rev=1335773&view=rev
Log:
- simplify and cleanup comment integration script
- make comment version tag configurable
Modified:
httpd/httpd/trunk/docs/manual/style/version.ent
httpd/httpd/trunk/docs/manual/style/xsl/common.xsl
Modified: httpd/httpd/trunk/docs/manual/style/version.ent
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/style/version.ent?rev=1335773&r1=1335772&r2=1335773&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/style/version.ent (original)
+++ httpd/httpd/trunk/docs/manual/style/version.ent Tue May 8 21:18:40 2012
@@ -22,3 +22,6 @@
<!ENTITY httpd.patch "0">
<!ENTITY httpd.docs "trunk">
+
+<!-- Version tag for disqus comments -->
+<!ENTITY httpd.disqus "2.4">
Modified: httpd/httpd/trunk/docs/manual/style/xsl/common.xsl
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/style/xsl/common.xsl?rev=1335773&r1=1335772&r2=1335773&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/style/xsl/common.xsl (original)
+++ httpd/httpd/trunk/docs/manual/style/xsl/common.xsl Tue May 8 21:18:40 2012
@@ -20,6 +20,8 @@
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp SYSTEM "util/nbsp.xml">
<!ENTITY lf SYSTEM "util/lf.xml">
+ <!ENTITY % HTTPD-VERSION SYSTEM "../version.ent">
+ %HTTPD-VERSION;
]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -169,7 +171,7 @@
rel="stylesheet"
href="{$path}/style/css/manual-print.css"/>
<link href="{$path}/style/css/prettify.css" type="text/css" rel="stylesheet" />&lf;
- <script type="text/javascript" src="{$path}/style/scripts/prettify.js">&lf; </script> &lf;
+ <script type="text/javascript" src="{$path}/style/scripts/prettify.js">&lf;</script>&lf;
<!-- chm files do not need a favicon -->
<xsl:if test="not($is-chm or $is-zip)">&lf;
<link rel="shortcut icon" href="{$path}/images/favicon.ico" />
@@ -294,23 +296,24 @@
<h2><a name="comments_section" id="comments_section"><xsl:value-of select="$message[@id='comments']" /></a></h2>
<div class="warning"><strong>This section is experimental!</strong><br/>Comments placed here should not be expected
to last beyond the testing phase of this system, nor do we in any way guarantee that we'll read them.</div>&lf;
-<div id="disqus_thread">&lf;</div>
<script type="text/javascript">
-<xsl:text disable-output-escaping="yes"><![CDATA[<!--//--><![CDATA[//><!--]]></xsl:text>
-var lang = '<xsl:value-of select="$doclang"/>';<![CDATA[
+<xsl:text disable-output-escaping="yes"><![CDATA[<!--//--><![CDATA[//><!--
var disqus_shortname = 'httpd';
-var disqus_identifier = window.location.href.replace(/(current|trunk)/, "2.4").replace(/\/[a-z]{2}\//, "/").replace(window.location.protocol, "http:") + '.' + lang;
-if (disqus_identifier.indexOf("httpd.apache.org") != -1) {
- (function() {
- var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
- dsq.src = window.location.protocol + '//' + disqus_shortname + '.disqus.com/embed.js';
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
- })();
-} else {
- var text = document.createTextNode("Comments have been disabled for offline viewing.");
- document.getElementById('disqus_thread').appendChild(text);
-}
-]]><xsl:text disable-output-escaping="yes"><![CDATA[//--><!]]]]>></xsl:text></script>
+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[';
+(function(w, d) {
+ if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
+ d.write('<div id="disqus_thread"><\/div>');
+ var s = d.createElement('script');
+ s.type = 'text/javascript';
+ s.async = true;
+ s.src = 'http' + '://' + disqus_shortname + '.disqus.com/embed.js';
+ (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
+ }
+ else {
+ d.write('<div id="disqus_thread">Comments have been disabled for offline viewing.<\/div>');
+ }
+})(window, document);
+//--><!]]]]>></xsl:text></script>
</div>
</xsl:when>
</xsl:choose>
@@ -340,11 +343,11 @@ if (disqus_identifier.indexOf("httpd.apa
</div> <!-- /footer -->
<script type="text/javascript">
-<xsl:text disable-output-escaping="yes"><![CDATA[<!--//--><![CDATA[//><!--]]></xsl:text><![CDATA[
-if (typeof(prettyPrint) !== undefined) {
+<xsl:text disable-output-escaping="yes"><![CDATA[<!--//--><![CDATA[//><!--
+if (typeof(prettyPrint) !== 'undefined') {
prettyPrint();
}
-]]><xsl:text disable-output-escaping="yes"><![CDATA[//--><!]]]]>></xsl:text></script>
+//--><!]]]]>></xsl:text></script>
</xsl:template>
<!-- /bottom -->