3
Copyright (C) 2006 Jos Hirth, kaioa.com
4
Copyright (C) 2007 bulia byak
5
Copyright (C) 2007 Aaron C. Spike
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or
10
(at your option) any later version.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
import sys, optparse, inkex
23
class CharDataEffect(inkex.Effect):
25
inkex.Effect.__init__(self)
32
if len(self.selected)==0:
33
self.recurse(self.document.getroot())
35
for id,node in self.selected.iteritems():
38
def recurse(self,node):
39
istext = (node.tag == '{http://www.w3.org/2000/svg}flowPara' or node.tag == '{http://www.w3.org/2000/svg}flowDiv' or node.tag == '{http://www.w3.org/2000/svg}text')
40
if node.get('{http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd}role') == 'line':
47
node.text = self.process_chardata(node.text, self.newline, self.newpar)
55
node.tail = self.process_chardata(node.tail, self.newline, self.newpar)
57
def process_chardata(self,text, line, par):