Fix importing of klewer template, add fix for recent update (null update for format 270)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18325 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
José Matox 2007-05-14 23:10:56 +00:00
parent 72e0b87a90
commit 5aefff5be0

View File

@ -340,19 +340,24 @@ key "argument"
This must be called after convert_commandparams. This must be called after convert_commandparams.
""" """
regex = re.compile(r'\S+\s*(\[[^\[\{]*\])?(\{[^}]*\})')
i = 0 i = 0
while 1: while 1:
i = find_token(document.body, "\\bibitem", i) i = find_token(document.body, "\\bibitem", i)
if i == -1: if i == -1:
break break
match = re.match(regex, document.body[i]) j = document.body[i].find('[') + 1
option = match.group(1) k = document.body[i].rfind(']')
argument = match.group(2) if j == 0: # No optional argument found
option = None
else:
option = document.body[i][j:k]
j = document.body[i].rfind('{') + 1
k = document.body[i].rfind('}')
argument = document.body[i][j:k]
lines = ['\\begin_inset LatexCommand bibitem'] lines = ['\\begin_inset LatexCommand bibitem']
if option != None: if option != None:
lines.append('label "%s"' % option[1:-1].replace('"', '\\"')) lines.append('label "%s"' % option.replace('"', '\\"'))
lines.append('key "%s"' % argument[1:-1].replace('"', '\\"')) lines.append('key "%s"' % argument.replace('"', '\\"'))
lines.append('') lines.append('')
lines.append('\\end_inset') lines.append('\\end_inset')
document.body[i:i+1] = lines document.body[i:i+1] = lines
@ -1564,7 +1569,8 @@ convert = [[246, []],
[266, []], [266, []],
[267, []], [267, []],
[268, []], [268, []],
[269, []]] [269, []],
[270, []]]
revert = [[269, [revert_beamer_alert, revert_beamer_structure]], revert = [[269, [revert_beamer_alert, revert_beamer_structure]],
[268, [revert_preamble_listings_params, revert_listings_inset, revert_include_listings]], [268, [revert_preamble_listings_params, revert_listings_inset, revert_include_listings]],