Am Sonntag, 8. Januar 2006 13:43 schrieb Jean-Marc Lasgouttes:
> >>>>> "Georg" == Georg Baum <[EMAIL PROTECTED]> writes:
> 
> Georg> Am Donnerstag, 5. Januar 2006 12:19 schrieb Jean-Marc
> Georg> Lasgouttes:
> >>  The following change was probably forgotten by whoever introduced
> >> the Bib_Environment tag.
> >> 
> >> Georg, is this something layout2layout c/should do?
> 
> Georg> Probably, but how should it recognize that Bib_Environment is
> Georg> needed?
> 
> It is when LabelType is Bibliography. In 1.5 I would like to change
> this and put back the LabelType to Top_environment, as it should.

Then it looks like the attached. I also changed two other forgotten 
occurences of Bib_Environment.

OK to go in?


Georg
Index: lib/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.754
diff -u -p -r1.754 ChangeLog
--- lib/ChangeLog	6 Jan 2006 10:23:33 -0000	1.754
+++ lib/ChangeLog	8 Jan 2006 14:28:54 -0000
@@ -1,3 +1,11 @@
+2006-01-08  Georg Baum  <[EMAIL PROTECTED]>
+
+	* 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  <[EMAIL PROTECTED]>
 
 	* layouts/cv.layout (Bibliography): change latextype to
Index: lib/layouts/aastex.layout
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/layouts/aastex.layout,v
retrieving revision 1.11
diff -u -p -r1.11 aastex.layout
--- lib/layouts/aastex.layout	21 Oct 2005 16:11:33 -0000	1.11
+++ lib/layouts/aastex.layout	8 Jan 2006 14:28:54 -0000
@@ -443,7 +443,7 @@ End
 
 Style References
 	Margin                First_Dynamic
-	LatexType             Item_Environment
+	LatexType             Bib_Environment
 	LatexName             thebibliography
 	NextNoIndent          1
 	LeftMargin            MM
Index: lib/layouts/kluwer.layout
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/layouts/kluwer.layout,v
retrieving revision 1.10
diff -u -p -r1.10 kluwer.layout
--- lib/layouts/kluwer.layout	21 Oct 2005 16:11:34 -0000	1.10
+++ lib/layouts/kluwer.layout	8 Jan 2006 14:28:54 -0000
@@ -344,7 +344,7 @@ End
 
 Style References
 	Margin                First_Dynamic
-	LatexType             Item_Environment
+	LatexType             Bib_Environment
 	LatexName             thebibliography
 	NextNoIndent          1
 	LeftMargin            MM
Index: lib/scripts/layout2layout.py
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/scripts/layout2layout.py,v
retrieving revision 1.2
diff -u -p -r1.2 layout2layout.py
--- lib/scripts/layout2layout.py	24 Oct 2005 14:13:44 -0000	1.2
+++ lib/scripts/layout2layout.py	8 Jan 2006 14:28:54 -0000
@@ -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,12 +117,29 @@ 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
 

Reply via email to