openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #11681
[Merge] lp:~googol/openlp/bug-796528 into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/bug-796528 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~googol/openlp/bug-796528/+merge/73396
Hello,
I hope that this fixes the soft break issue completely. It was not working as desired.
--
https://code.launchpad.net/~googol/openlp/bug-796528/+merge/73396
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/bug-796528 into lp:openlp.
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2011-08-29 20:58:32 +0000
+++ openlp/core/lib/renderer.py 2011-08-30 15:38:23 +0000
@@ -233,45 +233,41 @@
len(pages) > 1 and u'[---]' in text:
pages = []
while True:
- # Check if the first two potential virtual slides will fit
- # (as a whole) on one slide.
- html_text = expand_tags(
- u'\n'.join(text.split(u'\n[---]\n', 2)[:-1]))
+ slides = text.split(u'\n[---]\n', 2)
+ # If there are (at least) two occurrences of [---] we use
+ # the first two slides (and neglect the last for now).
+ if len(slides) == 3:
+ html_text = expand_tags(u'\n'.join(slides[:2]))
+ # We check both slides to determine if the virtual break is
+ # needed (there is only one virtual break).
+ else:
+ 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 occurrences of [---].
- text = text.replace(u'\n[---]', u'', 2)
+ # slide. Replace the first occurrence of [---].
+ text = text.replace(u'\n[---]', u'', 1)
else:
- # The first two virtual slides did not fit as a whole.
- # Check if the first virtual slide will fit.
- html_text = expand_tags(text.split(u'\n[---]\n', 1)[1])
- html_text = html_text.replace(u'\n', u'<br>')
- if self._text_fits_on_slide(html_text):
- # The first virtual slide fits, so remove it.
- text = text.replace(u'\n[---]', u'', 1)
- else:
- # The first virtual slide does not fit, 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:
- text_to_render = text
- 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)
+ # 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:
+ text_to_render = text
+ 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))
Follow ups