Summary
hyde doesn't do any HTML-escaping for unknown languages
Metadata
- Id: 5688f61280ce2af57a0d59c54651ab6fc5ebd16a
- Trac id: 890
- Type: defect
- Reporter: sjamaan
- Owner: syn
- Cc:
- Status: closed
- Component: extensions
- Estimated difficulty:
- Resolution: fixed
- Priority: major
- Milestone:
- Version:
- Changetime: 2012-07-28 18:07:36 UTC
- Created: 2012-07-28 17:17:43 UTC
- Keywords: escaping, html, hyde
Attachments
- 5688f61280ce2af57a0d59c54651ab6fc5ebd16a/attachments/colorize-bugfix.patch
Description
The following will put the HTML code as-is into the output instead of escaping the angular brackets.
<enscript highlight="html"> <div> <span>Hello, <strong>dear</strong> friends.</span> <span>This is a simple example.</span> </div> </enscript>
The problem here is that hyde calls colorize with an exception handler which just returns the original code. This code is then injected, whereas colorize will return HTML, taking care of escaping.
Actually, hyde should choose whether it wants to do string manipulation or use SXML throughout. Using inject is a nasty hack and should be avoided. Take a look at qwiki; it calls html->sxml on the output of colorize and any other user-supplied HTML. If hyde would do this, it also ensures that any mistakes in any of the converters (or the user's own code) don't mess up the SXML structure.
Changes and comments
[2012-07-28 17:18:18 UTC] sjamaan attached colorize-bugfix.patch (description=Fix for the immediate bug)
[2012-07-28 18:07:36 UTC] syn changed status from new to closed
[2012-07-28 18:07:36 UTC] syn set resolution to fixed
[2012-07-28 18:07:36 UTC] syn wrote:
Thanks for the patch, I applied it to trunk and will include it in the next release. I'm not quite sold on SXML all the way down. I'll give it some more though :-) Thanks!