Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only render text that belongs to a layer #10

Open
cossio opened this issue Apr 9, 2018 · 5 comments
Open

Only render text that belongs to a layer #10

cossio opened this issue Apr 9, 2018 · 5 comments

Comments

@cossio
Copy link

cossio commented Apr 9, 2018

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.

@seebk
Copy link
Owner

seebk commented Apr 9, 2018

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.

@cossio
Copy link
Author

cossio commented Apr 9, 2018

I have no idea how to do it.

@csorvagep
Copy link

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)

@oliver-pola
Copy link

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.

@oliver-pola
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants