diff options
| -rw-r--r-- | share/extensions/Makefile.am | 2 | ||||
| -rw-r--r-- | share/extensions/text_replace.inx | 17 | ||||
| -rw-r--r-- | share/extensions/text_replace.py | 16 |
3 files changed, 35 insertions, 0 deletions
diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am index e15df2f38..af31e6777 100644 --- a/share/extensions/Makefile.am +++ b/share/extensions/Makefile.am @@ -88,6 +88,7 @@ extensions = \ text_titlecase.py \ text_flipcase.py \ text_randomcase.py \ + text_replace.py \ txt2svg.pl \ webbrowser_commandline.py \ webbrowser_faq.py\ @@ -175,6 +176,7 @@ modules = \ text_titlecase.inx \ text_flipcase.inx \ text_randomcase.inx \ + text_replace.inx \ txt2svg.inx \ whirl.inx \ wmf_input.inx diff --git a/share/extensions/text_replace.inx b/share/extensions/text_replace.inx new file mode 100644 index 000000000..a1e2951c5 --- /dev/null +++ b/share/extensions/text_replace.inx @@ -0,0 +1,17 @@ +<inkscape-extension>
+ <_name>Replace text...</_name>
+ <id>org.inkscape.text.replacetext</id>
+ <dependency type="executable" location="extensions">chardataeffect.py</dependency>
+ <dependency type="executable" location="extensions">text_replace.py</dependency>
+ <param name="from_text" type="string" gui-text="Replace:"></param> + <param name="to_text" type="string" gui-text="By:"></param> + <effect>
+ <object-type>all</object-type>
+ <effects-menu>
+ <submenu _name="Text"/>
+ </effects-menu>
+ </effect>
+ <script>
+ <command reldir="extensions" interpreter="python">text_replace.py</command>
+ </script>
+</inkscape-extension>
\ No newline at end of file diff --git a/share/extensions/text_replace.py b/share/extensions/text_replace.py new file mode 100644 index 000000000..3ea665970 --- /dev/null +++ b/share/extensions/text_replace.py @@ -0,0 +1,16 @@ +import chardataeffect, inkex, string
+
+class C(chardataeffect.CharDataEffect):
+ def __init__(self):
+ chardataeffect.CharDataEffect.__init__(self)
+ self.OptionParser.add_option("-f", "--from_text", action="store", type="string", dest="from_text", default="", help="Replace")
+ self.OptionParser.add_option("-t", "--to_text", action="store", type="string", dest="to_text", default="", help="by")
+
+ def process_chardata(self,text, line, par):
+ fr = self.options.from_text.strip('"').replace('\$','$')
+ to = self.options.to_text.strip('"').replace('\$','$')
+
+ return (text.replace(fr, to))
+
+c = C()
+c.affect()
|
