From: Connor Patrick Jackson <cpjackson-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: <article> rather than <section> in HTML5 output
Date: Thu, 22 Jul 2021 07:20:07 -0700 (PDT) [thread overview]
Message-ID: <cdcdbebe-d19a-4d8f-96dc-5e03a2977bc2n@googlegroups.com> (raw)
In-Reply-To: <m2fswblavu.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 2964 bytes --]
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 <article> opening and closing tags, and removes the original Div,
putting its content between the <article> 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 <section>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 <article> is now wrapped in
_another_ <section> tag (the <article> 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 <cpja...-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> 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.
[-- Attachment #1.2: Type: text/html, Size: 3873 bytes --]
next prev parent reply other threads:[~2021-07-22 14:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-16 17:56 Connor Patrick Jackson
[not found] ` <c07ed5ea-b466-4b33-b9dc-9917c2983f7an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-17 2:57 ` John MacFarlane
[not found] ` <m28s25pryw.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-07-17 18:42 ` Connor Patrick Jackson
[not found] ` <3ceb7519-ed4b-4118-a214-6c4b63e07c21n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-18 18:44 ` John MacFarlane
[not found] ` <m2fswblavu.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-07-22 14:20 ` Connor Patrick Jackson [this message]
[not found] ` <cdcdbebe-d19a-4d8f-96dc-5e03a2977bc2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-22 18:41 ` John MacFarlane
[not found] ` <yh480keebq42e9.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2021-07-22 19:24 ` Connor Patrick Jackson
[not found] ` <39dfd03d-544d-46b1-8492-f517a5b3e652n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-22 20:25 ` John MacFarlane
2021-07-24 17:08 ` BPJ
[not found] ` <CADAJKhDe9nzpyXzB2pWO=bme-A5TBZEH6xncmnGnEQQ7jB78-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-07-24 20:08 ` Connor Patrick Jackson
[not found] ` <54d50be7-9ffa-44a3-8a31-9988a60bb831n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-25 1:17 ` Connor Patrick Jackson
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=cdcdbebe-d19a-4d8f-96dc-5e03a2977bc2n@googlegroups.com \
--to=cpjackson-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
--cc=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).