Last modified: 2013-03-14 16:33:03 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T10981, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 8981 - Rich Diff framework
Rich Diff framework
Status: NEW
Product: MediaWiki
Classification: Unclassified
History/Diffs (Other open bugs)
PC Linux
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2007-02-14 00:39 UTC by Felipe Corrêa da Silva Sanches
Modified: 2013-03-14 16:33 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Felipe Corrêa da Silva Sanches 2007-02-14 00:39:06 UTC
This is related to enhancement bug 8954: Visual coloured math diffs.
Here, I propose a framework for a visually rich diff engine that would treat bug
8954(enh) as a particular case.

Each extension, or code that implements parsing of a particular tag (such as
<math> in the bug 8954 particular case) should register a regular expression and
a highlighter callback. If these are not registered, then the default ones would
be used. 

Currently, the default regex is '/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?:
(?!< \n) [^\S\n])? /xs' and the default highlighter function would be:

function default_highlighter($element){
    return '<del class="diffchange">' . htmlspecialchars ( $element ) . '</del>';

For bug 8954 the highlighter function would be:

function default_highlighter($element){
    return '{\color{red}' . $element . '}';

Think a bit about extensions such as WikiTeX that would use particular regexes
and highlighters for each tag implemented. This woul provide us with visual
diffs including stuff like circuit diagrams, chemestry formulas, fluxograms,
Chess & Go boards, etc.

The reason why I propose this kind of solution is because the default regex
currently used in DifferenceEngine.php is not suitable for every kind of
content. It is satisfactory for common text. But I have noticed that it is not
necessarily suitable for syntax dependent stuff (such as LaTeX, for example)
since the highlighted code must also match the syntax. The regex must split the
input into  elements that could be safely applied to the highlighter function
producing a result that is also compliant to the syntax.
Comment 1 Rob Church 2007-02-14 00:41:24 UTC
How would this work with extensions such as wikidiff and wikidiff2?
Comment 2 Felipe Corrêa da Silva Sanches 2007-02-14 01:08:31 UTC
If I got it right, wikidiff is an external diff engine, right? So, here we have
2 options:

# when using an external diff engine you won't have visual diffs, or
# implement something similar on the alternative external diff engine.

different diff engines => different features, right?
Comment 3 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-02-14 03:07:58 UTC
Different diff engines = same algorithm rewritten in C++ for speed, at least for
wikidiff2 (diffs were very slow at one point, now they're a few ms).  It would
probably be kind of difficult to hook PHP functions into that, and for that
matter I assume linking C++ functions into it would require a recompile, so
making this accessible to extensions at least would be tricky for the wikidiffs
(although they could still work with core features).  The extensions are at
these URLs respectively:

Note You need to log in before you can comment on or make changes to this bug.