From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32715 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: Sun, 28 May 2023 20:50:56 -0400 Message-ID: <4c58dad0-bd86-608e-2d68-74bd6f2f808b@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> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------C5ECCAE20B8F70E4F84826AA" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14143"; 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+bncBCEIZSNSZ4IRB47NZ6RQMGQETT3IY2I-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon May 29 02:51:02 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f190.google.com ([209.85.167.190]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1q3R6E-0003SB-9o for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 29 May 2023 02:51:02 +0200 Original-Received: by mail-oi1-f190.google.com with SMTP id 5614622812f47-3922d2460afsf1940525b6e.3 for ; Sun, 28 May 2023 17:51:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685321461; cv=pass; d=google.com; s=arc-20160816; b=PJvJpcjJjz4T8/i7F29r1z0ieoGeikcxprPoFxvqyfo50nxrQCa40ALa7V4dCrKVTl YryhTXUxD1nN27wvdYnWaBVP+oDNTq/ZOn7AP2ExjCFVv7L7GHju+Af07muyhI4OcmPw P41d7o7oPj7XB6W1Zf/lAX8gIPvHbWL4cgnVVWl9yD2dQJa1M29F5P3mpPAuA8eCf6Tm Of7mhx4vtToZR6sFMZfqBdT8r4StlOb8KoIz2V5F3E95gJFHh6XuWKH+jBlO1nWqzrCs viZ1Ix4uvvSC/5ivcXG7ykEcUiU2v1nHUnlrmHAD397UjdtAuJ6LNQOxLDlaXshJPQZe mnjQ== 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=r1IF7R8m/tOl/9g/JxnyIbBOvRppCjmNlTgyah2wWXo=; b=rv53Cvstt8hZfuYqg3xXqufT9NOXbw8SHCBz4q/Y0vmI3DXpQCOhKqJDBJ0yDRTXTE bZmq5TZdPggTuBn2Nfzzn11xz06ZU+SyhtQQJYQlg64uZsdR1ryRQF+/rpFYDm6Pmich Sye3tIyRwESYupjca1MqEATeuCi26kg1Rpc290MsW8b06ACRJK+J9o0RUpelyzBCUfZA Ej5UFhsl8GsvrqzyzT01C6kf/h0CHmhUTYGgmP9+bQPIW2Wv2aF2iXLj9qBetfOFVDte UBMkzLzF93k0/avDEDGDJxKn4n+TYRBg7bS5zlOSkRBIuzucjk7O0EnYiuOq4f/MRKGG 3mdQ== 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.194 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=1685321461; x=1687913461; 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=r1IF7R8m/tOl/9g/JxnyIbBOvRppCjmNlTgyah2wWXo=; b=YkVnw8Vbk3LqVQ9qGme0FcHYNKrs5l1BTy6MKSi4im8zD5pJW3Ud9BuA8AWt2KFaCx /1c+kzcGG5225IdsDJLw8IGJ3f0Y3zyP+Bv3qWCkTSRzS7k2/PmcaJ5d+AtYRX3jln9Y LfMEnroAJUmfFUTmAhNaAM0bdcWK4bRX/Agznw9rvTjX3wOXJoKqXNZSE9vNpIa9ZooW Mr6QMa3N6ScNepfRg7tcWr2w4hcerXECJFiIatN+/5VBmxJabmKPkSpo5uhpFzmQTWPg XxHgXkf/IWCzVMsMO X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685321461; x=1687913461; 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=r1IF7R8m/tOl/9g/JxnyIbBOvRppCjmNlTgyah2wWXo=; b=Dz0OYSpbQ8PBWIOlczKyPs+Wy20tXcV4GWrsAnTiE6wIloUDznCeLfqVDZNYAmESw4 cyh2ydW4dFLFzwzEeS9dfpJXz7WCftF+cZYwBwupTYALzTAOY2egUu/VM7eXJcLLo+hP WxtBsXWMvczvYwub6fntXIjEg/+aVuoz2MLmruAYD1wC7/qGsktBLNH7z7RZ0PNdV6Oe V85tkXE8NyCH9t3vKw7U+8jQ0iRi Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AC+VfDxFpTe19grE6R5t3FwIM6REZfh5FxQEfAjbASLSqDGpVVIIDH9J /SzonxA5k2BJEMEtBpC8vr0= X-Google-Smtp-Source: ACHHUZ43tqeUMKFC2qoZZcBn/4hXB8Kj2/ugdt4U8JtdYOxK2bWsgmWpwyIYsqW+Oz1Kli89EDmFNQ== X-Received: by 2002:aca:f287:0:b0:394:66db:3374 with SMTP id q129-20020acaf287000000b0039466db3374mr2155359oih.10.1685321461142; Sun, 28 May 2023 17:51:01 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6870:4c1:b0:19a:1554:7a3c with SMTP id u1-20020a05687004c100b0019a15547a3cls2939608oam.1.-pod-prod-01-us; Sun, 28 May 2023 17:50:58 -0700 (PDT) X-Received: by 2002:a9d:7e8c:0:b0:6ab:ce:6eac with SMTP id m12-20020a9d7e8c000000b006ab00ce6eacmr4975185otp.20.1685321458793; Sun, 28 May 2023 17:50:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685321458; cv=none; d=google.com; s=arc-20160816; b=bD0PVvN/Bajax/xP+BkptDxk/oZorAVvVkmIWKWjr/N4Gbin1OpysS+7EDXax35i+z jEheWTjnpoLu0/pf5U4v8i800fmHCyXWvz1JerrXVfB9nxOtj8wXS7ls+tLKGCEoNr1M 4oJARLjAXv1peH17Sv0iyuJ+fjmvq0Xgn0iR9QkZrlaW5omyH/OMuxK89WOs4z27RTIK 3UoPG9mDVBIp/s5a0EWQGL0n8I9Y694yS0viUpVzi6qsuKNVHIS61OZ59ft/C517uoV6 PHNExok9Lo0XlxN+g21GPv24r/o7LDgB4XLb1sLoJmdgWII9TRQ5eCNOQRuj6CMaihRi uCrw== 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=FY7BqVIAPtZbgAuPgbaGSgq1tS5XT9TolR2Ht7/w8XU=; b=dd2OwjD7P6EvbSdknY0QI+dXlrPuRxBSw7mMl8DOzVFHDMReXrZeA4kGBzTOit/bxY 6KtUBKhOLiE+fKeB60kTO20oMMmc3USmHJTiZWAXxX70Xukf+XHrjRLoi5O6qt7wCdpl YsmPwNR5rGO1O8OlqZRcddfc32ddEr+q1oh9W/gCEC7JGnRPJUqr2235bXR1cCh7pFIX qzgBrcsl3GMHHk1fk59M5+nHgM3CRWbR/jkQiHJdJzT0R26irZDsb5NUcZ+PTHQ7CaE+ MdwMFS9zqxSQkjlTIyZgnTMRpsQFcmpEdpW5dSVO7nB3fNdTY+CROzqFxsyIcMkkxK2B +otA== 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.194 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.194]) by gmr-mx.google.com with ESMTPS id cr3-20020a056830670300b006aae144574bsi785198otb.3.2023.05.28.17.50.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 May 2023 17:50:58 -0700 (PDT) Received-SPF: pass (google.com: domain of agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org designates 74.208.4.194 as permitted sender) client-ip=74.208.4.194; Original-Received: from [192.168.1.17] ([72.94.51.172]) by mrelay.perfora.net (mreueus002 [74.208.5.2]) with ESMTPSA (Nemesis) id 0MQgyx-1pfxrI1fBd-00U5V4 for ; Mon, 29 May 2023 02:50:57 +0200 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K1:eACZPzjBTv3xMbpbhIH3qTy9RmEPYtr/DYkmAs6HiOOa6TyjJB8 79IAA6QqpAFV65o4ylqU/2pvhPW5SAwuGdMBZ2Mbu+7ah8dgvmTXp5yiegyvGJuoXqpehbh nxItqDVRzmTq51MQZ08k3MDsvAhKopQt50Gl8cHhX2gr740MSesfvFNCS/axQtZnM3dNmZc gHULSi6cTW41M8YpHpU5w== UI-OutboundReport: notjunk:1;M01:P0:mNDvL7emnjI=;XYNoVWWNX+W4v1XIsr1L+EGKbG3 WYY8qOYhJttxkLZ0zd4JpG0f8mBxYV+QT4iJzIVKEbgJdgrtyWBUuowhrPxaXh9nLjYOi6JcF VHn4qNNrPVpCc+DRQLtvEsojeM/LOkzGxiuimTcSeMctNvTrjy+25KypMKkiNvbe2bEUcQ0vC 5k+74TFzPJNbC4R4LWob1bmyudLrz8SZPNzJFP7OZxG4FRJZ4ARhg6vBjvhY/jpzi+9OSBSNj v7ArDF7RI/WKv7YFXmKx54n1WIuFaVCJgSkQySQp9+3NgpRw8XxW6VnoSuUO+0o+ckuy3IxoI zibw22mmHc2xNFMPQDHZBT7HesgO/JnoX1t5vjYqcIOaxhLMEu4l91DPHlHCogEw34JyVyUQh UNnSp5RsOuFPPAkUFSMGQr+A5ghPEAjGovWfonRP8cgNVAyzXxjV9HnRImBT1m9WATUO55y9P E7C7fa/6EtR76X7/nomywXEyvW/5Sh6bGtmi5uwcSXreLngayBIgyrxKWDFmRcCmU0NMqUv7u TizajHBECS+volm90UwwImY0YEuOCvR/ampRbeyvMhClzt715wdGyvzuCcxLG8X3XgkVS7t9c XnkMFh/Yt5kYIeuju5p4xkaQRnyDnyOyBbTpKc4jQJC/6yptvj1gsN7VaWxslNDHcKoDrXe6U QO1yDzNvSIdgvYw9ed6jSj2uwVso81gkMptlylqKNA== 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.194 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:32715 Archived-At: This is a multi-part message in MIME format. --------------C5ECCAE20B8F70E4F84826AA Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On 05/26/2023 03:43 PM, H wrote: > On 05/26/2023 02:33 AM, 'William Lupton' via pandoc-discuss wrote: >> Good. From your original message: >> >> >=C2=A0Some of the
tags need to wrap H1, H2, image, multiple= paragraphs, other
tags wrap only one such item. In addition, m= ost HTML tag need to have some predefined custom style information. >> >> --section-divs covers some of this. For the rest, do you want to wrap al= l images, or only some? If the latter, how will this be indicated in the ma= rkdown? Similarly, how will the multiple paragraphs (that are to be wrapped= ) be grouped? >> >> The remaining wrapping logic can almost certainly be achieved via a lua = filter, and shouldn't require changes to the writer. >> >> As for the styles, can the desired results be achieved via CSS? >> >> On Fri, 26 May 2023, 01:31 H, > wrote: >> >> On 05/25/2023 04:38 PM, 'William Lupton' via pandoc-discuss wrote: >>> Have you considered the --sections-divs option (https://pandoc.org/= MANUAL.html#option--section-divs)? >>> >>> For example, this markdown: >>> >>> # A >>> >>> ## A1 >>> >>> ## A2 >>> >>> # B >>> >>> gives the=C2=A0following: >>> >>> (1) pandoc section-divs.md >>> >>>

