From 821c09668a5d66c5381a4520953eaa222148c14d Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Mon, 1 Dec 2014 12:35:46 +0100 Subject: [PATCH] Honor paragraph parameters when converting chunk layouts. Fixes: #9320. --- lib/lyx2lyx/lyx_2_1.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index 76156d2fa1..58b290b5c0 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -4621,10 +4621,23 @@ def convert_chunks(document): # We have stripped everything. This can be deleted. contents.pop(0) - newstuff = ['\\begin_layout Standard', - '\\begin_inset Flex Chunk', - 'status open', '', - '\\begin_layout Plain Layout', ''] + newstuff = ['\\begin_layout Standard'] + + # Maintain paragraph parameters + par_params = ["\\noindent", "\\indent", "\\indent-toggle", "\\leftindent", + "\\start_of_appendix", "\\paragraph_spacing", "\\align", + "\\labelwidthstring"] + parms = start + 1 + while True: + if document.body[parms].split(' ', 1)[0] not in par_params: + break + newstuff.extend([document.body[parms]]) + parms += 1 + + newstuff.extend( + ['\\begin_inset Flex Chunk', + 'status open', '', + '\\begin_layout Plain Layout', '']) # If we have a non-empty optional argument, insert it. if match and optarg != "":