Try putting content model elements in an inline list in element summary boxes.
--- a/publish/definitions.js Tue Aug 21 16:05:19 2012 +1000
+++ b/publish/definitions.js Tue Aug 21 17:29:06 2012 +1000
@@ -109,12 +109,12 @@
this.presentationAttributes = { };
}
-Definitions.prototype.formatElementLink = function(name, n) {
+Definitions.prototype.formatElementLink = function(name, n, omitQuotes) {
if (!this.elements[name]) {
utils.warn('unknown element "' + name + '"', n);
return utils.parse('<span class="xxx">@@ unknown element "{{name}}"</span>', { name: name });
}
- return this.elements[name].formatLink();
+ return this.elements[name].formatLink(omitQuotes);
};
Definitions.prototype.formatElementAttributeLink = function(elementName, attributeName, n) {
--- a/publish/processing.js Tue Aug 21 16:05:19 2012 +1000
+++ b/publish/processing.js Tue Aug 21 17:29:06 2012 +1000
@@ -409,13 +409,15 @@
intro = 'Any number of the following elements or character data, in any order:';
break;
case 'anyof':
- intro = 'Any number of the following elements or character data:';
+ intro = 'Any number of the following elements, in any order:';
break;
case 'oneormoreof':
- intro = 'One or more of the following elements or character data:';
+ intro = 'One or more of the following elements, in any order:';
break;
}
+ var content = [intro];
+
var ul = utils.parse('<ul class="no-bullets"></ul>');
element.elementCategories.concat().sort().forEach(function(name) {
var cat = conf.definitions.elementCategories[name];
@@ -428,18 +430,17 @@
elements: utils.fragment(cat.elements.map(function(name) { return conf.definitions.formatElementLink(name, n) }), ', ') });
ul.appendChild(li);
});
+ content.push(ul);
- element.elements.concat().sort().forEach(function(name) {
+ content.push(utils.list(element.elements.concat().sort().map(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 });
+ return utils.parse('<a href="data:," style="background: red; color: white">@@ unknown element "{{name}}"</a>', { name: name });
}
- var li = utils.parse('<li>{{element}}</li>',
- { element: conf.definitions.formatElementLink(name, n) });
- ul.appendChild(li);
- });
+ return conf.definitions.formatElementLink(name, n, true);
+ })));
- return [intro, ul];
+ return content;
}
function formatElementAttributes(conf, element, n) {
--- a/publish/utils.js Tue Aug 21 16:05:19 2012 +1000
+++ b/publish/utils.js Tue Aug 21 17:29:06 2012 +1000
@@ -163,7 +163,7 @@
exports.englishList = function(items) {
if (!items.length) {
- return null;
+ return undefined;
}
var doc = items[0].ownerDocument;
var frag = doc.createDocumentFragment();
@@ -176,6 +176,21 @@
return frag;
};
+exports.list = function(items) {
+ if (!items.length) {
+ return undefined;
+ }
+ var doc = items[0].ownerDocument;
+ var frag = doc.createDocumentFragment();
+ for (var i = 0; i < items.length; i++) {
+ if (i != 0) {
+ frag.appendChild(doc.createTextNode(', '));
+ }
+ frag.appendChild(items[i]);
+ }
+ return frag;
+};
+
exports.splitList = function(s) {
if (!s) {
return [];