From c75044656616b4a887050cd7a3c57860c039d141 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Thu, 1 Nov 2007 22:17:54 +0000 Subject: [PATCH] lyx_1_6.py: fix dataloss in URL conversion routine git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21359 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_1_6.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py index c5fea14fef..1290ca9c2b 100644 --- a/lib/lyx2lyx/lyx_1_6.py +++ b/lib/lyx2lyx/lyx_1_6.py @@ -521,20 +521,28 @@ def convert_url(document): 'Convert url insets to url charstyles' if document.backend == "docbook": return - r = re.compile(r'target\s+"(.*)"') didone = False i = 0 while True: i = find_token(document.body, "\\begin_inset CommandInset url", i) if i == -1: break + n = find_token(document.body, "name", i) + if n == i + 2: + # place the URL name in typewriter before the new URL insert + # grab the name 'bla' from the e.g. the line 'name "bla"', + # therefore start with the 6th character + name = document.body[n][6:-1] + newname = ["\\begin_layout Standard", + name + " "] + document.body[i-1:i-1] = newname + i = i + 1 j = find_token(document.body, "target", i) if j == -1: document.warning("Malformed LyX document: Can't find target for url inset") i = j continue - m = r.match(document.body[j]) - target = m.group(1) + target = document.body[j][8:-1] k = find_token(document.body, "\\end_inset", j) if k == -1: document.warning("Malformed LyX document: Can't find end of url inset") @@ -543,6 +551,7 @@ def convert_url(document): newstuff = ["\\begin_inset Flex URL", "status collapsed", "", "\\begin_layout Standard", + "", target, "\\end_layout", ""] -- 2.39.2