A

>>>

A1

>>>

A2

>>>

B

>>> >>> (2) pandoc section-divs.md --section-divs >>> >>>
>>>

A

>>>
>>>

A1

>>>
>>>
>>>

A2

>>>
>>>
>>>
>>>

B

>>>
>>> >>> (3) pandoc section-divs.md --section-divs --to=3Dhtml4 >>> >>>
>>>

A

>>>
>>>

A1

>>>
>>>
>>>

A2

>>>
>>>
>>>
>>>

B

>>>
>>> >>> On Thu, 25 May 2023 at 20:36, H > wrote: >>> >>> On May 25, 2023 6:42:49 AM EDT, Felix SOEDJEDE > wrote: >>> >You could use Fenced divs: >>> >https://pandoc.org/MANUAL.html#divs-and-spans >>> > >>> >You can put inside headers, paragraphs, code blocks, etc. >>> > >>> > >>> >Le jeudi 25 mai 2023 =C3=A0 01:20:09 UTC+2, H a =C3=A9crit : >>> > >>> >> On 05/24/2023 04:51 PM, H wrote: >>> >> > Using pandoc 3.1.2 and am trying my hand at writing my fir= st writer >>> >to >>> >> customize HTML output for a specific, predefined newsletter = format. >>> >> > >>> >> > The source document is written in markdown, contains heade= rs of >>> >various >>> >> levels, paragraphs of text, links to images and mail links. = No lists, >>> >no >>> >> tables and no code blocks. >>> >> > >>> >> > The document is structured with an introductory section, m= ultiple >>> >> identically formatted sections and then a final section at t= he end. I >>> >need >>> >> to wrap various portions of the structure with
a= t >>> >multiple >>> >> levels in order to achieve the desired formatting. Some of t= he >>> >
>>> >> tags need to wrap H1, H2, image, multiple paragraphs, other >>> >
>>> >> tags wrap only one such item. In addition, most HTML tag nee= d to have >>> >some >>> >> predefined custom style information. >>> >> > >>> >> > This output will be manually added to a certain newsletter= editor >>> >in a >>> >> CRM system and I cannot add any CSS information whatsoever, >>> >everything has >>> >> to be structured as outlined above. >>> >> > >>> >> > Since I am new to writing filters, I am looking for some >>> >suggestions how >>> >> approach the
wrapping when multiple different HT= ML items >>> >need >>> >> to be wrapped. >>> >> > >>> >> > Thank you. >>> >> > >>> >> I should add that one
pair may enclose H1, H2, i= mage, and >>> > >>> >> several paragraphs until the next H1 tag or end of document.= Another >>> >>
pair (within the just-mentioned pair) may enclos= e the >>> >image and >>> >> several paragraphs, again until the next H1 tag (or end of d= ocument). >>> >There >>> >> are some additional levels of
pairs but this describes= the gist >>> >of it. >>> >> >>> >> Suggestions welcome! >>> >> >>> >> >>> >>> I do not want to make any changes to the source markdown docume= nt, the appropriate processing needs to be done in my custom output HTML fi= lter. >>> >>> I am looking into the following (simplified) flow example: >>> - Add a
tag when encountering a H2 element. >>> - Add the corresponding
tag when encountering a H1 or H2= element or the end of the document. >>> >>> --=20 >>> You received this message because you are subscribed to the Goo= gle Groups "pandoc-discuss" group. >>> To unsubscribe from this group and stop receiving emails from i= t, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org . >>> To view this discussion on the web visit https://groups.google.= com/d/msgid/pandoc-discuss/1F66BB1E-B5C8-4062-8202-D82C5CE9A3D0%40meddatain= c.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, s= end an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org . >>> To view this discussion on the web visit https://groups.google.com/= d/msgid/pandoc-discuss/CAEe_xxgNr8O73TNGgV5y%3DgwiLAKB3WFuX5a49Vv_RJDtojVcS= Q%40mail.gmail.com . >> >> It's somewhat close but I need to do additional customization. Where= can I find the code this uses so I can look at it and use as a base for my= own writer? >> >> --=20 >> You received this message because you are subscribed to the Google G= roups "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, se= nd an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org . >> To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/6d414734-e661-ae2d-68a1-4dfc9cb4f035%40meddatainc.com= . >> >> --=20 >> You received this message because you are subscribed to the Google Group= s "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org . >> To view this discussion on the web visit https://groups.google.com/d/msg= id/pandoc-discuss/CAEe_xxg9ExgK4WCNz6G%3Dr%3Ds4DSCs4CBPERcUV431yov2UmeO8w%4= 0mail.gmail.com . > > No CSS (I had mentioned that in a previous message), also no modification= s to the markdown file so the entire interpretation of layout, adding style= information etc. needs to be in my custom PDF writer. This custom writer w= ill - obviously - be specific for this single dedicated use by myself. > > Any pointers (links, code fragments to look at etc.) as to how I should t= raverse the tree to be able to output my custom PDF would be greatly apprec= iated since this will be my first pandoc writer. > I am making some progress working on my custom writer for my desired html o= utput layout. I am using the 3.0 syntax where the output function looks lik= e Writer.Pandoc =3D function(doc) =C2=A0=C2=A0=C2=A0 return Writer.Blocks(doc.blocks) end At the start of my document I also have Writer =3D pandoc.scaffolding.Writer with customization added for inlines and blocks added. In the Writer.Pandoc function above, is there a way I can see exactly in wh= ich order the document is evaluated? I am interested in exploring traverse = =3D 'topdown' vs. traverse =3D 'typewise' as I think the topdown traversal = will be required to add the necessary
and
in the correct locat= ions to my final document. Again, please bear in mind that I will do /all/ processing in this my custo= m lua writer. Thanks. --=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/4c58dad0-bd86-608e-2d68-74bd6f2f808b%40meddatainc.com. --------------C5ECCAE20B8F70E4F84826AA Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On 05/26/2023 03:43 PM, H wrote:
On 05/26/2023 02:33 AM, 'William Lupton' via pandoc-discuss wrote:
Good. From your original message:

