On Wednesday 04 June 2003 11:33, Angus Leeming wrote: > I want to add a module to lyxconvert_221.py to change this: > > \begin_inset External RasterImage,"taulogo.png","" > > \end_inset > > to this > > \begin_inset External > template RasterImage > filename taulogo.png > > \end_inset > > throwing away the final arg (here "", more generally "<string>") that holds > the parameters variable. I guess that we could retain the filename within > quotes as LyXLeX will handle that. > > Trouble is, I don't know how to split the line into its constituent parts.
I point the answer, use split. > Could someone write the 5 lines of code? Pleeeease? def convert_external(lines): i = 0 while 1: i = find_token(lines, "\\begin_inset External", i) if i == -1: break top = "\\begin_inset External" args = string.split(lines[i][len(top)+1:],',') template = "\ttemplate " + args[0] filename = "\tfilename " + args[1] lines[i:i+1] = [top, template, filename] i = i + 1 I'm not even sure this runs, if you send me a file I will teste this code for you. :-) -- José Abílio