svg2: Initial generated element table, just showing which specs have ...

details:   https://svgwg.org/hg/svg2/rev/8c6239bc8871
branches:  
changeset: 486:8c6239bc8871
user:      Cameron McCormack <cam@mcc.id.au>
date:      Sun Apr 07 16:06:05 2013 +1000
description:
Initial generated element table, just showing which specs have the element for the moment.

diffstat:

 specs/integration/master/Overview.html |  82 ++++++++++++++++++++++++++++++++++
 specs/integration/master/publish.xml   |  14 ++--
 2 files changed, 89 insertions(+), 7 deletions(-)

diffs (152 lines):

diff --git a/specs/integration/master/Overview.html b/specs/integration/master/Overview.html
--- a/specs/integration/master/Overview.html
+++ b/specs/integration/master/Overview.html
@@ -36,16 +36,54 @@
         padding: 0.5em !important;
     }
     table.features thead th {
         text-align: center;
         background-color: gray !important;
         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>
 
 <div class="head">
   <p><a href="http://www.w3.org/"><img height="48" width="72" alt="W3C" src="http://www.w3.org/Icons/w3c_home"/></a></p>
   <h1 id="pagetitle">SVG Integration 1.0</h1>
   <h2 id="pagesubtitle">W3C <edit:maturity/> <em><edit:date/></em></h2>
@@ -803,16 +841,60 @@ range <abbr title="a-z">U+0061..U+007A</
 class <abbr title="Letter, Uppercase">Lu</abbr> character.  In other words,
 for mixed-case element names, the lowercase-only strings must be changed to
 the mixed-case string.</p>
 
 <h3 id="svg-elements">SVG Elements</h3>
 
 <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>
 
 <h3 id="svg-properties">SVG Properties</h3>
 
 <p class="issue">TODO: auto-generate a table of properties.</p>
 
diff --git a/specs/integration/master/publish.xml b/specs/integration/master/publish.xml
--- a/specs/integration/master/publish.xml
+++ b/specs/integration/master/publish.xml
@@ -22,22 +22,22 @@
     <cvs href='https://dvcs.w3.org/hg/svg2/specs/integration'/>
     <this href='http://www.w3.org/TR/2013/WD-SVGIntegration-2013xxxx'/>
     <!--
     <previous href='http://www.w3.org/TR/2013/WD-SVGIntegration-2013xxxx'/>
     -->
     <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'/>
   <resource href='target.svg'/>
 
   <index name='Overview'/>
 </publish-conf>

Received on Sunday, 7 April 2013 06:09:03 UTC