mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Fix indentation (from 2 spaces to 4) in lyx_1_6.py
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20818 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7e30f47252
commit
b352c78905
@ -257,66 +257,66 @@ def remove_inzip_options(document):
|
||||
|
||||
|
||||
def convert_inset_command(document):
|
||||
"""
|
||||
Convert:
|
||||
\begin_inset LatexCommand cmd
|
||||
to
|
||||
\begin_inset CommandInset InsetType
|
||||
LatexCommand cmd
|
||||
"""
|
||||
i = 0
|
||||
while 1:
|
||||
i = find_token(document.body, "\\begin_inset LatexCommand", i)
|
||||
if i == -1:
|
||||
return
|
||||
line = document.body[i]
|
||||
r = re.compile(r'\\begin_inset LatexCommand (.*)$')
|
||||
m = r.match(line)
|
||||
cmdName = m.group(1)
|
||||
insetName = ""
|
||||
#this is adapted from factory.cpp
|
||||
if cmdName[0:4].lower() == "cite":
|
||||
insetName = "citation"
|
||||
elif cmdName == "url" or cmdName == "htmlurl":
|
||||
insetName = "url"
|
||||
elif cmdName[-3:] == "ref":
|
||||
insetName = "ref"
|
||||
elif cmdName == "tableofcontents":
|
||||
insetName = "toc"
|
||||
elif cmdName == "printnomenclature":
|
||||
insetName = "nomencl_print"
|
||||
elif cmdName == "printindex":
|
||||
insetName = "index_print"
|
||||
else:
|
||||
insetName = cmdName
|
||||
insertion = ["\\begin_inset CommandInset " + insetName, "LatexCommand " + cmdName]
|
||||
document.body[i : i+1] = insertion
|
||||
"""
|
||||
Convert:
|
||||
\begin_inset LatexCommand cmd
|
||||
to
|
||||
\begin_inset CommandInset InsetType
|
||||
LatexCommand cmd
|
||||
"""
|
||||
i = 0
|
||||
while 1:
|
||||
i = find_token(document.body, "\\begin_inset LatexCommand", i)
|
||||
if i == -1:
|
||||
return
|
||||
line = document.body[i]
|
||||
r = re.compile(r'\\begin_inset LatexCommand (.*)$')
|
||||
m = r.match(line)
|
||||
cmdName = m.group(1)
|
||||
insetName = ""
|
||||
#this is adapted from factory.cpp
|
||||
if cmdName[0:4].lower() == "cite":
|
||||
insetName = "citation"
|
||||
elif cmdName == "url" or cmdName == "htmlurl":
|
||||
insetName = "url"
|
||||
elif cmdName[-3:] == "ref":
|
||||
insetName = "ref"
|
||||
elif cmdName == "tableofcontents":
|
||||
insetName = "toc"
|
||||
elif cmdName == "printnomenclature":
|
||||
insetName = "nomencl_print"
|
||||
elif cmdName == "printindex":
|
||||
insetName = "index_print"
|
||||
else:
|
||||
insetName = cmdName
|
||||
insertion = ["\\begin_inset CommandInset " + insetName, "LatexCommand " + cmdName]
|
||||
document.body[i : i+1] = insertion
|
||||
|
||||
|
||||
def revert_inset_command(document):
|
||||
"""
|
||||
Convert:
|
||||
\begin_inset CommandInset InsetType
|
||||
LatexCommand cmd
|
||||
to
|
||||
\begin_inset LatexCommand cmd
|
||||
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.
|
||||
"""
|
||||
i = 0
|
||||
while 1:
|
||||
i = find_token(document.body, "\\begin_inset CommandInset", i)
|
||||
if i == -1:
|
||||
return
|
||||
nextline = document.body[i+1]
|
||||
r = re.compile(r'LatexCommand\s+(.*)$')
|
||||
m = r.match(nextline)
|
||||
if not m:
|
||||
document.warning("Malformed LyX document: Missing LatexCommand in " + document.body[i] + ".")
|
||||
continue
|
||||
cmdName = m.group(1)
|
||||
insertion = ["\\begin_inset LatexCommand " + cmdName]
|
||||
document.body[i : i+2] = insertion
|
||||
"""
|
||||
Convert:
|
||||
\begin_inset CommandInset InsetType
|
||||
LatexCommand cmd
|
||||
to
|
||||
\begin_inset LatexCommand cmd
|
||||
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.
|
||||
"""
|
||||
i = 0
|
||||
while 1:
|
||||
i = find_token(document.body, "\\begin_inset CommandInset", i)
|
||||
if i == -1:
|
||||
return
|
||||
nextline = document.body[i+1]
|
||||
r = re.compile(r'LatexCommand\s+(.*)$')
|
||||
m = r.match(nextline)
|
||||
if not m:
|
||||
document.warning("Malformed LyX document: Missing LatexCommand in " + document.body[i] + ".")
|
||||
continue
|
||||
cmdName = m.group(1)
|
||||
insertion = ["\\begin_inset LatexCommand " + cmdName]
|
||||
document.body[i : i+2] = insertion
|
||||
|
||||
|
||||
def convert_wrapfig_options(document):
|
||||
|
Loading…
Reference in New Issue
Block a user