From: buliabyak Date: Sun, 15 Jul 2007 03:29:51 +0000 (+0000) Subject: text replace X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=996a77d32da1c3ffe2d4e1da1af377b84cb63087;p=inkscape.git text replace --- 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 @@ + + <_name>Replace text... + org.inkscape.text.replacetext + chardataeffect.py + text_replace.py + + + + all + + + + + + \ 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()