Arlolra has uploaded a new change for review.

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

Change subject: WIP: Make behavior switches SOL transparent
......................................................................

WIP: Make behavior switches SOL transparent

 * Removes the mysterious pre at the bottom of enwiki/Main_Page

 * Still html2wt direction to take care of ...

Bug: T97386
Change-Id: I67f68118ac2db8e84b9f9a06103ddba211ae4098
---
M lib/mediawiki.Util.js
1 file changed, 17 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/00/214300/1

diff --git a/lib/mediawiki.Util.js b/lib/mediawiki.Util.js
index 490a096..3fd5ae8 100644
--- a/lib/mediawiki.Util.js
+++ b/lib/mediawiki.Util.js
@@ -463,22 +463,30 @@
                        
this.solTransparentLinkRegexp.test(token.getAttribute('rel'));
        },
 
+       isBehaviorSwitch: function(token) {
+               var tc = token.constructor;
+               return tc === pd.SelfclosingTagTk && token.name === 
'behavior-switch';
+       },
+
        isSolTransparent: function(token) {
                var tc = token.constructor;
                if (tc === String) {
                        return token.match(/^\s*$/);
                } else if (this.isSolTransparentLinkTag(token)) {
                        return true;
-               } else if (tc !== pd.CommentTk &&
-                          (tc !== pd.SelfclosingTagTk || token.name !== 
'meta')) {
+               } else if (tc === pd.CommentTk) {
+                       return true;
+               } else if (this.isBehaviorSwitch(token)) {
+                       return true;
+               } else if (tc !== pd.SelfclosingTagTk || token.name !== 'meta') 
{
                        return false;
-               }
-
-               // BUG 47854: Treat all mw:Extension/* tokens as non-SOL.
-               if (token.name === 'meta' && 
/(?:^|\s)mw:Extension\//.test(token.getAttribute('typeof'))) {
-                       return false;
-               } else {
-                       return token.dataAttribs.stx !== 'html';
+               } else {  // only metas left
+                       // BUG 47854: Treat all mw:Extension/* tokens as 
non-SOL.
+                       if 
(/(?:^|\s)mw:Extension\//.test(token.getAttribute('typeof'))) {
+                               return false;
+                       } else {
+                               return token.dataAttribs.stx !== 'html';
+                       }
                }
        },
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I67f68118ac2db8e84b9f9a06103ddba211ae4098
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>

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

Reply via email to