Subramanya Sastry has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/386016 )
Change subject: WIP: Add tidy-font-bug high priority linteer category ...................................................................... WIP: Add tidy-font-bug high priority linteer category Change-Id: I7510ad39172b4025a79bc6f3f26eb265587c8d8c --- M lib/wt2html/pp/handlers/linter.js 1 file changed, 63 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/16/386016/1 diff --git a/lib/wt2html/pp/handlers/linter.js b/lib/wt2html/pp/handlers/linter.js index 87d1ba0..6de5926 100644 --- a/lib/wt2html/pp/handlers/linter.js +++ b/lib/wt2html/pp/handlers/linter.js @@ -452,6 +452,69 @@ }; env.log('lint/obsolete-tag', lintObj); } + + if (c.nodeName === 'FONT' && c.getAttribute('color')) { + /* ---------------------------------------------------------- + * Tidy migrates <font> into the link in these cases + * <font>[[Foo]]</font> + * <font>[[Foo]]l</font> (link-trail) + * <font><!--boo-->[[Foo]]</font> + * <font>__NOTOC__[[Foo]]</font> + * <font>[[Category:Foo]][[Foo]]</font> + * <font>{{1x|[[Foo]]}}</font> + * + * Tidy does not migrate <font> into the link in these cases + * <font> [[Foo]]</font> + * <font>[[Foo]] </font> + * <font>[[Foo]]L</font> (not a link-trail) + * <font>[[Foo]][[Bar]]</font> + * <font>[[Foo]][[Bar]]</font> + * + * <font> is special. + * This behavior is not seen with other formatting tags. + * + * Remex/parsoid won't do any of this. + * This difference in behavior only matters when the font tag + * specifies a link colour because the link no longer renders + * as blue/red but in the font-specified colour. + * ---------------------------------------------------------- */ + var tidyFontBug = true; + var haveLink = false; + var n = c.firstChild; + while (n) { + if (!DU.isComment(n) && + n.nodeName !== 'A' && + n.nodeName !== 'FIGURE' && + !(n.nodeName === 'SPAN' && /\bmw:Image\b/.test(n.getAttribute('typeof'))) && + !DU.isBehaviorSwitch(env, n) && + !DU.isSolTransparentLink(n) && + !(n.nodeName === 'META' && Util.TPL_META_TYPE_REGEXP.test(n.getAttribute('typeof'))) + ) { + tidyFontBug = false; + break; + } + + if (n.nodeName === 'A' || n.nodeName === 'FIGURE') { + if (!haveLink) { + haveLink = true; + } else { + tidyFontBug = false; + break; + } + } + + n = n.nextSibling; + } + + if (tidyFontBug) { + var templateInfo = findEnclosingTemplateName(env, tplInfo); + env.log('lint/tidy-font-bug', { + dsr: findLintDSR(templateInfo, tplInfo, dp.dsr), + templateInfo: templateInfo, + params: { name: 'font' }, + }); + } + } } /* -- To view, visit https://gerrit.wikimedia.org/r/386016 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7510ad39172b4025a79bc6f3f26eb265587c8d8c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits