Dear list, this issue has been bugging me for some time: \startbuffer[demo] <doc> <meta> <author>author</author> <title>title</title> </meta> <text> text </text> </doc> \stopbuffer \starttext \startxmlsetups xml:initialize \xmlsetsetup{#1}{code|meta|text}{xml:*} \stopxmlsetups \xmlregistersetup{xml:initialize} \startxmlsetups xml:doc \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:meta \setupinteraction [author={\xmltext{#1}{/author}}, title={\xmltext{#1}{/title}}] \stopxmlsetups \startxmlsetups xml:text \xmlflush{#1} \stopxmlsetups \setupinteraction[state=start] \xmlprocessbuffer{main}{demo}{} \stoptext With LuaTeX, I get PDF metadata. With LuaMetaTeX, I cannot get them. For both, I’m using current latest (from 2024.02.27 09:21). Could anyone confirm the issue or explain me what I am missing? Many thanks for your help, Pablo
Pablo Rodriguez via ntg-context schrieb am 03.03.2024 um 20:02:
Dear list,
this issue has been bugging me for some time:
[...]
With LuaTeX, I get PDF metadata. With LuaMetaTeX, I cannot get them.
For both, I’m using current latest (from 2024.02.27 09:21).
Could anyone confirm the issue or explain me what I am missing
I can confirm the issue and it happens because Hans changed they way how the values of the \setupinteraction commands are passed to Lua side of ConTeXt to be written to the PDF file. I can provide at the moment solutions which ensure the information appear in the PDF but none of the is very elegant and I hope Hans can help with a clean solution. The first solution works around the grouping issue of the xmlsetups environment and pushes the setting beyond the limit of it. \startxmlsetups xml:meta \aftergrouped{\setupinteraction [author={\xmltext{#1}{/author}}, title={\xmltext{#1}{/title}}]} \stopxmlsetups The second solution makes the assignment to the \setupinteraction command global to ensure they are kept even the environment ends, int old MkII days ConTeXt provided a \startglobal environment to do this but now I have rely on the primitives. \startxmlsetups xml:meta \globaldefs\plusone \setupinteraction [author={\xmltext{#1}{/author}}, title={\xmltext{#1}{/title}}] \globaldefs\zerocount \stopxmlsetups Wolfgang
On 3/4/24 01:18, Wolfgang Schuster wrote:
Pablo Rodriguez via ntg-context schrieb am 03.03.2024 um 20:02:
[...] With LuaTeX, I get PDF metadata. With LuaMetaTeX, I cannot get them. [...] I can confirm the issue and it happens because Hans changed they way how the values of the \setupinteraction commands are passed to Lua side of ConTeXt to be written to the PDF file.
Many thanks for your reply and your explanation, Wolfgang.
I can provide at the moment solutions which ensure the information appear in the PDF but none of the is very elegant and I hope Hans can help with a clean solution.
The first one avoids the issue until Hans provides a final fix. Many thanks for your help, Pablo
Pablo Rodriguez via ntg-context schrieb am 04.03.2024 um 07:17:
On 3/4/24 01:18, Wolfgang Schuster wrote:
Pablo Rodriguez via ntg-context schrieb am 03.03.2024 um 20:02:
[...] With LuaTeX, I get PDF metadata. With LuaMetaTeX, I cannot get them. [...] I can confirm the issue and it happens because Hans changed they way how the values of the \setupinteraction commands are passed to Lua side of ConTeXt to be written to the PDF file.
Many thanks for your reply and your explanation, Wolfgang.
I can provide at the moment solutions which ensure the information appear in the PDF but none of the is very elegant and I hope Hans can help with a clean solution.
The first one avoids the issue until Hans provides a final fix.
Here is the official solution: \startxmlsetups xml:meta \setupmetadata [author={\xmltext{#1}{/author}}, title={\xmltext{#1}{/title}}] \stopxmlsetups The command is new and accepts the following keys: - title - subtitle - author - keyword - date Wolfgang
On Tue, 5 Mar 2024 23:14:04 +0100
Wolfgang Schuster
Here is the official solution:
\startxmlsetups xml:meta \setupmetadata [author={\xmltext{#1}{/author}}, title={\xmltext{#1}{/title}}] \stopxmlsetups
So now we have: \setupinteraction [title=FooBar] \setupdocument [metadata:title=FooBar] \setupmetadata [title=FooBar] Are any of those deprecated or the preferred way? I'm starting to get confused. Marco
Am 06.03.24 um 11:18 schrieb Marco Patzer:
On Tue, 5 Mar 2024 23:14:04 +0100 Wolfgang Schuster
wrote: Here is the official solution:
\startxmlsetups xml:meta \setupmetadata [author={\xmltext{#1}{/author}}, title={\xmltext{#1}{/title}}] \stopxmlsetups
So now we have:
\setupinteraction [title=FooBar]
\setupdocument [metadata:title=FooBar]
\setupmetadata [title=FooBar]
Are any of those deprecated or the preferred way? I'm starting to get confused.
There’s also \settaggedmetadata; I actually didn’t know \setupmetadata. Both are missing in the wiki yet. Also https://wiki.contextgarden.net/Command/setupinteraction doesn’t talk about metadata. Sigh. AFAIK the metadata from \setupinteraction is used for everything, as long as you don’t overwrite it elsewhere. Hraban
On 3/6/2024 11:18 AM, Marco Patzer wrote:
On Tue, 5 Mar 2024 23:14:04 +0100 Wolfgang Schuster
wrote: Here is the official solution:
\startxmlsetups xml:meta \setupmetadata [author={\xmltext{#1}{/author}}, title={\xmltext{#1}{/title}}] \stopxmlsetups
So now we have:
\setupinteraction [title=FooBar]
\setupdocument [metadata:title=FooBar]
that just sets defaults for \setupinteraction so that they inherit from document
\setupmetadata [title=FooBar]
that's for those who go global
Are any of those deprecated or the preferred way? I'm starting to get confused.
even if we would use \setupmetadata we'd still have \setupinteraction because we remain compatible Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 3/6/24 15:54, Hans Hagen wrote:
[...]
\setupmetadata [title=FooBar]
that's for those who go global
Many thanks for the new command, Hans. I‘m afraid this new command breaks my compilation. The error message isn’t very helpful for me (see below). I wonder whether this requires a minimal sample to be fixed. Many thanks for your help, Pablo tex error > tex error on line 0 in file : Argument of \D9>:title has an extra } <inserted text> \par } <macro> \prerolltostring #1->\beginlocalcontrol \setbox \b_syst_boxes \hbox {\expand \everypreroll #1} \normalexpanded {\setbox \b_syst_boxes \emptybox \endlocalcontrol \boxtostring \b_syst_boxes } <macro> \scrn_identity_get #1->\setidentityvariable {#1}{\prerolltostring {\interactionparameter {#1}} } <inserted text> [[special cmd: end local call]] <initial input> <empty file> I've run across a '}' that doesn't seem to match anything. For example, '\def\a#1{...}' and '\a}' would produce this error. The '\par' that I've just inserted will cause me to report a runaway argument that might be the root of the problem. mtx-context | fatal error: return code: 1
exit status: 256
Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 16:52:
On 3/6/24 15:54, Hans Hagen wrote:
\setupmetadata [title=FooBar]
[...] that's for those who go global Many thanks for the new command, Hans.
I‘m afraid this new command breaks my compilation.
The error message isn’t very helpful for me (see below).
I wonder whether this requires a minimal sample to be fixed.
Yes, a minimal example would help because \setupmetadata works in your previous example. Wolfgang
On 3/6/24 17:35, Wolfgang Schuster wrote:
Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 16:52:
[...] I wonder whether this requires a minimal sample to be fixed.
Yes, a minimal example would help because \setupmetadata works in your previous example.
Many thanks for your reply, Wolfgang. Now I have the minimal sample: \startbuffer[demo] <doc> <div id="header"> <h2 class="author">author</h2> </div> <text> text </text> </doc> \stopbuffer \starttext \startxmlsetups xml:initialize \xmlsetsetup{#1}{doc}{xml:*} \xmlsetsetup{\xmldocument} {(div|section)[@id='header']} {xml:meta} \xmlsetsetup{\xmldocument} {(h2|p)[contains(@class,'author')]} {xml:title:author} \stopxmlsetups \xmlregistersetup{xml:initialize} \startxmlsetups xml:doc \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:text \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:meta %\aftergrouped{\setupinteraction% \setupmetadata [author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, }}] %} \stopxmlsetups \startxmlsetups xml:title:author \xmlflush{#1} \stopxmlsetups \setupinteraction[state=start] \xmlprocessbuffer{main}{demo}{} \stoptext With \setupmetadata it breaks compilation. I know it is not the most elegant code, but in my real environment xml:title:author outputs text. Many thanks for your help, Pablo
Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 20:11:
On 3/6/24 17:35, Wolfgang Schuster wrote:
[...] I wonder whether this requires a minimal sample to be fixed. Yes, a minimal example would help because \setupmetadata works in your
Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 16:52: previous example. Many thanks for your reply, Wolfgang.
Now I have the minimal sample:
[...]
\startxmlsetups xml:meta %\aftergrouped{\setupinteraction% \setupmetadata [author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, }}] %} \stopxmlsetups
Use \expanded. \startxmlsetups xml:meta \expanded{\setupmetadata[author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, }}]} \stopxmlsetups Wolfgang
Pablo Rodriguez via ntg-context schrieb am 06.03.2024 um 20:11:
[...]
\startxmlsetupsxml:meta %\aftergrouped{\setupinteraction% \setupmetadata [author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, }}] %} \stopxmlsetups
Use \expanded. \startxmlsetups xml:meta \expanded{\setupmetadata[author={\xmlconcat{#1}{/h2[contains(@class,'author')]}{, }}]} \stopxmlsetups Wolfgang
participants (5)
-
Hans Hagen
-
Henning Hraban Ramm
-
Marco Patzer
-
Pablo Rodriguez
-
Wolfgang Schuster