2009/dap/ReSpec.js/js respec.js,1.93,1.94

Update of /sources/public/2009/dap/ReSpec.js/js
In directory hutz:/tmp/cvs-serv28870

Modified Files:
	respec.js 
Log Message:
Made minor changes to ToC and section heading generation so that html2ps will work seamlessly and generate PostScript (and therefore PDF) versions from ReSpec.js output.

Index: respec.js
===================================================================
RCS file: /sources/public/2009/dap/ReSpec.js/js/respec.js,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- respec.js	24 Feb 2010 20:21:10 -0000	1.93
+++ respec.js	25 Feb 2010 18:12:50 -0000	1.94
@@ -711,7 +711,6 @@
             var id = sn.makeID(sec, null, title);
             current[current.length-1]++;
             var secnos = current.slice();
-            // if (sec.getAttribute("class") == "appendix" && current.length == 1 && !this.appendixMode) {
             if (sn.hasClass(sec, "appendix") && current.length == 1 && !this.appendixMode) {
                 this.lastNonAppendix = current[0];
                 this.appendixMode = true;
@@ -724,15 +723,22 @@
             // sn.text(" ", df);
             var df2 = df.cloneNode(true);
             h.insertBefore(df, h.firstChild);
+            // if this is a top level item, insert
+            // an OddPage comment so html2ps will correctly
+            // paginate the output
+            if (/\.$/.test(secno)) {
+                var com = document.createComment('OddPage') ;
+                h.parentNode.insertBefore(com, h) ;
+            }
             // sn.text(title, df2);
             df2.appendChild(hKids);
-            var a = sn.element("a", { href: "#" + id }, null, [df2]);
-            sn.element("li", {}, ul, [a]);
+            var a = sn.element("a", { href: "#" + id, 'class' : 'tocxref' }, null, [df2]);
+            var item = sn.element("li", { "class":"tocline" }, ul, [a]);
             
             if (this.maxTocLevel && level >= this.maxTocLevel) continue;
             current.push(0);
             var sub = this.makeTOCAtLevel(sec, current, level + 1);
-            if (sub) sn.element("li", {}, ul, [sub]);
+            if (sub) item.appendChild(sub) ;
             current.pop();
         }
         

Received on Thursday, 25 February 2010 18:12:53 UTC