W3C home > Mailing lists > Public > public-dap-commits@w3.org > December 2009

2009/dap/ReSpec.js/js respec.js,1.53,1.54

From: Robin Berjon via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 02 Dec 2009 11:27:26 +0000
To: public-dap-commits@w3.org
Message-Id: <E1NFnMk-0000pr-UB@lionel-hutz.w3.org>
Update of /sources/public/2009/dap/ReSpec.js/js
In directory hutz:/tmp/cvs-serv3176/ReSpec.js/js

Modified Files:
	respec.js 
Log Message:
Support option not to sort IDL descriptions

Index: respec.js
===================================================================
RCS file: /sources/public/2009/dap/ReSpec.js/js/respec.js,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- respec.js	30 Nov 2009 16:36:20 -0000	1.53
+++ respec.js	2 Dec 2009 11:27:24 -0000	1.54
@@ -257,6 +257,7 @@
         if (!cfg.editors) cfg.editors = [];
         if (!cfg.authors) cfg.authors = [];
         if (!cfg.inlineCSS) cfg.inlineCSS = false;
+        if (!cfg.noIDLSorting) cfg.noIDLSorting = false;
         if (!cfg.maxTocLevel) cfg.maxTocLevel = 0;
         for (var k in cfg) this[k] = cfg[k];
         this.isRecTrack = this.recTrackStatus.indexOf(this.specStatus) >= 0;
@@ -694,7 +695,7 @@
         var infNames = [];
         for (var i = 0; i < idls.length; i++) {
             var idl = idls[i];
-            var w = new berjon.WebIDLProcessor();
+            var w = new berjon.WebIDLProcessor({ noIDLSorting: this.noIDLSorting });
             var inf = w.definition(idl);
             var df = w.makeMarkup();
             idl.parentNode.replaceChild(df, idl);
@@ -808,8 +809,10 @@
     },
 };
 
-berjon.WebIDLProcessor = function () {
+berjon.WebIDLProcessor = function (cfg) {
     this.parent = { type: "module", id: "outermost", children: [] };
+    if (!cfg) cfg = {};
+    for (var k in cfg) this[k] = cfg[k];
 };
 berjon.WebIDLProcessor.prototype = {
     definition:    function (idl) {
@@ -1114,11 +1117,13 @@
                 var type = types[i];
                 var things = obj.children.filter(function (it) { return it.type == type });
                 if (things.length == 0) continue;
-                things.sort(function (a, b) {
-                    if (a.id < b.id) return -1;
-                    if (a.id > b.id) return 1;
-                      return 0;
-                });
+                if (!this.noIDLSorting) {
+                    things.sort(function (a, b) {
+                        if (a.id < b.id) return -1;
+                        if (a.id > b.id) return 1;
+                          return 0;
+                    });
+                }
                 
                 var sec = sn.element("section", {}, df);
                 var secTitle = type;
Received on Wednesday, 2 December 2009 11:27:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 2 December 2009 11:27:35 GMT