From: "jmuc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <jmuccigr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Lua filters: accessing Images's 'fig:' attribute?
Date: Tue, 26 Apr 2022 12:03:40 -0700 (PDT) [thread overview]
Message-ID: <3e6c1960-af52-4911-aa64-f31944d0198an@googlegroups.com> (raw)
In-Reply-To: <73ccd54a-b1eb-44ca-9a22-f08b63cd4757n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 1974 bytes --]
Some discussion on a similar issue (not showing the fig label in beamer
while keeping the image centered) in the GitHub repo issues here
<https://github.com/jgm/pandoc/issues/7988>.
I don't write too many filters, but isn't the "fig." bit stored in
`img.title` for lua?
On Tuesday, 26 April 2022 at 13:41:57 UTC-4 Julien Dutant wrote:
> Hi,
>
> Pandoc's markdown `implicit_figures` extension parses blocks consisting of
> a single image as figures. This shows up in the `native` output as `fig:`
> attribute after the source. Compare without caption:
>
> % pandoc -t native
>
> ![](file.jpg)
>
> [ Para [ Image ( "" , [] , [] ) [] ( "file.jpg" , "" ) ] ]
> And with:
>
> ![caption](file.jpg)
>
> [ Para
> [ Image
> ( "" , [] , [] ) [ Str "caption" ] ( "file.jpg" , "fig:" )
> ]
> ]
> We can't look up this attribute in Lua filters. Any reason not too? Is it
> not part of the Pandoc AST, or doesn't fit neatly in current Lua types?
>
> I'd like my filter to be aware of whether an image is treated as figure or
> inline (e.g., to wrap the latter, but not the former, in a LaTeX center
> environment). Perhaps others need this too. Atm my best bet is to redo
> Pandoc's figure detection, i.e. (a) check if we're reading from markdown
> with the implicit_headers extension, (b) filter Para elements looking if
> they contain only one Image with caption and if so tag it with some
> `.is-a-figure` class, and then (c) make my Image filter aware of the
> `.is-a-figure` class, and perhaps (d) clean up by removing the class.
>
> J
>
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/3e6c1960-af52-4911-aa64-f31944d0198an%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 2732 bytes --]
next prev parent reply other threads:[~2022-04-26 19:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-26 17:41 Julien Dutant
[not found] ` <73ccd54a-b1eb-44ca-9a22-f08b63cd4757n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-04-26 18:44 ` William Lupton
2022-04-26 19:03 ` jmuc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [this message]
[not found] ` <3e6c1960-af52-4911-aa64-f31944d0198an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-04-27 10:14 ` Julien Dutant
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=3e6c1960-af52-4911-aa64-f31944d0198an@googlegroups.com \
--to=jmuccigr-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
/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).