public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Section and heading id in MediaWiki output
Date: Mon, 17 Oct 2022 17:04:53 +0200	[thread overview]
Message-ID: <CADAJKhAJARL1rpi2k-j-1jZLTGoEFnmhfybH9-F6W-_SaYrXNQ@mail.gmail.com> (raw)

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

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.

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

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 15:04 BPJ [this message]
     [not found] ` <CADAJKhAJARL1rpi2k-j-1jZLTGoEFnmhfybH9-F6W-_SaYrXNQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-10-17 15:56   ` John MacFarlane
     [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=CADAJKhAJARL1rpi2k-j-1jZLTGoEFnmhfybH9-F6W-_SaYrXNQ@mail.gmail.com \
    --to=melroch-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).