mediawiki-extensions-Discus.../tests/cases/for-parser-cache/for-parser-cache-formattedreply.html
Bartosz Dziewoński 492dbd7847 Fix inserting comment start markers when they're outside of any wrappers
Comment boundaries are stored as a DOM parent node plus a child index.
Because of that, inserting anything into the DOM before a comment –
such as another comment's start/end markers – would cause us to insert
subsequent comments' markers into the wrong places.

This issue didn't affect many pages, because usually any parent node
would have just one comment in it. Only pages with comment boundaries
outside of any wrappers (directly inside the root node) were broken.

Just process the list in reverse to fix this.

Bug: T298096
Change-Id: Iccffc36b71e9fcf3d72c4db2b9459d39042f7a2d
2022-01-11 16:07:37 +00:00

11 lines
4.1 KiB
HTML

<span data-mw-comment="{&quot;type&quot;:&quot;heading&quot;,&quot;level&quot;:0,&quot;id&quot;:&quot;h--2021-02-24T19:24:00.000Z&quot;,&quot;replies&quot;:[&quot;c-Matma_Rex-2021-02-24T19:24:00.000Z&quot;],&quot;headingLevel&quot;:99,&quot;placeholderHeading&quot;:true}"><span data-mw-comment-start="" id="h--2021-02-24T19:24:00.000Z"></span><span data-mw-comment-end="h--2021-02-24T19:24:00.000Z"></span></span><span data-mw-comment-start="" id="c-Matma_Rex-2021-02-24T19:24:00.000Z"></span><style data-mw-deduplicate="TemplateStyles:r3303">.mw-parser-output .color-purple{color:purple}</style><div class="color-purple">This page demonstrates some quirks of raw HTML generated in ParserOutput, which gets saved to the parser cache and which we operate on in the ParserAfterTidy hook. Most other test cases are using the final HTML returned by ParserOutput::getText(), which we operate on in the OutputPageBeforeHTML hook.</div>
<p>Note:
</p>
<ul><li>No "mw-parser-output" wrapper div</li>
<li>Funky mw:editsection tags</li></ul>
<p><a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> (<a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex"><font color="green"><i>talk</i></font></a>) 19:24, 24 February 2021 (UTC)<span class="ext-discussiontools-init-replylink-buttons"><span class="ext-discussiontools-init-replylink-bracket">[</span><a class="ext-discussiontools-init-replylink-reply" role="button" tabindex="0" data-mw-comment="{&quot;type&quot;:&quot;comment&quot;,&quot;level&quot;:1,&quot;id&quot;:&quot;c-Matma_Rex-2021-02-24T19:24:00.000Z&quot;,&quot;replies&quot;:[],&quot;timestamp&quot;:&quot;2021-02-24T19:24:00.000Z&quot;,&quot;author&quot;:&quot;Matma Rex&quot;}" href="">(discussiontools-replylink)</a><span class="ext-discussiontools-init-replylink-bracket">]</span></span><span data-mw-comment-end="c-Matma_Rex-2021-02-24T19:24:00.000Z"></span>
</p>
<h2 class="ext-discussiontools-init-section"><span id="Heading_with_a_.22_quote"></span><span class="mw-headline" id="Heading_with_a_&quot;_quote" data-mw-comment="{&quot;type&quot;:&quot;heading&quot;,&quot;level&quot;:0,&quot;id&quot;:&quot;h-Heading_with_a_\&quot;_quote-2021-02-24T19:24:00.000Z&quot;,&quot;replies&quot;:[&quot;c-Matma_Rex-2021-02-24T19:24:00.000Z-Heading_with_a_\&quot;_quote&quot;],&quot;headingLevel&quot;:2,&quot;placeholderHeading&quot;:false}"><span data-mw-comment-start="" id="h-Heading_with_a_&quot;_quote-2021-02-24T19:24:00.000Z"></span>Heading with a " quote<span data-mw-comment-end="h-Heading_with_a_&quot;_quote-2021-02-24T19:24:00.000Z"></span></span><mw:editsection page="Talk:For parser cache" section="1">Heading with a " quote</mw:editsection><span class="ext-discussiontools-init-section-subscribe mw-editsection-like"><span class="ext-discussiontools-init-section-subscribe-bracket">[</span><a href="" class="ext-discussiontools-init-section-subscribe-link" role="button" tabindex="0" data-mw-comment-name="h-Matma_Rex-2021-02-24T19:24:00.000Z" title="(discussiontools-topicsubscription-button-subscribe-tooltip)">(discussiontools-topicsubscription-button-subscribe)</a><span class="ext-discussiontools-init-section-subscribe-bracket">]</span></span></h2>
<p><span data-mw-comment-start="" id="c-Matma_Rex-2021-02-24T19:24:00.000Z-Heading_with_a_&quot;_quote"></span>Test. <a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> (<a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex"><font color="green"><i>talk</i></font></a>) 19:24, 24 February 2021 (UTC)<span class="ext-discussiontools-init-replylink-buttons"><span class="ext-discussiontools-init-replylink-bracket">[</span><a class="ext-discussiontools-init-replylink-reply" role="button" tabindex="0" data-mw-comment="{&quot;type&quot;:&quot;comment&quot;,&quot;level&quot;:1,&quot;id&quot;:&quot;c-Matma_Rex-2021-02-24T19:24:00.000Z-Heading_with_a_\&quot;_quote&quot;,&quot;replies&quot;:[],&quot;timestamp&quot;:&quot;2021-02-24T19:24:00.000Z&quot;,&quot;author&quot;:&quot;Matma Rex&quot;}" href="">(discussiontools-replylink)</a><span class="ext-discussiontools-init-replylink-bracket">]</span></span><span data-mw-comment-end="c-Matma_Rex-2021-02-24T19:24:00.000Z-Heading_with_a_&quot;_quote"></span>
</p>