From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32817 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephan Boltzmann Newsgroups: gmane.text.pandoc Subject: Re: Bold figure caption prefix in docx output with filter Date: Wed, 14 Jun 2023 05:35:49 -0700 (PDT) Message-ID: References: <534b2214-42e6-4be9-8b0e-537509f5be3an@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_766_580875184.1686746149553" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31585"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCZ25UWY24ERBJ7IU2SAMGQECUEN4TQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Jun 14 14:35:55 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f55.google.com ([209.85.210.55]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1q9Pj8-000815-N5 for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 14 Jun 2023 14:35:54 +0200 Original-Received: by mail-ot1-f55.google.com with SMTP id 46e09a7af769-6b1604fc39asf4797964a34.3 for ; Wed, 14 Jun 2023 05:35:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1686746153; x=1689338153; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :sender:from:to:cc:subject:date:message-id:reply-to; bh=3ASlmFUUIfOe5yO36PL8wggadQ7cwguQ/xiILFTRIjU=; b=tD3kzFZSPd/ibyYgmz4iG05He8lfwnYWk7xC+UlmcdSMn/D5hiQsgAsjL3lLIEMhyv YNX0/qkWk8L91RKgtr6PiVpqn5d4FlcbUWq5HYklt5+ejSBBjWFRyEITxxo0tNKUTMpD Z35VLIQImm8RV0MAXsurNEbQa0TUsfcrSXwnG1pk+mXrUUJXruxCz/ZbmBpucvIE8HG6 wmbyYNKNtTpYt2QTcrznP7seQLCz/e7WRVaPmFs1prfXfbPtH0StVJgp5I59aFRvia2n rHxJ15zFtHwVe4TAMn0gSqetGyvxB12fxJjjcsv223/yBmygJ1UJgNrVIvPm9NZTrE4p O4vw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686746153; x=1689338153; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=3ASlmFUUIfOe5yO36PL8wggadQ7cwguQ/xiILFTRIjU=; b=QMxbH3pJ4m/cE0ZdOj9qkPIYNQ0EgS84j6zgDCxMtTtMuxeFixu/kzfO6d+ECtnPYl 9fVCkhOk5lLdgYyCPmnrRUyTnQSDWgYtyHU1ZbreVJXncjY+JHeEqhV3AYNLY1iscNz/ 3vnvFxi+OWyRtd3DL2fSI5SqJiQKCN1CYZlQ8FUBj9NinAKCqqj729XCHi2LWZPELiNY YusXfEX85JfLD4ENLU94T06kPd3AfU0zfJ3UyC+7xHM+ugIiCgYUgKDp4EglsgrHXWuh gIEPegDdOAyC1+Mw5bs6o/bMQuWDSCxlgVALvseE966n4LK6mYyr/JlgRrU5q4jtqRop Kpww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686746153; x=1689338153; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-sender:mime-version:subject:references:in-reply-to :message-id:to:from:date:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=3ASlmFUUIfOe5yO36PL8wggadQ7cwguQ/xiILFTRIjU=; b=N3LxlZdbLLJkep5pwmBu78n+HwfciiPjydTpakTr7zCNzQUD1BPfFUh3SedvzwZ+dL ZnvdbtMvozCZ4zLGkUgYaaQgo7v2+r9vPPM6qpSZtQZ89zE1asxmRHQd8yMiDUdmVegw 6cCLX3fyN/c2hEBwPAWYzH/qICx88PljSgpaUSRYcUOg/u+gS9P0eHOKZ33A61o2rRAN uCAUD7PdwA9N8zFJBU/64EnvoQwKz/65Nh4Trb6WE6U6zBqNoLrZvCNTYITx6VbC0Y/Y GDF7cla3qSMPuG+IbQ2BNp78/IfwTI1ccq7oE4CTBM5QCI6xjT Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AC+VfDxIuYIxMLDhfSoNLBRoa7KbpdZB8WjfZeSBryJYoTH5bbdNBFUM XVdXdPP14iXWGTdjHxFkVms= X-Google-Smtp-Source: ACHHUZ5IaAMVHkWA73gICjHXRrRBo1ldWfgnRDM93BhGM1eFcKxfhjPP5cA6XbC20hSVJWD3DZ1dFw== X-Received: by 2002:a05:6870:73c4:b0:19f:5f32:32db with SMTP id a4-20020a05687073c400b0019f5f3232dbmr12261220oan.14.1686746153479; Wed, 14 Jun 2023 05:35:53 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6870:6694:b0:1a0:bbd6:a9c5 with SMTP id ge20-20020a056870669400b001a0bbd6a9c5ls166314oab.0.-pod-prod-06-us; Wed, 14 Jun 2023 05:35:50 -0700 (PDT) X-Received: by 2002:a05:6871:6baf:b0:1a6:e141:4f2f with SMTP id zh47-20020a0568716baf00b001a6e1414f2fmr389442oab.0.1686746150292; Wed, 14 Jun 2023 05:35:50 -0700 (PDT) In-Reply-To: X-Original-Sender: stephan2boltzmann-Re5JQEeQqe8AvxtiuMwx3w@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:32817 Archived-At: ------=_Part_766_580875184.1686746149553 Content-Type: multipart/alternative; boundary="----=_Part_767_1360035210.1686746149553" ------=_Part_767_1360035210.1686746149553 Content-Type: text/plain; charset="UTF-8" Thanks a lot for not only suggesting an answer, but also explaining how to debug Lua filters as well as providing the logging script, which helped me a lot. My final solution looks like this and I hope it is of help to anyone arrive at this question via internet search: function Figure (fig) -- works on Windows if FORMAT:match 'docx' then caption = pandoc.utils.stringify(fig.caption.long) if (string.find(caption, 'Fig') ~= nil) then cap = fig.caption.long[1].content fig.caption.long[1].content[1] = pandoc.Strong(cap[1]) num_suffix = string.gsub(cap[3].text,':','.') fig.caption.long[1].content[3] = pandoc.Strong(num_suffix) fig_num_string = string.sub(pandoc.utils.stringify(cap[3]), 1, 1) fig_num = math.floor(tonumber(fig_num_string)) if (fig_num > 6) then num_str = "S" .. tostring(8-fig_num) .. '.' fig.caption.long[1].content[3] = pandoc.Strong(num_str) end end end return fig end I'm happy to add when to use short captions: In case one generates a list of figures in analogy to a table of contents, it can be very helpful to have short captions whereas longer captions might be required to explain in more detail what is shown in a figure. William Lupton schrieb am Dienstag, 13. Juni 2023 um 15:57:05 UTC+2: > I think that the main thing here is that you need to operate on the Figure > rather than the Image. Also note that image and figure captions are > different: > > - An image caption is an Inlines list; > https://pandoc.org/lua-filters.html#type-image > - A figure caption is a Caption object, which has a long (Blocks list) > caption with option short (Inlines list) caption; > https://pandoc.org/lua-filters.html#type-figure > > I'm not quite sure when or if you should use the short figure caption, but > am pretty sure that you do need to set the long figure caption. > > Finally, a plug for the https://github.com/pandoc-ext/logging module, > which can help to shed light on the AST structure. With this document (I > guessed your input format): > > ![Figure 1: Cat](Cat.png) > > ...and with this lua filter (derived from yours): > > local logging = require 'logging' > > function Figure(fig) > logging.temp('figure', fig) > end > > function Image(img) > logging.temp('image', img) > local caption = pandoc.utils.stringify(img.caption) > > if (string.find(caption, 'Fig') ~= nil) then > img.caption[1] = pandoc.Strong(img.caption[1]) > img.caption[3] = pandoc.Str(string.gsub(img.caption[3].text, ":", > ".")) > img.caption[3] = pandoc.Strong(img.caption[3]) > local fig_num_string = string.sub( > pandoc.utils.stringify(img.caption[3]),1,2) > local fig_num = math.floor(tonumber(fig_num_string)) > > if (fig_num > 6) then > img.caption[3] = pandoc.Strong("S" .. tostring(8-fig_num) .. > '.') > end > img.caption.long = pandoc.Strong('A') > img.caption = pandoc.Strong('A') > end > logging.temp('->', img) > return img > end > > ...you get this output: > > % pandoc figure.md -L figure.lua > (#) image Image { > attr: Attr { > attributes: AttributeList {} > classes: List {} > identifier: "" > } > caption: Inlines[5] { > [1] Str "Figure" > [2] Space > [3] Str "1:" > [4] Space > [5] Str "Cat" > } > src: "Cat.png" > title: "" > } > (#) -> Image { > attr: Attr { > attributes: AttributeList {} > classes: List {} > identifier: "" > } > caption: Inlines[1] { > [1] Strong { > content: Inlines[1] { > [1] Str "A" > } > } > } > src: "Cat.png" > title: "" > } > (#) figure Figure { > attr: Attr { > attributes: AttributeList {} > classes: List {} > identifier: "" > } > caption: { > long: Blocks[1] { > [1] Plain { > content: Inlines[5] { > [1] Str "Figure" > [2] Space > [3] Str "1:" > [4] Space > [5] Str "Cat" > } > } > } > } > content: Blocks[1] { > [1] Plain { > content: Inlines[1] { > [1] Image { > attr: Attr { > attributes: AttributeList {} > classes: List {} > identifier: "" > } > caption: Inlines[1] { > [1] Strong { > content: Inlines[1] { > [1] Str "A" > } > } > } > src: "Cat.png" > title: "" > } > } > } > } > } >
> A >
Figure 1: Cat
>
> > On Tue, 13 Jun 2023 at 14:16, Stephan Boltzmann > wrote: > >> Hello everybody out there using Pandoc, >> >> The following Lua (used with RMarkdown in RStudio) filter should put "*Figure >> n.*" in bold at the beginning of every figure caption, but it doesn't >> change my output: >> >> function Image (img) >> if FORMAT:match 'docx' then >> caption = pandoc.utils.stringify(img.caption) >> if (string.find(caption, 'Fig') ~= nil) then >> img.caption[1] = pandoc.Strong(img.caption[1]) >> img.caption[3] = pandoc.Str(string.gsub(img.caption[3].text, ":", >> ".")) >> img.caption[3] = pandoc.Strong(img.caption[3]) >> fig_num_string = >> string.sub(pandoc.utils.stringify(img.caption[3]),1,2) >> fig_num = math.floor(tonumber(fig_num_string)) >> if (fig_num > 6) then >> img.caption[3] = pandoc.Strong("S" .. tostring(8-fig_num) .. '.') >> end >> img.caption.long = pandoc.Strong('A') >> img.caption = pandoc.Strong('A') >> end >> end >> print(pandoc.utils.stringify(img.caption.long)) >> return img >> end >> >> By putting print statements, I can partially verify that the filter >> operates on the correct elements, but it doesn't change the output. >> >> -- >> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/534b2214-42e6-4be9-8b0e-537509f5be3an%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/c1b91dac-7b1d-4d2b-96d0-7306ae80750en%40googlegroups.com. ------=_Part_767_1360035210.1686746149553 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks a lot for not only suggesting an answer, but also explaining ho= w to debug Lua filters as well as providing the logging script, which helpe= d me a lot.

My final solution looks like this an= d I hope it is of help to anyone arrive at this question via internet searc= h:

fun= ction Figure (fig) =C2=A0-- works on Windows
=C2=A0 if FORMAT:match 'd= ocx' then
=C2=A0 =C2=A0 caption =3D pandoc.utils.stringify(fig.caption= .long)
=C2=A0 =C2=A0 if (string.find(caption, 'Fig') ~=3D nil) then=C2=A0 =C2=A0 =C2=A0 cap =3D fig.caption.long[1].content
=C2=A0 =C2= =A0 =C2=A0 fig.caption.long[1].content[1] =3D pandoc.Strong(cap[1])
= =C2=A0 =C2=A0 =C2=A0 num_suffix =3D string.gsub(cap[3].text,':','.')
= =C2=A0 =C2=A0 =C2=A0 fig.caption.long[1].content[3] =3D pandoc.Strong(num_s= uffix)
=C2=A0 =C2=A0 =C2=A0 fig_num_string =3D string.sub(pandoc.utils= .stringify(cap[3]), 1, 1)
=C2=A0 =C2=A0 =C2=A0 fig_num =3D math.floor(= tonumber(fig_num_string))
=C2=A0 =C2=A0 =C2=A0 if (fig_num > 6) the= n
=C2=A0 =C2=A0 =C2=A0 =C2=A0 num_str =3D "S" .. tostring(8-fig_num) .= . '.'
=C2=A0 =C2=A0 =C2=A0 =C2=A0 fig.caption.long[1].content[3] =3D p= andoc.Strong(num_str)
=C2=A0 =C2=A0 =C2=A0 end
=C2=A0 =C2=A0 end<= br />=C2=A0 end
=C2=A0 return fig
end

=C2=A0I'm happy to = add when to use short captions:
In case one generates a list of f= igures in analogy to a table of contents, it can be very helpful to have sh= ort captions whereas longer captions might be required to explain in more d= etail what is shown in a figure.

William Lupton schrieb am Dienstag, 13. Juni 2023 um 15:57:= 05 UTC+2:
I think that the main thing here is that you need to operate = on the Figure rather than the Image. Also note that image and figure captio= ns are different:=C2=A0
I'm not quite sure when or if you should use th= e short figure caption, but am pretty sure that you do need to set the long= figure caption.

Finally, a plug for the=C2= =A0https://github.com/p= andoc-ext/logging module, which can help to shed light on the AST struc= ture. With this document (I guessed your input format):

![Figure 1: Cat](Cat.png)

...and with this lua filter (derived from yours):

local logging =3D require 'l= ogging'

function Figure(fig)
=C2=A0 =C2=A0 logging.temp('= figure', fig)
end

function Image(img)
=C2=A0 =C2=A0 loggin= g.temp('image', img)
=C2=A0 =C2=A0 local caption =3D pandoc.util= s.stringify(img.caption)

=C2=A0 =C2=A0 if (string.find(caption, 'Fig') ~= =3D nil) then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 img.caption[1] =3D pandoc.Stro= ng(img.caption[1])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 img.caption[3] =3D pandoc= .Str(string.gsub(img.caption[3].text, ":", "."))
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 img.caption[3] =3D pandoc.Strong(img.caption[3])
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 local fig_num_string =3D string.sub(
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 pandoc.utils.stringify(img.caption[3]),1,2)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 local fig_num =3D math.floor(tonumber(fig_num_s= tring))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (fig_num > 6) then
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 img.caption[3] =3D pandoc.Strong("S" .. = tostring(8-fig_num) .. '.')
=C2=A0 =C2=A0 =C2=A0 =C2=A0 end
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 img.caption.long =3D pandoc.Strong('A')=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 img.caption =3D pandoc.Strong('A')<= br>=C2=A0 =C2=A0 end
=C2=A0 =C2=A0 logging.temp('->', img)
=C2=A0 = =C2=A0 return img
end

...you get thi= s output:

% pandoc figure= .md -L figure.lua
(#) image Image {
=C2=A0 attr: Attr {
=C2=A0 =C2= =A0 attributes: AttributeList {}
=C2=A0 =C2=A0 classes: List {}
=C2= =A0 =C2=A0 identifier: ""
=C2=A0 }
=C2=A0 caption: Inlines[= 5] {
=C2=A0 =C2=A0 [1] Str "Figure"
=C2=A0 =C2=A0 [2] Space=
=C2=A0 =C2=A0 [3] Str "1:"
=C2=A0 =C2=A0 [4] Space
=C2= =A0 =C2=A0 [5] Str "Cat"
=C2=A0 }
=C2=A0 src: "Cat.png= "
=C2=A0 title: ""
}
(#) -> Image {
=C2=A0 at= tr: Attr {
=C2=A0 =C2=A0 attributes: AttributeList {}
=C2=A0 =C2=A0 c= lasses: List {}
=C2=A0 =C2=A0 identifier: ""
=C2=A0 }
= =C2=A0 caption: Inlines[1] {
=C2=A0 =C2=A0 [1] Strong {
=C2=A0 =C2=A0= =C2=A0 content: Inlines[1] {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 [1] Str "= A"
=C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 }
=C2=A0 }
=C2=A0 = src: "Cat.png"
=C2=A0 title: ""
}
(#) figure F= igure {
=C2=A0 attr: Attr {
=C2=A0 =C2=A0 attributes: AttributeList {= }
=C2=A0 =C2=A0 classes: List {}
=C2=A0 =C2=A0 identifier: "&quo= t;
=C2=A0 }
=C2=A0 caption: {
=C2=A0 =C2=A0 long: Blocks[1] {
= =C2=A0 =C2=A0 =C2=A0 [1] Plain {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 content: In= lines[5] {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [1] Str "Figure"=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [2] Space
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 [3] Str "1:"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = [4] Space
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [5] Str "Cat"
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 }<= br>=C2=A0 }
=C2=A0 content: Blocks[1] {
=C2=A0 =C2=A0 [1] Plain {
= =C2=A0 =C2=A0 =C2=A0 content: Inlines[1] {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 [= 1] Image {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 attr: Attr {
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 attributes: AttributeList {}
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 classes: List {}
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 identifier: ""
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 caption: Inlines[1] {=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [1] Strong {
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 content: Inlines[1] {
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [1] Str "A"
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 src: "Cat.png"
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 title: ""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 = =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 }
=C2=A0 }
}
<figure>
&l= t;img src=3D"Cat.png" alt=3D"A" />
<figcaption= >Figure 1: Cat</figcaption>
</figure>
<= br>
On Tue, 13 Jun 2023 at 14:16, Stephan Boltzmann &= lt;stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>= wrote:
Hello everybody out there using Pandoc,
=

The following Lua (used with RMarkdown in RStudio) filt= er should put "Figure n." in bold at the beginning of ever= y figure caption, but it doesn't change my output:

=
function Image (im= g)
=C2=A0 if FORMAT:match 'docx' then
=C2=A0 =C2=A0 caption = =3D pandoc.utils.stringify(img.caption)
=C2=A0 =C2=A0 if (string.find(ca= ption, 'Fig') ~=3D nil) then
=C2=A0 =C2=A0 =C2=A0 img.caption[1]= =3D pandoc.Strong(img.caption[1])
=C2=A0 =C2=A0 =C2=A0 img.caption[3] = =3D pandoc.Str(string.gsub(img.caption[3].text, ":", "."= ;))
=C2=A0 =C2=A0 =C2=A0 img.caption[3] =3D pandoc.Strong(img.caption[3]= )
=C2=A0 =C2=A0 =C2=A0 fig_num_string =3D string.sub(pandoc.utils.string= ify(img.caption[3]),1,2)
=C2=A0 =C2=A0 =C2=A0 fig_num =3D math.floor(ton= umber(fig_num_string))
=C2=A0 =C2=A0 =C2=A0 if (fig_num > 6) then
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 img.caption[3] =3D pandoc.Strong("S" = .. tostring(8-fig_num) .. '.')
=C2=A0 =C2=A0 =C2=A0 end
=C2= =A0 =C2=A0 =C2=A0 img.caption.long =3D pandoc.Strong('A')
=C2=A0= =C2=A0 =C2=A0 img.caption =3D pandoc.Strong('A')
=C2=A0 =C2=A0 = end
=C2=A0 end
=C2=A0 print(pandoc.utils.stringify(img.caption.long))=
=C2=A0 return img
end

By putting print statements, I= can partially verify that the filter operates on the correct elements, but= it doesn't change the output.

--
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-discus...@googleg= roups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/534b2214-4= 2e6-4be9-8b0e-537509f5be3an%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/c1b91dac-7b1d-4d2b-96d0-7306ae80750en%40googlegroups.= com.
------=_Part_767_1360035210.1686746149553-- ------=_Part_766_580875184.1686746149553--