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

missing the transformation filters #23

Open
alexbodn opened this issue Aug 29, 2016 · 3 comments
Open

missing the transformation filters #23

alexbodn opened this issue Aug 29, 2016 · 3 comments

Comments

@alexbodn
Copy link

alexbodn commented Aug 29, 2016

hello friends,

and many thanks for providing kajiki.

with genshi, i was using transformation filters,
that allowed me to give a last touch to some tags' attributes.

how could i hook a callback in kajiki template _render_attrs?
how could _render_attrs know the tag name it was called for?
should such callback be hooked somewhere else?

thanks in advance,
alex

@alexbodn
Copy link
Author

alexbodn commented Aug 29, 2016

well i did monkey patch the template loaded in the (subclassed loader)._load by changing _render_attrs.
to find the tag name of the rendering attrs, i monkey patched iter to save the current chunk in self, but this should be a stack, i think.

@amol-
Copy link
Collaborator

amol- commented Aug 29, 2016

Note that even though we can implement a stack to track the tags, it won't be possible to actually implement transformations. As Kajiki is designed like Jinja it has no representation of the DOM that can be modified at runtime. To achieve dynamic tags those should be created from python code itself

@alexbodn
Copy link
Author

alexbodn commented Aug 29, 2016

thanks @amol .
but the template is being parsed and compiled to a dom,
thus a hook may be plugged to influence the process,
either during the parsing, or on the parsed doc.
xmltemplate may receive an user made parser,
that would inherit the _Parser, which is standard sax parser.

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

2 participants