From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30483 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: William Lupton Newsgroups: gmane.text.pandoc Subject: Re: Lua filters: accessing Images's 'fig:' attribute? Date: Tue, 26 Apr 2022 19:44:11 +0100 Message-ID: References: <73ccd54a-b1eb-44ca-9a22-f08b63cd4757n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000c7e4b405dd93140b" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6756"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCS4HJ6WSAHBBB73UCJQMGQELXPCXMY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Apr 26 20:44:29 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-io1-f61.google.com ([209.85.166.61]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1njQAk-0001Nu-6R for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 26 Apr 2022 20:44:26 +0200 Original-Received: by mail-io1-f61.google.com with SMTP id i19-20020a5d9353000000b006495ab76af6sf15049577ioo.0 for ; Tue, 26 Apr 2022 11:44:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1650998665; cv=pass; d=google.com; s=arc-20160816; b=G11LjeevrGz3TXC/MmSekSXfCJ2Akapnhdyr9gUdTt7eHHdGfCwQWmGZdBA/dswgjK VRFBiYJR6ho8IyuGecXJRnGMH46wTgNjTj1SZHlXEAYInbN71KrdyifOaVA4TtpuKmoK kR0duG3ZtX4CSKIVoQaUnkMirkm8MAfbmsXxBU00bXjk6MwacN24oAYx1WN6u2hxWUky Ljgu7NYtA06lWA3wwLuulNLrwVmjGOcjcvy/hEKXbg6QssJjR3AD3BKI/hzskbpyZjHP /yKE4/5J3fdOrS5WUjYiBxkjo1k3LK47q0leyVc4V8UkfEmiJ5/IhuQVSMZ3MnPhdO2U ESog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date :from:in-reply-to:references:mime-version:sender:dkim-signature; bh=f5M1qlcGZJeQwDVt6V3/yw+9xmEh/tmYI0wh6G+0Ano=; b=Pt8k7KwwSxbgicxykftLLcOUnNEDphvhVWB5zzzb9SbduAoaDQ+4Nz6xz6fAAKJEXc BMuCJGW0KHYIGpG+OG7fxNT9+XlG+642IGaiSoozBBZPSTJB1mfA4TNFiZhjcI83fCmo Gp7VnlZzYVY74Hw4DVXtnOG3+3cALyniDhH+ekoj4gSwllABh5TfPXoL+jKBSMMXoYMM JX/gDPaceBcdhRLrRz3U2Dy8as9UQHgeTfBygZRMyhqc9WiqoFB4ChtoybRa4C3rGT9t 26Rlx6+ZzyaKvnktzTsU1zfN615CO5afangBWljhC2zEa590Zy/9PifKsMfgdhdbr4qb Dw3w== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@broadband-forum-org.20210112.gappssmtp.com header.s=20210112 header.b=27fw52p8; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2607:f8b0:4864:20::b35 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:mime-version:references:in-reply-to:from:date:message-id :subject:to:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=f5M1qlcGZJeQwDVt6V3/yw+9xmEh/tmYI0wh6G+0Ano=; b=mEodzP2LzVQULbuPubpHB/ipjueTc81iACcKtcSLY6F1vdnXB3fSyEOHIPurxIMBXy QAyrpF1Bab6Nhfij6PsM3lDM6gtgfz+/8uLbPl17oK7xSi8ezuEZHtCOAvwi4lh7KOGz 1Q5ZLky/EBUzTToZs9/GBLd7yGk+Q/V+1AAxauOQrnGLMSQb3ie2C3Pxtcv71Zx6bpV4 rszogFjYqi9GTp+2wX1apPMGB0ENgNEw13YLGHw69IdWUM8+Yk7jvGgwO62aqw1QjrKW LBK2ii888Oox2ZHI8kxCdwsC3VOctBeDjKbbv/T8CMHeFVoRtsCTM7GPQ0y3jSB8ZgXW aCsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:mime-version:references:in-reply-to:from :date:message-id:subject:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=f5M1qlcGZJeQwDVt6V3/yw+9xmEh/tmYI0wh6G+0Ano=; b=LY5InVAfbPR35E3xRMpo85aEDDSQoM9VBsRV5bEoNjiJLFeXJcMc0kAZDrpAoOd9YM iqZSXryjMTHizLrOZMeEfziVfPBhrVEY4c9je7DijnFR6ksMh4In8SOoQdwFRR3WoC9A wvGpiy7esduMiyJl2ASHSyHWweUQLTeb1it1dj1KPMMiNl+FfFz85W/3C760KM8nd1Dl 4cSebzFdTFJXMqyyTS9/8lYaiP7FTI2A5xttLLNYFTWX/ZZgGbm3a0+IY4+cy/NbVsc7 Vv2q1L1A2/7uqiTs5vfquzzLHC0ijQu3pzNfQCl9QepzPS1oVB4i1k45MfxJng1lSF/P WwqA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM531oTtNR+3sPwMjpuePhfTc2Nb+DTfAWqcv84+lw1FHi2X9Iz0we /GYrGUQL90AS+gAfnUN0I0s= X-Google-Smtp-Source: ABdhPJzWsMc/rW+S1QXIO8HAKeIskDv0o87IlPxLsztud4y9tXMXt1NjhhFAWp9GR12m7psFYBUHxQ== X-Received: by 2002:a92:c548:0:b0:2cc:47f1:815 with SMTP id a8-20020a92c548000000b002cc47f10815mr9639968ilj.257.1650998665180; Tue, 26 Apr 2022 11:44:25 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6e02:1d9c:b0:2cd:6e90:e862 with SMTP id h28-20020a056e021d9c00b002cd6e90e862ls2876386ila.7.gmail; Tue, 26 Apr 2022 11:44:22 -0700 (PDT) X-Received: by 2002:a05:6e02:12b4:b0:2ca:e755:ee4a with SMTP id f20-20020a056e0212b400b002cae755ee4amr9941785ilr.65.1650998662723; Tue, 26 Apr 2022 11:44:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650998662; cv=none; d=google.com; s=arc-20160816; b=UVFo8XoocCD0QNiYJKt1EA3e3wtdAdrczI3aGR3rbn0j9qyC18EdETz5fIzB+3RoVC qmx64atp8ijU9sEYI03RvOMzFbObO9UIqbHlFD35rAAOJoh1eS1fIBoFSqpAR0A/IpNt +gbQbagGurAlXIuR703ZmmFB72SAukjkoOrOcg9zg7wNmdHDTcgcJr3HXxZIrEqmp1Ud nVsyOQjHOAakey5ZeUY8HUIElHgjE9L4kFDCljs+3ktm7acfTtXoiDJwnSbBaz7a9wSX /1OKy4wpO77iU1DV3utEC4iz3PD32PRLc71W4F4g6Gf6f+A20tLEuMQDfl0Cqzf5SLDa 3F8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=xhdtmoWVzV4FZ8G3vbWjzeKQonknYYZgvCE1OdtfjrQ=; b=I2rysdlrp0J3bu1eWAWHPR6A2eqW9nLOB5jFuQ0TArsXqC1UO1qZWHPeIKSws93wnN OPXW2CGdXkrxytUenZlR0NY8IlPoBgjuCqw+41LmfCMeLPAcqCv+d04VJ3eA7DHxgSL4 jKJK/NM8Rh7rmZLk1iQO3cQ8gnS1RksJOTEp2cN+BxeH/yfoioev+CLzZ+UcxPqJaO85 vKpm7WoMEMPCE7MwKpNwGOHyzcporWd7WB0qcqz0oCiG0xnWwuOhjLU/J7lrlk17/nHT EvkD6G14Gblmb1snct9EhGRPrqBMdE4QfRZ+0UXzrZobAClPD5aK1HIP11ciFCipNVTb DpmQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@broadband-forum-org.20210112.gappssmtp.com header.s=20210112 header.b=27fw52p8; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2607:f8b0:4864:20::b35 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org Original-Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com. [2607:f8b0:4864:20::b35]) by gmr-mx.google.com with ESMTPS id f2-20020a056638168200b0032660e4051bsi1314071jat.7.2022.04.26.11.44.22 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Apr 2022 11:44:22 -0700 (PDT) Received-SPF: pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2607:f8b0:4864:20::b35 as permitted sender) client-ip=2607:f8b0:4864:20::b35; Original-Received: by mail-yb1-xb35.google.com with SMTP id j2so34672833ybu.0 for ; Tue, 26 Apr 2022 11:44:22 -0700 (PDT) X-Received: by 2002:a05:6902:c6:b0:63e:55f0:40df with SMTP id i6-20020a05690200c600b0063e55f040dfmr21874212ybs.631.1650998662123; Tue, 26 Apr 2022 11:44:22 -0700 (PDT) In-Reply-To: <73ccd54a-b1eb-44ca-9a22-f08b63cd4757n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@broadband-forum-org.20210112.gappssmtp.com header.s=20210112 header.b=27fw52p8; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2607:f8b0:4864:20::b35 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:30483 Archived-At: --000000000000c7e4b405dd93140b Content-Type: text/plain; charset="UTF-8" I think that the 'fig:' goes into the image's title attribute? On Tue, 26 Apr 2022 at 18:42, 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/73ccd54a-b1eb-44ca-9a22-f08b63cd4757n%40googlegroups.com > > . > -- 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/CAEe_xxiqzQq1PVG0fzQMP36MhMtvsATFaAtDpZkVPB7aCOm5JA%40mail.gmail.com. --000000000000c7e4b405dd93140b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I think that the 'fig:' goes into the image's = title attribute?

On Tue, 26 Apr 2022 at 18:42, Julien Dutant <julien.dutant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
<= /div>
Hi,

Pandoc's markdown `implicit_figures` extension parses blocks consist= ing 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" , &q= uot;" ) ] ]

And with:

![caption]= (file.jpg)

[ Para
=C2=A0 =C2=A0 [ Image
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 ( "" , [] , [] ) [ Str "caption&quo= t; ] ( "file.jpg" , "fig:" )
=C2=A0 =C2=A0 ]
]

We can't look up this attribute in Lua filters. Any reason n= ot too? Is it not part of the Pandoc AST, or doesn't fit neatly in curr= ent Lua types?=C2=A0

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,=C2=A0 (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 the= n (c) make my Image filter aware of the `.is-a-figure` class, and perhaps (= d) clean up by removing the class.=C2=A0

J

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https= ://groups.google.com/d/msgid/pandoc-discuss/73ccd54a-b1eb-44ca-9a22-f08b63c= d4757n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.= google.com/d/msgid/pandoc-discuss/CAEe_xxiqzQq1PVG0fzQMP36MhMtvsATFaAtDpZkV= PB7aCOm5JA%40mail.gmail.com.
--000000000000c7e4b405dd93140b--