On Sat, Sep 30, 2006 at 05:29:07PM +0100, José Matos wrote: > On Saturday 30 September 2006 16:50, Georg Baum wrote: > > The question is then if this is a file format change at all. > > Previous invalid lyx constructs are now valid, that is file format change > to > me. :-) > > > Why should we > > change the file format if we don't provide a suitable conversion? > > We could but it would darn ugly. :-( > > > Georg > > -- > José Abílio
Attached is the patch including the version bump. Tested and appears to work. I will check this in soon if I don't hear objections. It just bumps the version number but makes no conversions (or formally, the identity conversion). What happens is that if an optarg appears in a paragraph not allowing it, the LyX file will contain the content but it doesn't get rendered to LaTeX. This was already the case for commands (e.g., if you change para type after insertion of an optarg); now it will also be the case for environments (which now for the first time may legally have OptionalArg = 1). I think this is a formally correct solution. - Martin
Index: src/buffer.C =================================================================== --- src/buffer.C (revision 15135) +++ src/buffer.C (working copy) @@ -146,7 +146,7 @@ namespace { -int const LYX_FORMAT = 249; +int const LYX_FORMAT = 250; } // namespace anon Index: src/output_latex.C =================================================================== --- src/output_latex.C (revision 15135) +++ src/output_latex.C (working copy) @@ -81,6 +81,10 @@ } +int latexOptArgInsets(Buffer const & buf, Paragraph const & par, + ostream & os, OutputParams const & runparams, int number); + + ParagraphList::const_iterator TeXEnvironment(Buffer const & buf, ParagraphList const & paragraphs, @@ -129,6 +133,14 @@ if (style->isEnvironment()) { os << "\\begin{" << style->latexname() << '}'; + if (style->optionalargs > 0) { + int ret = latexOptArgInsets(buf, *pit, os, runparams, + style->optionalargs); + while (ret > 0) { + texrow.newline(); + --ret; + } + } if (style->latextype == LATEX_LIST_ENVIRONMENT) { os << "{" << pit->params().labelWidthString() << "}\n"; } else if (style->labeltype == LABEL_BIBLIO) { Index: lib/lyx2lyx/lyx_1_5.py =================================================================== --- lib/lyx2lyx/lyx_1_5.py (revision 15135) +++ lib/lyx2lyx/lyx_1_5.py (working copy) @@ -239,9 +239,11 @@ convert = [[246, []], [247, [convert_font_settings]], [248, []], - [249, [convert_utf8]]] + [249, [convert_utf8]], + [250, []] -revert = [[248, [revert_utf8]], +revert = [[249, []], + [248, [revert_utf8]], [247, [revert_booktabs]], [246, [revert_font_settings]], [245, [revert_framed]]]
pgpefEYgGsrF2.pgp
Description: PGP signature