* lib/scripts/layout2layout.py

(convert): Change "LabelType Static" to "LabelType Itemize" for
	itemize environments
	(convert): Change "LabelType Counter_EnumI" to "LabelType Enumerate"
	for enumerate environments


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@13660 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-04-13 09:10:40 +00:00
parent add226478a
commit 7d91f9f96e
2 changed files with 16 additions and 0 deletions

View File

@ -114,6 +114,7 @@ def convert(lines):
labelstring_line = -1 labelstring_line = -1
labelstringappendix_line = -1 labelstringappendix_line = -1
labeltype_line = -1 labeltype_line = -1
latextype = ""
latextype_line = -1 latextype_line = -1
style = "" style = ""
maxcounter = 0 maxcounter = 0
@ -206,6 +207,7 @@ def convert(lines):
# Remember the LatexType line # Remember the LatexType line
match = re_LatexType.match(lines[i]) match = re_LatexType.match(lines[i])
if match: if match:
latextype = string.lower(match.group(4))
latextype_line = i latextype_line = i
# Reset variables at the beginning of a style definition # Reset variables at the beginning of a style definition
@ -220,6 +222,7 @@ def convert(lines):
labelstring_line = -1 labelstring_line = -1
labelstringappendix_line = -1 labelstringappendix_line = -1
labeltype_line = -1 labeltype_line = -1
latextype = ""
latextype_line = -1 latextype_line = -1
if re_End.match(lines[i]): if re_End.match(lines[i]):
@ -233,6 +236,16 @@ def convert(lines):
else: else:
lines[latextype_line] = re_LatexType.sub(r'\1\2\3Bib_Environment', lines[latextype_line]) lines[latextype_line] = re_LatexType.sub(r'\1\2\3Bib_Environment', lines[latextype_line])
# Change "LabelType Static" to "LabelType Itemize" for itemize environments
if latextype == "item_environment" and string.lower(label) == "static":
lines[labeltype_line] = re_LabelType.sub(r'\1\2\3Itemize', lines[labeltype_line])
# Change "LabelType Counter_EnumI" to "LabelType Enumerate" for enumerate environments
if latextype == "item_environment" and string.lower(label) == "counter_enumi":
lines[labeltype_line] = re_LabelType.sub(r'\1\2\3Enumerate', lines[labeltype_line])
# Don't add the LabelCounter line later
counter = ""
# Replace # Replace
# #
# LabelString "Chapter" # LabelString "Chapter"

View File

@ -25,6 +25,9 @@ What's new
* Document input/output: * Document input/output:
- Convert definitions of itemize and enumerate environments in old layout
files correctly
* Math editor: * Math editor: