public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: "'William Lupton' via pandoc-discuss" <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Wrapping sections of text with <div></div> in custom filter
Date: Thu, 25 May 2023 21:38:41 +0100	[thread overview]
Message-ID: <CAEe_xxgNr8O73TNGgV5y=gwiLAKB3WFuX5a49Vv_RJDtojVcSQ@mail.gmail.com> (raw)
In-Reply-To: <1F66BB1E-B5C8-4062-8202-D82C5CE9A3D0-FcZObrvlYduBUy7/sJONFg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 4396 bytes --]

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

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

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

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

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

<div id="a" class="section level1">
<h1>A</h1>
<div id="a1" class="section level2">
<h2>A1</h2>
</div>
<div id="a2" class="section level2">
<h2>A2</h2>
</div>
</div>
<div id="b" class="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 SOEDJEDE <soefelix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 à 01:20:09 UTC+2, H a écrit :
> >
> >> 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+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
> .
>

-- 
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/CAEe_xxgNr8O73TNGgV5y%3DgwiLAKB3WFuX5a49Vv_RJDtojVcSQ%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 6790 bytes --]

  parent reply	other threads:[~2023-05-25 20:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24 20:51 H
     [not found] ` <2fc450a6-5a16-316c-02c8-8ef055bccd11-FcZObrvlYduBUy7/sJONFg@public.gmane.org>
2023-05-24 23:20   ` H
     [not found]     ` <93e5b610-66a2-6ac7-1d53-8a04a8314249-FcZObrvlYduBUy7/sJONFg@public.gmane.org>
2023-05-25 10:42       ` Felix SOEDJEDE
     [not found]         ` <853c402b-d9ee-4c9d-8bae-15b20faf7194n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-05-25 19:36           ` H
     [not found]             ` <1F66BB1E-B5C8-4062-8202-D82C5CE9A3D0-FcZObrvlYduBUy7/sJONFg@public.gmane.org>
2023-05-25 20:38               ` 'William Lupton' via pandoc-discuss [this message]
     [not found]                 ` <CAEe_xxgNr8O73TNGgV5y=gwiLAKB3WFuX5a49Vv_RJDtojVcSQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-05-26  0:31                   ` H
     [not found]                     ` <6d414734-e661-ae2d-68a1-4dfc9cb4f035-FcZObrvlYduBUy7/sJONFg@public.gmane.org>
2023-05-26  6:33                       ` 'William Lupton' via pandoc-discuss
     [not found]                         ` <CAEe_xxg9ExgK4WCNz6G=r=s4DSCs4CBPERcUV431yov2UmeO8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-05-26 19:43                           ` H
     [not found]                             ` <cee5298a-37c9-6e17-6370-eecda5d9d6fb-FcZObrvlYduBUy7/sJONFg@public.gmane.org>
2023-05-26 21:01                               ` 'William Lupton' via pandoc-discuss
2023-05-29  0:50                               ` H
     [not found]                                 ` <4c58dad0-bd86-608e-2d68-74bd6f2f808b-FcZObrvlYduBUy7/sJONFg@public.gmane.org>
2023-05-29  4:31                                   ` H
     [not found]                                     ` <F41D20AD-EDDD-4AF4-A9AD-AAB8581086BF-FcZObrvlYduBUy7/sJONFg@public.gmane.org>
2023-05-30 18:30                                       ` H
     [not found]                                         ` <574fbf9f-c1b8-711a-f14a-3acd75cbf634-FcZObrvlYduBUy7/sJONFg@public.gmane.org>
2023-05-30 19:23                                           ` H
     [not found]                                             ` <05ba5663-1578-d555-8539-d6a2bdff6743-FcZObrvlYduBUy7/sJONFg@public.gmane.org>
2023-06-01  8:34                                               ` 'William Lupton' via pandoc-discuss
     [not found]                                                 ` <CAEe_xxhTjZJRuNZFtYMqh1eSNM9yobfgs_YTj2muxs1px0ygjg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-06-06 19:14                                                   ` H
     [not found]                                                     ` <7878b22d-bf64-2d25-1136-d9f9cf5e135b-FcZObrvlYduBUy7/sJONFg@public.gmane.org>
2023-06-11  2:25                                                       ` H
     [not found]                                                         ` <992af9a4-285c-a20f-56de-347ea88f021f-FcZObrvlYduBUy7/sJONFg@public.gmane.org>
2023-06-11 13:51                                                           ` BPJ
     [not found]                                                             ` <CADAJKhDBqvOL469ZXigacDug2dMx=OiGWjteOM3fXqT-29BM5A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-06-11 15:54                                                               ` H
     [not found]                                                                 ` <b189960a-3e0d-19b8-91e2-c16dc88cd595-FcZObrvlYduBUy7/sJONFg@public.gmane.org>
2023-06-12 21:09                                                                   ` 'William Lupton' via pandoc-discuss
     [not found]                                                                     ` <CAEe_xxjer3B9Qy8oGGNx_ARySSMD1mG8-AD6-EJQQXYnddFMYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-06-12 21:18                                                                       ` H
     [not found]                                                                         ` <EAF5063B-4655-48B3-8961-AF664AE3C94F-FcZObrvlYduBUy7/sJONFg@public.gmane.org>
2023-06-13  8:28                                                                           ` 'William Lupton' via pandoc-discuss
     [not found]                                                                             ` <CAEe_xxjdOUK-tpNsw65u_v_gNr0nUkF5vfrQc0RQyLhJyjtHSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-06-13 17:28                                                                               ` H

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEe_xxgNr8O73TNGgV5y=gwiLAKB3WFuX5a49Vv_RJDtojVcSQ@mail.gmail.com' \
    --to=pandoc-discuss-/jypxa39uh5tlh3mbocffw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).