From c24abd5c3141e4175a48af3875df3f7e6109f2c0 Mon Sep 17 00:00:00 2001 From: aurium Date: Mon, 30 Mar 2009 17:46:33 +0000 Subject: [PATCH] etree CDATA support compatibilization in inkwebeffect.py --- share/extensions/Makefile.am | 8 +++++--- share/extensions/inkwebeffect.py | 13 ++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am index 70b06c213..7fac49c5c 100644 --- a/share/extensions/Makefile.am +++ b/share/extensions/Makefile.am @@ -67,6 +67,8 @@ extensions = \ ill2svg.pl \ inkex.py \ Inkscape.pm \ + inkwebeffect.py \ + inkweb.js \ interp.py \ interp-att-g.py \ launch_webbrowser.py \ @@ -191,7 +193,7 @@ modules = \ inkscape_help_svgspec.inx \ inkscape_help_keys.inx \ interp.inx \ - interp-att-g.py \ + interp-att-g.inx \ lindenmayer.inx \ lorem_ipsum.inx \ markers_strokepaint.inx \ @@ -231,8 +233,8 @@ modules = \ text_braille.inx \ triangle.inx \ txt2svg.inx \ - web-set-att.py \ - web-transmit-att.py \ + web-set-att.inx \ + web-transmit-att.inx \ whirl.inx \ wmf_input.inx \ xaml2svg.inx diff --git a/share/extensions/inkwebeffect.py b/share/extensions/inkwebeffect.py index 5fbb8db8b..994f74dea 100644 --- a/share/extensions/inkwebeffect.py +++ b/share/extensions/inkwebeffect.py @@ -25,7 +25,6 @@ class InkWebEffect(inkex.Effect): self.reUpdateJS = '/\\*\\s* inkweb.js [^*]* InkWebEffect:AutoUpdate \\s*\\*/' def mustAddInkWebJSCode(self, scriptEl): - #inkex.errormsg( re.search(self.reUpdateJS, scriptEl.text) ) if not scriptEl.text: return True if len(scriptEl.text) == 0: return True if re.search(self.reUpdateJS, scriptEl.text): return True @@ -33,10 +32,14 @@ class InkWebEffect(inkex.Effect): def addInkWebJSCode(self, scriptEl): js = open( os.path.join(sys.path[0], "inkweb.js"), 'r' ) - scriptEl.text = \ - inkex.etree.CDATA( - "\n/* inkweb.js - InkWebEffect:AutoUpdate */\n" + js.read() - ) + if hasattr(inkex.etree, "CDATA"): + scriptEl.text = \ + inkex.etree.CDATA( + "\n/* inkweb.js - InkWebEffect:AutoUpdate */\n" + js.read() + ) + else: + scriptEl.text = \ + "\n/* inkweb.js - InkWebEffect:AutoUpdate */\n" + js.read() js.close() def ensureInkWebSupport(self): -- 2.30.2