LaTeXText
LaTeXText copied to clipboard
Only render text that belongs to a layer
Instead of rendering all the text in the document, I think it would be more useful if this extension rendered all the text found in a specified layer.
That would indeed be a nice feature. Probably I won't have time to implement it soon, but if anyone is willing to work on this I would be glad to check and merge a patch.
I have no idea how to do it.
I'm really not used to python, but my guess is, the responsible line is at latextex.py:449
text_nodes = self.docroot.findall('.//{%s}text' % SVG_NS)
Of course there are text elements that produce errors when processed by latex. You really need to specify a choice. I've just limited to search in a layer with the fixed name 'Latex'. Probably someone needs it to be in the options dialog?
I changed the line @csorvagep has mentioned to this:
latex_layer = self.docroot.find("{%s}g[@{%s}label='Latex']" % (SVG_NS, INKSCAPE_NS))
if latex_layer is None:
text_nodes = self.docroot.findall('.//{%s}text' % SVG_NS)
else:
text_nodes = latex_layer.findall('.//{%s}text' % SVG_NS)
As I just need the problem solved, I'm fine with the fixed layer name. I will not dig into options. When someone thinks it would still be worth a pull request, I may be convinced to create one.
Oh why did @csorvagep not mention here that he already made a pull request #13 … Searching for the problem I just found the issue not the PR. Sorry.