user8472
2010-11-19 18:28:12 UTC
I want to generate a page which contains PHP code programmatically
with Genshi. However, I need to escape the special characters.
When I try: print(tag('<?php echo "Test"; ?>').generate())
the "<" and ">" will get escaped to < and > which obviously will
not work (not to mention what will happen to actual PHP code).
When I try to use the Unicode entities < and >, instead,
everything just gets worse.
However, there seems to be a way to escape strings using e.g.
tag.script('<!-- @Javascript@ //-->') which pastes the @Javascript@
code without escaping and works fine.
So is there a way to paste strings verbatim into the stream?
with Genshi. However, I need to escape the special characters.
When I try: print(tag('<?php echo "Test"; ?>').generate())
the "<" and ">" will get escaped to < and > which obviously will
not work (not to mention what will happen to actual PHP code).
When I try to use the Unicode entities < and >, instead,
everything just gets worse.
However, there seems to be a way to escape strings using e.g.
tag.script('<!-- @Javascript@ //-->') which pastes the @Javascript@
code without escaping and works fine.
So is there a way to paste strings verbatim into the stream?
--
You received this message because you are subscribed to the Google Groups "Genshi" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to genshi+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/genshi?hl=en.
You received this message because you are subscribed to the Google Groups "Genshi" group.
To post to this group, send email to ***@googlegroups.com.
To unsubscribe from this group, send email to genshi+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/genshi?hl=en.