#! /usr/bin/env python
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
# file layout2layout.py
# This file is part of LyX, the document processor.
labelstring_line = -1
labelstringappendix_line = -1
labeltype_line = -1
+ latextype = ""
latextype_line = -1
style = ""
maxcounter = 0
return
error('Cannot convert file format %s' % format)
else:
- lines.insert(i, "Format 2")
+ lines.insert(i, "Format 2")
only_comment = 0
continue
# Remember the LatexType line
match = re_LatexType.match(lines[i])
if match:
+ latextype = string.lower(match.group(4))
latextype_line = i
# Reset variables at the beginning of a style definition
labelstring_line = -1
labelstringappendix_line = -1
labeltype_line = -1
+ latextype = ""
latextype_line = -1
if re_End.match(lines[i]):
else:
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
#
# LabelString "Chapter"
i = i + 1
# Add the TocLevel setting for sectioning styles
- if toclevels.has_key(style) and maxcounter <= toclevels[style]:
+ if toclevels.has_key(style) and maxcounter <= toclevels[style]:
lines.insert(i, '%sTocLevel %d' % (space1, toclevels[style]))
i = i + 1