Fix bug 9300. We need manually to convert newlines to paragraph breaks.

This commit is contained in:
Richard Heck 2014-11-03 10:56:22 -05:00
parent 6f3fbc9cd3
commit 8f40d784c0
2 changed files with 21 additions and 3 deletions

View File

@ -4636,7 +4636,23 @@ def convert_chunks(document):
# does not need to do that. # does not need to do that.
did_one_par = False did_one_par = False
if postoptstuff: if postoptstuff:
newstuff.extend(postoptstuff) # we need to replace newlines with new layouts
start_newline = -1
started_text = False
for lno in range(0,len(postoptstuff)):
if postoptstuff[lno].startswith("\\begin_inset Newline newline"):
start_newline = lno
elif start_newline != -1:
if postoptstuff[lno].startswith("\\end_inset"):
# replace that bit, but only if we already have some text
# and we're not at the end except for a blank line
if started_text and \
(lno != len(postoptstuff) - 2 or postoptstuff[-1] != ""):
newstuff.extend(['\\end_layout', '\n', '\\begin_layout Plain Layout', '\n'])
start_newline = -1
started_text = True
else:
newstuff.extend([postoptstuff[lno]])
newstuff.append('\\end_layout') newstuff.append('\\end_layout')
did_one_par = True did_one_par = True
for c in contents: for c in contents:

View File

@ -83,6 +83,8 @@ What's new
- Fix import of Chunk layout with trailing empty paragraph (bug 9298). - Fix import of Chunk layout with trailing empty paragraph (bug 9298).
- Fix import of chunk insets containing newlines (bug 9300).
* USER INTERFACE * USER INTERFACE