Page MenuHomePhabricator

Show TeX source for math values in diffs
Closed, ResolvedPublic

Description

In diffs, we want to see the effect of an edit to both the rendered form of a formula as well as the TeX source. Otherwise, edits that do not obviously affect the rendered formula would be invisible in the diff.

We already support this kind of thing for GeoCoordinates, Quantities, and other complex types. All it takes is a specialized formatter for the FORMAT_HTML_DIFF output format. The formatter for the TeX source should output an html-escaped version of the string value, perhaps in a monospace font using <tt> or something.

Event Timeline

Note that <tt> is outdated and afaik not supported in HTML 5 anymore. Rather use <code> or <kbd> for that purpose.

Edit: Quite some irony that phabricator uses <tt> to format these snippets. ^^

@Bene thanks for your notice. However, HTML 5 and support by browsers are two differnt things. The best example is the <math /> tag itself
http://caniuse.com/#search=math

Change 273204 had a related patch set uploaded (by Daniel Kinzler):
Show TeX in wikibase diffs.

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

Screenshot 2016-02-25 14.39.26.png (1×1 px, 267 KB)

The result on a labs instance http://wikidata-math-de.wmflabs.org/w/index.php?title=Q2&type=revision&diff=196&oldid=186
It would still be nice to have a real diff that highlights what was changed.

Change 273204 merged by jenkins-bot:
Show TeX in wikibase diffs.

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

It would still be nice to have a real diff that highlights what was changed.

You mean "word level" highlighting? We don't have that for anything in Wikibase. I suppose it could be added by comparing the HTML content of the diff rows. I think that's how it is done for wikitext. But that's a completely different issue. We simply don't have support for word level highlighting for structural diffs at all.

@daniel I was thinking of the HTML diff

<mi>sin</mi>
<mo>⁡<!-- ⁡ --></mo>
<msup>
  <mi>x</mi>
  <mrow class="MJX-TeXAtom-ORD">
    <mn>5</mn>
  </mrow>
</msup>
<mo>+</mo>
<mn>5</mn>

vs

<mi>sin</mi>
<mo>⁡<!-- ⁡ --></mo>
<msup>
  <mi>x</mi>
  <mrow class="MJX-TeXAtom-ORD">
    <mn>5</mn>
  </mrow>
</msup>

one could simply add mathcolor='#cc0000' or wrap the changed expression in a mstyle.

@Physikerwelt That would require us to know what part of the DataValue changed. We currently do not look into DataValues at all. They are either the same, or different. We'd have to add infrastructure for that.

@daniel I see. I think it's good for now. However, if similar requests pop up in the future, we can reconsider this decision.