public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Section and heading id in MediaWiki output
Date: Mon, 17 Oct 2022 08:56:05 -0700	[thread overview]
Message-ID: <926E2AED-D785-4763-8368-A35EAB35B6FC@gmail.com> (raw)
In-Reply-To: <CADAJKhAJARL1rpi2k-j-1jZLTGoEFnmhfybH9-F6W-_SaYrXNQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Seems like a bug to me. Can you open an issue at our GitHub tracker?
https://github.com/jgm/pandoc/issues

> On Oct 17, 2022, at 8:04 AM, BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> When converting to mediawiki MW headings are prepended with a span
> `<span id="HEADING-ID"></span>`, evidently to provide an anchor to
> pandoc's original/automatic id so that internal links will still work. However
> if there is a `<section>` element[^1] I frequently end up with an identical id
> tag on the div resulting from the section element and the automatically
> inserted span element, which seems like a bug to me:
> 
> ``````html
> <section id="head-2" class="level2">
> <h2>Head 2</h2>
> <section id="head-3" class="level3">
> <h3>Head 3</h3>
> <ol type="1">
> <li><p>Li 1</p></li>
> <li><p>Li 2</p>
> <p>Li 2 para 2</p></li>
> <li><p>Li 3</p></li>
> </ol>
> <p>Text</p>
> <ol type="i">
> <li>Li i</li>
> <li>Li ii</li>
> </ol>
> </section>
> </section>
> ``````
> 
> ``````mediawiki
> <div id="head-2" class="section level2">
> 
> <span id="head-2"></span>
> == Head 2 ==
> 
> <div id="head-3" class="section level3">
> 
> <span id="head-3"></span>
> === Head 3 ===
> 
> <ol style="list-style-type: decimal;">
> <li><p>Li 1</p></li>
> <li><p>Li 2</p>
> <p>Li 2 para 2</p></li>
> <li><p>Li 3</p></li></ol>
> 
> Text
> 
> <ol style="list-style-type: lower-roman;">
> <li>Li i</li>
> <li>Li ii</li></ol>
> 
> 
> </div>
> 
> </div>
> ``````
> 
> It seems that the only fix currently is to go through the MW source after
> conversion and manually remove any offending spans.
> 
> I wish the mediawiki writer were smart enough to not insert the span above the
> heading if its id would be identical to that of a parent section div. Would that
> be possible, and is this enough of a bug to submit an issue?
> 
> In the actual use case I modify the HTML input with an HTML editing
> script/library before conversion to mediawiki, and as a part of that I add
> attributes to the section elements which I want to be there on the div in
> the MW output, so removin
> 
> [^1]: In my case inserted by pandoc into the HTML now used as source at an
> earlier run.
> 
> 
> -- 
> 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/CADAJKhAJARL1rpi2k-j-1jZLTGoEFnmhfybH9-F6W-_SaYrXNQ%40mail.gmail.com.


  parent reply	other threads:[~2022-10-17 15:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 15:04 BPJ
     [not found] ` <CADAJKhAJARL1rpi2k-j-1jZLTGoEFnmhfybH9-F6W-_SaYrXNQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-10-17 15:56   ` John MacFarlane [this message]
     [not found]     ` <926E2AED-D785-4763-8368-A35EAB35B6FC-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-10-17 18:23       ` BPJ

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=926E2AED-D785-4763-8368-A35EAB35B6FC@gmail.com \
    --to=fiddlosopher-re5jqeeqqe8avxtiumwx3w@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).