t4

markup problem with embedded python

Bug #516355 reported by cfhowes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
t4
New
Undecided
Unassigned

Bug Description

If you put 2 python code segments on a page too close to each other the second one will not get pulled out of the page text and will be interpreted by markdown.

for example:
"""
Hello World

{{=plugin_comments('t_page',page.id)}}
text
{{=plugin_rating('t_page',page.id)}}
sometext
{{=page.id}}
other stuff
"""

will have the "plugin_rating" section skipped, and markdown will convert it to "pluging<em>rating" and the layout will fail.

a potential fix that works so far for me is:
 hg diff models/db.py | more
diff -r e5db5d0e74c0 web2py/applications/t4/models/db.py
--- a/web2py/applications/t4/models/db.py Tue Feb 02 16:42:41 2010 -0800
+++ b/web2py/applications/t4/models/db.py Tue Feb 02 16:43:25 2010 -0800
@@ -153,8 +153,8 @@
             match=regex.search(text,k)
             if not match: break
             items.append(match.group())
- k=match.end()
- text=text[:match.start()]+key+text[k:]
+ k=match.start() + len(key)
+ text=text[:match.start()]+key+text[match.end():]
         (k,nkey)=(-1,len(key))

     text=wiki(text)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.