We need to find a good way to properly count and display reference counts per article; that discussion is ongoing in the parent task, and should continue.
For the moment, we can implement basic functionality with relatively high accuracy (and some outliers) as a temporary measure that is still performant. This should only be done for articles, not image pages.
- Fetch existing Parser HTML for the given article
- Use Regular Expression to count the number of iterations of the substring mw:Extension/ref
As pointed out by Subbu, this will give us correct information 99% of the time, where the 1% falsehoods would come from tutorial pages that have that string directly in the content. Those pages are less likely to be utilized in the Attribution API and are very few, which should be acceptable for a first pass.
Implementation details
- This substring is available only new Parsoid.
- Count should be returned only for Articles, not for Files
