Python Forum
single/double quote escapes codebox highlighter - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Forum & Off Topic (https://python-forum.io/forum-23.html)
+--- Forum: Board (https://python-forum.io/forum-26.html)
+--- Thread: single/double quote escapes codebox highlighter (/thread-4320.html)



single/double quote escapes codebox highlighter - metulburr - Aug-08-2017

someone posted this...
    if s[0] == "'" and s[-1] == "'":
and i remember there was an issue regarding the string of the codebox escaping incorrectly. But i 1) cant find that thread and 2) dont remember if we fixed this issue or not?


RE: syntax highlighter codebox escapes string - snippsat - Aug-08-2017

I don't remember if we have looked at this or it has ever come up.
It's a rare case,usually it it's more code like this.
'a' and 'b'
1 and 2
'l' and '4'
'''c''' and '''d'''
'4' or '7'
# The rare case
'"' and '"'
'"' and '&'
So i don't know if digging into regex for this is worth it,can also mess up something else.


RE: syntax highlighter codebox escapes string - nilamo - Aug-08-2017

I know we've talked about it before, but I can't find where it's mentioned specifically.  Lots of highlighter threads, though.

I think the issue is related to multiple different quote characters near each other, like the highlighter loses track of which one is the enclosing quote, or something, and ends up highlighting too much.  I also think it might be specifically related to single quotes.


RE: syntax highlighter codebox escapes string - metulburr - Aug-08-2017

"'" and "'"
'"' and '"'
" ' " and " ' "
' " ' and ' " '
So it appears to only happen when you string a single or double quotation mark by itself.

I guess that would be a rare case of someone doing that. But it is surely annoying. I might be in agreement, that it might make it worse by tweaking the regex. But i also might think it might be worth trying to tweak if it happens more in the future.