lyx2lyx took really little time. (15 minutes or so.) I have attached
the patch. I have increased the version number, by the way. Please
correct it, if necessary.
For tex2lyx, OK then, I believe that my patch should be applied if
clearpage stuff is in. In any case somebody (unfortunately not me)
should write tex2lyx code for version 254, and my code will reduce the
work that should be done, I guess.
I'll correct label and resend the patch. Documentation should follow.
Ugras
On 11/21/06, Georg Baum <[EMAIL PROTECTED]> wrote:
Am Dienstag, 21. November 2006 15:57 schrieb Ozgur Ugras BARAN:
> As requested today, I have added \clearpage and \cleardoublepage
> commands.
As I wrote: The changes are trivial. If this should appear in a menu then
we would also need an explanation of the differences of \pagebreak,
\clearpage and \cleardoublepage in the documentation.
> tex2lyx should work, but I guess there is something wrong
> with latex import. It doesn't work with or without my patch.
If you want tex2lyx support for this you first have to implement the
changes from format 245 to 254 in tex2lyx, otherwise tex2lyx will produce
invalid files.
> I haven't touch to the lyx2lyx.
>
> I'll be glad if somebody test and apply the patch.
José, would this be OK for 1.5.0? If yes I can do the lyx2lyx part in 10
minutes and put it in. Ugras, you could also have a look at the lyx2lyx
part yourself if you want. It is not hard at all, I suggest to take
revert_eqref in lyx_1_4.py as a template.
> Index: src/insets/insetpagebreak.C
> ===================================================================
> --- src/insets/insetpagebreak.C (revision 16002)
> +++ src/insets/insetpagebreak.C (working copy)
> @@ -29,7 +29,12 @@
> using std::endl;
> using std::ostream;
>
> +InsetPagebreak::InsetPagebreak()
> +{
> + label_="Clear Page";
> +}
That should be a static class member, and a translated docstring, and with
the correct text like this:
InsetPagebreak::label_ = _("Page Break");
With your current solution you create one label per instance. This is not
needed, and translation does not work because the string "Clear Page" is
never marked for translation.
Georg
Index: lyx_1_5.py
===================================================================
--- lyx_1_5.py (revision 16009)
+++ lyx_1_5.py (working copy)
@@ -603,6 +603,45 @@
if (use_esint == 2):
document.preamble.append('\\usepackage{esint}')
+def revert_clearpage(document):
+ " clearpage -> ERT"
+ i = 0
+ while 1:
+ i = find_token(document.body, "\\clearpage", i)
+ if i == -1:
+ break
+ document.body[i:i+1] = ['\\begin_inset ERT',
+ 'status collapsed',
+ '',
+ '\\begin_layout %s' % document.default_layout,
+ '',
+ '',
+ '\\backslash',
+ 'clearpage',
+ '\\end_layout',
+ '',
+ '\\end_inset']
+ i = i + 1
+
+def revert_cleardoublepage(document):
+ " cleardoublepage -> ERT"
+ i = 0
+ while 1:
+ i = find_token(document.body, "\\cleardoublepage", i)
+ if i == -1:
+ break
+ document.body[i:i+1] = ['\\begin_inset ERT',
+ 'status collapsed',
+ '',
+ '\\begin_layout %s' % document.default_layout,
+ '',
+ '',
+ '\\backslash',
+ 'cleardoublepage',
+ '\\end_layout',
+ '',
+ '\\end_inset']
+ i = i + 1
##
# Conversion hub
@@ -619,7 +658,8 @@
[253, []],
[254, [convert_esint]]]
-revert = [[253, [revert_esint]],
+revert = [[254, [revert_clearpage, revert_cleardoublepage]],
+ [253, [revert_esint]],
[252, [revert_nomenclature, revert_printnomenclature]],
[251, [revert_commandparams]],
[250, [revert_cs_label]],