ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Christoph Edenhauser <info@edenhauser.net>
To: ntg-context@ntg.nl
Subject: [NTG-context] Re: ConTeXt source from XML
Date: Wed, 5 Jun 2024 12:00:44 +0200	[thread overview]
Message-ID: <8a3d411d-7f08-4fdb-9d8d-d017900902ba@edenhauser.net> (raw)
In-Reply-To: <76bfe0ea-91cd-498a-bc2b-1b282a10d104@xs4all.nl>


[-- Attachment #1.1: Type: text/plain, Size: 4123 bytes --]

Dear Hand, dear list

Am 04.06.24 um 22:09 schrieb Hans Hagen:
> On 6/4/2024 9:21 PM, Christoph Edenhauser wrote:
>> Dear Pablo, dear list
>>
>> That's great, thank you very much for your suggestion.
>> That seems to me to be a very elegant solution to the next two 
>> problems that were actually still ahead of me.
>>
>> And now to my initial question, which I didn't specify precisely enough.
>>
>> I have the following workflow in mind:
>> 1. I have an XML file (TEI-XML),
>> 2. then, following your brilliant suggestion, I will create an 
>> xml-analyze-template.tex file and customise it.
>> 3. As you suggest, now one would actually use
>>      context --environment xml-analyze-template.tex file.xml
>>      to typeset in a pdf file.
>> But I would like to convert all the XML nodes into the ConTeXt 
>> typesetting language, and then edit/correct the text and maybe some 
>> structure in this *.tex file.
>>
>> And here comes my question: Can I use context to convert my XML-file 
>> 'file.xml' into a ConTeXt-file 'file.tex' instead of typesetting it 
>> as a 'file.pdf'.
>
> What do you want to tweak. HEre is the lowest level approach:
>
> <?xml version='1.0'?>
> <whatever>
>     <p>test 1</p>
>     <?context-tex-directive start ?>
>     <?context-tex-directive red   ?>
>     <p>test 2</p>
>     <?context-tex-directive stop ?>
>     <p>test 3</p>
> </whatever>
>
> But quite some can be done when processing and there are mechanisms to 
> inject e.g. page breaks using processing instruction. Probablyh not 
> all is documented.
>
> There is a xml-mkiv-tricks.tex file in the distribution (no pdf is 
> seems so I need to add that one.)
>
> 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
> -----------------------------------------------------------------


I realise that it is somehow difficult for me to describe what I would 
like to achieve, perhaps what I have in mind is not even possible.

Let' say i have an xml File with something like this

<?xml version='1.0'?>
<chapter>St. Martin</chapter>
<paragraph>A comprehensive treatise</paragraph>
<section>The medieval part of the church</section>

I would now like to create a first file1.tex with all the necessary 
xmlsetups like e.g. something like this

\startxmlsetupsxml:chapter
\startchapter[title={\xmlflush{#1}}]\stopchapter
\stopxmlsetups
\startxmlsetupsxml:section
\startsection[title={\xmlflush{#1}}]\stopsection
\stopxmlsetups

I can now generate a pdf file with context. But:

My Question is, is it possible to generate a second context file2.tex 
with the help of this first xml-mapping file1.tex, where all the 
xml-nodes from the xml file are mapped to contex commands which then 
looks something like this:

\starttext
\startchapter[title=St. Martin]\stopchapter
\startsection[title=The medieval part of the church]\stopsection
\stoptext

I would then like to edit the Text in such a more "TeXish" result  
manually, e.g. insert small spaces as in ‘St.\,Martin’, explain unknown 
words in \footnote{comment}, etc.

I know you could or even should do the text corrections in the xml file, 
but XML would overwhelm my proofreader. (He has learnt to leave LaTeX 
code untouched, that should then work with ConTeXt code as well). So for 
me, the main reason for having a TeX-ish file2.tex is, that the Text 
could be corrected directly from the proofreader in this file2.tex file, 
but won't do that in the xml file.

And now a second approach to my question:
Are all these \startxmlsetups like '\startxmlsetup xml:chapter' 
internally mapped to standard context commands like \startchapter ... 
\stopchapter before they are converted to pdf?
If this is the case, can this intermediate context representation be 
exported, and how would this be done?

Thank you very much for your help,

best regards, Christoph

[-- Attachment #1.2: Type: text/html, Size: 8304 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

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

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2024-06-05 10:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 11:51 [NTG-context] " Christoph Edenhauser
2024-06-04 15:21 ` [NTG-context] " Pablo Rodriguez via ntg-context
2024-06-04 19:21   ` Christoph Edenhauser
2024-06-04 20:09     ` Hans Hagen
2024-06-05 10:00       ` Christoph Edenhauser [this message]
2024-06-05 12:16         ` Henning Hraban Ramm
2024-06-05 14:13           ` Christoph Edenhauser
2024-06-05 15:08           ` Hans Hagen
2024-06-05 14:34         ` Pablo Rodriguez via ntg-context
2024-06-05 18:23           ` Christoph Edenhauser
2024-06-06 15:33             ` Pablo Rodriguez via ntg-context
2024-06-06 15:42               ` Hans Hagen via ntg-context
2024-06-06 20:53               ` [NTG-context] " Christoph Edenhauser
2024-06-07 19:41                 ` [NTG-context] " Pablo Rodriguez via ntg-context
2024-06-07 20:34                   ` Henning Hraban Ramm
2024-06-08  7:14                   ` Denis Maier via ntg-context
2024-06-08  7:49                     ` Wolfgang Schuster
2024-06-08  8:49                       ` vm via ntg-context
2024-06-08  8:59                         ` Thomas A. Schmitz
2024-06-08  8:59                         ` Pablo Rodriguez via ntg-context
2024-06-08  9:04                       ` Pablo Rodriguez via ntg-context
2024-06-05 16:30       ` Pablo Rodriguez via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8a3d411d-7f08-4fdb-9d8d-d017900902ba@edenhauser.net \
    --to=info@edenhauser.net \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).