Initial generated element table, just showing which specs have the element for the moment.
authorCameron McCormack <cam@mcc.id.au>
Sun, 07 Apr 2013 16:06:05 +1000
changeset 486 8c6239bc8871
parent 485 3bb03942a967
child 487 f5e37c318829
Initial generated element table, just showing which specs have the element for the moment.
specs/integration/master/Overview.html
specs/integration/master/publish.xml
--- a/specs/integration/master/Overview.html	Sat Apr 06 16:50:01 2013 +1100
+++ b/specs/integration/master/Overview.html	Sun Apr 07 16:06:05 2013 +1000
@@ -41,6 +41,44 @@
         color: white !important;
         font-weight: normal;
     }
+
+.element-buttons {
+  padding-left: 0.5em;
+}
+a.button, .button {
+  font-size: 10px;
+  font-weight: bold;
+  padding: 2px 4px;
+  border-top: 1px solid rgba(255, 255, 255, 0.25);
+  border-left: 1px solid rgba(255, 255, 255, 0.25);
+  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
+  border-right: 1px solid rgba(0, 0, 0, 0.25);
+  background-color: wheat;
+}
+a.button:link, a.button:visited {
+  text-decoration: none;
+  color: black;
+}
+.button.disabled {
+  background: none;
+  color: #aaa;
+  cursor: default;
+}
+#element-index > * > tr > :first-child {
+  width: 1px;
+}
+#element-index > tbody > tr > :first-child {
+  white-space: nowrap;
+}
+#element-index > thead th {
+  vertical-align: bottom;
+}
+#element-index > tbody > tr > * {
+  vertical-align: baseline;
+}
+#element-index > tbody > tr > td > div + div {
+  margin-top: 0.5em;
+}
   </style>
 </head>
 <body>
@@ -808,6 +846,50 @@
 
 <p class="issue">TODO: auto-generate a table of elements.</p>
 
+<edit:script><![CDATA[
+function doElementTable(conf, page, n) {
+  var table = utils.parse('<table class="proptable attrtable" id="element-index"><thead><tr><th>Element</th><th>Attributes and content model</th></tr></thead><tbody></tbody></table>');
+  var tbody = table.lastChild;
+  Object.keys(conf.definitions.elements).sort().forEach(function(elementName) {
+    function makeElementButton(className, label, href) {
+      var enabled = !!href;
+      return utils.parse(enabled ? ' <a class="button {{className}}" href="{{href}}">{{label}}</a>'
+                                 : ' <span class="button disabled {{className}}">{{label}}</span>',
+                         { className: className,
+                           href: href,
+                           label: label });
+    }
+    var href11, href12T, href2;
+    for (var specid in conf.definitionsBySpec) {
+      var element = conf.definitionsBySpec[specid].elements[elementName];
+      if (element) {
+        if (specid == 'SVG11' || conf.definitionMainSpecs[specid] == 'SVG11') {
+          href11 = element.href;
+        } else if (specid == 'SVG12T' || conf.definitionMainSpecs[specid] == 'SVG12T') {
+          href12T = element.href;
+        } else if (specid == 'SVG2' || conf.definitionMainSpecs[specid] == 'SVG2') {
+          href2 = element.href;
+        }
+      }
+    }
+    var buttons = [
+      makeElementButton('SVG11', '1.1', href11),
+      makeElementButton('SVG12T', '1.2T', href12T),
+      makeElementButton('SVG2', '2', href2)
+    ];
+    var tr = utils.parse('<tr><th><span class="element-name">{{elementName}}</span> <span class="element-buttons" onmouseover="overButton(event)" onmouseout="outButton(event)">{{buttons}}</span></th><td>...</td></tr>',
+                         { elementName: elementName,
+                           buttons: buttons });
+    tbody.appendChild(tr);
+  });
+  utils.replace(n, table);
+}
+
+processing.defineReplacement("elementtable", doElementTable);
+]]></edit:script>
+
+<edit:elementtable/>
+
 <h3 id="svg-attributes">SVG Attributes</h3>
 
 <p class="issue">TODO: auto-generate a table of attributes.</p>
--- a/specs/integration/master/publish.xml	Sat Apr 06 16:50:01 2013 +1100
+++ b/specs/integration/master/publish.xml	Sun Apr 07 16:06:05 2013 +1000
@@ -27,13 +27,13 @@
     <latest href='http://www.w3.org/TR/SVGIntegration/'/>
   </versions>
 
-  <definitions href='definitions.xml'/>
-  <definitions href='../../../master/definitions.xml' base='http://www.w3.org/TR/SVG2/'/>
-  <definitions href='../../../master/definitions-filters.xml' base='http://www.w3.org/TR/2012/WD-filter-effects-20121025/'/>
-  <definitions href='../../../master/definitions-masking.xml' base='http://www.w3.org/TR/2012/WD-css-masking-20121115/'/>
-  <definitions href='../../../master/definitions-compositing.xml' base='http://www.w3.org/TR/2012/WD-compositing-20120816/'/>
-  <definitions href='definitions-SVG11.xml' base='http://www.w3.org/TR/SVG11/'/>
-  <definitions href='definitions-SVGT12.xml' base='http://www.w3.org/TR/SVGTiny12/'/>
+  <definitions href='definitions.xml' specid='Integration'/>
+  <definitions href='../../../master/definitions.xml' base='http://www.w3.org/TR/SVG2/' specid='SVG2'/>
+  <definitions href='../../../master/definitions-filters.xml' base='http://www.w3.org/TR/2012/WD-filter-effects-20121025/' specid='Filters' mainspec='SVG2'/>
+  <definitions href='../../../master/definitions-masking.xml' base='http://www.w3.org/TR/2012/WD-css-masking-20121115/' specid='Masking' mainspec='SVG2'/>
+  <definitions href='../../../master/definitions-compositing.xml' base='http://www.w3.org/TR/2012/WD-compositing-20120816/' specid='Compositing' mainspec='SVG2'/>
+  <definitions href='definitions-SVG11.xml' base='http://www.w3.org/TR/SVG11/' specid='SVG11'/>
+  <definitions href='definitions-SVGT12.xml' base='http://www.w3.org/TR/SVGTiny12/' specid='SVG12T'/>
 
   <resource href='style'/>
   <resource href='smiley.svg'/>