svg2-tools: Sort elements and element categories in element summary b...

details:   https://svgwg.org/hg/svg2-tools/rev/d1a22842fc34
branches:  
changeset: 60:d1a22842fc34
user:      Cameron McCormack <cam@mcc.id.au>
date:      Tue Aug 21 16:05:19 2012 +1000
description:
Sort elements and element categories in element summary boxes.

diffstat:

 publish/processing.js |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (35 lines):

diff --git a/publish/processing.js b/publish/processing.js
--- a/publish/processing.js
+++ b/publish/processing.js
@@ -412,29 +412,29 @@ function formatContentModel(conf, elemen
       intro = 'Any number of the following elements or character data:';
       break;
     case 'oneormoreof':
       intro = 'One or more of the following elements or character data:';
       break;
   }
 
   var ul = utils.parse('<ul class="no-bullets"></ul>');
-  element.elementCategories.forEach(function(name) {
+  element.elementCategories.concat().sort().forEach(function(name) {
     var cat = conf.definitions.elementCategories[name];
     if (!cat) {
       return utils.parse('<li><a href="data:," style="background: red; color: white">@@ unknown element category "{{name}}"</a><li>', { name: name });
     }
     var li = utils.parse('<li><a href="{{href}}">{{name}} elements</a><span class="expanding"> — {{elements}}</span></li>',
                          { href: cat.href,
                            name: cat.name,
                            elements: utils.fragment(cat.elements.map(function(name) { return conf.definitions.formatElementLink(name, n) }), ', ') });
     ul.appendChild(li);
   });
 
-  element.elements.forEach(function(name) {
+  element.elements.concat().sort().forEach(function(name) {
     var e = conf.definitions.elements[name];
     if (!e) {
       return utils.parse('<li><a href="data:," style="background: red; color: white">@@ unknown element "{{name}}"</a><li>', { name: name });
     }
     var li = utils.parse('<li>{{element}}</li>',
                          { element: conf.definitions.formatElementLink(name, n) });
     ul.appendChild(li);
   });

Received on Tuesday, 21 August 2012 06:05:54 UTC