On May 28, 2023 8:50:56 PM EDT, H wrote: >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: >>> >>> > 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. >>> >>> --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, > 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 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=html4 >>>> >>>>
>>>>

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 à 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 >
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 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-/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%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-/JYPxA39Uh5TLH3MbocFFw@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 >. >>> >>> 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-/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 >. >>> >>> -- >>> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >. >>> To view this discussion on the web visit >https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxg9ExgK4WCNz6G%3Dr%3Ds4DSCs4CBPERcUV431yov2UmeO8w%40mail.gmail.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 = function(doc) >    return Writer.Blocks(doc.blocks) >end > >At the start of my document I also have > >Writer = 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 = 'topdown' vs. traverse = 'typewise' as I think the topdown >traversal will be required to add the necessary
and
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 "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/4c58dad0-bd86-608e-2d68-74bd6f2f808b%40meddatainc.com. Upon further reading, it looks like the traverse directive might only be applicable to filters when the AST is being processed Is this correct? If so, is there anyway I can view the traversal processing sequence in my filter when I am writing and debugging it? -- 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/F41D20AD-EDDD-4AF4-A9AD-AAB8581086BF%40meddatainc.com.