Page MenuHomePhabricator

Technical debt: jquery.tablesorter hardcodes exclude for span.references
Open, Needs TriagePublic

Description

This patch incurs technical debt by hardcoding logic for the Cite extension in MediaWiki core. We should consider finding a way to trigger the same behaviour without hardcoding this logic.

The outcome should be that:

  • The Cite extension is in control of the behaviour.
  • The tablesorter extension exposes a documented and tested public interface that is used by Cite extension.

Two options come to mind, but there may be other approaches as well:

  1. Use exiting tablesorter API: The Cite extension is developed for MediaWki so it is fine for it to contain optional enhancements in its HTML aimed at tablesorter. For example, it could output data-sort-value="" on its <span class="reference"> elements. This would achieve the above outcomes. And:
    • Benefit: Does not introduce additional APIs to document, maintain and test for.
    • Drawback: May be difficult to implement given this is part of Parser output, which we prefer not to change too often.
  1. Create an extendable interface for special behaviours. This would mean tablesorter gets a public interface to register class names to ignore, and the Cite extension, either by PHP or JS hook, would adds its "reference" class to that list.
    • Neutral: Adds a new feature to support, although it would essentially cost the same in terms of complexity and maintenance as the current patch (except in a more generalised form).
    • Benefit: Doesn't involve changing Parser output.

Event Timeline

Vvjjkkii renamed this task from Technical debt: jquery.tablesorter hardcodes exclude for span.references to 4beaaaaaaa.Jul 1 2018, 1:14 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
Wong128hk renamed this task from 4beaaaaaaa to Technical debt: jquery.tablesorter hardcodes exclude for span.references.Jul 1 2018, 6:06 AM
Wong128hk raised the priority of this task from High to Needs Triage.
Wong128hk updated the task description. (Show Details)
Wong128hk added a subscriber: Aklapper.

I still think this is not a problem after working with the mentioned codebases for so long. Cite effectively is a part of core. The reference class is already hardcoded in a lot of places. It's a public interface. And one we need to consider "stable" for all practical purposes, I believe. I suggest to not bother and close this ticket without making any changes.