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
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
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
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
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
participants (2)
-
Alexey Kryukov
-
Wolfgang Schuster