fix missing elements
This commit is contained in:
@@ -159,15 +159,35 @@ class InkscapeUprint(inkex.Effect):
|
||||
l.extend(self.svg_traverse_node(child))
|
||||
return l
|
||||
|
||||
def draw_tick(self, page, pos, length, direction, parent):
|
||||
x1,y1 = pos
|
||||
x2,y2 = pos * direction
|
||||
|
||||
line_style = { 'stroke': '#000000',
|
||||
'stroke-width': '0.2',
|
||||
'fill': 'none'
|
||||
}
|
||||
|
||||
line_attribs = {'style' : str(inkex.Style(line_style)),
|
||||
inkex.addNS('label','inkscape') : "none",
|
||||
'd' : 'M '+str(x1) +',' +
|
||||
str(y1) +' L '+str(x2)
|
||||
+','+str(y2) }
|
||||
|
||||
line = etree.SubElement(parent, inkex.addNS('path','svg'), line_attribs )
|
||||
return line
|
||||
|
||||
def replace_text(self, selected, substs):
|
||||
import re
|
||||
for node in selected:
|
||||
tspans = [ n for n in self.svg_traverse_node(node, tag='tspan')]
|
||||
for k,v in substs.items():
|
||||
patt = re.compile(r'\{\{' + re.escape(k) + r'\}\}')
|
||||
if k is None:
|
||||
continue
|
||||
patt = re.compile(r'\{\{' + re.escape(str(k)) + r'\}\}')
|
||||
for t in tspans:
|
||||
if t.text is None: continue
|
||||
t.text = patt.sub(v, t.text)
|
||||
t.text = patt.sub(str(v), t.text)
|
||||
# multilines = t.text.split('\n')
|
||||
# if len(multilines) > 1:
|
||||
# t.text = multilines[0]
|
||||
@@ -313,4 +333,3 @@ class InkscapeUprint(inkex.Effect):
|
||||
if __name__ == '__main__':
|
||||
e = InkscapeUprint()
|
||||
e.run()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user