W3C home > Mailing lists > Public > public-svg-wg@w3.org > April to June 2014

svg2-tools: Add self links for headings.

From: SVG Working Group repository <cam+svgwgrepo@mcc.id.au>
Date: Thu, 22 May 2014 04:12:21 -0700
Message-Id: <hg.82a60b68a131.1400757141.2168319282941016272@ps58493.dreamhostps.com>
To: public-svg-wg@w3.org
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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:20:19 UTC