forked from openlp/openlp
reverted some changes
This commit is contained in:
parent
9841406071
commit
3a2be026f5
@ -227,46 +227,50 @@ class Renderer(object):
|
|||||||
# Songs and Custom
|
# Songs and Custom
|
||||||
elif item.is_capable(ItemCapabilities.CanSoftBreak):
|
elif item.is_capable(ItemCapabilities.CanSoftBreak):
|
||||||
pages = []
|
pages = []
|
||||||
while True:
|
if u'[---]' in text:
|
||||||
slides = text.split(u'\n[---]\n', 2)
|
while True:
|
||||||
# If there are (at least) two occurrences of [---] we use
|
slides = text.split(u'\n[---]\n', 2)
|
||||||
# the first two slides (and neglect the last for now).
|
# If there are (at least) two occurrences of [---] we use
|
||||||
if len(slides) == 3:
|
# the first two slides (and neglect the last for now).
|
||||||
html_text = expand_tags(u'\n'.join(slides[:2]))
|
if len(slides) == 3:
|
||||||
# We check both slides to determine if the virtual break is
|
html_text = expand_tags(u'\n'.join(slides[:2]))
|
||||||
# needed (there is only one virtual break).
|
# We check both slides to determine if the virtual break is
|
||||||
else:
|
# needed (there is only one virtual break).
|
||||||
html_text = expand_tags(u'\n'.join(slides))
|
|
||||||
html_text = html_text.replace(u'\n', u'<br>')
|
|
||||||
if self._text_fits_on_slide(html_text):
|
|
||||||
# The first two virtual slides fit (as a whole) on one
|
|
||||||
# slide. Replace the first occurrence of [---].
|
|
||||||
text = text.replace(u'\n[---]', u'', 1)
|
|
||||||
else:
|
|
||||||
# The first virtual slide fits, which means we have to
|
|
||||||
# render the first virtual slide.
|
|
||||||
text_contains_break = u'[---]' in text
|
|
||||||
if text_contains_break:
|
|
||||||
text_to_render, text = text.split(u'\n[---]\n', 1)
|
|
||||||
else:
|
else:
|
||||||
text_to_render = text
|
html_text = expand_tags(u'\n'.join(slides))
|
||||||
text = u''
|
html_text = html_text.replace(u'\n', u'<br>')
|
||||||
lines = text_to_render.strip(u'\n').split(u'\n')
|
if self._text_fits_on_slide(html_text):
|
||||||
slides = self._paginate_slide(lines, line_end)
|
# The first two virtual slides fit (as a whole) on one
|
||||||
if len(slides) > 1 and text:
|
# slide. Replace the first occurrence of [---].
|
||||||
# Add all slides apart from the last one the list.
|
text = text.replace(u'\n[---]', u'', 1)
|
||||||
pages.extend(slides[:-1])
|
else:
|
||||||
if text_contains_break:
|
# The first virtual slide fits, which means we have to
|
||||||
text = slides[-1] + u'\n[---]\n' + text
|
# render the first virtual slide.
|
||||||
|
text_contains_break = u'[---]' in text
|
||||||
|
if text_contains_break:
|
||||||
|
text_to_render, text = text.split(u'\n[---]\n', 1)
|
||||||
else:
|
else:
|
||||||
text = slides[-1] + u'\n'+ text
|
text_to_render = text
|
||||||
text = text.replace(u'<br>', u'\n')
|
text = u''
|
||||||
|
lines = text_to_render.strip(u'\n').split(u'\n')
|
||||||
|
slides = self._paginate_slide(lines, line_end)
|
||||||
|
if len(slides) > 1 and text:
|
||||||
|
# Add all slides apart from the last one the list.
|
||||||
|
pages.extend(slides[:-1])
|
||||||
|
if text_contains_break:
|
||||||
|
text = slides[-1] + u'\n[---]\n' + text
|
||||||
|
else:
|
||||||
|
text = slides[-1] + u'\n'+ text
|
||||||
|
text = text.replace(u'<br>', u'\n')
|
||||||
|
else:
|
||||||
|
pages.extend(slides)
|
||||||
|
if u'[---]' not in text:
|
||||||
|
lines = text.strip(u'\n').split(u'\n')
|
||||||
|
pages.extend(self._paginate_slide(lines, line_end))
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
pages.extend(slides)
|
pages = self._paginate_slide(
|
||||||
if u'[---]' not in text:
|
text.split(u'\n'), line_end)
|
||||||
lines = text.strip(u'\n').split(u'\n')
|
|
||||||
pages.extend(self._paginate_slide(lines, line_end))
|
|
||||||
break
|
|
||||||
else:
|
else:
|
||||||
# Clean up line endings.
|
# Clean up line endings.
|
||||||
pages = self._paginate_slide(text.split(u'\n'), line_end)
|
pages = self._paginate_slide(text.split(u'\n'), line_end)
|
||||||
|
Loading…
Reference in New Issue
Block a user