ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Table head/body via lua
@ 2023-08-18 17:02 Alexey Kryukov
  2023-08-18 18:12 ` [NTG-context] " Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Kryukov @ 2023-08-18 17:02 UTC (permalink / raw)
  To: ntg-context

Hi,

I am trying to generate a table representation for some xml source.
As the data structure doesn't directly correspond to the desired table
structure, some manipulations via lua are required. So far everything
works OK except table sectioning commands, like \bTABLEhead,
\eTABLEhead, bTABLEbody or \eTABLEbody: it seems impossible to
incapsulate them into lua functions. For example, the following is not
compiled:

\starttext
\bTABLE
\ctxlua{context.bTABLEbody()}
\bTR
\bTD Cell 1\eTD
\bTD Cell 2\eTD
\eTR
\ctxlua{context.eTABLEbody()}
\eTABLE
\stoptext

Can anybody suggest a workaround (except changing the source XML of
course)?

-- 
Regards,
Alexey Kryukov <anagnost at yandex dot ru>

Moscow State University
Faculty of History
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Table head/body via lua
  2023-08-18 17:02 [NTG-context] Table head/body via lua Alexey Kryukov
@ 2023-08-18 18:12 ` Wolfgang Schuster
  2023-08-18 18:31   ` Alexey Kryukov
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2023-08-18 18:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Alexey Kryukov

Alexey Kryukov schrieb am 18.08.2023 um 19:02:
> Hi,
>
> I am trying to generate a table representation for some xml source.
> As the data structure doesn't directly correspond to the desired table
> structure, some manipulations via lua are required. So far everything
> works OK except table sectioning commands, like \bTABLEhead,
> \eTABLEhead, bTABLEbody or \eTABLEbody: it seems impossible to
> incapsulate them into lua functions. For example, the following is not
> compiled:
>
> \starttext
> \bTABLE
> \ctxlua{context.bTABLEbody()}
> \bTR
> \bTD Cell 1\eTD
> \bTD Cell 2\eTD
> \eTR
> \ctxlua{context.eTABLEbody()}
> \eTABLE
> \stoptext
>
> Can anybody suggest a workaround (except changing the source XML of
> course)?

Do you create the whole table with Lua? When this is the case a small 
change to the table section
commands on the Lua side can fix your problems but otherwise a different 
approach is needed.

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Table head/body via lua
  2023-08-18 18:12 ` [NTG-context] " Wolfgang Schuster
@ 2023-08-18 18:31   ` Alexey Kryukov
  2023-08-18 19:11     ` Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Kryukov @ 2023-08-18 18:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, 18 Aug 2023 20:12:33 +0200
Wolfgang Schuster wrote:

> Do you create the whole table with Lua? When this is the case a small 
> change to the table section
> commands on the Lua side can fix your problems but otherwise a
> different approach is needed.

Hi Wolfgang,

thanks for the answer. Basically I would like to typeset a document
represented as TEI xml. Unfortunately, TEI support for table typesetting
is rather limited: there are no tags corresponding to table head of
body. It is only possible to specify a specific role for some rows.
So I have to use lua code to add head/body markup where appropriate,
and that's exactly what I can't do due to the described problem.

If there is no better solution, I can simply extend my xml with custom
tags, but I would like to keep it as TEI compliant as possible.

-- 
Regards,
Alexey Kryukov <anagnost at yandex dot ru>

Moscow State University
Faculty of History
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Table head/body via lua
  2023-08-18 18:31   ` Alexey Kryukov
@ 2023-08-18 19:11     ` Wolfgang Schuster
  2023-08-18 19:51       ` Alexey Kryukov
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2023-08-18 19:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Alexey Kryukov

Alexey Kryukov schrieb am 18.08.2023 um 20:31:
> On Fri, 18 Aug 2023 20:12:33 +0200
> Wolfgang Schuster wrote:
>
>> Do you create the whole table with Lua? When this is the case a small
>> change to the table section
>> commands on the Lua side can fix your problems but otherwise a
>> different approach is needed.
> Hi Wolfgang,
>
> thanks for the answer. Basically I would like to typeset a document
> represented as TEI xml. Unfortunately, TEI support for table typesetting
> is rather limited: there are no tags corresponding to table head of
> body. It is only possible to specify a specific role for some rows.
> So I have to use lua code to add head/body markup where appropriate,
> and that's exactly what I can't do due to the described problem.
>
> If there is no better solution, I can simply extend my xml with custom
> tags, but I would like to keep it as TEI compliant as possible.

What you can do here is to put the table together piece by piece with 
the collecting
mechanism which collect parts of the table until you flush the whole 
collection
at the end with the \stopcollecting command.

\starttext

\bTABLE
\startcollecting
\startcollect
\bTABLEbody
\stopcollect
\startcollect
\bTR
\bTD Cell 1\eTD
\bTD Cell 2\eTD
\eTR
\stopcollect
\startcollect
\eTABLEbody
\stopcollect
\stopcollecting
\eTABLE

\stoptext

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Table head/body via lua
  2023-08-18 19:11     ` Wolfgang Schuster
@ 2023-08-18 19:51       ` Alexey Kryukov
  0 siblings, 0 replies; 5+ messages in thread
From: Alexey Kryukov @ 2023-08-18 19:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, 18 Aug 2023 21:11:38 +0200
Wolfgang Schuster wrote:

> What you can do here is to put the table together piece by piece with 
> the collecting
> mechanism which collect parts of the table until you flush the whole 
> collection
> at the end with the \stopcollecting command.

Many thanks, I'll try this.

-- 
Regards,
Alexey Kryukov <anagnost at yandex dot ru>

Moscow State University
Faculty of History
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-18 19:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-18 17:02 [NTG-context] Table head/body via lua Alexey Kryukov
2023-08-18 18:12 ` [NTG-context] " Wolfgang Schuster
2023-08-18 18:31   ` Alexey Kryukov
2023-08-18 19:11     ` Wolfgang Schuster
2023-08-18 19:51       ` Alexey Kryukov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).