Make revert_flexnames more pythonic.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36086 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-11-04 17:48:53 +00:00
parent 883520c197
commit d3fc1c21d1

View File

@ -1654,66 +1654,66 @@ def convert_flexnames(document):
i += 1 i += 1
flex_insets = [ flex_insets = {
["Alert", "CharStyle:Alert"], "Alert" : "CharStyle:Alert",
["Code", "CharStyle:Code"], "Code" : "CharStyle:Code",
["Concepts", "CharStyle:Concepts"], "Concepts" : "CharStyle:Concepts",
["E-Mail", "CharStyle:E-Mail"], "E-Mail" : "CharStyle:E-Mail",
["Emph", "CharStyle:Emph"], "Emph" : "CharStyle:Emph",
["Expression", "CharStyle:Expression"], "Expression" : "CharStyle:Expression",
["Initial", "CharStyle:Initial"], "Initial" : "CharStyle:Initial",
["Institute", "CharStyle:Institute"], "Institute" : "CharStyle:Institute",
["Meaning", "CharStyle:Meaning"], "Meaning" : "CharStyle:Meaning",
["Noun", "CharStyle:Noun"], "Noun" : "CharStyle:Noun",
["Strong", "CharStyle:Strong"], "Strong" : "CharStyle:Strong",
["Structure", "CharStyle:Structure"], "Structure" : "CharStyle:Structure",
["ArticleMode", "Custom:ArticleMode"], "ArticleMode" : "Custom:ArticleMode",
["Endnote", "Custom:Endnote"], "Endnote" : "Custom:Endnote",
["Glosse", "Custom:Glosse"], "Glosse" : "Custom:Glosse",
["PresentationMode", "Custom:PresentationMode"], "PresentationMode" : "Custom:PresentationMode",
["Tri-Glosse", "Custom:Tri-Glosse"] "Tri-Glosse" : "Custom:Tri-Glosse"
] }
flex_elements = [ flex_elements = {
["Abbrev", "Element:Abbrev"], "Abbrev" : "Element:Abbrev",
["CCC-Code", "Element:CCC-Code"], "CCC-Code" : "Element:CCC-Code",
["Citation-number", "Element:Citation-number"], "Citation-number" : "Element:Citation-number",
["City", "Element:City"], "City" : "Element:City",
["Code", "Element:Code"], "Code" : "Element:Code",
["CODEN", "Element:CODEN"], "CODEN" : "Element:CODEN",
["Country", "Element:Country"], "Country" : "Element:Country",
["Day", "Element:Day"], "Day" : "Element:Day",
["Directory", "Element:Directory"], "Directory" : "Element:Directory",
["Dscr", "Element:Dscr"], "Dscr" : "Element:Dscr",
["Email", "Element:Email"], "Email" : "Element:Email",
["Emph", "Element:Emph"], "Emph" : "Element:Emph",
["Filename", "Element:Filename"], "Filename" : "Element:Filename",
["Firstname", "Element:Firstname"], "Firstname" : "Element:Firstname",
["Fname", "Element:Fname"], "Fname" : "Element:Fname",
["GuiButton", "Element:GuiButton"], "GuiButton" : "Element:GuiButton",
["GuiMenu", "Element:GuiMenu"], "GuiMenu" : "Element:GuiMenu",
["GuiMenuItem", "Element:GuiMenuItem"], "GuiMenuItem" : "Element:GuiMenuItem",
["ISSN", "Element:ISSN"], "ISSN" : "Element:ISSN",
["Issue-day", "Element:Issue-day"], "Issue-day" : "Element:Issue-day",
["Issue-months", "Element:Issue-months"], "Issue-months" : "Element:Issue-months",
["Issue-number", "Element:Issue-number"], "Issue-number" : "Element:Issue-number",
["KeyCap", "Element:KeyCap"], "KeyCap" : "Element:KeyCap",
["KeyCombo", "Element:KeyCombo"], "KeyCombo" : "Element:KeyCombo",
["Keyword", "Element:Keyword"], "Keyword" : "Element:Keyword",
["Literal", "Element:Literal"], "Literal" : "Element:Literal",
["MenuChoice", "Element:MenuChoice"], "MenuChoice" : "Element:MenuChoice",
["Month", "Element:Month"], "Month" : "Element:Month",
["Orgdiv", "Element:Orgdiv"], "Orgdiv" : "Element:Orgdiv",
["Orgname", "Element:Orgname"], "Orgname" : "Element:Orgname",
["Postcode", "Element:Postcode"], "Postcode" : "Element:Postcode",
["SS-Code", "Element:SS-Code"], "SS-Code" : "Element:SS-Code",
["SS-Title", "Element:SS-Title"], "SS-Title" : "Element:SS-Title",
["State", "Element:State"], "State" : "Element:State",
["Street", "Element:Street"], "Street" : "Element:Street",
["Surname", "Element:Surname"], "Surname" : "Element:Surname",
["Volume", "Element:Volume"], "Volume" : "Element:Volume",
["Year", "Element:Year"] "Year" : "Element:Year"
] }
def revert_flexnames(document): def revert_flexnames(document):
@ -1733,13 +1733,9 @@ def revert_flexnames(document):
document.warning("Illegal flex inset: " + document.body[i]) document.warning("Illegal flex inset: " + document.body[i])
i += 1 i += 1
continue continue
style = m.group(1) style = m.group(1)
for f in flexlist: if style in flexlist:
if f[0] == style: document.body[i] = "\\begin_inset Flex " + flexlist[style]
document.body[i] = "\\begin_inset Flex " + f[1]
break
i += 1 i += 1