-
Notifications
You must be signed in to change notification settings - Fork 294
escape_gt_in_attrs #201
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
Comments
I'm not sure I really want to start adding hacks for regexp parsers given they're almost certainly going to be broken by some reasonable output. Is it anything particularly notable or what is it? |
FYI, one more data point on this. I just discovered that Here is the issue I just filed about it: htacg/tidy-html5#542 If it's straightforward to add a custom filter to escape characters like this, I assume that would be enough. |
Maybe we should make escaping pluggable, though I wonder what the perf cost of that would be… This isn't the first thing it'd help with. |
For sure, I think it can be done. It's mainly a question of the API you want and which aspects you want pluggable. All of the behavior we're discussing in this issue happens in these three lines:
One possible API would be to have an instance attribute that stores the simple escapes. It could be a list of pairs
Then the three lines up top would become:
This approach wouldn't impact performance in any noticeable way. |
FWIW: my view at this point is adding |
Why is there no
escape_gt_in_attrs
counterpart ofescape_lt_in_attrs
? Optimistic regex tag-soup readers do negative lookaheads for>
to determine the closing point of a tag. They’re just as important to escape in atts as<
for compatibility with everything.Authors can’t work around this because
<elm attr="<example>">
is always turned into<elm attr="<example>">
The text was updated successfully, but these errors were encountered: