ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Thangalin via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Thangalin <thangalin@gmail.com>
Subject: Re: Set up external figure for particular image type
Date: Mon, 18 Jul 2022 09:01:13 -0700	[thread overview]
Message-ID: <CAANrE7pJys5tFTkwoErMbT0jDM3yYkPVJqCn4kOVm7s92T9m3A@mail.gmail.com> (raw)
In-Reply-To: <995e8fc7-b8ea-3d87-92e8-b2dd8aa8f1e4@rik.users.panix.com>


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

Thanks, Rik.

Not using Pandoc. I was using Pandoc up until 2020:

https://dave.autonoma.ca/blog/2019/05/22/typesetting-markdown-part-1/

I've since authored KeenWrite <https://github.com/DaveJarvis/keenwrite>,
which uses flexmark-java <https://github.com/vsch/flexmark-java> to
generate XHTML documents from Markdown. The only additions I've made to the
library is to add support for Pandoc's annotation syntax (:::).

That said, I'm also a firm believer in not duplicating information. The
information (file name extension) is already available in the documents, so
adding a classification on top of the extension feels redundant.

Thanks for the suggestion!

On Tue, Jul 12, 2022 at 12:18 PM Rik Kabel via ntg-context <
ntg-context@ntg.nl> wrote:

>
> On 2022-07-12 14:11, Thangalin via ntg-context wrote:
>
> Thank you for the suggestion Hraban.
>
> 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).
>
> One possibility would be something like:
>
> \setupexternalfigure[
>     width=1em,
>     height=1em,
>     order={svg,pdf,png,jpg},
>     location={local,default,global},
> ]
> \defineexternalfigure[png][
>     width=\textwidth,
>     height=\textheight,
> ]
> \unprotect
> \let\old_externalfigure=\externalfigure
> \tolerant\def\externalfigure[#1]#,[#2]#,[#3]{%
>     \doifelseinstring{.png}{#1}{%
>         \old_externalfigure[#1][png][#2]%
>     }{%
>         \doifelsefileexists{#1.png}{%
>             \old_externalfigure[#1.png][png][#2]%
>         }{%
>             \old_externalfigure[#1][#2][#3]%
>         }%
>     }%
> }\protect
>
> See: https://tex.stackexchange.com/a/650221/2148
>
> I was wondering if there was a simpler or a solution that's more the
> ConTeXt-way?
>
> Thanks again!
>
>
> Assuming that Pandoc markdown is being used, you should be able to set
> class attributes on each image. You can then associate external figure
> definitions with specific classes, and process each individually. (Pandoc
> user guide, link_attributes
> <https://pandoc.org/MANUAL%202.html#extension-link_attributes>)
>
> --
> Rik
>
>
> ___________________________________________________________________________________
> 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
>
> ___________________________________________________________________________________
>

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

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

___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2022-07-18 16:01 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 [this message]
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
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=CAANrE7pJys5tFTkwoErMbT0jDM3yYkPVJqCn4kOVm7s92T9m3A@mail.gmail.com \
    --to=ntg-context@ntg.nl \
    --cc=thangalin@gmail.com \
    /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).