Code

Fixed some extensions (.inx files) to cater for localization better and added two...
[inkscape.git] / share / extensions / text_replace.py
1 import chardataeffect, inkex, string\r
2 \r
3 class C(chardataeffect.CharDataEffect):\r
4   def __init__(self):\r
5     chardataeffect.CharDataEffect.__init__(self)\r
6     self.OptionParser.add_option("-f", "--from_text", action="store", type="string", dest="from_text", default="", help="Replace")\r
7     self.OptionParser.add_option("-t", "--to_text", action="store", type="string", dest="to_text", default="", help="by")\r
8               \r
9   def process_chardata(self,text, line, par):\r
10     fr = self.options.from_text.strip('"').replace('\$','$')\r
11     to = self.options.to_text.strip('"').replace('\$','$')\r
12 \r
13     return (text.replace(unicode(fr,"utf-8"), unicode(to,"utf-8")))\r
14 \r
15 c = C()\r
16 c.affect()\r