Subramanya Sastry has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/76324


Change subject: Assign tagid to SelfclosingTagTk as well to detect fostered 
cat-links
......................................................................

Assign tagid to SelfclosingTagTk as well to detect fostered cat-links

* Category links are represented as SelfclosingTagTk and they can
  get fostered ==> they need a tag-id so that their fostering
  can be detected by the algo in git sha 89057946.

* Currently, category links are being fostered out a lot on pages
  like en:List_of_X-Men_(TV_series)_episodes (a lot pages that
  use Template:Episode_list.  However, the fix in 89057946 wasn't
  detecting this.  The fix in this patch ensures that those fostered
  links are ignored properly by selser and don't cause dirty diffs
  as seen in:
  
https://en.wikipedia.org/w/index.php?title=List_of_X-Men_%28TV_series%29_episodes&diff=565487327&oldid=565419567

* No change in parser tests.

* Verified fix by testing on a use of Template:Episode_list
  in a table, introducing edit changes, and verifying that the
  fostered links are ignored.

* To be separately investigated: the fostered category link comes
  from a template and is currently escaping template encapsulation.

Change-Id: I4e998ebd38d3fc176414c9083d42dbb4b7c31e16
---
M js/lib/mediawiki.HTML5TreeBuilder.node.js
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/24/76324/1

diff --git a/js/lib/mediawiki.HTML5TreeBuilder.node.js 
b/js/lib/mediawiki.HTML5TreeBuilder.node.js
index 5bf7b7a..85574f8 100644
--- a/js/lib/mediawiki.HTML5TreeBuilder.node.js
+++ b/js/lib/mediawiki.HTML5TreeBuilder.node.js
@@ -34,7 +34,7 @@
        this.env = env;
        this.trace = env.conf.parsoid.debug || (env.conf.parsoid.traceFlags && 
(env.conf.parsoid.traceFlags.indexOf("html") !== -1));
 
-       // Assigned to start tags
+       // Assigned to start/self-closing tags
        this.tagId = 1;
 };
 
@@ -108,8 +108,11 @@
        if (!dataAttribs) {
                dataAttribs = {};
        }
-       // Assign tagid for open tags
-       if (token.constructor === TagTk && token.name !== 'body') {
+
+       // Assign tagid to open/self-closing tags
+       if ((token.constructor === TagTk || token.constructor === 
SelfclosingTagTk) &&
+               token.name !== 'body')
+       {
                if (Object.isFrozen(dataAttribs)) {
                        dataAttribs = Util.clone(dataAttribs);
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/76324
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e998ebd38d3fc176414c9083d42dbb4b7c31e16
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to