mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Normalize the begining of Tabular insets (+ cosmetics: remove spaces at the end of lines)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23823 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a0f4be8515
commit
7535cabd60
@ -33,7 +33,7 @@ def find_end_of_inset(lines, i):
|
|||||||
|
|
||||||
def wrap_into_ert(string, src, dst):
|
def wrap_into_ert(string, src, dst):
|
||||||
" Wrap a something into an ERT"
|
" Wrap a something into an ERT"
|
||||||
return string.replace(src, '\n\\begin_inset ERT\nstatus collapsed\n\\begin_layout Standard\n'
|
return string.replace(src, '\n\\begin_inset ERT\nstatus collapsed\n\\begin_layout Standard\n'
|
||||||
+ dst + '\n\\end_layout\n\\end_inset\n')
|
+ dst + '\n\\end_layout\n\\end_inset\n')
|
||||||
|
|
||||||
def add_to_preamble(document, text):
|
def add_to_preamble(document, text):
|
||||||
@ -76,9 +76,13 @@ def convert_tablines(document):
|
|||||||
while True:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset Tabular", i)
|
i = find_token(document.body, "\\begin_inset Tabular", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
|
# LyX 1.3 inserted an extra space between \begin_inset
|
||||||
|
# and Tabular so let us try if this is the case and fix it.
|
||||||
i = find_token(document.body, "\\begin_inset Tabular", i)
|
i = find_token(document.body, "\\begin_inset Tabular", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
document.body[i] = "\\begin_inset Tabular"
|
||||||
j = find_end_of_inset(document.body, i + 1)
|
j = find_end_of_inset(document.body, i + 1)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
document.warning("Malformed LyX document: Could not find end of tabular.")
|
document.warning("Malformed LyX document: Could not find end of tabular.")
|
||||||
@ -288,7 +292,7 @@ def axe_show_label(document):
|
|||||||
document.warning("Malformed LyX document: show_label neither false nor true.")
|
document.warning("Malformed LyX document: show_label neither false nor true.")
|
||||||
else:
|
else:
|
||||||
document.warning("Malformed LyX document: show_label missing in CharStyle.")
|
document.warning("Malformed LyX document: show_label missing in CharStyle.")
|
||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
@ -418,8 +422,8 @@ def remove_inzip_options(document):
|
|||||||
def convert_inset_command(document):
|
def convert_inset_command(document):
|
||||||
"""
|
"""
|
||||||
Convert:
|
Convert:
|
||||||
\begin_inset LatexCommand cmd
|
\begin_inset LatexCommand cmd
|
||||||
to
|
to
|
||||||
\begin_inset CommandInset InsetType
|
\begin_inset CommandInset InsetType
|
||||||
LatexCommand cmd
|
LatexCommand cmd
|
||||||
"""
|
"""
|
||||||
@ -457,8 +461,8 @@ def revert_inset_command(document):
|
|||||||
Convert:
|
Convert:
|
||||||
\begin_inset CommandInset InsetType
|
\begin_inset CommandInset InsetType
|
||||||
LatexCommand cmd
|
LatexCommand cmd
|
||||||
to
|
to
|
||||||
\begin_inset LatexCommand cmd
|
\begin_inset LatexCommand cmd
|
||||||
Some insets may end up being converted to insets earlier versions of LyX
|
Some insets may end up being converted to insets earlier versions of LyX
|
||||||
will not be able to recognize. Not sure what to do about that.
|
will not be able to recognize. Not sure what to do about that.
|
||||||
"""
|
"""
|
||||||
@ -516,7 +520,7 @@ def revert_wrapfig_options(document):
|
|||||||
|
|
||||||
def convert_latexcommand_index(document):
|
def convert_latexcommand_index(document):
|
||||||
"Convert from LatexCommand form to collapsable form."
|
"Convert from LatexCommand form to collapsable form."
|
||||||
i = 0
|
i = 0
|
||||||
while True:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset CommandInset index", i)
|
i = find_token(document.body, "\\begin_inset CommandInset index", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
@ -662,7 +666,7 @@ def revert_japanese_encoding(document):
|
|||||||
document.header[j] = "\\inputencoding JIS"
|
document.header[j] = "\\inputencoding JIS"
|
||||||
k = 0
|
k = 0
|
||||||
k = find_token(document.header, "\\inputencoding SJIS-plain", 0)
|
k = find_token(document.header, "\\inputencoding SJIS-plain", 0)
|
||||||
if k != -1: # convert to UTF8 since there is currently no SJIS encoding
|
if k != -1: # convert to UTF8 since there is currently no SJIS encoding
|
||||||
document.header[k] = "\\inputencoding UTF8"
|
document.header[k] = "\\inputencoding UTF8"
|
||||||
|
|
||||||
|
|
||||||
@ -763,7 +767,7 @@ def convert_url(document):
|
|||||||
i = k
|
i = k
|
||||||
continue
|
continue
|
||||||
newstuff = ["\\begin_inset Flex URL",
|
newstuff = ["\\begin_inset Flex URL",
|
||||||
"status collapsed", "",
|
"status collapsed", "",
|
||||||
"\\begin_layout Standard",
|
"\\begin_layout Standard",
|
||||||
"",
|
"",
|
||||||
target,
|
target,
|
||||||
@ -840,7 +844,7 @@ def convert_include(document):
|
|||||||
cmd = m.group(1)
|
cmd = m.group(1)
|
||||||
fn = m.group(2)
|
fn = m.group(2)
|
||||||
opt = m.group(3)
|
opt = m.group(3)
|
||||||
insertion = ["\\begin_inset CommandInset include",
|
insertion = ["\\begin_inset CommandInset include",
|
||||||
"LatexCommand " + cmd, previewline,
|
"LatexCommand " + cmd, previewline,
|
||||||
"filename \"" + fn + "\""]
|
"filename \"" + fn + "\""]
|
||||||
newlines = 2
|
newlines = 2
|
||||||
|
Loading…
Reference in New Issue
Block a user