* Section and heading id in MediaWiki output @ 2022-10-17 15:04 BPJ [not found] ` <CADAJKhAJARL1rpi2k-j-1jZLTGoEFnmhfybH9-F6W-_SaYrXNQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: BPJ @ 2022-10-17 15:04 UTC (permalink / raw) To: pandoc-discuss [-- 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 --] ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <CADAJKhAJARL1rpi2k-j-1jZLTGoEFnmhfybH9-F6W-_SaYrXNQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Section and heading id in MediaWiki output [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> 0 siblings, 1 reply; 3+ messages in thread From: John MacFarlane @ 2022-10-17 15:56 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw 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. ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <926E2AED-D785-4763-8368-A35EAB35B6FC-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: Section and heading id in MediaWiki output [not found] ` <926E2AED-D785-4763-8368-A35EAB35B6FC-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2022-10-17 18:23 ` BPJ 0 siblings, 0 replies; 3+ messages in thread From: BPJ @ 2022-10-17 18:23 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 3879 bytes --] Den mån 17 okt. 2022 17:56John MacFarlane <fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev: > Seems like a bug to me. Can you open an issue at our GitHub tracker? > https://github.com/jgm/pandoc/issues https://github.com/jgm/pandoc/issues/8383 > > > 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 > . > > -- > 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/926E2AED-D785-4763-8368-A35EAB35B6FC%40gmail.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhBi-hS-pg0GC3truoB%3DxUGKJYU6LXCtXcSVmFrpk30uiw%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 6406 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-17 18:23 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-10-17 15:04 Section and heading id in MediaWiki output BPJ [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
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).