From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32703 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: Thu, 25 May 2023 21:38:41 +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> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000ca557505fc8a9b1a" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9760"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCS4HJ6WSAHBBX4OX6RQMGQEHXMIHIQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu May 25 22:39:01 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lj1-f189.google.com ([209.85.208.189]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1q2Hjh-0002K3-6l for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 25 May 2023 22:39:01 +0200 Original-Received: by mail-lj1-f189.google.com with SMTP id 38308e7fff4ca-2af2790f4a2sf5453871fa.1 for ; Thu, 25 May 2023 13:39:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685047140; cv=pass; d=google.com; s=arc-20160816; b=L5RBFK2SGgLJhs9EgumBI5sP+S4hjMRzvq51Qk0DJ7PEShGrRj6wly1hNzsGsXNm87 HjaAFZKETl5YmMI7sahRQsWRor+3cYQesB7Qhj3vZ7DZy9COowCGCZlMVUhxvPGq5f0y GuMP3DsF47HyZCokXBHUnLT+uCvuzC9jaxWWKXfuki27vtJrcQioz2CNI7KRqxJzUIx1 g6HBeSBF4L/Gx5ovF7kLzqA3tzrMceo8gtB7AfsldKgkNnoGB/XM1k0bA6+pNBH9cYy9 vbVJ7PGRUN+ai+q+owZLykuBf6BZHdJfM69Nw5D4Qgt9ynCZshZy+j7vYspGM1v7F3Yb gMOw== 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=2M8E82tSd4RVFBgROJXnZ9w8Qlbve1EEk83Q1v+VMdY=; b=fGZguGkMkUdn5YxZtZ2SDwdIYSvhd+Hk1GBFN74dmg3JKaJKP9zobYsbbDxxO9Mh+X 2mn5RkTaJcv6LRoR2KJ3LCx+nOa07xtcH1H7a5TCdHEy37z5dlPipiXTXHpQCRRqHyRm vIr7EFNwaJh0KdRfg0ibS/VtsVctPOvIW3ELbQ7d+0o5x5DtlKlancpVll292aeBWP8k 5h7K4bg9VQrA5t48f7AC5DTp2ThwYBJdNGMlxqJ7qhZl/4frrwKioGvel0ohTcPdLMgu PW0h8aJr5wqeAaSYnGU7gNP1eSOUTKA+dvSviYqtJtQ+p8anwkJnEGRRCWVZatzbvsej Na+w== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@broadband-forum.org header.s=google header.b=PBbkyrea; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::62a 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=1685047140; x=1687639140; 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=2M8E82tSd4RVFBgROJXnZ9w8Qlbve1EEk83Q1v+VMdY=; b=R2TQha6W+b7MoI5r06pxJWOLz2WICb97Jwcx/zWHVhbS2mX08Jm7VL62YIVFzvd/Be 7E8xJRmUdhpjGouRX+Ubr/UYICR0xW4o5zZ76hHMVNU2T9LFQWH1mXY/F+qmf+atvJkB vp5xYAIBwX+kybaUG42vPIhtRn/VX0jhezYEAevwvZvbvT54G2OQ8lXCu4/MdPrhLuC0 bS8xVgvPc9rEDufKQKq8bED1JlhRk1oOTMeRrrTu1NI400jMmZmER2S1B0LRz7Sylprf yv/4AqKhlazZbNlabc+szyMnN1nsBSOnssqV4giitbbE7rhxhPbr+p1xrlfWDcxdRKhO JD X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685047140; x=1687639140; 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=2M8E82tSd4RVFBgROJXnZ9w8Qlbve1EEk83Q1v+VMdY=; b=A7zSnG/1WW1wCnQ/lr9Fffif1duwO06Hm9Gcq7Rt5ck5hOsaQ5dehVRwnMFOmoczT4 RwBXgpX6JG4rC8TJFSnw7A/ztfRgAvVx+VLwpvDbHCjnztu+y6Hw8FC5SQviVDfnVZ0B Ka/WXiniwoj8zyTfJGPaeZsC91owqyzrqEYCWMeT5Wh6HFoW4B2iUQb/HsAzdh4SvAKJ jUNOUV/yYOuTjDsJkYhg295JHvDYMOrKvwRgZkI0ff92xoKxOHjKWpfpEmV3YRRYiWSd +i+hvG4czSR0M X-Gm-Message-State: AC+VfDy2FwfkQDaRBfoFxmrg4GHiFy2a7GyjYhyrcTWu4LkjfyOy3LQq 8AUQu5eN1zxMK2xNKLxqWi8= X-Google-Smtp-Source: ACHHUZ459swzLxXdH/5Xfj9FaiA7UHRXUN2hs/cWiua7/WV0jcPiJ43NwCiQ+lqalGhPqcoR9je/KQ== X-Received: by 2002:a2e:8189:0:b0:2ad:ce29:bd86 with SMTP id e9-20020a2e8189000000b002adce29bd86mr1132979ljg.4.1685047139714; Thu, 25 May 2023 13:38:59 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:651c:a0d:b0:2af:5db:ad4d with SMTP id k13-20020a05651c0a0d00b002af05dbad4dls694167ljq.1.-pod-prod-00-eu; Thu, 25 May 2023 13:38:54 -0700 (PDT) X-Received: by 2002:a2e:4941:0:b0:2ac:8b00:91a2 with SMTP id b1-20020a2e4941000000b002ac8b0091a2mr1203514ljd.20.1685047133961; Thu, 25 May 2023 13:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685047133; cv=none; d=google.com; s=arc-20160816; b=TWosw7UG2PED67nIivJTEOJ7BM6vINz4gpY9E6Fozs7r8wtMsypZCZrhTq8yHtw49C 6ocRlX5Vq8GDqi8wFMABi4cGkirPFewWQxHX0se/XuSz2FSP7isOx2WBSak1iff8HbjW Aiowp1RC2VKVmoWlhn1c3HRjZsx19OOLD4JazVhjq4+OmFNYFmfGB8Zipn+y98dqK1Kj iiHOyb2DYsTT0Mqb5CigTjAUyBn/3SFMlrjDtZpndGrasozEeU/Oow5eauTv2f9oHTs7 UbFn2NDYmIO0obJIr1WZx8c7yFClLYJ9wK4ThMV+louxZvSqLA/JjqZQVO25j0XX4QNH Intw== 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=YHjnMA7vV0V0bplCTk6zrvHNn8rEJtJ7sMQuB5+Gm78=; b=oFYpf2XXBRWbjt0MT3U2/O0Okcr8jA0Y+BZM5z/iAVQY+jZi7c3MzhVLsXzOI4/t2T 8+3pVB2NcJmfMzgQxTc58RkpPPyBoiys6UouU7k36OgbWYl9zPPYOzX96nROifn8p4D0 YYLsInX11kBT7uMYNtMYpXbqs9A/cfq/SxFaY9Bo2BsfGmtJHCkYfY+4fI1FYCRE7+h3 8u6qkSJVSn/7l0xQl++BuFpVPYV5mvz8BIl1MZTeufKJVAYPiJo8k67VS5qJIhb0LpsW eDZRodVklJslzoSxgbcdY95osmfZLs/SjhCSQbBOhjhg1TuFbtdx+5DRSUAHnUJyJqaZ 09YA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@broadband-forum.org header.s=google header.b=PBbkyrea; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::62a 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-ej1-x62a.google.com (mail-ej1-x62a.google.com. [2a00:1450:4864:20::62a]) by gmr-mx.google.com with ESMTPS id bz8-20020a05651c0c8800b002ac885a8f29si208823ljb.3.2023.05.25.13.38.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 May 2023 13:38:53 -0700 (PDT) Received-SPF: pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::62a as permitted sender) client-ip=2a00:1450:4864:20::62a; Original-Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-96f99222e80so31857566b.1 for ; Thu, 25 May 2023 13:38:53 -0700 (PDT) X-Received: by 2002:a17:907:168c:b0:96a:f8ec:c311 with SMTP id hc12-20020a170907168c00b0096af8ecc311mr2349878ejc.36.1685047132960; Thu, 25 May 2023 13:38:52 -0700 (PDT) In-Reply-To: <1F66BB1E-B5C8-4062-8202-D82C5CE9A3D0-FcZObrvlYduBUy7/sJONFg@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 header.s=google header.b=PBbkyrea; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::62a 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:32703 Archived-At: --000000000000ca557505fc8a9b1a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 following: (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 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
at > >multiple > >> levels in order to achieve the desired formatting. Some of the > >
> >> tags need to wrap H1, H2, image, multiple paragraphs, other > >
> >> 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
wrapping when multiple different HTML items > >need > >> to be wrapped. > >> > > >> > Thank you. > >> > > >> I should add that one
pair may enclose H1, H2, image, and > > > >> several paragraphs until the next H1 tag or end of document. Another > >>
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
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
tag when encountering a H2 element. > - Add the corresponding
tag when encountering a H1 or H2 element o= r > 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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/1F66BB1E-B5C8-4062-8202-= D82C5CE9A3D0%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_xxgNr8O73TNGgV5y%3DgwiLAKB3WFuX5a49Vv_RJDtojVcSQ%40mail= .gmail.com. --000000000000ca557505fc8a9b1a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Have you considered the --sections-divs option (https://pandoc.o= rg/MANUAL.html#option--section-divs)?

For exam= ple, this markdown:

# A
## A1

## A2

# B

giv= es the=C2=A0following:

(1) pandoc section-divs.md<= /div>

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

(2) pandoc section-divs.md --section-divs
<section id=3D"a" class= =3D"level1">
<h1>A</h1>
<section id=3D&qu= ot;a1" class=3D"level2">
<h2>A1</h2>
&l= t;/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 secti= on-divs.md --section-divs --to=3Dhtml4

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

On Thu, 25 May 2023 at 20:36, H <agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org> wrote:
On May 25, 2023 6:42:49 AM EDT, Felix SOED= JEDE <soefelix@g= mail.com> 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 lis= ts,
>no
>> tables and no code blocks.
>> >
>> > The document is structured with an introductory section, mult= iple
>> 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 h= ave
>some
>> predefined custom style information.
>> >
>> > This output will be manually added to a certain newsletter ed= itor
>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 differ= ent 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. Anoth= er
>> <div></div> pair (within the just-mentioned pair) may = enclose the
>image and
>> several paragraphs, again until the next H1 tag (or end of documen= t).
>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 appr= opriate 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 eleme= nt or the end of the document.

--
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/msgi= d/pandoc-discuss/1F66BB1E-B5C8-4062-8202-D82C5CE9A3D0%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://group= s.google.com/d/msgid/pandoc-discuss/CAEe_xxgNr8O73TNGgV5y%3DgwiLAKB3WFuX5a4= 9Vv_RJDtojVcSQ%40mail.gmail.com.
--000000000000ca557505fc8a9b1a--