mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-24 02:48:18 +00:00
Merge "Skip over whitespace when looking for trailing comments"
This commit is contained in:
commit
fa2ee6cfe6
|
@ -6,6 +6,7 @@ use DOMComment;
|
|||
use DOMDocument;
|
||||
use DOMElement;
|
||||
use DOMNode;
|
||||
use DOMText;
|
||||
use DOMXPath;
|
||||
use Wikimedia\Parsoid\Utils\DOMCompat;
|
||||
|
||||
|
@ -140,8 +141,21 @@ class CommentModifier {
|
|||
|
||||
// Parsoid puts HTML comments which appear at the end of the line in wikitext outside the paragraph,
|
||||
// but we usually shouldn't insert replies between the paragraph and such comments. (T257651)
|
||||
if ( $target->nextSibling && $target->nextSibling instanceof DOMComment ) {
|
||||
$target = $target->nextSibling;
|
||||
// Skip over comments and whitespace, but only update target when skipping past comments.
|
||||
$pointer = $target;
|
||||
while (
|
||||
$pointer->nextSibling && (
|
||||
$pointer->nextSibling instanceof DOMComment ||
|
||||
(
|
||||
$pointer->nextSibling instanceof DOMText &&
|
||||
CommentUtils::htmlTrim( $pointer->nextSibling->nodeValue ) === ''
|
||||
)
|
||||
)
|
||||
) {
|
||||
$pointer = $pointer->nextSibling;
|
||||
if ( $pointer instanceof DOMComment ) {
|
||||
$target = $pointer;
|
||||
}
|
||||
}
|
||||
|
||||
// Insert required number of wrappers
|
||||
|
|
|
@ -67,7 +67,7 @@ function addReplyLink( comment, linkNode ) {
|
|||
function addListItem( comment ) {
|
||||
var
|
||||
curComment, curLevel, desiredLevel, itemType, listType,
|
||||
target, parent, covered, list, item, newNode,
|
||||
target, pointer, parent, covered, list, item, newNode,
|
||||
listTypeMap = {
|
||||
li: 'ul',
|
||||
dd: 'dl'
|
||||
|
@ -132,8 +132,21 @@ function addListItem( comment ) {
|
|||
|
||||
// Parsoid puts HTML comments which appear at the end of the line in wikitext outside the paragraph,
|
||||
// but we usually shouldn't insert replies between the paragraph and such comments. (T257651)
|
||||
if ( target.nextSibling && target.nextSibling instanceof Comment ) {
|
||||
target = target.nextSibling;
|
||||
// Skip over comments and whitespace, but only update target when skipping past comments.
|
||||
pointer = target;
|
||||
while (
|
||||
pointer.nextSibling && (
|
||||
pointer.nextSibling.nodeType === Node.COMMENT_NODE ||
|
||||
(
|
||||
pointer.nextSibling.nodeType === Node.TEXT_NODE &&
|
||||
utils.htmlTrim( pointer.nextSibling.textContent ) === ''
|
||||
)
|
||||
)
|
||||
) {
|
||||
pointer = pointer.nextSibling;
|
||||
if ( pointer.nodeType === Node.COMMENT_NODE ) {
|
||||
target = pointer;
|
||||
}
|
||||
}
|
||||
|
||||
// Insert required number of wrappers
|
||||
|
|
|
@ -999,8 +999,8 @@ Currently, one of the most backlogged processes is <a rel="mw:WikiLink" href="./
|
|||
</section><section data-mw-section-id="78" id="mwDaY"><h3 id="Learning_more">Learning more</h3>
|
||||
<p id="mwDac">The <a rel="mw:WikiLink/Interwiki" href="https://www.mediawiki.org/wiki/VisualEditor%20on%20mobile" title="mw:VisualEditor on mobile" id="mwDag">VisualEditor on mobile</a> is a good place to learn more about the projects we are working on. The team wants to talk with you about anything related to editing. If you have something to say or ask, please leave a message at <a rel="mw:WikiLink/Interwiki" href="https://www.mediawiki.org/wiki/Talk:VisualEditor%20on%20mobile" title="mw:Talk:VisualEditor on mobile" id="mwDak">Talk:VisualEditor on mobile</a>.</p>
|
||||
|
||||
<p id="mwDao"><a rel="mw:WikiLink/Interwiki" href="https://www.mediawiki.org/wiki/User:PPelberg%20(WMF)" title="mw:User:PPelberg (WMF)" id="mwDas">PPelberg (WMF)</a> (<a rel="mw:WikiLink/Interwiki" href="https://www.mediawiki.org/wiki/User%20talk:PPelberg%20(WMF)" title="mw:User talk:PPelberg (WMF)" id="mwDaw">talk</a>) and <a rel="mw:WikiLink" href="./User:Whatamidoing_(WMF)" title="User:Whatamidoing (WMF)" id="mwDa0">Whatamidoing (WMF)</a> (<a rel="mw:WikiLink" href="./User_talk:Whatamidoing_(WMF)" title="User talk:Whatamidoing (WMF)" id="mwDa4">talk</a>) 21:24, 15 July 2019 (UTC)</p><dl><dd data-parsoid="{}">Reply to Whatamidoing (WMF)|2019-07-15T21:24:00.000Z|0</dd></dl>
|
||||
<!-- Message sent by User:Whatamidoing (WMF)@enwiki using the list at https://en.wikipedia.org/w/index.php?title=Wikipedia:VisualEditor/Newsletter&oldid=901773265 -->
|
||||
<p id="mwDao"><a rel="mw:WikiLink/Interwiki" href="https://www.mediawiki.org/wiki/User:PPelberg%20(WMF)" title="mw:User:PPelberg (WMF)" id="mwDas">PPelberg (WMF)</a> (<a rel="mw:WikiLink/Interwiki" href="https://www.mediawiki.org/wiki/User%20talk:PPelberg%20(WMF)" title="mw:User talk:PPelberg (WMF)" id="mwDaw">talk</a>) and <a rel="mw:WikiLink" href="./User:Whatamidoing_(WMF)" title="User:Whatamidoing (WMF)" id="mwDa0">Whatamidoing (WMF)</a> (<a rel="mw:WikiLink" href="./User_talk:Whatamidoing_(WMF)" title="User talk:Whatamidoing (WMF)" id="mwDa4">talk</a>) 21:24, 15 July 2019 (UTC)</p>
|
||||
<!-- Message sent by User:Whatamidoing (WMF)@enwiki using the list at https://en.wikipedia.org/w/index.php?title=Wikipedia:VisualEditor/Newsletter&oldid=901773265 --><dl><dd data-parsoid="{}">Reply to Whatamidoing (WMF)|2019-07-15T21:24:00.000Z|0</dd></dl>
|
||||
|
||||
</section></section><section data-mw-section-id="79" id="mwDa8"><h2 id="Tech_News:_2019-29"><a rel="mw:WikiLink/Interwiki" href="https://meta.wikimedia.org/wiki/Special:MyLanguage/Tech/News/2019/29" title="m:Special:MyLanguage/Tech/News/2019/29" id="mwDbA">Tech News: 2019-29</a></h2>
|
||||
|
||||
|
|
|
@ -2,5 +2,7 @@
|
|||
|
||||
<p>hello <a rel="mw:WikiLink" href="./User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> (<a rel="mw:WikiLink" href="./User_talk:Matma_Rex" title="User talk:Matma Rex"><font color="green"><i>talk</i></font></a>) 18:40, 22 July 2020 (UTC) </p><!-- xxx --><dl><dd data-parsoid="{}">Reply to Matma Rex|2020-07-22T18:40:00.000Z|0</dd></dl>
|
||||
|
||||
<p>hello <!-- Template:Unsigned --><small class="autosigned">—<span typeof="mw:Entity"> </span>Preceding <a rel="mw:WikiLink/Interwiki" href="https://en.wikipedia.org/wiki/Signatures" title="wikipedia:Signatures">unsigned</a> comment added by <a rel="mw:WikiLink" href="./User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> (<a rel="mw:WikiLink" href="./User_talk:Matma_Rex#top" title="User talk:Matma Rex">talk</a> • <a rel="mw:WikiLink" href="./Special:Contributions/Matma_Rex" title="Special:Contributions/Matma Rex">contribs</a>) 18:43, 22 July 2020 (UTC)</small></p> <!--Autosigned by SineBot--><dl><dd data-parsoid="{}">Reply to Matma Rex|2020-07-22T18:43:00.000Z|0</dd></dl>
|
||||
|
||||
<p>hello <a rel="mw:WikiLink" href="./User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> (<a rel="mw:WikiLink" href="./User_talk:Matma_Rex" title="User talk:Matma Rex"><font color="green"><i>talk</i></font></a>) 18:41, 22 July 2020 (UTC) <!-- xxx --></p>
|
||||
<ul><li>hello <a rel="mw:WikiLink" href="./User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> (<a rel="mw:WikiLink" href="./User_talk:Matma_Rex" title="User talk:Matma Rex"><font color="green"><i>talk</i></font></a>) 18:42, 22 July 2020 (UTC)<!-- xxx --><dl><dd data-parsoid="{}">Reply to Matma Rex|2020-07-22T18:42:00.000Z|0</dd></dl></li></ul><dl><dd data-parsoid="{}">Reply to Matma Rex|2020-07-22T18:41:00.000Z|0</dd></dl></body></html>
|
||||
|
|
|
@ -2,5 +2,7 @@
|
|||
|
||||
<p>hello <a rel="mw:WikiLink" href="./User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> (<a rel="mw:WikiLink" href="./User_talk:Matma_Rex" title="User talk:Matma Rex"><font color="green"><i>talk</i></font></a>) 18:40, 22 July 2020 (UTC) </p><!-- xxx -->
|
||||
|
||||
<p>hello <!-- Template:Unsigned --><small class="autosigned">—<span typeof="mw:Entity"> </span>Preceding <a rel="mw:WikiLink/Interwiki" href="https://en.wikipedia.org/wiki/Signatures" title="wikipedia:Signatures">unsigned</a> comment added by <a rel="mw:WikiLink" href="./User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> (<a rel="mw:WikiLink" href="./User_talk:Matma_Rex#top" title="User talk:Matma Rex">talk</a> • <a rel="mw:WikiLink" href="./Special:Contributions/Matma_Rex" title="Special:Contributions/Matma Rex">contribs</a>) 18:43, 22 July 2020 (UTC)</small></p> <!--Autosigned by SineBot-->
|
||||
|
||||
<p>hello <a rel="mw:WikiLink" href="./User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> (<a rel="mw:WikiLink" href="./User_talk:Matma_Rex" title="User talk:Matma Rex"><font color="green"><i>talk</i></font></a>) 18:41, 22 July 2020 (UTC) <!-- xxx --></p>
|
||||
<ul><li>hello <a rel="mw:WikiLink" href="./User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> (<a rel="mw:WikiLink" href="./User_talk:Matma_Rex" title="User talk:Matma Rex"><font color="green"><i>talk</i></font></a>) 18:42, 22 July 2020 (UTC)<!-- xxx --></li></ul></body></html>
|
||||
|
|
Loading…
Reference in a new issue