mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-24 02:48:18 +00:00
Merge "Ignore empty paragraphs at the beginning of comments"
This commit is contained in:
commit
f7c7ba3c44
|
@ -86,7 +86,8 @@ class CommentParser {
|
|||
* Return the next leaf node in the tree order that is not an empty or whitespace-only text node.
|
||||
*
|
||||
* In other words, this returns a text node with content other than whitespace, or an element node
|
||||
* with no children, that follows the given node.
|
||||
* with no children, such as `<img>` or `<hr>` (with the exception of `<br>`), that follows the
|
||||
* given node in the HTML source.
|
||||
*
|
||||
* @param DOMNode $node Node to start searching at. This node's children are ignored.
|
||||
* @return DOMNode
|
||||
|
@ -111,7 +112,10 @@ class CommentParser {
|
|||
$n->nodeType === XML_CDATA_SECTION_NODE &&
|
||||
CommentUtils::htmlTrim( $n->nodeValue ) !== ''
|
||||
) ||
|
||||
( $n->nodeType === XML_ELEMENT_NODE && !$n->firstChild )
|
||||
(
|
||||
$n->nodeType === XML_ELEMENT_NODE &&
|
||||
!$n->firstChild && strtolower( $n->nodeName ) !== 'br'
|
||||
)
|
||||
) {
|
||||
return NodeFilter::FILTER_ACCEPT;
|
||||
}
|
||||
|
|
|
@ -625,7 +625,8 @@ Parser.prototype.findSignature = function ( timestampNode, until ) {
|
|||
* Return the next leaf node in the tree order that is not an empty or whitespace-only text node.
|
||||
*
|
||||
* In other words, this returns a Text node with content other than whitespace, or an Element node
|
||||
* with no children, that follows the given node in the HTML source.
|
||||
* with no children, such as `<img>` or `<hr>` (with the exception of `<br>`), that follows the
|
||||
* given node in the HTML source.
|
||||
*
|
||||
* @private
|
||||
* @param {Node} node Node to start searching at. If it isn't a leaf node, its children are ignored.
|
||||
|
@ -648,7 +649,7 @@ Parser.prototype.nextInterestingLeafNode = function ( node ) {
|
|||
if (
|
||||
( n.nodeType === Node.TEXT_NODE && utils.htmlTrim( n.textContent ) !== '' ) ||
|
||||
( n.nodeType === Node.CDATA_SECTION_NODE && utils.htmlTrim( n.textContent ) !== '' ) ||
|
||||
( n.nodeType === Node.ELEMENT_NODE && !n.firstChild )
|
||||
( n.nodeType === Node.ELEMENT_NODE && !n.firstChild && n.nodeName.toLowerCase() !== 'br' )
|
||||
) {
|
||||
return NodeFilter.FILTER_ACCEPT;
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@
|
|||
"timestamp": "2020-04-30T11:58:00.000Z",
|
||||
"author": "Aws Al-mimari",
|
||||
"range": [
|
||||
"0/1/8/2/1",
|
||||
"0/1/8/2/2",
|
||||
"0/1/8/2/10/2"
|
||||
],
|
||||
"signatureRanges": [
|
||||
|
|
|
@ -503,28 +503,25 @@
|
|||
],
|
||||
"level": 1,
|
||||
"id": "Sarchia Banokay|2015-07-16T14:01:00.000Z|0",
|
||||
"replies": []
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2015-07-16T15:11:00.000Z",
|
||||
"author": "Diyako kazm",
|
||||
"range": [
|
||||
"0/45/0",
|
||||
"0/47/0/5/33"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/47/0/4",
|
||||
"0/47/0/5/33"
|
||||
]
|
||||
],
|
||||
"level": 1,
|
||||
"id": "Diyako kazm|2015-07-16T15:11:00.000Z|0",
|
||||
"warnings": [
|
||||
"Comment starts and ends with different indentation"
|
||||
],
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2015-07-16T15:11:00.000Z",
|
||||
"author": "Diyako kazm",
|
||||
"range": [
|
||||
"0/47/0/0",
|
||||
"0/47/0/5/33"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/47/0/4",
|
||||
"0/47/0/5/33"
|
||||
]
|
||||
],
|
||||
"level": 2,
|
||||
"id": "Diyako kazm|2015-07-16T15:11:00.000Z|0",
|
||||
"replies": []
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2015-07-16T21:31:00.000Z",
|
||||
|
@ -1101,117 +1098,111 @@
|
|||
"replies": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-03T15:56:00.000Z",
|
||||
"author": "Diyar se",
|
||||
"range": [
|
||||
"0/119/0",
|
||||
"0/121/0/3/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/121/0/1",
|
||||
"0/121/0/3/29"
|
||||
]
|
||||
],
|
||||
"level": 1,
|
||||
"id": "Diyar se|2016-03-03T15:56:00.000Z|0",
|
||||
"warnings": [
|
||||
"Comment starts and ends with different indentation"
|
||||
],
|
||||
"replies": [
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-03T16:29:00.000Z",
|
||||
"author": "Calak",
|
||||
"timestamp": "2016-03-03T15:56:00.000Z",
|
||||
"author": "Diyar se",
|
||||
"range": [
|
||||
"0/121/0/4/0/0",
|
||||
"0/121/0/4/0/4/29"
|
||||
"0/121/0/0",
|
||||
"0/121/0/3/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/121/0/4/0/1",
|
||||
"0/121/0/4/0/4/29"
|
||||
"0/121/0/1",
|
||||
"0/121/0/3/29"
|
||||
]
|
||||
],
|
||||
"level": 3,
|
||||
"id": "Calak|2016-03-03T16:29:00.000Z|0",
|
||||
"warnings": [
|
||||
"Comment skips indentation level"
|
||||
],
|
||||
"level": 2,
|
||||
"id": "Diyar se|2016-03-03T15:56:00.000Z|0",
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-07T13:22:00.000Z",
|
||||
"author": "Serchia",
|
||||
"timestamp": "2016-03-03T16:29:00.000Z",
|
||||
"author": "Calak",
|
||||
"range": [
|
||||
"0/121/0/4/0/5/0/0",
|
||||
"0/121/0/4/0/5/0/4/29"
|
||||
"0/121/0/4/0/0",
|
||||
"0/121/0/4/0/4/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/121/0/4/0/5/0/1",
|
||||
"0/121/0/4/0/5/0/4/29"
|
||||
"0/121/0/4/0/1",
|
||||
"0/121/0/4/0/4/29"
|
||||
]
|
||||
],
|
||||
"level": 4,
|
||||
"id": "Serchia|2016-03-07T13:22:00.000Z|0",
|
||||
"level": 3,
|
||||
"id": "Calak|2016-03-03T16:29:00.000Z|0",
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-07T15:29:00.000Z",
|
||||
"author": "Calak",
|
||||
"timestamp": "2016-03-07T13:22:00.000Z",
|
||||
"author": "Serchia",
|
||||
"range": [
|
||||
"0/121/0/4/0/5/0/5/0/0",
|
||||
"0/121/0/4/0/5/0/5/0/4/29"
|
||||
"0/121/0/4/0/5/0/0",
|
||||
"0/121/0/4/0/5/0/4/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/121/0/4/0/5/0/5/0/1",
|
||||
"0/121/0/4/0/5/0/5/0/4/29"
|
||||
"0/121/0/4/0/5/0/1",
|
||||
"0/121/0/4/0/5/0/4/29"
|
||||
]
|
||||
],
|
||||
"level": 5,
|
||||
"id": "Calak|2016-03-07T15:29:00.000Z|0",
|
||||
"level": 4,
|
||||
"id": "Serchia|2016-03-07T13:22:00.000Z|0",
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-07T16:00:00.000Z",
|
||||
"author": "Serchia",
|
||||
"timestamp": "2016-03-07T15:29:00.000Z",
|
||||
"author": "Calak",
|
||||
"range": [
|
||||
"0/121/0/4/0/5/0/5/0/5/0/0",
|
||||
"0/121/0/4/0/5/0/5/0/5/0/4/29"
|
||||
"0/121/0/4/0/5/0/5/0/0",
|
||||
"0/121/0/4/0/5/0/5/0/4/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/121/0/4/0/5/0/5/0/5/0/1",
|
||||
"0/121/0/4/0/5/0/5/0/5/0/4/29"
|
||||
"0/121/0/4/0/5/0/5/0/1",
|
||||
"0/121/0/4/0/5/0/5/0/4/29"
|
||||
]
|
||||
],
|
||||
"level": 6,
|
||||
"id": "Serchia|2016-03-07T16:00:00.000Z|0",
|
||||
"level": 5,
|
||||
"id": "Calak|2016-03-07T15:29:00.000Z|0",
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-07T21:19:00.000Z",
|
||||
"author": "Calak",
|
||||
"timestamp": "2016-03-07T16:00:00.000Z",
|
||||
"author": "Serchia",
|
||||
"range": [
|
||||
"0/121/0/4/0/5/0/5/0/5/0/5/0/0",
|
||||
"0/121/0/4/0/5/0/5/0/5/0/5/0/4/29"
|
||||
"0/121/0/4/0/5/0/5/0/5/0/0",
|
||||
"0/121/0/4/0/5/0/5/0/5/0/4/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/121/0/4/0/5/0/5/0/5/0/5/0/1",
|
||||
"0/121/0/4/0/5/0/5/0/5/0/5/0/4/29"
|
||||
"0/121/0/4/0/5/0/5/0/5/0/1",
|
||||
"0/121/0/4/0/5/0/5/0/5/0/4/29"
|
||||
]
|
||||
],
|
||||
"level": 7,
|
||||
"id": "Calak|2016-03-07T21:19:00.000Z|0",
|
||||
"replies": []
|
||||
"level": 6,
|
||||
"id": "Serchia|2016-03-07T16:00:00.000Z|0",
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-07T21:19:00.000Z",
|
||||
"author": "Calak",
|
||||
"range": [
|
||||
"0/121/0/4/0/5/0/5/0/5/0/5/0/0",
|
||||
"0/121/0/4/0/5/0/5/0/5/0/5/0/4/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/121/0/4/0/5/0/5/0/5/0/5/0/1",
|
||||
"0/121/0/4/0/5/0/5/0/5/0/5/0/4/29"
|
||||
]
|
||||
],
|
||||
"level": 7,
|
||||
"id": "Calak|2016-03-07T21:19:00.000Z|0",
|
||||
"replies": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -503,28 +503,25 @@
|
|||
],
|
||||
"level": 1,
|
||||
"id": "Sarchia Banokay|2015-07-16T14:01:00.000Z|0",
|
||||
"replies": []
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2015-07-16T15:11:00.000Z",
|
||||
"author": "Diyako kazm",
|
||||
"range": [
|
||||
"0/6/4/1",
|
||||
"0/6/6/0/5/33"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/6/6/0/4",
|
||||
"0/6/6/0/5/33"
|
||||
]
|
||||
],
|
||||
"level": 1,
|
||||
"id": "Diyako kazm|2015-07-16T15:11:00.000Z|0",
|
||||
"warnings": [
|
||||
"Comment starts and ends with different indentation"
|
||||
],
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2015-07-16T15:11:00.000Z",
|
||||
"author": "Diyako kazm",
|
||||
"range": [
|
||||
"0/6/6/0/0/0/0",
|
||||
"0/6/6/0/5/33"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/6/6/0/4",
|
||||
"0/6/6/0/5/33"
|
||||
]
|
||||
],
|
||||
"level": 2,
|
||||
"id": "Diyako kazm|2015-07-16T15:11:00.000Z|0",
|
||||
"replies": []
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2015-07-16T21:31:00.000Z",
|
||||
|
@ -1101,117 +1098,111 @@
|
|||
"replies": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-03T15:56:00.000Z",
|
||||
"author": "Diyar se",
|
||||
"range": [
|
||||
"0/15/12/1",
|
||||
"0/15/14/0/3/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/15/14/0/1",
|
||||
"0/15/14/0/3/29"
|
||||
]
|
||||
],
|
||||
"level": 1,
|
||||
"id": "Diyar se|2016-03-03T15:56:00.000Z|0",
|
||||
"warnings": [
|
||||
"Comment starts and ends with different indentation"
|
||||
],
|
||||
"replies": [
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-03T16:29:00.000Z",
|
||||
"author": "Calak",
|
||||
"timestamp": "2016-03-03T15:56:00.000Z",
|
||||
"author": "Diyar se",
|
||||
"range": [
|
||||
"0/15/14/0/4/0/0",
|
||||
"0/15/14/0/4/0/4/29"
|
||||
"0/15/14/0/0",
|
||||
"0/15/14/0/3/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/15/14/0/4/0/1",
|
||||
"0/15/14/0/4/0/4/29"
|
||||
"0/15/14/0/1",
|
||||
"0/15/14/0/3/29"
|
||||
]
|
||||
],
|
||||
"level": 3,
|
||||
"id": "Calak|2016-03-03T16:29:00.000Z|0",
|
||||
"warnings": [
|
||||
"Comment skips indentation level"
|
||||
],
|
||||
"level": 2,
|
||||
"id": "Diyar se|2016-03-03T15:56:00.000Z|0",
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-07T13:22:00.000Z",
|
||||
"author": "Serchia",
|
||||
"timestamp": "2016-03-03T16:29:00.000Z",
|
||||
"author": "Calak",
|
||||
"range": [
|
||||
"0/15/14/0/4/0/5/0/0",
|
||||
"0/15/14/0/4/0/5/0/4/29"
|
||||
"0/15/14/0/4/0/0",
|
||||
"0/15/14/0/4/0/4/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/15/14/0/4/0/5/0/1",
|
||||
"0/15/14/0/4/0/5/0/4/29"
|
||||
"0/15/14/0/4/0/1",
|
||||
"0/15/14/0/4/0/4/29"
|
||||
]
|
||||
],
|
||||
"level": 4,
|
||||
"id": "Serchia|2016-03-07T13:22:00.000Z|0",
|
||||
"level": 3,
|
||||
"id": "Calak|2016-03-03T16:29:00.000Z|0",
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-07T15:29:00.000Z",
|
||||
"author": "Calak",
|
||||
"timestamp": "2016-03-07T13:22:00.000Z",
|
||||
"author": "Serchia",
|
||||
"range": [
|
||||
"0/15/14/0/4/0/5/0/5/0/0",
|
||||
"0/15/14/0/4/0/5/0/5/0/4/29"
|
||||
"0/15/14/0/4/0/5/0/0",
|
||||
"0/15/14/0/4/0/5/0/4/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/15/14/0/4/0/5/0/5/0/1",
|
||||
"0/15/14/0/4/0/5/0/5/0/4/29"
|
||||
"0/15/14/0/4/0/5/0/1",
|
||||
"0/15/14/0/4/0/5/0/4/29"
|
||||
]
|
||||
],
|
||||
"level": 5,
|
||||
"id": "Calak|2016-03-07T15:29:00.000Z|0",
|
||||
"level": 4,
|
||||
"id": "Serchia|2016-03-07T13:22:00.000Z|0",
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-07T16:00:00.000Z",
|
||||
"author": "Serchia",
|
||||
"timestamp": "2016-03-07T15:29:00.000Z",
|
||||
"author": "Calak",
|
||||
"range": [
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/0",
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/4/29"
|
||||
"0/15/14/0/4/0/5/0/5/0/0",
|
||||
"0/15/14/0/4/0/5/0/5/0/4/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/1",
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/4/29"
|
||||
"0/15/14/0/4/0/5/0/5/0/1",
|
||||
"0/15/14/0/4/0/5/0/5/0/4/29"
|
||||
]
|
||||
],
|
||||
"level": 6,
|
||||
"id": "Serchia|2016-03-07T16:00:00.000Z|0",
|
||||
"level": 5,
|
||||
"id": "Calak|2016-03-07T15:29:00.000Z|0",
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-07T21:19:00.000Z",
|
||||
"author": "Calak",
|
||||
"timestamp": "2016-03-07T16:00:00.000Z",
|
||||
"author": "Serchia",
|
||||
"range": [
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/5/0/0",
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/5/0/4/29"
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/0",
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/4/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/5/0/1",
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/5/0/4/29"
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/1",
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/4/29"
|
||||
]
|
||||
],
|
||||
"level": 7,
|
||||
"id": "Calak|2016-03-07T21:19:00.000Z|0",
|
||||
"replies": []
|
||||
"level": 6,
|
||||
"id": "Serchia|2016-03-07T16:00:00.000Z|0",
|
||||
"replies": [
|
||||
{
|
||||
"type": "comment",
|
||||
"timestamp": "2016-03-07T21:19:00.000Z",
|
||||
"author": "Calak",
|
||||
"range": [
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/5/0/0",
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/5/0/4/29"
|
||||
],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/5/0/1",
|
||||
"0/15/14/0/4/0/5/0/5/0/5/0/5/0/4/29"
|
||||
]
|
||||
],
|
||||
"level": 7,
|
||||
"id": "Calak|2016-03-07T21:19:00.000Z|0",
|
||||
"replies": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -4165,7 +4165,7 @@
|
|||
"timestamp": "2019-06-14T13:11:00.000Z",
|
||||
"author": "Nosebagbear",
|
||||
"range": [
|
||||
"0/24/2/1",
|
||||
"0/24/2/2",
|
||||
"0/24/12/0/6/27"
|
||||
],
|
||||
"signatureRanges": [
|
||||
|
|
Loading…
Reference in a new issue