From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32794 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "'William Lupton' via pandoc-discuss" Newsgroups: gmane.text.pandoc Subject: Re: Wrapping sections of text with
in custom filter Date: Mon, 12 Jun 2023 22:09:20 +0100 Message-ID: References: <2fc450a6-5a16-316c-02c8-8ef055bccd11@meddatainc.com> <93e5b610-66a2-6ac7-1d53-8a04a8314249@meddatainc.com> <853c402b-d9ee-4c9d-8bae-15b20faf7194n@googlegroups.com> <1F66BB1E-B5C8-4062-8202-D82C5CE9A3D0@meddatainc.com> <6d414734-e661-ae2d-68a1-4dfc9cb4f035@meddatainc.com> <4c58dad0-bd86-608e-2d68-74bd6f2f808b@meddatainc.com> <574fbf9f-c1b8-711a-f14a-3acd75cbf634@meddatainc.com> <05ba5663-1578-d555-8539-d6a2bdff6743@meddatainc.com> <7878b22d-bf64-2d25-1136-d9f9cf5e135b@meddatainc.com> <992af9a4-285c-a20f-56de-347ea88f021f@meddatainc.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000083b31105fdf52225" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23883"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCS4HJ6WSAHBBDMTT2SAMGQEOXRWZFI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Jun 12 23:09:46 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wm1-f61.google.com ([209.85.128.61]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1q8onC-0005n3-8Q for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 12 Jun 2023 23:09:38 +0200 Original-Received: by mail-wm1-f61.google.com with SMTP id 5b1f17b1804b1-3f5fa06debcsf31858385e9.0 for ; Mon, 12 Jun 2023 14:09:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686604178; cv=pass; d=google.com; s=arc-20160816; b=Y3k5bo6JspPVykwXaOhYbkbvnT7Nrs3wApsyRN9Frr3R0Wp0Z42Uq5a3RU/4r8+jtM GiOugoZ6bAvqmNAI0IeTTqJp3kjiluHRlkUyBN+GQtFS7zc/GUdev25HaRt5p+O4rqqo PB0i6encVSttoxMt3XR/Zoz48zlbaXabyv4sn7G3kplyHMEZ5FFc0V6KXhcZSvPaj93F bdZ5B0CNzaISb9OAPSJr26+QfYlQjWRwXdnlkXWoG8E8jEtEQi3F4RhGH93q8yLDAb4W F21C+Ki/P1WlNRbYwVWV1FRGptONM72ZsxHK5EReya9F0NAkuPwbVX4MOP2P00I5vzBu y0sQ== 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:dkim-signature; bh=nowObJq93exnitoN1qvzlMhQe9x1sPzGQHtN23CJTx4=; b=rnEHkthYOLRMQxDkOxI78P+Es9TmKLiKRJ3JvkGa9f8h5tloxHYc2m6C65EN17eUzi 7Vcu7EGZHxQms3tiuLX7HJDvWNysK/hPyMs7tX0C1wFXjrZdSp3Kkyi/ePlW0aJizL9u 2k4Mw3fdjQ8o7cmYDJPM5xOOk4tnsYyTeLFgmh99HTr6OCYgiRjhR38tOnvE5A7VHp7I McZYiAqo5i2BeVDlcgScFufX2wILBKFKNTloDSVMZQgNPyNWLdnT9JJC8qz01wPazC59 /zv4G/N/qpJeWaxAiB6eBPkDXetsmOQ6Y2lKHOk68iG0j+QoWNxBUBW6+5OrCX3FlJhe nPCA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@broadband-forum.org header.s=google header.b="AI6X33N/"; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::529 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadband-forum.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1686604177; x=1689196177; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version:from:to:cc :subject:date:message-id:reply-to; bh=nowObJq93exnitoN1qvzlMhQe9x1sPzGQHtN23CJTx4=; b=VeZF0ysvIH8K5TcDjSoluVTwltjlBeW+mqI6nE9TAC8DNHeA2BZNRP29mrvKcpRkWM 0GoclegcyITxh5z3eu8FZOfDswSvGK4fbMilVBelQx8NYIVq+nwU/pXQUIptpgn2r8ds oAbIRw61XstYNC0+nE4qEGMK40FsMx2/NqR/t00nQbPd3VvsyI47hUc3CZNJde2gQSco SvPZNnA/ngclchHX060lPWlThI9rBj06/VQP4u5CrEc7JnfJMuCTEJIzzRyPYVystssm lUMROo2zZrKL35MXUc6pAsIu66ZkZa8N5/ysYzvPi/Da0k8KmCPn0Kfziw5vVnVln/O5 xE X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686604177; x=1689196177; 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-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nowObJq93exnitoN1qvzlMhQe9x1sPzGQHtN23CJTx4=; b=hhY66u/n/v2qXmdwucPa2LxOI10GFOnWvFW+yVcDl5HQ/uhR5q/LlZSd4Xm7CUqylk eBUIFhozMFx/l/eFug5IyZX7AYHyFYRlLlI9Tj/dSJu/kMhvx9ap+rUC+/DA/iqyghC4 MnM3yoap6x8kah9RLH1QcUkkOr5Q1SKZbcDzAuh1dlI9svIX3trWCPTTyJUXufinHiRc 20zx4LZVQFsNiIRtm/m+HY2ojbyUelFKJk9j8o6UIddFt9voVAR+CpnCPaGGQdPaGnrT CMHzWj6vCsLVv X-Gm-Message-State: AC+VfDwv20CqWvDc01nE8vF+C9pvANKXrnKO4ujsg6DZrmiV1OG95Nxq AFhFlJicnAhxHu4MzZcTZcc= X-Google-Smtp-Source: ACHHUZ4POX6nsum9m26BvTr/LQKk49Zo6qlj9OJ2m1+3MSl988VI1t1bKqaWiQdsfdhIk76+aMv/SQ== X-Received: by 2002:a05:600c:2198:b0:3f8:1d6c:4587 with SMTP id e24-20020a05600c219800b003f81d6c4587mr2335980wme.19.1686604176966; Mon, 12 Jun 2023 14:09:36 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:600c:1d20:b0:3f6:f2c9:1a30 with SMTP id l32-20020a05600c1d2000b003f6f2c91a30ls1407169wms.0.-pod-prod-07-eu; Mon, 12 Jun 2023 14:09:32 -0700 (PDT) X-Received: by 2002:adf:f150:0:b0:30f:cc45:5af1 with SMTP id y16-20020adff150000000b0030fcc455af1mr160949wro.45.1686604172278; Mon, 12 Jun 2023 14:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686604172; cv=none; d=google.com; s=arc-20160816; b=bhB7gx+MgjKwvePIRHp6ULet+syZ6ip6+LXwLWtAdzVx/45x7xYP1VOb1AIYCJSmY+ fo1ywPETiJdrArAS0j7JBmZ5D/QsplONPBDKQh/UeNHaF++/iKwvc1LlQJgCLf70KnBu 2WPMqjjv64rfgaxS6xTzbEFAFrExsPQ+cDx5O5cP/cGFl8ByEFdLOJ+AcaTeWNgjr2Bc Fv1Qiong12MMfPXp3EnUHYD1EVZ1UgmP9Z1nTD+0ohxfQvEBOyH3hSkGdVBBUc+ocljl BUDR1gxAV9a75tOvaeiRgLmK5rCLQrURN7/gIk2r/cSHuM70ufdhchhN35O29gSqoYdH NOBg== 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=qukGj2IyEHvavIsaDyekjT//V9/bL+tQfxFa/QNHVrk=; b=iAu5dysttjQ0QVljVGLHjs/bcKAVuY7ipPIKlZs+nFgSUSMdTAvAxuqV4S4gN518h7 yjD6ScVGqk2ShNm5zALoeCJ+sSfA6vWtkIOMWu+trnKdMcT06NQZZ2kfCI4tne5Vr/VT uC0x2TvhdkX3TikPDByHot6vVhYoksDA8vYWwhHQ3w7vo9mx57QxWKetTlRXSOmiHyNL vMnbUakDytBzNS4h7ydEG7xFXmDQ9bGYMq/JcnSgriNmH4bBz3KL/lO3/a4CGsOABX1E umWhRNYI+6VU5LM9/Vqqwej223dCHuJdItPBpRNMUBwTEb65xFDHDWpCHwcQBelSt/Qd 5rsQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@broadband-forum.org header.s=google header.b="AI6X33N/"; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::529 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadband-forum.org Original-Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com. [2a00:1450:4864:20::529]) by gmr-mx.google.com with ESMTPS id d20-20020a05600c34d400b003f7eb2a8258si682594wmq.2.2023.06.12.14.09.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Jun 2023 14:09:32 -0700 (PDT) Received-SPF: pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::529 as permitted sender) client-ip=2a00:1450:4864:20::529; Original-Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-51868eb05ecso996006a12.2 for ; Mon, 12 Jun 2023 14:09:32 -0700 (PDT) X-Received: by 2002:a17:907:9349:b0:973:e4c2:2bcd with SMTP id bv9-20020a170907934900b00973e4c22bcdmr10064095ejc.18.1686604171416; Mon, 12 Jun 2023 14:09:31 -0700 (PDT) In-Reply-To: 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 header.s=google header.b="AI6X33N/"; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::529 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadband-forum.org X-Original-From: William Lupton 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:32794 Archived-At: --00000000000083b31105fdf52225 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I'm not sure whether this helps in your situation, but if the image has no alt text then there'll be no caption in the HTML (and no figure element either). This document: ![test](https://www.somedomain.tld/test.jpg) ![](https://www.somedomain.tld/test.jpg) ...gives this HTML:
3D"test"
test

See https://pandoc.org/MANUAL.html#extension-implicit_figures On Sun, 11 Jun 2023 at 16:54, H wrote: > On 06/11/2023 09:51 AM, BPJ wrote: > > An image will be wrapped in a `
` when it is the only thing in a > paragraph, so the workaround is to add a non-breaking space after the > image. > > This filter removes the Figure leaving the Image and an nbspace in a Para > unless the Image has a class `.fig`. > > It can be used both to globally insert the needed nbspace into Markdown o= r > used always to so to speak implement a better syntax where you clearly ma= rk > a lone-image paragraph if you want a figure. > > https://gist.github.com/bpj/6664b0b0755e7ebe9007de4d1426d400 > > Den s=C3=B6n 11 juni 2023 04:26H skrev: > >> On 06/06/2023 03:14 PM, H wrote: >> >> On 06/01/2023 04:34 AM, 'William Lupton' via pandoc-discuss wrote: >> >> Am I correct in thinking that when you say "filter" here, you really mea= n >> "writer"? >> >> In filters, you can use the 'traverse' field to force top-down traversal= . >> See https://pandoc.org/lua-filters.html#traversal-order >> >> In writers, you can choose to call doc:walk(), which will honour >> 'traverse'. See >> https://pandoc.org/custom-writers.html#example-modified-markdown-writer >> (and example below) >> >> However, if you use pandoc.scaffolding.Writer (as I think you are?) then >> I suspect that you can't control the traversal order (but I'm not sure t= hat >> it makes sense to do so, because, for example, surely you always want th= e >> contents of a
to have been traversed before you add '
' and >> '
'?). >> >> With the custom writer shown below, and with an input file that consists >> of the single line 'Text' (and using my logging module >> ), you get this with the default >> 'typewise' traversal: >> >> (#) inline Str "Text" >> (#) inlines Inlines[1] {[1] Str "Text"} >> (#) block Para {content: Inlines[1] {[1] Str "Text"}} >> (#) blocks Blocks[1] {[1] Para {content: Inlines[1] {[1] Str "Text"}}} >> (#) meta Meta {} >> (#) doc Pandoc { >> blocks: Blocks[1] { >> [1] Para { >> content: Inlines[1] { >> [1] Str "Text" >> } >> } >> } >> meta: Meta {} >> } >> >> ...and this with 'topdown' traversal: >> >> (#) doc Pandoc { >> blocks: Blocks[1] { >> [1] Para { >> content: Inlines[1] { >> [1] Str "Text" >> } >> } >> } >> meta: Meta {} >> } >> (#) meta Meta {} >> (#) blocks Blocks[1] {[1] Para {content: Inlines[1] {[1] Str "Text"}}} >> (#) block Para {content: Inlines[1] {[1] Str "Text"}} >> (#) inlines Inlines[1] {[1] Str "Text"} >> (#) inline Str "Text" >> >> The writer: >> >> local logging =3D require 'logging' >> >> local function report(label, elem) >> logging.temp(label, elem) >> end >> >> -- 'typewise' (default) or 'topdown' >> local traverse =3D 'topdown' >> >> function Writer (doc, opts) >> local filter =3D { >> traverse =3D traverse, >> Inline =3D function(inline) >> report('inline', inline) >> end, >> Inlines=3D function(inlines) >> report('inlines', inlines) >> end, >> Block =3D function(block) >> report('block', block) >> end, >> Blocks =3D function(blocks) >> report('blocks', blocks) >> end, >> Meta =3D function(meta) >> report('meta', meta) >> end, >> Pandoc =3D function(doc) >> report('doc', doc) >> end, >> } >> return pandoc.write(doc:walk(filter), 'html', opts) >> end >> >> Thank you for your thoughtful response. I realize I have used the term >> 'filter' and 'writer' cavalierly. I have a "slightly" complicated layout= I >> want to output from the writer and my thought right now is that I should >> try to add the
and
in the right places in a filter and then >> let the writer just output the resulting html. >> >> I may have to traverse the AST several times in my filter to accomplish >> the result since multiple
need to be added at different leve= ls >> to achieve the desired output. >> >> I just downloaded your logging filter to aid in the development and am >> also working on formalizing the rules for adding
. >> >> >> I spent some more time learning more about writing filters and have made >> some progress. >> >> I think the entire logic for adding
to achieve the desired >> layout might be doable in the filter and most of it seems to be working. >> >> One thing I found is that when an image is included using the following >> syntax >> ![test](https://www.somedomain.tld/test.jpg) >> pandoc wraps the element in
which I think I >> don't want/need. >> >> How can I get rid of
wrapped around elements? At the >> very least I want got get rid of some text I do not >> need inside the
element? >> >> Got it, thank you and I will look at your code. If I am not adding the > non-breakable space after the image however, how do I get rid of the > element which I do not need (or want cluttering up my cod= e)? > > -- > 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/b189960a-3e0d-19b8-91e2-= c16dc88cd595%40meddatainc.com > > . > --=20 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 e= mail 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_xxjer3B9Qy8oGGNx_ARySSMD1mG8-AD6-EJQQXYnddFMYA%40mail.g= mail.com. --00000000000083b31105fdf52225 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'm not sure whether this helps in your situation, but= if the image has no alt text then there'll be no caption in the HTML (= and no figure element either). This document:



...gives this HTML:

<= div><figure>
<img src=3D"https://www.somedomain.tld/test.jp= g" alt=3D"test" />
<figcaption aria-hidden=3D&q= uot;true">test</figcaption>
</figure>
<p>&l= t;img src=3D"https://w= ww.somedomain.tld/test.jpg" /></p>

<= br>


On Sun, 11 Jun 2023 at 16:54, H <agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org> wrote:
=20 =20 =20
On 06/11/2023 09:51 AM, BPJ wrote:
=20
An image will be wrapped in a `<figure>` when it is the only thing in a paragraph, so the workaround is to add a non-breaking space after the image.

This filter removes the Figure leaving the Image and an nbspace in a Para unless the Image has a class `.fig`.

It can be used both to globally insert the needed nbspace into Markdown or used always to so to speak implement a better syntax where you clearly mark a lone-image paragraph if you want a figure.


Den s=C3=B6n 11 juni 2023 04:= 26H <ag= ents-FcZObrvlYduBUy7/sJONFg@public.gmane.org> skrev:
On 06/06/2023 03:14 PM, H wrote:
On 06/01/2023 04:34 AM, 'William Lupton' via pandoc-discuss wrote:
Am I correct in thinking that when you say "filter" here, you really mean "writer= "?

In filters, you can use the 'traverse' field= to force top-down traversal. See https://pandoc.org/lua-filters.html#traversal-order

In writers, you can choose to call doc:walk(), which will honour 'traverse'. See=C2=A0https://pandoc.org/custom-writers.ht= ml#example-modified-markdown-writer (and example below)

However, if you use=C2=A0pandoc.scaffolding.Writer (= as I think you are?) then I suspect that you can't control the traversal order (but I'm not sure that it makes sense to do so, because, for example, surely you always want the contents of a <div> to have been traversed before you add '<div>&= #39; and '</div>'?).

With the custom writer shown below, and with an input file that consists of the single line 'Text&#= 39; (and using my logging module), you get this with the default 'typewise' traversal:=

(#) inline Str "Text&q= uot;
(#) inlines Inlines[1] {[1] Str "Text"}
(#) block Para {content: Inlines[1] {[1] Str "Text"}}
(#) blocks Blocks[1] {[1] Para {content: Inlines[1] {[1] Str "Text"}}}
(#) meta Meta {}
(#) doc Pandoc {
=C2=A0 blocks: Blocks[1] {
=C2=A0 =C2=A0 [1] Para {
=C2=A0 =C2=A0 =C2=A0 content: Inlines[1] {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 [1] Str "Text"<= br> =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 }
=C2=A0 }
=C2=A0 meta: Meta {}
}


...and this with 'topdown' traversal:

(#) doc Pandoc {
=C2=A0 blocks: Blocks[1] {
=C2=A0 =C2=A0 [1] Para {
=C2=A0 =C2=A0 =C2=A0 content: Inlines[1] {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 [1] Str "Text"<= br> =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 }
=C2=A0 }
=C2=A0 meta: Meta {}
}
(#) meta Meta {}
(#) blocks Blocks[1] {[1] Para {content: Inlines[1] {[1] Str "Text"}}}
(#) block Para {content: Inlines[1] {[1] Str "Text"}}
(#) inlines Inlines[1] {[1] Str "Text"}
(#) inline Str "Text"

The writer:

local logging =3D require 'logging'

local function report(label, elem)
=C2=A0 =C2=A0 logging.temp(label, elem)
end

-- 'typewise' (default) or 'topdown'<= br> local traverse =3D 'topdown'

function Writer (doc, opts)
=C2=A0 =C2=A0 local filter =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 traverse =3D traverse, =C2=A0 =C2=A0 =C2=A0 =C2=A0 Inline =3D function(inlin= e)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 report('= ;inline', inline)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 end,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Inlines=3D function(inlin= es)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 report('= ;inlines', inlines)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 end,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Block =3D function(block)=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 report('= ;block', block)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 end,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Blocks =3D function(block= s)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 report('= ;blocks', blocks)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 end,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Meta =3D function(meta) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 report('= ;meta', meta)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 end,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Pandoc =3D function(doc)<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 report('= ;doc', doc)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 end,
=C2=A0 =C2=A0 }
=C2=A0 =C2=A0 return pandoc.write(doc:walk(filter), &= #39;html', opts)
end


Thank you for your thoughtful response. I realize I have used the term 'filter' and 'writer' ca= valierly. I have a "slightly" complicated layout I want to ou= tput from the writer and my thought right now is that I should try to add the <div> and </div> in the right places in a filter and then let the writer just output the resulting html.

I may have to traverse the AST several times in my filter to accomplish the result since multiple <div></div> need to be added at different levels to achieve the desired output.

I just downloaded your logging filter to aid in the development and am also working on formalizing the rules for adding <div></div>.


I spent some more time learning more about writing filters and have made some progress.

I think the entire logic for adding <div></div> to achieve the desired layout might be doable in the filter and most of it seems to be working.

One thing I found is that when an image is included using the following syntax
![test](https://www.somedomain.tld/test.jpg)
pandoc wraps the <image> element in <figure></figure> which I think I don't want/need.

How can I get rid of <figure> wrapped around <image> elements? At the very least I want got get rid of <figurecaption>some text I do not need</figurecaption> inside the <figure></figure> element?

Got it, thank you and I will look at your code. If I am not adding the non-breakable space after the image however, how do I get rid of the <figurecaption> element which I do not need (or want cluttering up my code)?

--
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/b189960a-3e0d-19b8-91e2-c16dc88cd5= 95%40meddatainc.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_xxjer3B9Qy8oGGNx_ARySSMD1mG8-AD6-EJQ= QXYnddFMYA%40mail.gmail.com.
--00000000000083b31105fdf52225--