qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jr...@apache.org
Subject svn commit: r1560748 - in /qpid/site: docs/site.js input/site.js
Date Thu, 23 Jan 2014 16:59:32 GMT
Author: jross
Date: Thu Jan 23 16:59:31 2014
New Revision: 1560748

URL: http://svn.apache.org/r1560748
Log:
QPID-5311: Make the section links also work with the anchors that docbook generates

Modified:
    qpid/site/docs/site.js
    qpid/site/input/site.js

Modified: qpid/site/docs/site.js
URL: http://svn.apache.org/viewvc/qpid/site/docs/site.js?rev=1560748&r1=1560747&r2=1560748&view=diff
==============================================================================
--- qpid/site/docs/site.js (original)
+++ qpid/site/docs/site.js Thu Jan 23 16:59:31 2014
@@ -245,15 +245,28 @@ function _addHeadingAnchors() {
         return;
     }
 
-
     var headings = _getHeadings();
 
     for (var i = 0; i < headings.length; i++) {
         var heading = headings[i];
+        var id = heading.id;
+
+        if (!id) {
+            var docbookAnchor = _getDescendant(heading, "a");
+
+            if (docbookAnchor) {
+                id = docbookAnchor.id;
+            }
+        }
+
+        if (!id) {
+            console.log("Giving up on " + heading);
+            continue;
+        }
 
         var anchor = document.createElement("a");
         anchor.className = "heading-link";
-        anchor.href = "#" + heading.id;
+        anchor.href = "#" + id;
 
         var text = document.createTextNode(" \u00a7");
         anchor.appendChild(text);

Modified: qpid/site/input/site.js
URL: http://svn.apache.org/viewvc/qpid/site/input/site.js?rev=1560748&r1=1560747&r2=1560748&view=diff
==============================================================================
--- qpid/site/input/site.js (original)
+++ qpid/site/input/site.js Thu Jan 23 16:59:31 2014
@@ -249,10 +249,23 @@ function _addHeadingAnchors() {
 
     for (var i = 0; i < headings.length; i++) {
         var heading = headings[i];
+        var id = heading.id;
+
+        if (!id) {
+            var docbookAnchor = _getDescendant(heading, "a");
+
+            if (docbookAnchor) {
+                id = docbookAnchor.id;
+            }
+        }
+
+        if (!id) {
+            continue;
+        }
 
         var anchor = document.createElement("a");
         anchor.className = "heading-link";
-        anchor.href = "#" + heading.id;
+        anchor.href = "#" + id;
 
         var text = document.createTextNode(" \u00a7");
         anchor.appendChild(text);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message