>=C2=A0Some= of the <div></div> tags need to wrap H1, H2, image, multiple paragraphs, other <div></div> tags wrap only one such item. In addition, most HTML tag need to have some predefined custom style information.=

--section-divs covers some of this. For the rest, do you want to wrap all images, or only some? If the latter, how will this be indicated in the markdown? Similarly, how will the multiple paragraphs (that are to be wrapped) be grouped?

The remaining wrapping logic can almost certainly be achieved via a lua filter, and shouldn't require changes to the writer.

As for the styles, can the desired results be achieved via CSS?

On Fri, 26 May 2023, 01:31 H, <agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org> wrote:
On 05/25/2023 04:38 PM, 'William Lupton' via pandoc-discuss wrote:
Have you considered the --sections-divs option (https://pandoc.org/MANUA= L.html#option--section-divs)?

For example, this markdown:

# A

## A1

## A2

# B

gives the=C2=A0following:

(1) pandoc section-divs.md

<h1 id=3D"a">A</h1>
<h2 id=3D"a1">A1</h2>
<h2 id=3D"a2">A2</h2>
<h1 id=3D"b">B</h1>

(2) pandoc section-divs.md --section-divs

<section id=3D"a" class=3D"level1">
<h1>A</h1>
<section id=3D"a1" class=3D"level2">
<h2>A1</h2>
</section>
<section id=3D"a2" class=3D"level2">
<h2>A2</h2>
</section>
</section>
<section id=3D"b" class=3D"level1">
<h1>B</h1>
</section>


(3) pandoc section-divs.md --section-divs --to=3Dhtml4

<div id=3D"a" class=3D"section level1">
<h1>A</h1>
<div id=3D"a1" class=3D"section level2"> <h2>A1</h2>
</div>
<div id=3D"a2" class=3D"section level2"> <h2>A2</h2>
</div>
</div>
<div id=3D"b" class=3D"section level1">
<h1>B</h1>
</div>

On May 25, 2023 6:42:49 AM EDT, Felix SOEDJEDE <soefelix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org&g= t; wrote:
>You could use Fenced divs:
>https:= //pandoc.org/MANUAL.html#divs-and-spans
>
>You can put inside headers, paragraphs, code blocks, etc.
>
>
>Le jeudi 25 mai 2023 =C3=A0 01:20:09 UTC+2, H a =C3=A9crit :
>
>> On 05/24/2023 04:51 PM, H wrote:
>> > Using pandoc 3.1.2 and am trying my hand at writing my first writer
>to
>> customize HTML output for a specific, predefined newsletter format.
>> >
>> > The source document is written in markdown, contains headers of
>various
>> levels, paragraphs of text, links to images and mail links. No lists,
>no
>> tables and no code blocks.
>> >
>> > The document is structured with an introductory section, multiple
>> identically formatted sections and then a final section at the end. I
>need
>> to wrap various portions of the structure with <div></div> at
>multiple
>> levels in order to achieve the desired formatting. Some of the
><div></div>
>> tags need to wrap H1, H2, image, multiple paragraphs, other
><div></div>
>> tags wrap only one such item. In addition, most HTML tag need to have
>some
>> predefined custom style information.
>> >
>> > This output will be manually added to a certain newsletter editor
>in a
>> CRM system and I cannot add any CSS information whatsoever,
>everything has
>> to be structured as outlined above.
>> >
>> > Since I am new to writing filters, I am looking for some
>suggestions how
>> approach the <div></div> wrapping when multiple different HTML items
>need
>> to be wrapped.
>> >
>> > Thank you.
>> >
>> I should add that one <div></div> pair may enclose H1, H2, image, and
>
>> several paragraphs until the next H1 tag or end of document. Another
>> <div></div> pair (within the just-mentioned pair) may enclose the
>image and
>> several paragraphs, again until the next H1 tag (or end of document).
>There
>> are some additional levels of <div> pairs but this describes the gist
>of it.
>>
>> Suggestions welcome!
>>
>>

I do not want to make any changes to the source markdown document, the appropriate processing needs to be done in my custom output HTML filter.

I am looking into the following (simplified) flow example:
- Add a <div> tag when encountering a H2 element.
- Add the corresponding </div> tag when encountering a H1 or H2 element or the end of the document.

--
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+unsubscri= be-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https:= //groups.google.com/d/msgid/pandoc-discuss/1F66BB1E-B5C8-4062-8202-D82C5CE9= A3D0%40meddatainc.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@g= ooglegroups.com.
To view this discussion on the web visit https://groups.google.com/d/= msgid/pandoc-discuss/CAEe_xxgNr8O73TNGgV5y%3DgwiLAKB3WFuX5a49Vv_RJDtojVcSQ%= 40mail.gmail.com.

It's somewhat close but I need to do additional customization. Where can I find the code this uses so I can look at it and use as a base for my own writer?

--
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@googl= egroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgi= d/pandoc-discuss/6d414734-e661-ae2d-68a1-4dfc9cb4f035%40meddatainc.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@googlegroups.= com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc= -discuss/CAEe_xxg9ExgK4WCNz6G%3Dr%3Ds4DSCs4CBPERcUV431yov2UmeO8w%40mail.gma= il.com.

No CSS (I had mentioned that in a previous message), also no modifications to the markdown file so the entire interpretation of layout, adding style information etc. needs to be in my custom PDF writer. This custom writer will - obviously - be specific for this single dedicated use by myself.

Any pointers (links, code fragments to look at etc.) as to how I should traverse the tree to be able to output my custom PDF would be greatly appreciated since this will be my first pandoc writer.

I am making some progress working on my custom writer for my desired html output layout. I am using the 3.0 syntax where the output function looks like

Writer.Pandoc =3D function(doc)
=C2=A0=C2=A0=C2=A0 return Writer.Blocks(doc.blocks)
end

At the start of my document I also have

Writer =3D pandoc.scaffolding.Writer

with customization added for inlines and blocks added.

In the Writer.Pandoc function above, is there a way I can see exactly in which order the document is evaluated? I am interested in exploring traverse =3D 'topdown' vs. traverse =3D 'typewise' as I think the topdown traversal will be required to add the necessary <div> and </div> in the correct locations to my final document.

Again, please bear in mind that I will do /all/ processing in this my custom lua writer.

Thanks.

--
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/4c58dad0-bd86-608e-2d68-74bd6f2f808b%40meddatainc.com.
--------------C5ECCAE20B8F70E4F84826AA--