Fix bug 4984: Revert Flex URL to InsetURL.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25477 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-07-07 16:12:32 +00:00
parent 341e4480df
commit 10f7b8cb35

View File

@ -1116,6 +1116,36 @@ def revert_href(document):
["\\begin_inset CommandInset url", "LatexCommand url"] ["\\begin_inset CommandInset url", "LatexCommand url"]
i = i + 2 i = i + 2
def revert_url(document):
'Reverts Flex URL insets to old-style URL insets'
i = 0
while True:
i = find_token(document.body, "\\begin_inset Flex URL", i)
if i == -1:
return
j = find_end_of_inset(document.body, i)
if j == -1:
document.warning("Can't find end of inset in revert_url!")
return
k = find_default_layout(document, i, j)
if k == -1:
document.warning("Can't find default layout in revert_url!")
i = j
continue
l = find_end_of(document.body, k, "\\begin_layout", "\\end_layout")
if l == -1 or l >= j:
document.warning("Can't find end of default layout in revert_url!")
i = j
continue
# OK, so the inset's data is between lines k and l.
data = " ".join(document.body[k+1:l])
data = data.strip()
newinset = ["\\begin_inset LatexCommand url", "target \"" + data + "\"",\
"", "\\end_inset"]
document.body[i:j+1] = newinset
i = i + len(newinset)
def convert_include(document): def convert_include(document):
'Converts include insets to new format.' 'Converts include insets to new format.'
@ -2713,7 +2743,7 @@ revert = [[337, [revert_polytonicgreek]],
[297, [revert_macro_optional_params]], [297, [revert_macro_optional_params]],
[296, [revert_albanian, revert_lowersorbian, revert_uppersorbian]], [296, [revert_albanian, revert_lowersorbian, revert_uppersorbian]],
[295, [revert_include]], [295, [revert_include]],
[294, [revert_href]], [294, [revert_href, revert_url]],
[293, [revert_pdf_options_2]], [293, [revert_pdf_options_2]],
[292, [revert_inset_info]], [292, [revert_inset_info]],
[291, [revert_japanese, revert_japanese_encoding]], [291, [revert_japanese, revert_japanese_encoding]],