svg2-tools: Add self links for headings.

details:   https://svgwg.org/hg/svg2-tools/rev/82a60b68a131
branches:  
changeset: 87:82a60b68a131
user:      Dirk Schulze <dschulze@adobe.com>
date:      Thu May 22 13:12:13 2014 +0200
description:
Add self links for headings.

diffstat:

 publish/processing.js |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (22 lines):

diff --git a/publish/processing.js b/publish/processing.js
--- a/publish/processing.js
+++ b/publish/processing.js
@@ -267,16 +267,18 @@ exports.addSectionNumbers = function(con
         /^h[2-6]$/.test(n.localName) &&
         n.getAttribute('toc') != 'no') {
       var id = n.getAttribute('id');
       if (id && conf.pages[page].sections && conf.pages[page].sections[id]) {
         n.insertBefore(utils.parse('{{number}}{{section}}. ',
                                    { number: conf.isSingleChapter ? '' : (conf.pages[page].formattedNumber + '.'),
                                      section: conf.pages[page].sections[id].number }),
                        n.firstChild);
+        n.setAttribute('class', 'heading');
+        n.appendChild(utils.parse('<a class="self-link" href="#' + id + '"></a>'));
       }
     }
   });
 }
 
 // -- Process edit:* element replacements -------------------------------------
 
 function doMiniTOC(conf, page, n) {

Received on Thursday, 22 May 2014 11:12:45 UTC