Page MenuHomePhabricator

DSR values for linter issues in extension content with wikitext content model are incorrect
Closed, ResolvedPublic

Description

Example: https://de.wikipedia.org/w/index.php?title=7/27&action=edit&lintid=1956834

I have seen this in a few other instances as well. Parsoid's linter has to more smartly detect linter issues. The example below demonstrates this very clearly.

[subbu@earth parsoid] echo "a<ref><center>c</center></ref> <references/>" | parse.js --lint > /dev/null
[info/lint/obsolete-tag][enwiki/Main Page] {"type":"obsolete-tag","params":{"name":"center"},"dsr":[31,44,2,2]}

Parsoid has to be smarter and look into references content and attribute linter issues to the <ref>tag causing it.

Event Timeline

ssastry moved this task from Needs Triage to Linting on the Parsoid board.
ssastry moved this task from Backlog to Parsoid on the MediaWiki-extensions-Linter board.
ssastry renamed this task from When a <ref> has linter issues, <references /> tag is flagged as having the issue to DSR values for linter issues in extension content with wikitext content model are incorrect.Oct 14 2017, 3:39 AM

Change 384198 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] Linter: Provide accurate DSR offsets for issues in extension content

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

Since the ref linkback in the references section has no markup to indicate it came from a transclusion, this fails.

[subbu@earth mocha] echo "a{{1x|<ref>x<center>c</center>y</ref>}} <references/>" | parse.js --lint
[error/lint][enwiki/Main Page] Missing DSR; msg= {"type":"obsolete-tag","params":{"name":"center"}}
Stack:
  /home/subbu/work/wmf/parsoid/lib/logger/LintLogger.js:21:11
  nextTickCallbackWith0Args (node.js:436:9)
  process._tickCallback (node.js:365:13)

This is more a problem with our HTML representation rather than the linter. A <ref> tag generates two pieces, one at the <ref> site that has the data-mw transclusion info and the other in the <references /> section without the data-mw transclusion info.

There are 2 options here. Use the linkback cite id to look up dsr from the ref site (but this will special case code for the cite extension). Alternatively, we have to duplicate data-mw and data-parsoid info for the ref linkback in the references section.

Change 384198 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Linter: Provide accurate DSR offsets for issues in extension content

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