From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32789 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: H Newsgroups: gmane.text.pandoc Subject: Re: Wrapping sections of text with
in custom filter Date: Sat, 10 Jun 2023 22:25:37 -0400 Message-ID: <992af9a4-285c-a20f-56de-347ea88f021f@meddatainc.com> 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> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------D2ACCC6BE61243FCF5B40674" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37006"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCEIZSNSZ4IRBI7BSSSAMGQENXCBMCQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Jun 11 04:25:44 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-qt1-f190.google.com ([209.85.160.190]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1q8Alz-0009SB-L2 for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 11 Jun 2023 04:25:43 +0200 Original-Received: by mail-qt1-f190.google.com with SMTP id d75a77b69052e-3f9aa2026ffsf43913861cf.2 for ; Sat, 10 Jun 2023 19:25:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686450342; cv=pass; d=google.com; s=arc-20160816; b=ZUDA5EC3zx5ggICVZLZcp3xZN3IBEutywfCQaIsZ933iN1FSLkewpNspimNAZZgFUI daOGCx0j29hGq7MxKseep1LuyhuOavN+zLsYtKig3jcwVgZ4enfAe2TSMihXz5TyRnKH iWbi4+KcYkH3JuC3mq9KoikTq7NBDtadfxyR+G0BYz0Yyoji2fzk/nTLLmemAMcWPP4B QVWvtgXyLjmXYnKfgByLJTNf0HMTyED9drAIG7b6+Wra8afr0uAEw7EfVR07mfyGGtIg FJc1GsFTazZeZK32nSgLhO4Nh3I2zmlOV86PNh/b/fswp4HnYcK90lBhv8S10a6yTVs6 WFiQ== 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:ui-outboundreport :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:to:from:subject:sender:dkim-signature; bh=3/iLcotdiK41G25uY/1CZJaGm5E7WKPZeym1Dk357ys=; b=SHF6pI/FDV0raNb1Kd6lEjKnAXtX31vGY+bpnJ2jG3fvqM5vsW1SRQFuv24rB6rCh3 pjuuqxJDK1MhzkVmmZRQL28GpSb6YRbdcDRdt2TRL/JJsnMj30bOHLDVS5MAI5xtjmuy 5cM48T6oybA5Fv3oLpXVxIxYODTimE62392mpZEWajPLy39VWiBho5mmmfeDt2jUAqu8 bN+nd9mVc31xUoG2obW0yTcsKKkJw/6/8Zb8ONUq9bl2cux47Nr1kU1jIlWn4nihBwcx xNuyulmgJFu9CQW6ner6q8C/S7YNKuxlobmawcH/FlrfUBwgRnfLWRQC6amEcOiBJWzB eBBw== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org designates 74.208.4.197 as permitted sender) smtp.mailfrom=agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=meddatainc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1686450342; x=1689042342; 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 :ui-outboundreport:content-language:in-reply-to:mime-version :user-agent:date:message-id:references:to:from:subject:sender:from :to:cc:subject:date:message-id:reply-to; bh=3/iLcotdiK41G25uY/1CZJaGm5E7WKPZeym1Dk357ys=; b=q6xcEMfCnXIjp1c6EkfhUr4417eG1VZtEhIhvv4VYmzTjAclJZU5tc82XLe3FtnvJy ws8+7NpsK1JnoF0Vk9DvzsU0YQk7MZ3PSzNv4ao+EZS3FzET5LFZl2B5VLhWTzfb/aTo Skr347BdjdDq03btFgqc9WE1Cm1dpkw1uRAVQnn8EdvQ3FYp8V/KplCPR3WsAixRsgou jCvoKYkUFTV4qxSAYVnQggnc+oBpWH4mLlT85GKmJuQxgZ+agRhPc2ZjzEouae8nmoBX zTDYcpbzwNuLY5kdb X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686450342; x=1689042342; 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 :ui-outboundreport:content-language:in-reply-to:mime-version :user-agent:date:message-id:references:to:from:subject:x-beenthere :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=3/iLcotdiK41G25uY/1CZJaGm5E7WKPZeym1Dk357ys=; b=lAIKfc3RJN+jvuwYcGnHVJ6nClx3NYufToRikwH9t6QFqAqEaDpeSlIQqsehcRaVFE U1UQlTAa9jk6kyj+GtxTYqThP4MkA8cM/EhqMV28gs35cMfRbbkVBY488Nh63BQ0HQ4Q OXJXVQ4fiSCQtOhOpHGvRprgBRrw3IL3P6AzrTj+Sho+gvD8ydLc3bd4pNxeWuyx6Pq9 QRviu5nZVQZbadC9HGOujby6B+V2 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AC+VfDwBpv0dGrifAMyVorzB2tAsUWy26hIwUMZ5TpjPTFkTRmGWalWr AdVODoWbtYR8RQ9BmmYOTCc= X-Google-Smtp-Source: ACHHUZ43t0VNnCBUECw8YZDXMmQ02B8buNW+XmHBpCv60in/t+2msfHo1k/0EHUlz1ocO1sEDry+Xg== X-Received: by 2002:a05:622a:14d0:b0:3f6:b4ee:f4c1 with SMTP id u16-20020a05622a14d000b003f6b4eef4c1mr6732992qtx.23.1686450342624; Sat, 10 Jun 2023 19:25:42 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:ac8:53ca:0:b0:3ef:5bd8:4108 with SMTP id c10-20020ac853ca000000b003ef5bd84108ls651206qtq.0.-pod-prod-06-us; Sat, 10 Jun 2023 19:25:39 -0700 (PDT) X-Received: by 2002:a05:622a:1ba2:b0:3f9:b63d:1be8 with SMTP id bp34-20020a05622a1ba200b003f9b63d1be8mr6233535qtb.52.1686450339464; Sat, 10 Jun 2023 19:25:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686450339; cv=none; d=google.com; s=arc-20160816; b=WlqaO1wDqu5ibFf+hvp2CFSLqt5rrT0j7BfWnG+ItodU1eve4gbT68cZ3qko4EFQ34 yEjNKM+VxcZmP68KImb6GeqP+CIB0bMKpr3od10RYtFhKaafLTTwCV683upe2Jvx8oXr aJh9c9KXprY5HW7oYg6eiehTWIwF7ms/LhiBidGRDhe/CRJE2JV+lLPX3wShjWMF2qz3 oEehtQgkIKTO9LgIP73Cuq5hJ5EhXsj6PuUwEPTydJ2jqlr7xn3hGpELKzHlBoJo0eXu obocg6rFQBEdkQ9/8jTS5N6fanvVDa7r5y9Rc/S/+wVd66UDj5E2lwOeQh59gzledrMQ 35xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-language:in-reply-to:mime-version :user-agent:date:message-id:references:to:from:subject; bh=oqwwY0f3vPb9AEk9NZ73/ad8mcmvnYyUGG6YtqS328k=; b=DLCfdokFKRViW9oZ37ZXSR067vOcLdn++ZkXqyHS3e7mmPcrS6yoQVJhIiFyrSH9qM sfu+ip70qYvCn43Ui0vFRNTWxpZ/70Ag/4RrNI7keIIIt8PuvlTDDYHXRd3sJZJ3PTTT mNj2Lc4oZ2YQ1Jg6wkhPPa3Ws/8awRpjEtFPCERE26M9rOyWi/GMU0jmbjJmIeEMtxVg z8G2P5PuNZDY6kNiZX+8+s+qZ8+Yxnhi39ceWggVLfYRHCpErLRNV3ywDuMcW8MbH0+L 22LnZe4A6K9X0kmYVKqJ2roGCf4sTV5X4G0ip3oMpazCdBECOQBekJ/oU8kjWeFLj7pn xXYQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org designates 74.208.4.197 as permitted sender) smtp.mailfrom=agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=meddatainc.com Original-Received: from mout.perfora.net (mout.perfora.net. [74.208.4.197]) by gmr-mx.google.com with ESMTPS id ce9-20020a056122410900b004664491e01csi682695vkb.4.2023.06.10.19.25.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Jun 2023 19:25:39 -0700 (PDT) Received-SPF: pass (google.com: domain of agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org designates 74.208.4.197 as permitted sender) client-ip=74.208.4.197; Original-Received: from [192.168.1.17] ([72.94.51.172]) by mrelay.perfora.net (mreueus003 [74.208.5.2]) with ESMTPSA (Nemesis) id 0MKpCY-1q8Alu1QAq-0002Vn for ; Sun, 11 Jun 2023 04:25:38 +0200 In-Reply-To: <7878b22d-bf64-2d25-1136-d9f9cf5e135b-FcZObrvlYduBUy7/sJONFg@public.gmane.org> Content-Language: en-US X-Provags-ID: V03:K1:ltqg9H1O8do1grDvsNNGkOwWnFfXYqNnlE/2RBgp6ThopeuyjNC NTQX3WZ1xCYTdtQPXpQQoIIAvENNkO9Intb7MC+hh1Y4t3bIIVDwoWqLU0516l0+gWDs5JS ozauQEGK/4OxM2NNDbze8kcyHVfUpkelzwm0W4UIvRyT3bDXtAQMGhGliiQPfLV6mPpHNrJ AvMyT187lNShD4E1kFz5w== UI-OutboundReport: notjunk:1;M01:P0:iG0/eitBooA=;riZy51D7SJQF8jqcvSEUIfweTzc sQHizaWijwTF5dFcr9ONXc+EiOgkbNBKdlY2vHmsUhQBL0fGDGihPtNBClT3aULZvfC7do6Vh 3lDiqFcjjHv3jy7QOO3aEmfZF0yrfBwnzc2AzkuSCUn66D4C19JFJ3Wcf+PrtRUJgCNy5DGBb 21yPoMl7gDcQTiECeuz3lIH/UiPjTQ9PSThjedoIBPbmVKfoj9vet7ydoi4JmuWJ0/bHeniiD q34r0zJyQ0NsLREFErJz4vMnpk/sRNiQkEoXuJSvq7Oehp6Uin/un0PdZDqm+jCXAUDH+j7WM ibkebp8qnehixxgjQQgn7hUwOdAaS6n4Ueo2UNiCLEwDeXmbQJxmmEMyMZ+fpXlzqxQRa1EvN zE6VdkdJ7WPOpaXUM9ClvmrJPW8uG23FXPjd/GEaE1moVHaqsvcTf/azamHa18vfkeZgNi1UE mhYlfbuaoxgxLsTCbnDedvT3KhIbc50dgbTF/c1NhdOnDaP1prvN+kKB1w7H9O7dMEXfKOs0r aTzKmRPzPt2oKIuH8t7E1cS1jGwU8Ps+pfH8Gn1VSfkCVpX8YxBNvLdH1RoJKl6pT+rsxhuFt NfdeHStWvaSnXpaVqFvucf3sTTQ2fQ99VvtsKhWunG+WHAGJ5g9SK1c8u1MvkeVfMl7o82yui C4Sr04Inu2TemLQ/Ra+/eSsmWbUNKK0u7q9HXwW6RA== X-Original-Sender: agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org designates 74.208.4.197 as permitted sender) smtp.mailfrom=agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=meddatainc.com 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:32789 Archived-At: This is a multi-part message in MIME format. --------------D2ACCC6BE61243FCF5B40674 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 'traver= se'. See=C2=A0https://pandoc.org/custom-writers.html#example-modified-markd= own-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 sur= e that it makes sense to do so, because, for example, surely you always wan= t the 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 { >> =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" >> =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" >> =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' >> 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(inline) >> =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(inlines) >> =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(blocks) >> =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) >> =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), 'html', opts) >> end >> > Thank you for your thoughtful response. I realize I have used the term 'f= ilter' and 'writer' cavalierly. I have a "slightly" complicated layout I wa= nt 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 th= e writer just output the resulting html. > > I may have to traverse the AST several times in my filter to accomplish t= he result since multiple
need to be added at different levels t= o achieve the desired output. > > I just downloaded your logging filter to aid in the development and am al= so working on formalizing the rules for adding
. > > I spent some more time learning more about writing filters and have made so= me progress. I think the entire logic for adding
to achieve the desired layo= ut 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 syn= tax ![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? --=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/992af9a4-285c-a20f-56de-347ea88f021f%40meddatainc.com. --------------D2ACCC6BE61243FCF5B40674 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 thi= nk 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>' and '</div>'?).

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 {
=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"
=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"
=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'
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(inline)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 report('inline', in= line)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 end,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Inlines=3D function(inlines)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 report('inlines', i= nlines)
=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', blo= ck)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 end,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Blocks =3D function(blocks)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 report('blocks', bl= ocks)
=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)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 report('doc', doc)<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 end,
=C2=A0 =C2=A0 }
=C2=A0 =C2=A0 return pandoc.write(doc:walk(filter), 'html', o= pts)
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 <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?

--
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/ms= gid/pandoc-discuss/992af9a4-285c-a20f-56de-347ea88f021f%40meddatainc.com.
--------------D2ACCC6BE61243FCF5B40674--