From: Albert Krewinkel via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Albert Krewinkel <albert+context@zeitkraut.de>
Subject: Re: Set up external figure for particular image type
Date: Wed, 13 Jul 2022 00:33:22 +0200 [thread overview]
Message-ID: <87lesxgbtr.fsf@zeitkraut.de> (raw)
In-Reply-To: <CAANrE7q-SG6+fp9TeZ=H_bj=PRVczeTdeeNqd8fdAoJT_DJsbA@mail.gmail.com>
Thangalin via ntg-context <ntg-context@ntg.nl> writes:
> The source comes from Markdown, which is converted to XML, then typeset
> using ConTeXt. There's no Markdown-specific mechanism to relate images
> to a particular external figure definition, unfortunately. All images
> use the same syntax and are treated the same way. The only part that
> differs is the file name extension (and header within the file).
The below is likely overkill and a good bit of work to setup, but it is
also very flexible. Maybe it suits your needs.
The Markdown-to-XML conversion can be tuned to include all the relevant
information. E.g., you could use pandoc with a custom writer to produce
the XML format of your choice. The link below is an example XML writer
that can be tuned as needed.
<https://gist.github.com/tarleb/634b409be0af62ca210cc9e96d41ca8c>
With that setup, one can modify the `Image` function to produce the
output you need. E.g., match on the file name extension use the library
function `pandoc.path.split_extension` and then change the element type
depending on the extension.
This way you'd have all the important information in your XML.
More info: <https://pandoc.org/custom-writers> and
<https://pandoc.org/lua-filters>.
Of course, you could also use pandoc to go directly to ConTeXt; that is
currently my preferred way of producing PDF from Markdown.
Cheers,
Albert
--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2022-07-12 22:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-08 15:46 Thangalin via ntg-context
2022-07-08 16:29 ` Henning Hraban Ramm via ntg-context
2022-07-12 18:11 ` Thangalin via ntg-context
2022-07-12 19:01 ` Rik Kabel via ntg-context
2022-07-18 16:01 ` Thangalin via ntg-context
2022-07-12 19:07 ` Wolfgang Schuster via ntg-context
2022-07-18 17:10 ` Thangalin via ntg-context
2022-07-18 20:14 ` Wolfgang Schuster via ntg-context
2022-08-01 0:29 ` Thangalin via ntg-context
2022-08-01 7:07 ` Hans Hagen via ntg-context
2022-07-12 22:33 ` Albert Krewinkel via ntg-context [this message]
2022-07-18 16:03 ` Thangalin 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=87lesxgbtr.fsf@zeitkraut.de \
--to=ntg-context@ntg.nl \
--cc=albert+context@zeitkraut.de \
/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).