DocBook: implement CALS tables

Richard Kimberly Heck rikiheck at lyx.org
Wed Jul 15 16:15:37 UTC 2020


On 7/15/20 10:20 AM, Thibaut Cuvelier wrote:
> On Mon, 13 Jul 2020 at 09:30, Jürgen Spitzmüller <spitz at lyx.org
> <mailto:spitz at lyx.org>> wrote:
>
>     Format increase should be done in the same commit than lyx2lyx (at
>     least adding an empty definition. Otherwise LyX will complain that it
>     cannot convert documents.
>
>
> Here is an updated version of the patch, with conversion routines.
> However, it doesn't look right, as LyX now generates this error when
> opening a document (I took doc/Development.lyx):
>
>     LyX: Unknown TextClass tag `\docbook_table_output' [around line 1
>     of file ~\AppData\Local\Temp\lyx_tmpdir.EpQUxUwunUIo\c
>     onvertncyrVl.layout current token: '\docbook_table_output'
>     context: '']
>     TextClass.cpp (396): Unable to convert internal layout information
>     to format 82
>     Warning: Read Error
>     ----------------------------------------
>     Error reading internal layout information
>
>
> This patch is the culprit, as there is no such error without it.
> However, I don't understand the message: why is there a note about
> layouts? I did not change anything about layouts, did I?

No, but there's a different problem.


> From 39389b2776315b3414015de5265bab2c4e3d9087 Mon Sep 17 00:00:00 2001
> From: Thibaut Cuvelier <tcuvelier at lyx.org>
> Date: Mon, 13 Jul 2020 03:31:48 +0200
> Subject: [PATCH] Add support for CALS tables in DocBook.
>
> ---
>  development/FORMAT               |   4 +
>  lib/lyx2lyx/lyx_2_4.py           |  19 +++-
>  src/BufferParams.cpp             |   7 ++
>  src/BufferParams.h               |   9 ++
>  src/frontends/qt/GuiDocument.cpp |  11 +++
>  src/frontends/qt/ui/OutputUi.ui  | 154 ++++++++++++++++++++++---------
>  src/insets/InsetTabular.cpp      | 135 ++++++++++++++++++++++++---
>  src/insets/InsetTabular.h        |   9 +-
>  src/tex2lyx/Preamble.cpp         |   2 +
>  src/tex2lyx/Preamble.h           |   1 +
>  src/version.h                    |   4 +-
>  11 files changed, 291 insertions(+), 64 deletions(-)
>
> diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py
> index c4d63cab14..bdf5118dbf 100644
> --- a/lib/lyx2lyx/lyx_2_4.py
> +++ b/lib/lyx2lyx/lyx_2_4.py
> @@ -3922,6 +3922,19 @@ def revert_libertinus_sftt_fonts(document):
>                      add_to_preamble(document,
> ["\\renewcommand*{\\LibertinusMono at scale}{" + str(tt_scale / 100.0) +
> "}"])
>  
>  
> +def convert_docbook_table_output(document):
> +    if find_token(document.header, '\\docbook_table_output 0') == -1
> and \
> +            find_token(document.header, '\\docbook_table_output 1')
> == -1:
> +        document.append_local_layout('\\docbook_table_output 0')

This is wrong: You're appending to the 'local layout' information, which
is why we are then seeing a failure to convert that. (The tag is
invalid, as layout.) You want to append to the preamble, so:

    append_to_preamble(document, '\\docbook_table_output 0')

though, since we have already checked whether it is there
(add_to_preamble checks that), probably just:

    document.preamble.append('\\docbook_table_output 0')

Probably add_to_preamble should be a method of the document object, but
the lyx2lyx code does not always make a lot of sense.

Riki




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200715/759aa3c4/attachment.html>


More information about the lyx-devel mailing list