svg2-tools: 2 new changesets

details:   https://svgwg.org/hg/svg2-tools/rev/499d59804682
branches:  
changeset: 75:499d59804682
user:      Cameron McCormack <cam@mcc.id.au>
date:      Sat Apr 06 16:36:59 2013 +1100
description:
Allow single file resources.

details:   https://svgwg.org/hg/svg2-tools/rev/cf60bdf06b8d
branches:  
changeset: 76:cf60bdf06b8d
user:      Cameron McCormack <cam@mcc.id.au>
date:      Sat Apr 06 16:37:10 2013 +1100
description:
Avoid exception when using SVG Tiny 1.2 definitions file.

diffstat:

 build.py               |  5 ++++-
 publish/definitions.js |  8 +++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diffs (52 lines):

diff --git a/build.py b/build.py
--- a/build.py
+++ b/build.py
@@ -190,16 +190,19 @@ if len(all) > 1:
     os.chdir(repo_dir) # chdir back
 
 # Copy over anything else that needs to be copied to 'publish':
 for f in resources:
   tocopypath = join(master_dir, f)
   if os.path.exists(tocopypath):
     copyto = os.path.join(publish_dir,os.path.basename(tocopypath))
     shutil.rmtree(copyto, ignore_errors=True)
-    shutil.copytree(tocopypath, copyto)
+    if os.path.isdir(tocopypath):
+      shutil.copytree(tocopypath, copyto)
+    else:
+      shutil.copyfile(tocopypath, copyto)
 
 # Done:
 
 if not built_something:
   print "Nothing to do."
 
 done()
diff --git a/publish/definitions.js b/publish/definitions.js
--- a/publish/definitions.js
+++ b/publish/definitions.js
@@ -428,19 +428,21 @@ function loadInto(filename, base, defs) 
 function resolve(defs) {
   for (var name in defs.elements) {
     var element = defs.elements[name];
     element.attributes = { };
     element.attributeOrder = [];
     for (var i = 0; i < element.attributeCategories.length; i++) {
       var catName = element.attributeCategories[i];
       var cat = defs.attributeCategories[catName];
-      for (var j = 0; j < cat.attributes.length; j++) {
-        element.attributes[cat.attributes[j].name] = cat.attributes[j];
-        element.attributeOrder.push(cat.attributes[j].name);
+      if (cat) {
+        for (var j = 0; j < cat.attributes.length; j++) {
+          element.attributes[cat.attributes[j].name] = cat.attributes[j];
+          element.attributeOrder.push(cat.attributes[j].name);
+        }
       }
     }
     for (var i = 0; i < defs.commonAttributesForElements.length; i++) {
       var attr = defs.commonAttributesForElements[i];
       if (attr.elements[element.name]) {
         element.attributes[attr.name] = attr;
         element.attributeOrder.push(attr.name);
       }

Received on Saturday, 6 April 2013 05:37:45 UTC