lyx2lyx/lyx_1_6.py: add conversion routine I forgot in r20462

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20466 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2007-09-24 14:37:10 +00:00
parent f319fdbc2a
commit c5372ca60e

View File

@ -178,12 +178,10 @@ def remove_manifest(document):
"Remove the manifest section" "Remove the manifest section"
document.manifest = None document.manifest = None
##
# Discard PDF options for hyperref
#
# Discard PDF options for hyperref
def revert_pdf_options(document): def revert_pdf_options(document):
"Revert PDF options for hyperref. " "Revert PDF options for hyperref."
i = 0 i = 0
i = find_token(document.header, "\\use_hyperref", i) i = find_token(document.header, "\\use_hyperref", i)
if i != -1: if i != -1:
@ -258,8 +256,27 @@ def remove_inzip_options(document):
i = i + 1 i = i + 1
def convert_wrapfig_options(document):
"Convert optional options for wrap floats (wrapfig)."
# adds the tokens "lines", "placement", and "overhang"
i = 0
while True:
i = find_token(document.body, "\\begin_inset Wrap figure", i)
if i == -1:
return
document.body.insert(i + 1, "lines 0")
j = find_token(document.body, "placement", i)
# placement can be already set or not; if not, set it
if j == i+2:
document.body.insert(i + 3, "overhang 0col%")
else:
document.body.insert(i + 2, "placement o")
document.body.insert(i + 3, "overhang 0col%")
i = i + 1
def revert_wrapfig_options(document): def revert_wrapfig_options(document):
"Revert optional options for wrap floats (wrapfig). " "Revert optional options for wrap floats (wrapfig)."
i = 0 i = 0
while True: while True:
i = find_tokens(document.body, "lines", i) i = find_tokens(document.body, "lines", i)
@ -291,7 +308,7 @@ convert = [
[284, []], [284, []],
[285, []], # an empty manifest is automatically added [285, []], # an empty manifest is automatically added
[286, []], [286, []],
[287, []] [287, [convert_wrapfig_options]]
] ]
revert = [ revert = [