mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Fix lyx2lyx problem with sweave files and ParBreakIsNewline.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37353 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b2d2fdf1ee
commit
5123774bd1
@ -2078,9 +2078,20 @@ def convert_passthru(document):
|
|||||||
document.warning("Can't find end of layout at line " + str(beg))
|
document.warning("Can't find end of layout at line " + str(beg))
|
||||||
beg += 1
|
beg += 1
|
||||||
continue
|
continue
|
||||||
|
document.warning(str(end))
|
||||||
|
|
||||||
# we are now going to replace newline insets within this layout
|
# we are now going to replace newline insets within this layout
|
||||||
# by new instances of this layout. so we have repeated layouts
|
# by new instances of this layout. so we have repeated layouts
|
||||||
# instead of newlines.
|
# instead of newlines.
|
||||||
|
|
||||||
|
# first, though, we need to find out if the paragraph has any
|
||||||
|
# customization, so those can be propogated.
|
||||||
|
custom = []
|
||||||
|
i = beg + 1
|
||||||
|
while document.body[i].startswith("\\"):
|
||||||
|
custom.append(document.body[i])
|
||||||
|
i += 1
|
||||||
|
|
||||||
ns = beg
|
ns = beg
|
||||||
while True:
|
while True:
|
||||||
ns = find_token(document.body, "\\begin_inset Newline newline", ns, end)
|
ns = find_token(document.body, "\\begin_inset Newline newline", ns, end)
|
||||||
@ -2093,13 +2104,14 @@ def convert_passthru(document):
|
|||||||
continue
|
continue
|
||||||
if document.body[ne + 1] == "":
|
if document.body[ne + 1] == "":
|
||||||
ne += 1
|
ne += 1
|
||||||
subst = ["\\end_layout", "", "\\begin_layout " + lay]
|
subst = ["\\end_layout", "", "\\begin_layout " + lay] + custom
|
||||||
document.body[ns:ne + 1] = subst
|
document.body[ns:ne + 1] = subst
|
||||||
# now we need to adjust end, in particular, but might as well
|
# now we need to adjust end, in particular, but might as well
|
||||||
# do ns properly, too
|
# do ns properly, too
|
||||||
newlines = (ne - ns) - len(subst)
|
newlines = (ne - ns) - len(subst) + len(custom)
|
||||||
ns += newlines + 2
|
ns += newlines + 2
|
||||||
end += newlines + 1
|
end += newlines + 2
|
||||||
|
|
||||||
# ok, we now want to find out if the next layout is the
|
# ok, we now want to find out if the next layout is the
|
||||||
# same as this one. if so, we will insert an extra copy of it
|
# same as this one. if so, we will insert an extra copy of it
|
||||||
didit = False
|
didit = False
|
||||||
|
Loading…
Reference in New Issue
Block a user