mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Assure backslash is on its own line in verbatim mode in get_ert
Also document the method
This commit is contained in:
parent
e17fdd1506
commit
3762e3604a
@ -47,6 +47,13 @@ put_cmd_in_ert(arg):
|
|||||||
ert = put_cmd_in_ert(content)
|
ert = put_cmd_in_ert(content)
|
||||||
document.body[i:j+1] = ert
|
document.body[i:j+1] = ert
|
||||||
|
|
||||||
|
get_ert(lines, i[, verbatim]):
|
||||||
|
Here, lines is a list of lines of LyX material containing an ERT inset,
|
||||||
|
whose content we want to convert to LaTeX. The ERT starts at index i.
|
||||||
|
If the optional (by default: False) bool verbatim is True, the content
|
||||||
|
of the ERT is returned verbatim, that is in LyX syntax (not LaTeX syntax)
|
||||||
|
for the use in verbatim insets.
|
||||||
|
|
||||||
lyx2latex(document, lines):
|
lyx2latex(document, lines):
|
||||||
Here, lines is a list of lines of LyX material we want to convert
|
Here, lines is a list of lines of LyX material we want to convert
|
||||||
to LaTeX. We do the best we can and return a string containing
|
to LaTeX. We do the best we can and return a string containing
|
||||||
@ -161,7 +168,10 @@ def get_ert(lines, i, verbatim = False):
|
|||||||
elif lines[i] == "\\end_layout":
|
elif lines[i] == "\\end_layout":
|
||||||
while i + 1 < j and lines[i+1] == "":
|
while i + 1 < j and lines[i+1] == "":
|
||||||
i = i + 1
|
i = i + 1
|
||||||
elif lines[i] == "\\backslash" and not verbatim:
|
elif lines[i] == "\\backslash":
|
||||||
|
if verbatim:
|
||||||
|
ret = ret + "\n" + lines[i] + "\n"
|
||||||
|
else:
|
||||||
ret = ret + "\\"
|
ret = ret + "\\"
|
||||||
else:
|
else:
|
||||||
ret = ret + lines[i]
|
ret = ret + lines[i]
|
||||||
|
Loading…
Reference in New Issue
Block a user