itdiy / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

python regex that parses url results truncated display and broke html links outside pre tag #82

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
sample problem snippet of python:

findreplace = [
(re.compile(ur'''<a href="http://(?P<urlpart>(?:[^.]+\.)?
wikipedia.org[^"]+)">http://([\w\.]+)+/(\w+/)+(?
P<title>[^<]+)</a>''',re.U|re.M),
ur'''<a href="http://\g<urlpart>">\g<title>↗</a>'''), # wikipedia
# more regex pairs here
]

when rendered with code-prettify, 
http://xahlee.org/js/google-code-prettify/gcp_python.html
the above regex gets rendered as:

findreplace = [
(re.compile(ur'''http://([\w\.]+)+/(\w+/)+(?P''',re.U|re.M),
ur'''\g'''), # wikipedia
]

but one thing particular worth mentioning is that html links outside of 
this pre block no longer works.

here's a example using hard-coded span marks:
http://xahlee.org/js/google-code-prettify/emacs_python.html

version used is prettify-21-May-2009.

Original issue reported on code.google.com by xah...@gmail.com on 21 Jun 2009 at 7:56

GoogleCodeExporter commented 9 years ago
The problem arose because the test page was not properly escaping HTML special
characters.

Original comment by mikesamuel@gmail.com on 6 Jul 2009 at 6:44