hopefully fixed bug #796528 (to be cleaned up

Fixes: https://launchpad.net/bugs/796528
This commit is contained in:
Andreas Preikschat 2011-08-23 21:57:29 +02:00
parent b0df1bdd94
commit 0d99f5be96
1 changed files with 27 additions and 7 deletions

View File

@ -229,13 +229,33 @@ class Renderer(object):
pages = self._paginate_slide(lines, line_end)
if len(pages) > 1:
# Songs and Custom
if item.is_capable(ItemCapabilities.AllowsVirtualSplit):
# Do not forget the line breaks!
slides = text.split(u'[---]')
if item.is_capable(ItemCapabilities.AllowsVirtualSplit) and \
u'[---]' in text:
pages = []
for slide in slides:
lines = slide.strip(u'\n').split(u'\n')
pages.extend(self._paginate_slide(lines, line_end))
while True:
html_text = expand_tags(text.split(u'[---]', 1)[0])
html_text = html_text.strip()
html_text = html_text.replace(u'\n', u'<br>')
if not self._text_fits_on_slide(html_text):
text = text.replace(u'\n[---]', u'', 1)
else:
if u'[---]' in text:
slides = text.split(u'[---]', 1)
text_to_render = slides[0]
text_to_render = text_to_render.strip()
text_to_render = text_to_render.replace(u'\n', u'<br>')
text = slides[1]
else:
text_to_render = text
text = u''
lines = text_to_render.strip(u'\n').split(u'\n')
lines = map(expand_tags, lines)
pages.extend(self._paginate_slide(lines, line_end))
if not text or u'[---]' not in text:
lines = text.strip(u'\n').split(u'\n')
lines = map(expand_tags, lines)
pages.extend(self._paginate_slide(lines, line_end))
break
new_pages = []
for page in pages:
while page.endswith(u'<br>'):
@ -488,7 +508,7 @@ class Renderer(object):
returned, otherwise ``False``.
``text``
The text to check. It can contain HTML tags.
The text to check. It may contain HTML tags.
"""
self.web_frame.evaluateJavaScript(u'show_text("%s")' %
text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))