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

2009/dap/ReSpec.js/js respec.js,1.57,1.58

From: Robin Berjon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 03 Dec 2009 11:56:10 +0000
To: public-dap-commits@w3.org
Message-Id: <E1NGAI6-00043j-Qn@lionel-hutz.w3.org>
Update of /sources/public/2009/dap/ReSpec.js/js
In directory hutz:/tmp/cvs-serv15572/js

Modified Files:
	respec.js 
Log Message:
support nullable typedef too

Index: respec.js
===================================================================
RCS file: /sources/public/2009/dap/ReSpec.js/js/respec.js,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- respec.js	3 Dec 2009 11:43:17 -0000	1.57
+++ respec.js	3 Dec 2009 11:56:08 -0000	1.58
@@ -855,7 +855,13 @@
         tdf.extendedAttributes = null; // remove them in case some were there by mistake
         var match = /^\s*typedef\s+(.+)\s+(\S+)\s*$/.exec(str);
         if (match) {
-            tdf.datatype = match[1];
+            var type = match[1];
+            tdf.nullable = false;
+            if (/\?$/.test(type)) {
+                type = type.replace(/\?$/, "");
+                tdf.nullable = true;
+            }
+            tdf.datatype = type;
             tdf.id = match[2];
             tdf.description = sn.documentFragment();
             sn.copyChildren(idl, tdf.description);
@@ -1135,6 +1141,7 @@
                         sn.element("span", { "class": "idlTypedefID" }, null, obj.id),
                         sn.text(" is used to refer to the "),
                         tdt,
+                        sn.text(obj.nullable ? " (nullable)" : ""),
                         sn.text(" type.")];
             }
             return sn.element("div", { "class": "idlTypedefDesc" }, null, cnt);
@@ -1324,9 +1331,10 @@
             }
         }
         else if (obj.type == "typedef") {
+            var nullable = obj.nullable ? "?" : "";
             return  "<span class='idlTypedef' id='idl-def-" + obj.id + "'>typedef <span class='idlTypedefType'>" + 
                     this.writeDatatype(obj.datatype) +
-                    "</span> <span class='idlTypedefID'>" + obj.id + "</span>;</span>";
+                    "</span>" + nullable + " <span class='idlTypedefID'>" + obj.id + "</span>;</span>";
         }
         else if (obj.type == "implements") {
             return  "<span class='idlImplements'><a>" + obj.id + "</a> implements <a>" + obj.datatype + "</a>;";
Received on Thursday, 3 December 2009 11:56:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 3 December 2009 11:56:19 GMT