Lucas_Werkmeister_WMDE added a comment.
I don’t think we should use wikidiff2, though. The inline diff functions
don’t seem useful for us, since we want to show a side-by-side diff:
>>> wikidiff2_inline_diff( 'This is a example', 'This is an example', 2 )
=> """
<div class="mw-diff-inline-header"><!-- LINES 1,1 --></div>\n
<div class="mw-diff-inline-changed">This is <del>a</del><ins>an</ins>
example</div>\n
"""
>>> wikidiff2_inline_json_diff( 'This is a example', 'This is an example',
2 )
=> "{"diff": [{"type": 3, "lineNumber": 1, "text": "This is aan example",
"offset": {"from": 0,"to": 0}, "highlightRanges": [{"start": 8, "length": 1,
"type": 1 },{"start": 9, "length": 2, "type": 0 }]}]}"
And the regular diff contains too much extra HTML that we’d have to strip out
again (the `<!--LINE-->` numbers get localized later
<https://gerrit.wikimedia.org/g/mediawiki/core/+/f08bdf947001f261ffa5707686bf8b079741193b/includes/diff/DifferenceEngine.php#1567>,
but make no sense in our context):
>>> wikidiff2_do_diff( 'This is a example', 'This is an example', 2 )
=> """
<tr>\n
<td colspan="2" class="diff-lineno"><!--LINE 1--></td>\n
<td colspan="2" class="diff-lineno"><!--LINE 1--></td>\n
</tr>\n
<tr>\n
<td class="diff-marker" data-marker="−"></td>\n
<td class="diff-deletedline diff-side-deleted"><div>This is <del
class="diffchange diffchange-inline">a</del> example</div></td>\n
<td class="diff-marker" data-marker="+"></td>\n
<td class="diff-addedline diff-side-added"><div>This is <ins
class="diffchange diffchange-inline">an</ins> example</div></td>\n
</tr>\n
"""
Let’s just stick to `WordLevelDiff` for now.
TASK DETAIL
https://phabricator.wikimedia.org/T303317
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Lucas_Werkmeister_WMDE
Cc: Lucas_Werkmeister_WMDE, noarave, Stang, Lydia_Pintscher, Manuel, Addshore,
ItamarWMDE, Aklapper, Tacsipacsi, Hellket777, Astuthiodit_1, 786, Biggs657,
karapayneWMDE, Invadibot, maantietaja, Juan90264, Alter-paule, Beast1978,
Un1tY, Akuckartz, Hook696, Kent7301, joker88john, CucyNoiD, Nandana, Gaboe420,
Giuliamocci, Cpaulf30, Lahi, Gq86, Af420, Bsandipan, GoranSMilovanovic,
QZanden, LawExplorer, Lewizho99, Maathavan, _jensen, rosalieper, Neuronton,
Scott_WUaS, Wikidata-bugs, aude, Mbch331
_______________________________________________
Wikidata-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]