@facelessuser: I came across encode() the other day and was considering âxmlcharrefreplaceâ, although I wasnât sure how it fitted in to the project. The Python docs donât indicate that encode() takes varargs - must be out of date.
BTW, and out of interest, I conquered adding comments last night (in my head ). Hereâs my outline, but Iâm not sure if itâs worth doing. Nevertheless, itâs interesting :
- Create a shortcut to store the current view, point, word under the point - and a comment read from the input panel - in a dictionary of tuples, using the view as key. If there isnât a proper a-z word under the point, then bail, and it cannot be a selection (just a single point).
Allowing a selection is too messy, as it would cover a number of spans. Similarly, extending the comment across the current span could be messy, particularly if within a comment line. (Why would someone put a comment in a comment, Doh!)
- Add CSS rule(s) to a tag such as âbâ or âttâ, or possibly a little bit of JS, based on a class that would create the tooltip on hover. (JS might use ids instead: e.g. âcommentâ + pt)
2b. Format the tag so it stands out. Canât really use a colour, so perhaps underline or italic. (But perhaps allow yet another setting for âcomment_colourâ.)
2c. Might need another styled-span, that JS would use to display the tooltip. - During parsing of the lines/spans - but after entity escaping the HTML - examine the comment-points to see if any fall within the current region/span.
- If so, compare the word-under-point. If itâs not the same, then bail - theyâve added more code and the comment is no longer relevant.
- Find the same word in tidied_text, and replace it with '<b class=âcommentâ title=âThe comment textâ>word".
- If using JS for the tooltip, would need to insert the (new) styled-span just inside this b-tag, containing the comment text. (It could be positioned to display underneath the line.)
I recall/believe that tooltips can be created with just CSS, particularly CSS3. They could even just be links, but a little JS might be better.
Anyway, I havenât decided how far I might pursue this. Although, itâs still kinda cool
I shall have a look at your current work in a while. Regards, Andy.