Okay, I have put together a Lua filter to do this that I'm happy with, and it makes the correct changes to the data in the AST (everything looks right when I print --to native). However, I'm running into an issue when actually writing out to HTML. My filter first calls make_sections to create the divs from the headers (seemed reasonable so I don't have to recreate the wheel), and then goes in, finds the Div blocks with class "article", creates the new
opening and closing tags, and removes the original Div, putting its content between the
tags. All is well. However, when I am writing to HTML, if I don't include --section-divs in the call, the resulting HTML doesn't include any of the
s for the other headers (the ones I didn't convert to articles), even though they exist in the AST after being created by make_sections. However, if I do call --section-divs, apparently make_sections gets called a second time, because the heading I just wrapped with an
is now wrapped in _another_
tag (the
tag remains), despite having removed the wrapping Div entirely from around that header. This behavior occurs regardless of whether I call --section-divs before or after the filter. So the --section-divs option is doing more than just calling make_sections, and has a larger role in the HTML writer. Thus, I can't exclude it from the call. On the other hand, if it calls make_sections a second time, and I can't control when that happens, it ends up writing invalid markup. So I can't include it. I am officially stuck. I'm not sure if this is proper behavior of --section-divs or a bug, but I'm unsure how to work around it in either case. Happy to provide an MRE and my Lua filter if it would help, or take this over to the Issue Tracker and file a bug report if that's what it is. On Sunday, July 18, 2021 at 11:45:07 AM UTC-7 John MacFarlane wrote: > Connor Patrick Jackson writes: > > > Sounds good to me! I've got half of a filter set up to do this, if > someone > > could just point me in the right direction. Is there a way to hook into > the > > HTML writer and tell it which tag to use for the div/section? Or would I > > have to go the route of just adding the tags manually as RawInline and > > removing the Section class? (or some third, better approach that I'm not > > seeing because this is the first time I've written a filter)? Thanks! > > Exactly, you'd have to add the tags manually. > > -- 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/cdcdbebe-d19a-4d8f-96dc-5e03a2977bc2n%40googlegroups.com.