Allow more links to be quote-less.
authorCameron McCormack <cam@mcc.id.au>
Sat, 18 Aug 2012 16:57:36 +1000
changeset 46 45101ee54e7a
parent 45 b511935ac513
child 47 ca9311658567
Allow more links to be quote-less.
publish/processing.js
--- a/publish/processing.js	Sat Aug 18 16:43:31 2012 +1000
+++ b/publish/processing.js	Sat Aug 18 16:57:36 2012 +1000
@@ -530,11 +530,11 @@
 }
 
 function doAttributeTable(conf, page, n) {
-  var table = utils.parse('<table class="vert property-table" summary="Alphabetic list of attributes"><tr><th>Attribute</th><th>Elements on which the attribute may me specified</th><th title="Animatable"><a href="animate.html#Animatable">Anim.</a></th></tr></table>');
+  var table = utils.parse('<table class="proptable attrtable" summary="Alphabetic list of attributes"><thead><tr><th>Attribute</th><th>Elements on which the attribute may be specified</th><th title="Animatable"><a href="animate.html#Animatable">Anim.</a></th></tr></thead><tbody></tbody></table>');
   var attributes = [];
   utils.values(conf.definitions.elements).forEach(function(e) {
     e.specificAttributes.forEach(function(a) {
-      attributes.push([[a.name, e.name].toString(), a.formatLink(), [e.formatLink()], a.animatable]);
+      attributes.push([[a.name, e.name].toString(), a.formatLink(true), [e.formatLink(true)], a.animatable]);
     });
   });
   utils.values(conf.definitions.attributeCategories).forEach(function(cat) {
@@ -543,15 +543,15 @@
         .filter(function(e) { return e.attributeCategories.indexOf(cat.name) != -1 })
         .sort(function(a, b) { return utils.compare(a.name, b.name) });
     var elementNames = elements.map(function(e) { return e.name });
-    var elementLinks = elements.map(function(e) { return e.formatLink() });
+    var elementLinks = elements.map(function(e) { return e.formatLink(true) });
     cat.attributes.forEach(function(a) {
-      attributes.push([[a.name, elementNames].toString(), a.formatLink(), elementLinks, a.animatable]);
+      attributes.push([[a.name, elementNames].toString(), a.formatLink(true), elementLinks, a.animatable]);
     });
   });
   conf.definitions.commonAttributesForElements.forEach(function(a) {
     var elementNames = Object.keys(a.elements).sort();
-    var elementLinks = elementNames.map(function(name) { return conf.definitions.elements[name].formatLink() });
-    attributes.push([[a.name, elementNames].toString(), a.formatLink(), elementLinks, a.animatable]);
+    var elementLinks = elementNames.map(function(name) { return conf.definitions.elements[name].formatLink(true) });
+    attributes.push([[a.name, elementNames].toString(), a.formatLink(true), elementLinks, a.animatable]);
   });
   utils.values(conf.definitions.commonAttributes).forEach(function(a) {
     var categoriesWithAttribute =
@@ -564,15 +564,15 @@
                                      utils.firstIndexOfAny(e.attributeCategories, categoriesWithAttribute) })
         .sort(function(a, b) { return utils.compare(a.name, b.name) });
     var elementNames = elements.map(function(e) { return e.name });
-    var elementLinks = elements.map(function(e) { return e.formatLink() });
-    attributes.push([[a.name, elementNames].toString(), a.formatLink(), elementLinks, a.animatable]);
+    var elementLinks = elements.map(function(e) { return e.formatLink(true) });
+    attributes.push([[a.name, elementNames].toString(), a.formatLink(true), elementLinks, a.animatable]);
   });
   attributes.sort(function(a, b) { return utils.compare(a[0], b[0]) });
   attributes.forEach(function(a) {
-    table.appendChild(utils.parse('<tr><td>{{attribute}}</td><td>{{elements}}</td><td>{{animatable}}</td></tr>',
-                                  { attribute: a[1],
-                                    elements: utils.fragment(a[2], ', '),
-                                    animatable: a[3] ? '✓' : '' }));
+    table.lastChild.appendChild(utils.parse('<tr><th>{{attribute}}</th><td>{{elements}}</td><td>{{animatable}}</td></tr>',
+                                            { attribute: a[1],
+                                              elements: utils.fragment(a[2], ', '),
+                                              animatable: a[3] ? '✓' : '' }));
   });
   utils.replace(n, table);
 }
@@ -606,22 +606,24 @@
   }
 
   var cat = conf.definitions.attributeCategories[n.getAttribute('name')];
+  var omitQuotes = n.getAttribute('omitquotes') == 'yes';
   var attributes =
     cat.presentationAttributes.map(lookupPresentationAttribute)
        .concat(cat.commonAttributes.map(lookupCommonAttribute))
        .concat(cat.attributes.map(function(attr) { return [attr.name, attr] }))
        .sort(function(a, b) { return a[0] - b[0] })
-       .map(function(a) { return a[1].formatLink() });
+       .map(function(a) { return a[1].formatLink(omitQuotes) });
   utils.replace(n, utils.englishList(attributes));
 }
 
 function doElementsWithAttributeCategory(conf, page, n) {
   var category = n.getAttribute('name');
+  var omitQuotes = n.getAttribute('omitquotes') == 'yes';
   var elements = 
     utils.values(conf.definitions.elements)
       .filter(function(e) { return e.attributeCategories.indexOf(category) != -1 })
       .sort(function(a, b) { return utils.compare(a.name, b.name) })
-      .map(function(e) { return e.formatLink() });
+      .map(function(e) { return e.formatLink(omitQuotes) });
   utils.replace(n, utils.englishList(elements));
 }