On Thursday 08 May 2008 09:02:46 Juergen Spitzmueller wrote: > José Matos wrote: > > My only remark is about the usage of ObsoletedBy. > > > > It makes sense to use that for 1.5 and to do a new file format change for > > 1.6 with the same purpose. > > > > If we don't do this now we will have to carry this ObsoletedBy forever > > while in lyx2lyx it says where it should. > > OK. Good point. > > > If you want I can code the convertion code. > > Yes, please. > > Jürgen > > > FWIW there is no reversion code, the same as if the file was saved with > > 1.6 and the change is lost.
Attached follows the code for lyx2lyx. It should be enough after the last patch. I suggest thus to remove the ObsoletedBy cases from apa.layout. -- José Abílio
Index: lyx_1_6.py =================================================================== --- lyx_1_6.py (revision 24678) +++ lyx_1_6.py (working copy) @@ -2208,6 +2208,30 @@ i = i + 1 +def update_apa_styles(document): + ' Replace obsolete styles' + + if document.textclass != "apa": + return + + obsoletedby = { "Acknowledgments": "Acknowledgements", + "Section*": "Section", + "Subsection*": "Subsection", + "Subsubsection*": "Subsubsection", + "Paragraph*": "Paragraph", + "Subparagraph*": "Subparagraph"} + i = 0 + while 1: + i = find_token(document.body, "\\begin_layout", i) + if i == -1: + return + + layout = document.body[i][14:] + if layout in obsolete: + document.body[i] = "\\begin_layout " + obsoletedby[layout] + + i += 1 + ## # Conversion hub # @@ -2269,9 +2293,11 @@ [330, []], [331, [convert_ltcaption]], [332, []], + [333, [update_apa_styles]], ] -revert = [[331, [revert_graphics_group]], +revert = [[332, []], + [331, [revert_graphics_group]], [330, [revert_ltcaption]], [329, [revert_leftarrowfill, revert_rightarrowfill, revert_upbracefill, revert_downbracefill]], [328, [revert_master]],