From 3e885523c305c260a52c4b6e65047bc6f5f3a867 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Fri, 21 Oct 2005 16:11:36 +0000 Subject: [PATCH] layout file converter for layout files in old format git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10565 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ChangeLog | 6 ++ lib/Makefile.am | 1 + lib/layouts/IEEEtran.layout | 1 + lib/layouts/aa.layout | 1 + lib/layouts/aapaper.inc | 1 + lib/layouts/aapaper.layout | 1 + lib/layouts/aastex.layout | 1 + lib/layouts/agu-dtd.layout | 1 + lib/layouts/agu_stdclass.inc | 1 + lib/layouts/agu_stdcounters.inc | 1 + lib/layouts/agu_stdlists.inc | 1 + lib/layouts/agu_stdsections.inc | 1 + lib/layouts/agu_stdtitle.inc | 1 + lib/layouts/agums.layout | 1 + lib/layouts/aguplus.inc | 1 + lib/layouts/amsart-plain.layout | 1 + lib/layouts/amsart-seq.layout | 1 + lib/layouts/amsart.layout | 1 + lib/layouts/amsbook.layout | 1 + lib/layouts/amsdefs.inc | 1 + lib/layouts/amsmaths-plain.inc | 1 + lib/layouts/amsmaths-seq.inc | 1 + lib/layouts/amsmaths.inc | 1 + lib/layouts/apa.layout | 1 + lib/layouts/article.layout | 1 + lib/layouts/book.layout | 1 + lib/layouts/broadway.layout | 1 + lib/layouts/chess.layout | 1 + lib/layouts/cl2emult.layout | 1 + lib/layouts/cv.layout | 1 + lib/layouts/db_lyxmacros.inc | 1 + lib/layouts/db_stdcharstyles.inc | 1 + lib/layouts/db_stdclass.inc | 1 + lib/layouts/db_stdcounters.inc | 1 + lib/layouts/db_stdlayouts.inc | 1 + lib/layouts/db_stdlists.inc | 1 + lib/layouts/db_stdsections.inc | 1 + lib/layouts/db_stdstarsections.inc | 1 + lib/layouts/db_stdstruct.inc | 1 + lib/layouts/db_stdtitle.inc | 1 + lib/layouts/dinbrief.layout | 1 + lib/layouts/docbook-book.layout | 1 + lib/layouts/docbook-chapter.layout | 3 +- lib/layouts/docbook-section.layout | 1 + lib/layouts/docbook.layout | 1 + lib/layouts/dtk.layout | 1 + lib/layouts/egs.layout | 1 + lib/layouts/elsart.layout | 1 + lib/layouts/entcs.layout | 1 + lib/layouts/extarticle.layout | 1 + lib/layouts/extbook.layout | 1 + lib/layouts/extletter.layout | 1 + lib/layouts/extreport.layout | 1 + lib/layouts/foils.layout | 1 + lib/layouts/g-brief-de.layout | 1 + lib/layouts/g-brief-en.layout | 1 + lib/layouts/g-brief2.layout | 1 + lib/layouts/heb-article.layout | 1 + lib/layouts/heb-letter.layout | 1 + lib/layouts/hollywood.layout | 1 + lib/layouts/ijmpd.layout | 1 + lib/layouts/jgrga.layout | 1 + lib/layouts/kluwer.layout | 1 + lib/layouts/latex8.layout | 1 + lib/layouts/letter.layout | 1 + lib/layouts/linuxdoc.layout | 1 + lib/layouts/literate-article.layout | 1 + lib/layouts/literate-book.layout | 1 + lib/layouts/literate-report.layout | 1 + lib/layouts/literate-scrap.inc | 1 + lib/layouts/llncs.layout | 1 + lib/layouts/ltugboat.layout | 1 + lib/layouts/lyxmacros.inc | 1 + lib/layouts/manpage.layout | 1 + lib/layouts/memoir.layout | 1 + lib/layouts/mwart.layout | 1 + lib/layouts/mwbk.layout | 1 + lib/layouts/mwrep.layout | 1 + lib/layouts/numarticle.inc | 1 + lib/layouts/numreport.inc | 1 + lib/layouts/numrevtex.inc | 1 + lib/layouts/paper.layout | 1 + lib/layouts/report.layout | 1 + lib/layouts/revtex.layout | 1 + lib/layouts/revtex4.layout | 1 + lib/layouts/scrartcl.layout | 1 + lib/layouts/scrbook.layout | 1 + lib/layouts/scrclass.inc | 1 + lib/layouts/scrlettr.layout | 1 + lib/layouts/scrlttr2.layout | 1 + lib/layouts/scrreprt.layout | 1 + lib/layouts/seminar.layout | 1 + lib/layouts/siamltex.layout | 1 + lib/layouts/slides.layout | 1 + lib/layouts/spie.layout | 1 + lib/layouts/stdclass.inc | 1 + lib/layouts/stdcounters.inc | 1 + lib/layouts/stdfloats.inc | 1 + lib/layouts/stdlayouts.inc | 1 + lib/layouts/stdletter.inc | 1 + lib/layouts/stdlists.inc | 1 + lib/layouts/stdsections.inc | 1 + lib/layouts/stdstarsections.inc | 1 + lib/layouts/stdstruct.inc | 1 + lib/layouts/stdtitle.inc | 1 + lib/layouts/svglobal.layout | 1 + lib/layouts/svjog.layout | 1 + lib/layouts/svjour.inc | 1 + lib/layouts/svprobth.layout | 1 + lib/scripts/layout2layout.py | 149 ++++++++++++++++++++++++++++ src/ChangeLog | 5 + src/lyxtextclass.C | 70 ++++++++++++- 112 files changed, 336 insertions(+), 4 deletions(-) create mode 100644 lib/scripts/layout2layout.py diff --git a/lib/ChangeLog b/lib/ChangeLog index 8e785a69eb..78ef94bef7 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,9 @@ +2005-10-21 Georg Baum + + * layouts/*.{inc,layout}: Add format information + * scripts/layout2layout.py: new layout file converter + * Makefile.am: install scripts/layout2layout.py + 2005-10-12 Hartmut Haase * example/de_Minipage.lyx: update. diff --git a/lib/Makefile.am b/lib/Makefile.am index 4435b51dc9..26b500e67f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -848,6 +848,7 @@ dist_scripts_DATA = \ scripts/fig2pdftex.sh \ scripts/fig2pstex.sh \ scripts/fig_copy.sh \ + scripts/layout2layout.py \ scripts/legacy_lyxpreview2ppm.py \ scripts/listerrors \ scripts/lyxpreview2bitmap.py \ diff --git a/lib/layouts/IEEEtran.layout b/lib/layouts/IEEEtran.layout index ba2337137d..d09540e181 100644 --- a/lib/layouts/IEEEtran.layout +++ b/lib/layouts/IEEEtran.layout @@ -14,6 +14,7 @@ # the author information area. There is a LaTeX 2.09 IEEEtran.sty available # also but LyX doesn't support 2.09 stuff so don't get that one. +Format 2 Style Standard Margin Static LatexType Paragraph diff --git a/lib/layouts/aa.layout b/lib/layouts/aa.layout index ccbc22c60e..1b2f534b95 100644 --- a/lib/layouts/aa.layout +++ b/lib/layouts/aa.layout @@ -11,6 +11,7 @@ # abstract is command +Format 2 Columns 2 Sides 2 SecNumDepth 3 diff --git a/lib/layouts/aapaper.inc b/lib/layouts/aapaper.inc index 8c5970a10e..dcb474d05f 100644 --- a/lib/layouts/aapaper.inc +++ b/lib/layouts/aapaper.inc @@ -5,6 +5,7 @@ # Author: Peter Sütterlin +Format 2 Style Subtitle Margin Static LatexType Command diff --git a/lib/layouts/aapaper.layout b/lib/layouts/aapaper.layout index 4b0abdaeb8..c3231a5110 100644 --- a/lib/layouts/aapaper.layout +++ b/lib/layouts/aapaper.layout @@ -14,6 +14,7 @@ # and reconfigure LyX (after running texhash, of course). +Format 2 Columns 2 Sides 2 SecNumDepth 3 diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout index e8b20591dc..bb72ea78bc 100644 --- a/lib/layouts/aastex.layout +++ b/lib/layouts/aastex.layout @@ -30,6 +30,7 @@ # Version 1.3 5/7/04 - Updated for AASTeX 5.2 +Format 2 Columns 1 Sides 1 #SecNumDepth 3 diff --git a/lib/layouts/agu-dtd.layout b/lib/layouts/agu-dtd.layout index e89cddb3b4..f1e605cef3 100644 --- a/lib/layouts/agu-dtd.layout +++ b/lib/layouts/agu-dtd.layout @@ -5,6 +5,7 @@ # Martin Vermeer +Format 2 Input agu_stdclass.inc Input numarticle.inc diff --git a/lib/layouts/agu_stdclass.inc b/lib/layouts/agu_stdclass.inc index af9cb719c4..4860d7499d 100644 --- a/lib/layouts/agu_stdclass.inc +++ b/lib/layouts/agu_stdclass.inc @@ -6,6 +6,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. +Format 2 OutputType docbook Columns 1 diff --git a/lib/layouts/agu_stdcounters.inc b/lib/layouts/agu_stdcounters.inc index cacc1a63bb..04a69f4453 100644 --- a/lib/layouts/agu_stdcounters.inc +++ b/lib/layouts/agu_stdcounters.inc @@ -4,6 +4,7 @@ # This include file contains all the counters that are defined as standard # in AGU-Article LyX layouts. +Format 2 Counter Name sect1 Within section diff --git a/lib/layouts/agu_stdlists.inc b/lib/layouts/agu_stdlists.inc index 87d8d96659..6468c63cf8 100644 --- a/lib/layouts/agu_stdlists.inc +++ b/lib/layouts/agu_stdlists.inc @@ -6,6 +6,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. +Format 2 Input stdlists.inc diff --git a/lib/layouts/agu_stdsections.inc b/lib/layouts/agu_stdsections.inc index 792bd46826..75f0ad309c 100644 --- a/lib/layouts/agu_stdsections.inc +++ b/lib/layouts/agu_stdsections.inc @@ -6,6 +6,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. +Format 2 Input stdsections.inc Style Part diff --git a/lib/layouts/agu_stdtitle.inc b/lib/layouts/agu_stdtitle.inc index 38b506ac4f..254d2244bc 100644 --- a/lib/layouts/agu_stdtitle.inc +++ b/lib/layouts/agu_stdtitle.inc @@ -6,6 +6,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. +Format 2 Input stdtitle.inc diff --git a/lib/layouts/agums.layout b/lib/layouts/agums.layout index a34f4a7d77..4e96d59b8a 100644 --- a/lib/layouts/agums.layout +++ b/lib/layouts/agums.layout @@ -4,6 +4,7 @@ # Author: Martin Vermeer +Format 2 Input aguplus.inc ClassOptions diff --git a/lib/layouts/aguplus.inc b/lib/layouts/aguplus.inc index 0f42d58562..0d2737ab73 100644 --- a/lib/layouts/aguplus.inc +++ b/lib/layouts/aguplus.inc @@ -6,6 +6,7 @@ # ftp://ftp.agu.org/journals/latex/journals +Format 2 Input stdclass.inc Input numarticle.inc diff --git a/lib/layouts/amsart-plain.layout b/lib/layouts/amsart-plain.layout index 3d303ce973..fe23540236 100644 --- a/lib/layouts/amsart-plain.layout +++ b/lib/layouts/amsart-plain.layout @@ -8,6 +8,7 @@ # Probably broken by Jean-Marc Lasgouttes # modified and modularized by Emmanuel GUREGHIAN +Format 2 Input amsart.layout # Change the definitions of the theorem-like environments to get unnumbered diff --git a/lib/layouts/amsart-seq.layout b/lib/layouts/amsart-seq.layout index 4a3446cffc..e94e3accee 100644 --- a/lib/layouts/amsart-seq.layout +++ b/lib/layouts/amsart-seq.layout @@ -12,6 +12,7 @@ # Probably broken by Jean-Marc Lasgouttes # modified and modularized by Emmanuel GUREGHIAN +Format 2 Input amsart.layout # Change the definitions of the theorem-like environments to get a diff --git a/lib/layouts/amsart.layout b/lib/layouts/amsart.layout index 0aceca126d..b9c2c75cf9 100644 --- a/lib/layouts/amsart.layout +++ b/lib/layouts/amsart.layout @@ -7,6 +7,7 @@ # Probably broken by Jean-Marc Lasgouttes # modified and modularized by Emmanuel GUREGHIAN +Format 2 Columns 1 Sides 2 PageStyle Headers diff --git a/lib/layouts/amsbook.layout b/lib/layouts/amsbook.layout index 0839396d76..eaf39ca052 100644 --- a/lib/layouts/amsbook.layout +++ b/lib/layouts/amsbook.layout @@ -8,6 +8,7 @@ # modified and modularized by Emmanuel GUREGHIAN +Format 2 Columns 1 Sides 2 PageStyle Headers diff --git a/lib/layouts/amsdefs.inc b/lib/layouts/amsdefs.inc index c9240e3f30..3b93697157 100644 --- a/lib/layouts/amsdefs.inc +++ b/lib/layouts/amsdefs.inc @@ -3,6 +3,7 @@ # modified and modularized by Emmanuel GUREGHIAN # Including the maths stuff +Format 2 Input amsmaths.inc # The AMS documentclasses use the package amsmath and provide the diff --git a/lib/layouts/amsmaths-plain.inc b/lib/layouts/amsmaths-plain.inc index 4dd901d103..e361a6c557 100644 --- a/lib/layouts/amsmaths-plain.inc +++ b/lib/layouts/amsmaths-plain.inc @@ -29,6 +29,7 @@ # - Conclusion +Format 2 Style Theorem LatexName thm* LabelString "Theorem." diff --git a/lib/layouts/amsmaths-seq.inc b/lib/layouts/amsmaths-seq.inc index 5bdc19ff07..c00acee278 100644 --- a/lib/layouts/amsmaths-seq.inc +++ b/lib/layouts/amsmaths-seq.inc @@ -28,6 +28,7 @@ # - Conclusion +Format 2 Style Theorem Preamble \theoremstyle{plain} diff --git a/lib/layouts/amsmaths.inc b/lib/layouts/amsmaths.inc index aad215773f..4e8766bbfd 100644 --- a/lib/layouts/amsmaths.inc +++ b/lib/layouts/amsmaths.inc @@ -47,6 +47,7 @@ # - Fact # - Fact* +Format 2 Preamble \theoremstyle{plain} \newtheorem{thm}{Theorem}[section] diff --git a/lib/layouts/apa.layout b/lib/layouts/apa.layout index 924bc290c7..5e1db0e06b 100644 --- a/lib/layouts/apa.layout +++ b/lib/layouts/apa.layout @@ -2,6 +2,7 @@ # \DeclareLaTeXClass[apa,apacite.sty]{article (APA)} # Author: Randy Gobbel +Format 2 Columns 1 Sides 1 PageStyle Headers diff --git a/lib/layouts/article.layout b/lib/layouts/article.layout index 038dbeef8b..6269aa7734 100644 --- a/lib/layouts/article.layout +++ b/lib/layouts/article.layout @@ -5,6 +5,7 @@ # Transposed by Pascal André # Heavily modifed and enhanced by serveral developers. +Format 2 Input stdclass.inc Input numarticle.inc diff --git a/lib/layouts/book.layout b/lib/layouts/book.layout index 5ec77cb549..7ef4ca3583 100644 --- a/lib/layouts/book.layout +++ b/lib/layouts/book.layout @@ -6,6 +6,7 @@ # Heavily modifed and enhanced by serveral developers. +Format 2 Input stdclass.inc Input numreport.inc diff --git a/lib/layouts/broadway.layout b/lib/layouts/broadway.layout index 0a726468ab..5ea9c61d4f 100644 --- a/lib/layouts/broadway.layout +++ b/lib/layouts/broadway.layout @@ -3,6 +3,7 @@ # For theater plays +Format 2 Columns 1 Sides 1 SecNumDepth 2 diff --git a/lib/layouts/chess.layout b/lib/layouts/chess.layout index 92d76a0487..7ddde98fd7 100644 --- a/lib/layouts/chess.layout +++ b/lib/layouts/chess.layout @@ -16,6 +16,7 @@ # \vspace*{-0.5in}) # +Format 2 Preamble \usepackage[ps,mover]{lyxskak} %%% initialize board diff --git a/lib/layouts/cl2emult.layout b/lib/layouts/cl2emult.layout index 5e01b462b7..22c257bd87 100644 --- a/lib/layouts/cl2emult.layout +++ b/lib/layouts/cl2emult.layout @@ -3,6 +3,7 @@ # Springer's cl2emult textclass definition file. # Author : André Poenitz +Format 2 Columns 1 Sides 1 SecNumDepth 2 diff --git a/lib/layouts/cv.layout b/lib/layouts/cv.layout index 741b52aecd..e6f07949b3 100644 --- a/lib/layouts/cv.layout +++ b/lib/layouts/cv.layout @@ -4,6 +4,7 @@ # Author : Jean-Marc Lasgouttes (Jean-Marc.Lasgouttes@inria.fr) +Format 2 Columns 1 Sides 1 SecNumDepth -1 diff --git a/lib/layouts/db_lyxmacros.inc b/lib/layouts/db_lyxmacros.inc index c43bc3546b..8086cf43a8 100644 --- a/lib/layouts/db_lyxmacros.inc +++ b/lib/layouts/db_lyxmacros.inc @@ -5,6 +5,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. +Format 2 Input lyxmacros.inc Style Code diff --git a/lib/layouts/db_stdcharstyles.inc b/lib/layouts/db_stdcharstyles.inc index 642c59dd3c..96b138b191 100644 --- a/lib/layouts/db_stdcharstyles.inc +++ b/lib/layouts/db_stdcharstyles.inc @@ -2,6 +2,7 @@ # Author : José Abílio Oliveira Matos # Character Styles definition +Format 2 CharStyle Filename LatexType Command LatexName filename diff --git a/lib/layouts/db_stdclass.inc b/lib/layouts/db_stdclass.inc index 4ee82a1b7f..019a9d4ba9 100644 --- a/lib/layouts/db_stdclass.inc +++ b/lib/layouts/db_stdclass.inc @@ -5,6 +5,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. +Format 2 OutputType docbook Columns 1 diff --git a/lib/layouts/db_stdcounters.inc b/lib/layouts/db_stdcounters.inc index f0fe0765ea..f95eda3d0e 100644 --- a/lib/layouts/db_stdcounters.inc +++ b/lib/layouts/db_stdcounters.inc @@ -4,6 +4,7 @@ # This include file contains all the counters that are defined as standard # in Docbook LyX layouts. +Format 2 Counter Name sect1 Within chapter diff --git a/lib/layouts/db_stdlayouts.inc b/lib/layouts/db_stdlayouts.inc index 2d3ff2c6b4..aae6ca7e92 100644 --- a/lib/layouts/db_stdlayouts.inc +++ b/lib/layouts/db_stdlayouts.inc @@ -5,6 +5,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. +Format 2 Input stdlayouts.inc Style Literal diff --git a/lib/layouts/db_stdlists.inc b/lib/layouts/db_stdlists.inc index 739b1d2651..b7d4d0aaa1 100644 --- a/lib/layouts/db_stdlists.inc +++ b/lib/layouts/db_stdlists.inc @@ -5,6 +5,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. +Format 2 Input stdlists.inc diff --git a/lib/layouts/db_stdsections.inc b/lib/layouts/db_stdsections.inc index 711c4aaf50..9b77ebf407 100644 --- a/lib/layouts/db_stdsections.inc +++ b/lib/layouts/db_stdsections.inc @@ -6,6 +6,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. +Format 2 Input stdsections.inc Style Part diff --git a/lib/layouts/db_stdstarsections.inc b/lib/layouts/db_stdstarsections.inc index 2265db9677..0009043834 100644 --- a/lib/layouts/db_stdstarsections.inc +++ b/lib/layouts/db_stdstarsections.inc @@ -9,6 +9,7 @@ # modifying the style of the regular sectioning layouts. +Format 2 Style Part* CopyStyle Part Margin Static diff --git a/lib/layouts/db_stdstruct.inc b/lib/layouts/db_stdstruct.inc index 7a1d7e33b4..8c97862a31 100644 --- a/lib/layouts/db_stdstruct.inc +++ b/lib/layouts/db_stdstruct.inc @@ -5,6 +5,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. +Format 2 Input stdstruct.inc Style Abstract diff --git a/lib/layouts/db_stdtitle.inc b/lib/layouts/db_stdtitle.inc index 667ddb1137..6829ee5d0c 100644 --- a/lib/layouts/db_stdtitle.inc +++ b/lib/layouts/db_stdtitle.inc @@ -6,6 +6,7 @@ # It is desirable, as far as possible, to have the same look and feel for # related layouts in latex and docbook. +Format 2 Input stdtitle.inc diff --git a/lib/layouts/dinbrief.layout b/lib/layouts/dinbrief.layout index 75a4eb3eb9..7eb406bab3 100644 --- a/lib/layouts/dinbrief.layout +++ b/lib/layouts/dinbrief.layout @@ -6,6 +6,7 @@ # Modifies only some things from letter.layout +Format 2 Input letter.layout diff --git a/lib/layouts/docbook-book.layout b/lib/layouts/docbook-book.layout index e2ee300678..0f9e13de23 100644 --- a/lib/layouts/docbook-book.layout +++ b/lib/layouts/docbook-book.layout @@ -4,6 +4,7 @@ # Author : Jose' Matos # hacked for books: Luc Abom +Format 2 Input report Input db_stdclass.inc diff --git a/lib/layouts/docbook-chapter.layout b/lib/layouts/docbook-chapter.layout index 7a2ecc2045..8f866dfa28 100644 --- a/lib/layouts/docbook-chapter.layout +++ b/lib/layouts/docbook-chapter.layout @@ -3,7 +3,8 @@ # DocBook textclass definition file. # Author : Jose' Matos -Input stnumarticle.inc +Format 2 +Input stdnumarticle.inc Input db_stdclass.inc Style Title diff --git a/lib/layouts/docbook-section.layout b/lib/layouts/docbook-section.layout index 7034e3da03..d24f8882f3 100644 --- a/lib/layouts/docbook-section.layout +++ b/lib/layouts/docbook-section.layout @@ -3,6 +3,7 @@ # DocBook textclass definition file. # Author : Jose' Matos +Format 2 Input numarticle.inc Input db_stdclass.inc diff --git a/lib/layouts/docbook.layout b/lib/layouts/docbook.layout index 4ca72a37e7..fb6089157c 100644 --- a/lib/layouts/docbook.layout +++ b/lib/layouts/docbook.layout @@ -3,6 +3,7 @@ # DocBook textclass definition file. # Author : Jose' Matos +Format 2 Input numarticle.inc Input db_stdclass.inc diff --git a/lib/layouts/dtk.layout b/lib/layouts/dtk.layout index c24dbc6e30..1f87df94cc 100644 --- a/lib/layouts/dtk.layout +++ b/lib/layouts/dtk.layout @@ -6,6 +6,7 @@ # Author : Herbert Voss 2001/08/13 +Format 2 Columns 1 Sides 2 SecNumDepth -1 # no counting diff --git a/lib/layouts/egs.layout b/lib/layouts/egs.layout index fd5c8d8b4d..c6cb693184 100644 --- a/lib/layouts/egs.layout +++ b/lib/layouts/egs.layout @@ -8,6 +8,7 @@ # Converted article -> egs Martin Vermeer +Format 2 Columns 2 Sides 1 PageStyle Plain diff --git a/lib/layouts/elsart.layout b/lib/layouts/elsart.layout index f87284cf7a..bae98c4210 100644 --- a/lib/layouts/elsart.layout +++ b/lib/layouts/elsart.layout @@ -22,6 +22,7 @@ # numbered sections, as does the class file. +Format 2 Columns 1 Sides 2 PageStyle headings diff --git a/lib/layouts/entcs.layout b/lib/layouts/entcs.layout index be7c6f149f..30f25b626b 100644 --- a/lib/layouts/entcs.layout +++ b/lib/layouts/entcs.layout @@ -3,6 +3,7 @@ # Based on LyX article class; modified to support ENTCS class # Reuben Thomas (rrt@sc3d.org) 27/5-2/6/01 +Format 2 Input article.layout # only font size 11pt is really available diff --git a/lib/layouts/extarticle.layout b/lib/layouts/extarticle.layout index 12fa5eea51..fa808bbaa2 100644 --- a/lib/layouts/extarticle.layout +++ b/lib/layouts/extarticle.layout @@ -2,6 +2,7 @@ # \DeclareLaTeXClass{extarticle} # Herbert Voss +Format 2 Input article.layout # change available fontsizes diff --git a/lib/layouts/extbook.layout b/lib/layouts/extbook.layout index 51293c25b3..853b0073d1 100644 --- a/lib/layouts/extbook.layout +++ b/lib/layouts/extbook.layout @@ -3,6 +3,7 @@ # Extended book textclass definition file. # Herbert Voss +Format 2 Input book.layout # change available fontsizes diff --git a/lib/layouts/extletter.layout b/lib/layouts/extletter.layout index 5ec1157238..c66566ac15 100644 --- a/lib/layouts/extletter.layout +++ b/lib/layouts/extletter.layout @@ -3,6 +3,7 @@ # Extended article textclass definition file. # Herbert Voss +Format 2 Input letter.layout # change available fontsizes diff --git a/lib/layouts/extreport.layout b/lib/layouts/extreport.layout index 4151317f8c..9538f02c35 100644 --- a/lib/layouts/extreport.layout +++ b/lib/layouts/extreport.layout @@ -3,6 +3,7 @@ # Extented report textclass definition file. # Herbert Voss +Format 2 Input report.layout # change available fontsizes diff --git a/lib/layouts/foils.layout b/lib/layouts/foils.layout index d5af5f1a70..e1ca28fd13 100644 --- a/lib/layouts/foils.layout +++ b/lib/layouts/foils.layout @@ -6,6 +6,7 @@ # To do: Define class specific options. +Format 2 Columns 1 Sides 1 diff --git a/lib/layouts/g-brief-de.layout b/lib/layouts/g-brief-de.layout index d5aeec1748..5987967f48 100644 --- a/lib/layouts/g-brief-de.layout +++ b/lib/layouts/g-brief-de.layout @@ -3,6 +3,7 @@ # Letter textclass definition file. # Author : Thomas Hartkens +Format 2 Input stdfloats.inc Input stdcounters.inc diff --git a/lib/layouts/g-brief-en.layout b/lib/layouts/g-brief-en.layout index 3e247e9b5e..dde3f60485 100644 --- a/lib/layouts/g-brief-en.layout +++ b/lib/layouts/g-brief-en.layout @@ -3,6 +3,7 @@ # Letter textclass definition file. # Author : Thomas Hartkens +Format 2 Input stdfloats.inc Input stdcounters.inc diff --git a/lib/layouts/g-brief2.layout b/lib/layouts/g-brief2.layout index 5e8262434b..eec8c18a4f 100644 --- a/lib/layouts/g-brief2.layout +++ b/lib/layouts/g-brief2.layout @@ -12,6 +12,7 @@ # General textclass parameters +Format 2 Columns 1 Sides 1 PageStyle Empty diff --git a/lib/layouts/heb-article.layout b/lib/layouts/heb-article.layout index 07333dfc62..7648fd1b65 100644 --- a/lib/layouts/heb-article.layout +++ b/lib/layouts/heb-article.layout @@ -4,6 +4,7 @@ # Author: Dekel Tsur # Few changes by Baruch Even +Format 2 Input article Preamble diff --git a/lib/layouts/heb-letter.layout b/lib/layouts/heb-letter.layout index cb67ad1711..0653fd0a2d 100644 --- a/lib/layouts/heb-letter.layout +++ b/lib/layouts/heb-letter.layout @@ -3,6 +3,7 @@ # Hebrew letter textclass definition file. # Author: Dekel Tsur +Format 2 Input letter diff --git a/lib/layouts/hollywood.layout b/lib/layouts/hollywood.layout index d6d0391981..f4756dd4cc 100644 --- a/lib/layouts/hollywood.layout +++ b/lib/layouts/hollywood.layout @@ -15,6 +15,7 @@ # Based on course given by Lars Davidson +Format 2 Columns 1 Sides 1 SecNumDepth 2 diff --git a/lib/layouts/ijmpd.layout b/lib/layouts/ijmpd.layout index 63b19fefaa..92620660ad 100644 --- a/lib/layouts/ijmpd.layout +++ b/lib/layouts/ijmpd.layout @@ -11,6 +11,7 @@ # Version 2 2003-03-03 - Updated for LyX 1.3.0. +Format 2 Input stdclass.inc Input numarticle.inc diff --git a/lib/layouts/jgrga.layout b/lib/layouts/jgrga.layout index 42358d6fec..3a36dd2a0e 100644 --- a/lib/layouts/jgrga.layout +++ b/lib/layouts/jgrga.layout @@ -3,6 +3,7 @@ # AGUplus JGR textclass definition file. # Author: Martin Vermeer +Format 2 Input aguplus.inc ClassOptions diff --git a/lib/layouts/kluwer.layout b/lib/layouts/kluwer.layout index 92f2172d01..4eec1590aa 100644 --- a/lib/layouts/kluwer.layout +++ b/lib/layouts/kluwer.layout @@ -14,6 +14,7 @@ # 2003-03-03 Updated for lyx 1.3.0. +Format 2 Columns 1 Sides 2 SecNumDepth 4 diff --git a/lib/layouts/latex8.layout b/lib/layouts/latex8.layout index 0f0af6ef45..8da09582d3 100644 --- a/lib/layouts/latex8.layout +++ b/lib/layouts/latex8.layout @@ -3,6 +3,7 @@ # Latex8 textclass definition file. # Author : Allan Rae +Format 2 Preamble \usepackage{latex8} \usepackage{times} diff --git a/lib/layouts/letter.layout b/lib/layouts/letter.layout index 6222bd0b38..789e657f6e 100644 --- a/lib/layouts/letter.layout +++ b/lib/layouts/letter.layout @@ -4,6 +4,7 @@ # Author : Matthias Ettrich # Heavily modifed and enhanced by serveral developers. +Format 2 Input stdletter.inc Input stdlists.inc Input lyxmacros.inc diff --git a/lib/layouts/linuxdoc.layout b/lib/layouts/linuxdoc.layout index 84f2a326c8..390675335a 100644 --- a/lib/layouts/linuxdoc.layout +++ b/lib/layouts/linuxdoc.layout @@ -4,6 +4,7 @@ # Author : Pascal André +Format 2 Columns 1 Sides 1 PageStyle Plain diff --git a/lib/layouts/literate-article.layout b/lib/layouts/literate-article.layout index e5649a6ae5..b5e4cc7ded 100644 --- a/lib/layouts/literate-article.layout +++ b/lib/layouts/literate-article.layout @@ -3,6 +3,7 @@ # literate-article textclass definition file. # Author : Edmar Wienskoski Jr. +Format 2 Preamble \usepackage{noweb} EndPreamble diff --git a/lib/layouts/literate-book.layout b/lib/layouts/literate-book.layout index 68b2aca468..bcabc67f8c 100644 --- a/lib/layouts/literate-book.layout +++ b/lib/layouts/literate-book.layout @@ -3,6 +3,7 @@ # literate-book textclass definition file. # Author : Edmar Wienskoski Jr. +Format 2 Preamble \usepackage{noweb} EndPreamble diff --git a/lib/layouts/literate-report.layout b/lib/layouts/literate-report.layout index 1696fc17eb..8b09cdc1be 100644 --- a/lib/layouts/literate-report.layout +++ b/lib/layouts/literate-report.layout @@ -3,6 +3,7 @@ # literate-report textclass definition file. # Author : Edmar Wienskoski Jr. +Format 2 Preamble \usepackage{noweb} EndPreamble diff --git a/lib/layouts/literate-scrap.inc b/lib/layouts/literate-scrap.inc index ea501b6e40..16f7997718 100644 --- a/lib/layouts/literate-scrap.inc +++ b/lib/layouts/literate-scrap.inc @@ -6,6 +6,7 @@ # resembles more closely the produced paper doc (more WYSIWYG) # +Format 2 OutputType literate Style Scrap diff --git a/lib/layouts/llncs.layout b/lib/layouts/llncs.layout index 187dbdb869..1c662d377b 100644 --- a/lib/layouts/llncs.layout +++ b/lib/layouts/llncs.layout @@ -14,6 +14,7 @@ # Modified for LyX 12 by Jean-Marc Lasgouttes and MV. +Format 2 Columns 1 Sides 1 PageStyle Plain diff --git a/lib/layouts/ltugboat.layout b/lib/layouts/ltugboat.layout index 88521f2649..b94d45777d 100644 --- a/lib/layouts/ltugboat.layout +++ b/lib/layouts/ltugboat.layout @@ -5,6 +5,7 @@ # Author : Herbert Voss 2001/08/13 +Format 2 Columns 2 Sides 2 #SecNumDepth # no counting diff --git a/lib/layouts/lyxmacros.inc b/lib/layouts/lyxmacros.inc index 251c31f88e..dfa3caf1bc 100644 --- a/lib/layouts/lyxmacros.inc +++ b/lib/layouts/lyxmacros.inc @@ -8,6 +8,7 @@ # be removed later. +Format 2 Style LyX-Code Margin Static LatexType Environment diff --git a/lib/layouts/manpage.layout b/lib/layouts/manpage.layout index 504653dd73..1c601aa0e8 100644 --- a/lib/layouts/manpage.layout +++ b/lib/layouts/manpage.layout @@ -4,6 +4,7 @@ # Author : José Matos +Format 2 Columns 1 Sides 1 PageStyle Plain diff --git a/lib/layouts/memoir.layout b/lib/layouts/memoir.layout index e1e813afdf..7c1bc9e930 100644 --- a/lib/layouts/memoir.layout +++ b/lib/layouts/memoir.layout @@ -6,6 +6,7 @@ # feel free to contribute missing features! +Format 2 Columns 1 Sides 2 SecNumDepth 2 diff --git a/lib/layouts/mwart.layout b/lib/layouts/mwart.layout index 419d5c39f2..631eaa2c16 100644 --- a/lib/layouts/mwart.layout +++ b/lib/layouts/mwart.layout @@ -5,6 +5,7 @@ # Transposed by Tomasz Łuczak # Heavily modifed and enhanced by several developers. +Format 2 Input stdclass.inc Input numarticle.inc diff --git a/lib/layouts/mwbk.layout b/lib/layouts/mwbk.layout index 5f886f3509..ec05915c32 100644 --- a/lib/layouts/mwbk.layout +++ b/lib/layouts/mwbk.layout @@ -5,6 +5,7 @@ # Transposed by Tomasz Łuczak # Heavily modifed and enhanced by serveral developers. +Format 2 Input stdclass.inc Sides 2 diff --git a/lib/layouts/mwrep.layout b/lib/layouts/mwrep.layout index 70eb3faf6d..90eb444505 100644 --- a/lib/layouts/mwrep.layout +++ b/lib/layouts/mwrep.layout @@ -5,6 +5,7 @@ # Transposed by Tomasz Łuczak # Heavily modifed and enhanced by serveral developers. +Format 2 Input stdclass.inc diff --git a/lib/layouts/numarticle.inc b/lib/layouts/numarticle.inc index 641cfbb7b7..2ef2b7917f 100644 --- a/lib/layouts/numarticle.inc +++ b/lib/layouts/numarticle.inc @@ -1,6 +1,7 @@ # Author : André Pönitz # This include file contains label definitions for an article-like numbering. +Format 2 Style Part LabelType Counter LabelCounter part diff --git a/lib/layouts/numreport.inc b/lib/layouts/numreport.inc index c337987feb..e07027a493 100644 --- a/lib/layouts/numreport.inc +++ b/lib/layouts/numreport.inc @@ -1,6 +1,7 @@ # Author : André Pönitz # This include file contains label definitions for a report-like numbering. +Format 2 Input numarticle.inc Style Part diff --git a/lib/layouts/numrevtex.inc b/lib/layouts/numrevtex.inc index b49dde6d4e..46666c3da5 100644 --- a/lib/layouts/numrevtex.inc +++ b/lib/layouts/numrevtex.inc @@ -2,6 +2,7 @@ # This include files contains label definitions for a article-like numbering. +Format 2 Style Section LabelType Counter LabelCounter section diff --git a/lib/layouts/paper.layout b/lib/layouts/paper.layout index 353144300b..fb39c13dad 100644 --- a/lib/layouts/paper.layout +++ b/lib/layouts/paper.layout @@ -4,6 +4,7 @@ # Created by Jean-Marc Lasgouttes (Jean-Marc.Lasgouttes@inria.fr) +Format 2 Columns 1 Sides 1 SecNumDepth 3 diff --git a/lib/layouts/report.layout b/lib/layouts/report.layout index 43438a80a3..0fcd210d95 100644 --- a/lib/layouts/report.layout +++ b/lib/layouts/report.layout @@ -5,6 +5,7 @@ # Transposed by Pascal André # Heavily modifed and enhanced by serveral developers. +Format 2 Input stdclass.inc Input numreport.inc diff --git a/lib/layouts/revtex.layout b/lib/layouts/revtex.layout index 7394c607c6..dcc2648ef1 100644 --- a/lib/layouts/revtex.layout +++ b/lib/layouts/revtex.layout @@ -9,6 +9,7 @@ # Amir Karger (LyX v11.34 style modifications - using changes # made by Jean-Marc Lasgouttes to amsart.layout) +Format 2 Columns 1 Sides 1 PageStyle Headers diff --git a/lib/layouts/revtex4.layout b/lib/layouts/revtex4.layout index ab52a08ccd..16af65726f 100644 --- a/lib/layouts/revtex4.layout +++ b/lib/layouts/revtex4.layout @@ -10,6 +10,7 @@ # Amir Karger (RevTeX 4 beta) 9/1999, 7/2000 +Format 2 Columns 1 Sides 1 PageStyle Headers diff --git a/lib/layouts/scrartcl.layout b/lib/layouts/scrartcl.layout index 99f071974d..7a861713aa 100644 --- a/lib/layouts/scrartcl.layout +++ b/lib/layouts/scrartcl.layout @@ -3,6 +3,7 @@ # KOMA scrartcl textclass definition file. # Bernd Rellermeyer <100.41728@germanynet.de>, 1998/7/11. +Format 2 Input scrclass.inc Input numarticle.inc diff --git a/lib/layouts/scrbook.layout b/lib/layouts/scrbook.layout index aad3b02f47..58bc2849b0 100644 --- a/lib/layouts/scrbook.layout +++ b/lib/layouts/scrbook.layout @@ -3,6 +3,7 @@ # KOMA scrbook textclass definition file. # Bernd Rellermeyer <100.41728@germanynet.de>, 1998/7/11. +Format 2 Input scrclass.inc Input numreport.inc diff --git a/lib/layouts/scrclass.inc b/lib/layouts/scrclass.inc index b6eab18645..5b82da5fbb 100644 --- a/lib/layouts/scrclass.inc +++ b/lib/layouts/scrclass.inc @@ -7,6 +7,7 @@ # Guenter Milde +Format 2 SecNumDepth 2 TocDepth 2 DefaultStyle Standard diff --git a/lib/layouts/scrlettr.layout b/lib/layouts/scrlettr.layout index 8aa490dd41..715735df2c 100644 --- a/lib/layouts/scrlettr.layout +++ b/lib/layouts/scrlettr.layout @@ -3,6 +3,7 @@ # KOMA scrlettr textclass definition file. # Bernd Rellermeyer <100.41728@germanynet.de>, 1999/2/17. +Format 2 Style Standard LatexName dummy ParSep 0.4 diff --git a/lib/layouts/scrlttr2.layout b/lib/layouts/scrlttr2.layout index 1f7af5a8f1..e6afe765d2 100644 --- a/lib/layouts/scrlttr2.layout +++ b/lib/layouts/scrlttr2.layout @@ -3,6 +3,7 @@ # KOMA scrlettr2 textclass definition file. # Juergen Spitzmueller , 2003/2/17. +Format 2 Style Standard LatexName dummy ParSep 0.4 diff --git a/lib/layouts/scrreprt.layout b/lib/layouts/scrreprt.layout index dc3612bff3..4298b77570 100644 --- a/lib/layouts/scrreprt.layout +++ b/lib/layouts/scrreprt.layout @@ -3,6 +3,7 @@ # KOMA scrreprt textclass definition file. # Bernd Rellermeyer <100.41728@germanynet.de>, 1998/7/11. +Format 2 Input scrclass.inc Input numreport.inc diff --git a/lib/layouts/seminar.layout b/lib/layouts/seminar.layout index a80375068e..8b86977ed3 100644 --- a/lib/layouts/seminar.layout +++ b/lib/layouts/seminar.layout @@ -3,6 +3,7 @@ # Initial attemt at makeing a LyX layout file for the seminar class. # Author : Lars Gullik Bjřnnes +Format 2 Input stdclass.inc Input numarticle.inc diff --git a/lib/layouts/siamltex.layout b/lib/layouts/siamltex.layout index e0b472c132..b9235e5dbb 100644 --- a/lib/layouts/siamltex.layout +++ b/lib/layouts/siamltex.layout @@ -4,6 +4,7 @@ # Cut & paste from various LyX layouts plus some minor modifications # Author : Kornelia Pietsch +Format 2 Columns 1 Sides 1 SecNumDepth 2 diff --git a/lib/layouts/slides.layout b/lib/layouts/slides.layout index 121d43a0d3..7da427bc1c 100644 --- a/lib/layouts/slides.layout +++ b/lib/layouts/slides.layout @@ -7,6 +7,7 @@ # +Format 2 Columns 1 Sides 1 PageStyle Plain diff --git a/lib/layouts/spie.layout b/lib/layouts/spie.layout index 4eb2d75009..138df3a04f 100644 --- a/lib/layouts/spie.layout +++ b/lib/layouts/spie.layout @@ -5,6 +5,7 @@ # to be used with the spie.cls LaTex-style available at # http://public.lanl.gov/kmh/spie/ +Format 2 Input stdclass.inc Input numarticle.inc diff --git a/lib/layouts/stdclass.inc b/lib/layouts/stdclass.inc index 937a7e1ecf..b06c34530e 100644 --- a/lib/layouts/stdclass.inc +++ b/lib/layouts/stdclass.inc @@ -7,6 +7,7 @@ # ``standard'' layouts, like article and friends. +Format 2 Columns 1 Sides 1 SecNumDepth 2 diff --git a/lib/layouts/stdcounters.inc b/lib/layouts/stdcounters.inc index 62654738b5..395aa9dafe 100644 --- a/lib/layouts/stdcounters.inc +++ b/lib/layouts/stdcounters.inc @@ -4,6 +4,7 @@ # in most LyX layouts. +Format 2 Counter Name part End diff --git a/lib/layouts/stdfloats.inc b/lib/layouts/stdfloats.inc index c26498a172..b040171c74 100644 --- a/lib/layouts/stdfloats.inc +++ b/lib/layouts/stdfloats.inc @@ -4,6 +4,7 @@ # in most LyX layouts. +Format 2 Float Type table GuiName Table diff --git a/lib/layouts/stdlayouts.inc b/lib/layouts/stdlayouts.inc index 00e66229a2..36b8aa1c4f 100644 --- a/lib/layouts/stdlayouts.inc +++ b/lib/layouts/stdlayouts.inc @@ -7,6 +7,7 @@ # quotations and such. +Format 2 Style Quotation Margin Static LatexType Environment diff --git a/lib/layouts/stdletter.inc b/lib/layouts/stdletter.inc index 7646d35095..79f47b6463 100644 --- a/lib/layouts/stdletter.inc +++ b/lib/layouts/stdletter.inc @@ -3,6 +3,7 @@ # Heavily modifed and enhanced by several developers. +Format 2 Columns 1 Sides 1 PageStyle Empty diff --git a/lib/layouts/stdlists.inc b/lib/layouts/stdlists.inc index d54b0e784d..823f680de1 100644 --- a/lib/layouts/stdlists.inc +++ b/lib/layouts/stdlists.inc @@ -7,6 +7,7 @@ # This include files contains various standard environments for lists. +Format 2 Style Itemize Margin Static LatexType Item_Environment diff --git a/lib/layouts/stdsections.inc b/lib/layouts/stdsections.inc index d2a5f3ecf7..75e4b9e399 100644 --- a/lib/layouts/stdsections.inc +++ b/lib/layouts/stdsections.inc @@ -7,6 +7,7 @@ # commands that are useful for article-like document classes, but not # for letters. +Format 2 Style Part Margin Dynamic LatexType Command diff --git a/lib/layouts/stdstarsections.inc b/lib/layouts/stdstarsections.inc index f3d8d11cec..4063206760 100644 --- a/lib/layouts/stdstarsections.inc +++ b/lib/layouts/stdstarsections.inc @@ -9,6 +9,7 @@ # modifying the style of the regular sectioning layouts. +Format 2 Style Part* CopyStyle Part Margin Static diff --git a/lib/layouts/stdstruct.inc b/lib/layouts/stdstruct.inc index 682567d538..f4d7ed6fd8 100644 --- a/lib/layouts/stdstruct.inc +++ b/lib/layouts/stdstruct.inc @@ -8,6 +8,7 @@ # a document, like abstract, bibliography and such. +Format 2 Style Abstract Margin Static LatexType Environment diff --git a/lib/layouts/stdtitle.inc b/lib/layouts/stdtitle.inc index ba60d504fd..e0f99dd052 100644 --- a/lib/layouts/stdtitle.inc +++ b/lib/layouts/stdtitle.inc @@ -8,6 +8,7 @@ # a document, like title, author and such. +Format 2 Style Title Margin Static LatexType Command diff --git a/lib/layouts/svglobal.layout b/lib/layouts/svglobal.layout index f972a3552e..95a49b91fd 100644 --- a/lib/layouts/svglobal.layout +++ b/lib/layouts/svglobal.layout @@ -18,6 +18,7 @@ # see www.springer.de/author/tex/help-journals.html for class files # # The standard Springer Journal sections +Format 2 Input svjour.inc ClassOptions diff --git a/lib/layouts/svjog.layout b/lib/layouts/svjog.layout index 467e687097..e5cb664c3a 100644 --- a/lib/layouts/svjog.layout +++ b/lib/layouts/svjog.layout @@ -22,6 +22,7 @@ # see www.springer.de/author/tex/help-journals.html for class files +Format 2 Input svjour.inc diff --git a/lib/layouts/svjour.inc b/lib/layouts/svjour.inc index ac030b3dc0..aa55d0098f 100644 --- a/lib/layouts/svjour.inc +++ b/lib/layouts/svjour.inc @@ -18,6 +18,7 @@ # see www.springer.de/author/tex/help-journals.html for class files +Format 2 Columns 2 Sides 1 PageStyle Plain diff --git a/lib/layouts/svprobth.layout b/lib/layouts/svprobth.layout index e618a294f2..7bf65d644f 100644 --- a/lib/layouts/svprobth.layout +++ b/lib/layouts/svprobth.layout @@ -24,6 +24,7 @@ # see www.springer.de/author/tex/help-journals.html for class files +Format 2 Input svjour.inc ClassOptions diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py new file mode 100644 index 0000000000..9a2de0565a --- /dev/null +++ b/lib/scripts/layout2layout.py @@ -0,0 +1,149 @@ +#! /usr/bin/env python +# -*- coding: iso-8859-1 -*- + +# file layout2layout.py +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. + +# author Georg Baum + +# Full author contact details are available in file CREDITS + +# This script will update a .layout file to format 2 + + +import os, re, string, sys + + +def usage(prog_name): + return ("Usage: %s inputfile outputfile\n" % prog_name + + "or %s outputfile" % prog_name) + + +def error(message): + sys.stderr.write(message + '\n') + sys.exit(1) + + +def trim_eol(line): + " Remove end of line char(s)." + if line[-2:-1] == '\r': + return line[:-2] + elif line[-1:-1] == '\r' or line[-1:-1] == '\n': + return line[:-1] + else: + # file with no EOL in last line + return line + + +def read(input): + " Read input file and strip lineendings." + lines = list() + while 1: + line = input.readline() + if not line: + break + lines.append(trim_eol(line)) + return lines + + +def write(output, lines): + " Write output file with native lineendings." + for line in lines: + output.write(line + os.linesep) + + +def convert(lines): + " Convert to new format." + re_Comment = re.compile(r'^(\s*)#') + re_Empty = re.compile(r'^(\s*)$') + re_Format = re.compile(r'^(\s*)(Format)(\s+)(\S+)', re.IGNORECASE) + re_Preamble = re.compile(r'^(\s*)Preamble', re.IGNORECASE) + 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) + + i = 0 + only_comment = 1 + while i < len(lines): + + # Skip comments and empty lines + if re_Comment.match(lines[i]) or re_Empty.match(lines[i]): + i = i + 1 + continue + + # insert file format if not already there + if (only_comment): + match = re_Format.match(lines[i]) + if match: + format = match.group(4) + if format == '2': + # nothing to do + return + error('Cannot convert file format %s' % format) + else: + lines.insert(i, "Format 2") + only_comment = 0 + continue + + # Don't get confused by LaTeX code + if re_Preamble.match(lines[i]): + i = i + 1 + while i < len(lines) and not re_EndPreamble.match(lines[i]): + i = i + 1 + continue + + # Delete MaxCounter + if re_MaxCounter.match(lines[i]): + del lines[i] + continue + + # Replace line + # + # LabelType Counter_EnumI + # + # with two lines + # + # LabelType Counter + # LabelCounter EnumI + # + match = re_LabelType.match(lines[i]) + if match: + label = match.group(4) + 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)) + + i = i + 1 + + +def main(argv): + + # Open files + if len(argv) == 1: + input = sys.stdin + output = sys.stdout + elif len(argv) == 3: + input = open(argv[1], 'rb') + output = open(argv[2], 'wb') + else: + error(usage(argv[0])) + + # Do the real work + lines = read(input) + convert(lines) + write(output, lines) + + # Close files + if len(argv) == 3: + input.close() + output.close() + + return 0 + + +if __name__ == "__main__": + main(sys.argv) diff --git a/src/ChangeLog b/src/ChangeLog index 9e1037dff1..ef5bdbf941 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2005-10-20 Georg Baum + + * lyxtextclass.C (Read): convert layout file if the format is wrong + * lyxtextclass.C (layout2layout): new, needed for the above + 2005-10-18 Jean-Marc Lasgouttes * messages.C: do not forget to include . diff --git a/src/lyxtextclass.C b/src/lyxtextclass.C index 070b1840f3..1fde276e79 100644 --- a/src/lyxtextclass.C +++ b/src/lyxtextclass.C @@ -22,10 +22,14 @@ #include "FloatList.h" #include "support/lstrings.h" +#include "support/lyxlib.h" #include "support/filetools.h" +#include + using lyx::support::LibFileSearch; using lyx::support::MakeDisplayPath; +using lyx::support::QuoteName; using lyx::support::rtrim; using lyx::support::subst; @@ -51,6 +55,37 @@ private: string name_; }; + +int const FORMAT = 2; + + +bool layout2layout(string const & filename, string const & tempfile) +{ + string const script = LibFileSearch("scripts", "layout2layout.py"); + if (script.empty()) { + lyxerr << "Could not find layout conversion " + "script layout2layout.py." << endl; + return false; + } + + std::ostringstream command; + command << "python " << QuoteName(script) + << ' ' << QuoteName(filename) + << ' ' << QuoteName(tempfile); + string const command_str = command.str(); + + lyxerr[Debug::TCLASS] << "Running `" << command_str << '\'' << endl; + + lyx::support::cmd_ret const ret = + lyx::support::RunCommand(command_str); + if (ret.first != 0) { + lyxerr << "Could not run layout conversion " + "script layout2layout.py." << endl; + return false; + } + return true; +} + } // namespace anon @@ -124,12 +159,20 @@ enum TextClassTags { TC_COUNTER, TC_NOFLOAT, TC_TITLELATEXNAME, - TC_TITLELATEXTYPE + TC_TITLELATEXTYPE, + TC_FORMAT }; + // Reads a textclass structure from file. bool LyXTextClass::Read(string const & filename, bool merge) { + if (!lyx::support::IsFileReadable(filename)) { + lyxerr << "Cannot read layout file `" << filename << "'." + << endl; + return true; + } + keyword_item textClassTags[] = { { "charstyle", TC_CHARSTYLE }, { "classoptions", TC_CLASSOPTIONS }, @@ -139,6 +182,7 @@ bool LyXTextClass::Read(string const & filename, bool merge) { "defaultstyle", TC_DEFAULTSTYLE }, { "environment", TC_ENVIRONMENT }, { "float", TC_FLOAT }, + { "format", TC_FORMAT }, { "input", TC_INPUT }, { "leftmargin", TC_LEFTMARGIN }, { "nofloat", TC_NOFLOAT }, @@ -170,10 +214,12 @@ bool LyXTextClass::Read(string const & filename, bool merge) LyXLex lexrc(textClassTags, sizeof(textClassTags) / sizeof(textClassTags[0])); - bool error = false; lexrc.setFile(filename); - if (!lexrc.isOK()) error = true; + bool error = !lexrc.isOK(); + + // Format of files before the 'Format' tag was introduced + int format = 1; // parsing while (lexrc.isOK() && !error) { @@ -194,6 +240,11 @@ bool LyXTextClass::Read(string const & filename, bool merge) switch (static_cast(le)) { + case TC_FORMAT: + if (lexrc.next()) + format = lexrc.getInteger(); + break; + case TC_OUTPUTTYPE: // output type definition readOutputType(lexrc); break; @@ -373,6 +424,19 @@ bool LyXTextClass::Read(string const & filename, bool merge) } break; } + if (format != FORMAT) + break; + } + + if (format != FORMAT) { + lyxerr[Debug::TCLASS] << "Converting layout file from format " + << format << " to " << FORMAT << endl; + string const tempfile = lyx::support::tempName(); + error = !layout2layout(filename, tempfile); + if (!error) + error = Read(tempfile, merge); + lyx::support::unlink(tempfile); + return error; } if (!merge) { // we are at top level here.