Jose' Matos wrote: > On Wednesday 04 June 2003 13:29, Angus Leeming wrote: >> [snip...] >> >> Thanks José. Thanks Dekel. >> >> I amalgamated your suggestions. Attached. >> >> It works fine, but I have a couple of (three) questions: > > def convert_external(lines): > external_rexp = re.compile(r'\\begin_inset External (.*),"(.*)",') > i = 0 > while 1: > i = find_token(lines, "\\begin_inset External", i) > if i == -1: > break > look = external_rexp.search(lines[i]) > top = "\\begin_inset External" > args = ['',''] > if look: > args[0] = look.group(1) > args[1] = look.group(2) > #FIXME: if the previous search fails then warn > template = "\ttemplate " + args[0] > if args[1]: > filename = "\tfilename " + args[1] > lines[i:i+1] = [top, template, filename] > i = i + 1
Not quite. If the second ExternalInset is of Template "Date" (no filename) then the result is \begin_inset External template Date filename taulogo.png where taulogo.png is filename from the first ExternalInset. Is there a filename.erase() or something? -- Angus