- From: Robin Berjon via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 30 Nov 2009 16:36:22 +0000
- To: public-dap-commits@w3.org
Update of /sources/public/2009/dap/ReSpec.js/js In directory hutz:/tmp/cvs-serv11047/ReSpec.js/js Modified Files: respec.js Log Message: added support for maxTocLevel Index: respec.js =================================================================== RCS file: /sources/public/2009/dap/ReSpec.js/js/respec.js,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- respec.js 21 Nov 2009 15:19:45 -0000 1.52 +++ respec.js 30 Nov 2009 16:36:20 -0000 1.53 @@ -257,6 +257,7 @@ if (!cfg.editors) cfg.editors = []; if (!cfg.authors) cfg.authors = []; if (!cfg.inlineCSS) cfg.inlineCSS = false; + if (!cfg.maxTocLevel) cfg.maxTocLevel = 0; for (var k in cfg) this[k] = cfg[k]; this.isRecTrack = this.recTrackStatus.indexOf(this.specStatus) >= 0; // this.specStatus = this._getMetaFor("http://berjon.com/prop/spec-status", "ED"); @@ -477,7 +478,7 @@ }, makeTOC: function () { - var ul = this.makeTOCAtLevel(document.body, [0]); + var ul = this.makeTOCAtLevel(document.body, [0], 1); if (!ul) return; var sec = sn.element("section", { id: "toc" }); sn.element("h2", { "class": "introductory" }, sec, "Table of Contents"); @@ -488,7 +489,7 @@ appendixMode: false, lastNonAppendix: 0, alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - makeTOCAtLevel: function (parent, current) { + makeTOCAtLevel: function (parent, current, level) { var secs = sn.findNodes("./x:section[not(@class='introductory')]|./section[not(@class='introductory')]", parent); if (secs.length == 0) return null; var ul = sn.element("ul", { "class": "toc" }); @@ -534,8 +535,9 @@ var a = sn.element("a", { href: "#" + id }, null, [df2]); sn.element("li", {}, ul, [a]); + if (this.maxTocLevel && level >= this.maxTocLevel) continue; current.push(0); - var sub = this.makeTOCAtLevel(sec, current); + var sub = this.makeTOCAtLevel(sec, current, level + 1); if (sub) sn.element("li", {}, ul, [sub]); current.pop(); } @@ -1068,7 +1070,7 @@ return this.writeAsHTML(obj.children[0]); } else { - this.warn("No HTML can be generated for module definitions."); + warning("No HTML can be generated for module definitions."); return sn.element("span"); } }
Received on Monday, 30 November 2009 16:36:26 UTC