Use symbolic HTML entities rather than character codes for escaping
dmbaturin opened this issue · 5 comments
Right now the escape
function uses numeric ASCII codes like >
. This if functional, but can be hard for a human reading that HTML. It's also a bit contrary to the way many other tools work. Symbolic entities like >
are easier to read.
However, I did look in the code and I see why you went with numeric codes—since all required codes consist of two digits, the length of the substitute substring is constant: one character like >
is always replaced by a 5-character string like >
. A variable-length implementation is more annoying to make.
If you aren't categorically opposed to a variable-length implementation, I'm ready to help with it. Just want to check first.
Current implementation of escape_html
is quite performant, but at the same time, I agree with your frustration, output is not easy to read.
So feel free to send us your PR!
Thanks!
I've been busy fighting with the calendar library and you got ahead of me. I like your implementation.
When do you plan to make a new release?
We'll probably release it in the near future (this month).
Great! I'm planning to make a new soupault release late in this month, too.