mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Convert bib_environment in layout2layout
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10715 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
10a5c58dbd
commit
7adc8beb4d
@ -1,3 +1,11 @@
|
||||
2006-01-08 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* scripts/layout2layout.py: add "LatexType Bib_Environment" to style
|
||||
if LabelType is Bibliography.
|
||||
* layouts/aastex.layout:
|
||||
* layouts/kluwer.layout: Change LatexType of Bibliography style to
|
||||
Bib_Environment.
|
||||
|
||||
2006-01-05 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* layouts/cv.layout (Bibliography): change latextype to
|
||||
|
@ -443,7 +443,7 @@ End
|
||||
|
||||
Style References
|
||||
Margin First_Dynamic
|
||||
LatexType Item_Environment
|
||||
LatexType Bib_Environment
|
||||
LatexName thebibliography
|
||||
NextNoIndent 1
|
||||
LeftMargin MM
|
||||
|
@ -344,7 +344,7 @@ End
|
||||
|
||||
Style References
|
||||
Margin First_Dynamic
|
||||
LatexType Item_Environment
|
||||
LatexType Bib_Environment
|
||||
LatexName thebibliography
|
||||
NextNoIndent 1
|
||||
LeftMargin MM
|
||||
|
@ -62,9 +62,16 @@ def convert(lines):
|
||||
re_EndPreamble = re.compile(r'^(\s*)EndPreamble', re.IGNORECASE)
|
||||
re_MaxCounter = re.compile(r'^\s*MaxCounter', re.IGNORECASE)
|
||||
re_LabelType = re.compile(r'^(\s*)(LabelType)(\s+)(\S+)', re.IGNORECASE)
|
||||
re_LatexType = re.compile(r'^(\s*)(LatexType)(\s+)(\S+)', re.IGNORECASE)
|
||||
re_Style = re.compile(r'^(\s*)(Style)(\s+)(\S+)', re.IGNORECASE)
|
||||
re_End = re.compile(r'^(\s*)(End)(\s*)$', re.IGNORECASE)
|
||||
|
||||
i = 0
|
||||
only_comment = 1
|
||||
label = ""
|
||||
space1 = ""
|
||||
latextype = ""
|
||||
style = ""
|
||||
while i < len(lines):
|
||||
|
||||
# Skip comments and empty lines
|
||||
@ -110,13 +117,30 @@ def convert(lines):
|
||||
match = re_LabelType.match(lines[i])
|
||||
if match:
|
||||
label = match.group(4)
|
||||
space1 = match.group(1)
|
||||
if string.lower(label[:8]) == "counter_":
|
||||
counter = label[8:]
|
||||
lines[i] = re_LabelType.sub(r'\1\2\3Counter', lines[i])
|
||||
# use the same indentation
|
||||
space1 = match.group(1)
|
||||
lines.insert(i + 1, "%sLabelCounter %s" % (space1, counter))
|
||||
|
||||
# Add a line "LatexType Bib_Environment" if LabelType is Bibliography
|
||||
# (or change the existing LatexType)
|
||||
match = re_LatexType.match(lines[i])
|
||||
if match:
|
||||
latextype = match.group(4)
|
||||
lines[i] = re_LatexType.sub(r'\1\2\3Bib_Environment', lines[i])
|
||||
match = re_Style.match(lines[i])
|
||||
if match:
|
||||
style = match.group(4)
|
||||
label = ""
|
||||
space1 = ""
|
||||
latextype = ""
|
||||
if re_End.match(lines[i]) and string.lower(label) == "bibliography":
|
||||
if (latextype == ""):
|
||||
lines.insert(i, "%sLatexType Bib_Environment" % space1)
|
||||
i = i + 1
|
||||
|
||||
i = i + 1
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user