jenkins-bot has submitted this change and it was merged. Change subject: More src reusing bullet cases ......................................................................
More src reusing bullet cases * Without data-mw.parts, we know that containing list elements weren't in the about-id'ed element src, so it's safe to get bullets for them. * Follow up to 1aadbb3146c792deb9e48acbd3133e5f779476bc * Fixes echo "*<references />" Bug: T89627 Change-Id: I89881aae20367c513dbaa0023568b42f3df9a38e --- M lib/wts.TagHandlers.js M tests/parserTests.txt 2 files changed, 36 insertions(+), 14 deletions(-) Approvals: Subramanya Sastry: Looks good to me, approved jenkins-bot: Verified diff --git a/lib/wts.TagHandlers.js b/lib/wts.TagHandlers.js index efc6a4f..e77e77f 100644 --- a/lib/wts.TagHandlers.js +++ b/lib/wts.TagHandlers.js @@ -244,9 +244,9 @@ } // Normally we wait until hitting the deepest nested list element before -// emitting bullets. However, if one of those list elements is template -// marked, the tag handler will serialize content from data-mw parts. This -// is a problem when a list wasn't assigned the shared prefix of bullets. +// emitting bullets. However, if one of those list elements is about-id +// marked, the tag handler will serialize content from data-mw parts or src. +// This is a problem when a list wasn't assigned the shared prefix of bullets. // For example, // // ** a @@ -262,24 +262,36 @@ // </li></ul> // // For the b-li, getListsBullets will walk up and emit the two bullets it was -// assigned. If it was template marked, the parts would contain the two bullet +// assigned. If it was about-id marked, the parts would contain the two bullet // start tag it was assigned. However, for the a-li, only one bullet is -// associated. When it's template marked, serializing the data-mw parts would -// miss the bullet assigned to the container li. +// associated. When it's about-id marked, serializing the data-mw parts or +// src would miss the bullet assigned to the container li. function isTplListWithoutSharedPrefix( node ) { if ( !DU.isTplOrExtToplevelNode( node ) ) { return false; } - // If the first part is a string, template ranges were expanded to include - // this list element. That may be trouble. - var dataMw = DU.getDataMw( node ); - if ( !dataMw.parts || typeof dataMw.parts[0] !== "string" ) { + + var typeOf = node.getAttribute( "typeof" ) || ''; + + if ( /(?:^|\s)mw:Transclusion(?=$|\s)/.test( typeOf ) ) { + // If the first part is a string, template ranges were expanded to + // include this list element. That may be trouble. Otherwise, + // containers aren't part of the template source and we should emit + // them. + var dataMw = DU.getDataMw( node ); + if ( !dataMw.parts || typeof dataMw.parts[0] !== "string" ) { + return true; + } + // Less than two bullets indicates that a shared prefix was not + // assigned to this element. A safe indication that we should call + // getListsBullets on the containing list element. + return !/^[*#:;]{2,}$/.test( dataMw.parts[0] ); + } else if ( /(?:^|\s)mw:(Extension|Param)/.test( typeOf ) ) { + // Containers won't ever be part of the src here, so emit them. + return true; + } else { return false; } - // Less than two bullets indicates that a shared prefix was not assigned to - // this element. A safe indication that we should call getListsBullets on - // the containing list element. - return !/^[*#:;]{2,}$/.test( dataMw.parts[0] ); } function buildListHandler(firstChildNames) { diff --git a/tests/parserTests.txt b/tests/parserTests.txt index 7220238..f80e116 100644 --- a/tests/parserTests.txt +++ b/tests/parserTests.txt @@ -8040,6 +8040,16 @@ !! end !! test +Nested lists 9 (extension interaction) +!! options +parsoid +!! wikitext +*<references /> +!! html/parsoid +<ul><li data-parsoid='{}'><ol class="references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul> +!! end + +!! test 1. Lists with start-of-line-transparent tokens before bullets: Comments !! wikitext *foo -- To view, visit https://gerrit.wikimedia.org/r/194965 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I89881aae20367c513dbaa0023568b42f3df9a38e Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Arlolra <abrea...@wikimedia.org> Gerrit-Reviewer: Cscott <canan...@wikimedia.org> Gerrit-Reviewer: Marcoil <marc...@wikimedia.org> Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits