Allow multiple <definitions> elements in publish.xml.
authorCameron McCormack <cam@mcc.id.au>
Sun, 19 Aug 2012 16:27:16 +1000
changeset 52 cc6446c2e16e
parent 51 f7d16d078dd0
child 53 1dc1bc93bcf9
Allow multiple <definitions> elements in publish.xml.
publish/config.js
publish/definitions.js
--- a/publish/config.js	Sat Aug 18 18:29:01 2012 +1000
+++ b/publish/config.js	Sun Aug 19 16:27:16 2012 +1000
@@ -139,10 +139,13 @@
   this.attributeIndex = attr(root, 'attributeindex', 'href');
   this.propertyIndex = attr(root, 'propertyindex', 'href');
 
-  this.definitionsFile = attr(root, 'definitions', 'href');
-  if (this.definitionsFile) {
-    this.definitions = definitions.load(this.definitionsFile);
+  var definitionsFilenamesAndBases = [];
+  for (var n = root.firstChild; n; n = n.nextSibling) {
+    if (n.nodeName == 'definitions') {
+      definitionsFilenamesAndBases.push([n.getAttribute('href'), n.getAttribute('base') || null]);
+    }
   }
+  this.definitions = definitions.load(definitionsFilenamesAndBases.reverse());
 
   this.interfacesFile = attr(root, 'interfaces', 'idl');
   this.pages = { };
--- a/publish/definitions.js	Sat Aug 18 18:29:01 2012 +1000
+++ b/publish/definitions.js	Sun Aug 19 16:27:16 2012 +1000
@@ -468,9 +468,11 @@
   }
 }
 
-exports.load = function(filename) {
+exports.load = function(filenamesAndBases) {
   var defs = new Definitions();
-  loadInto(filename, null, defs);
+  for (var i = 0; i < filenamesAndBases.length; i++) {
+    loadInto(filenamesAndBases[i][0], filenamesAndBases[i][1], defs);
+  }
   resolve(defs);
   return defs;
 };