Fix #77 html code inside document viewer.
--- a/src/cm/utils/spannifier.py Tue Jun 12 14:00:32 2012 +0200
+++ b/src/cm/utils/spannifier.py Thu Jun 14 11:43:46 2012 +0200
@@ -35,6 +35,11 @@
span_starts[i] = len(''.join(textNodes_content))
textNodes_content.append(textNode.string)
output = unicode(soup)
+ # Soup has introduced HTML entities, which should be expanded
+ output =re.sub(r""", '"', output)
+ output =re.sub(r"&", '&', output)
+ output =re.sub(r">", '>', output)
+ output =re.sub(r"<", '<', output)
textualized = ''.join(textNodes_content)
return output, textualized, span_starts
--- a/src/cm/views/texts.py Tue Jun 12 14:00:32 2012 +0200
+++ b/src/cm/views/texts.py Thu Jun 14 11:43:46 2012 +0200
@@ -355,11 +355,6 @@
html = pandoc_convert(original_content, original_format, 'html')
wrapped_text_version, _ , _ = spannify(html)
with_markers = True
- # Tidy has introduced HTML entities, which should be expanded to keep correct offsets of comments.
- wrapped_text_version =re.sub(r""", '"', wrapped_text_version)
- wrapped_text_version =re.sub(r"&", '&', wrapped_text_version)
- wrapped_text_version =re.sub(r">", '>', wrapped_text_version)
- wrapped_text_version =re.sub(r"<", '<', wrapped_text_version)
marked_content = insert_comment_markers(wrapped_text_version, comments, with_markers, with_color)
viewable_comments = comments_thread(request, text_version, text)