Closed NeatNit closed 7 years ago
Option Show unsaved changes works with files only. Until you will save wiki page as file - it's unavailable.
Another way - you can use plugins like Sublimerge - to show diffs between two tabs in Sublime - with edited page version and with original.
If this feature is currently unavailable in Mediawiker, please add it. I consider it very important, and I can think of a few ways you could implement it - either do it yourself as part of the Edit panel, or override Sublime's "Show Unsaved Changes" option to do it in a custom way (not sure if this is possible), or make it work as-is by simply saving the edited article as a temporary file in the filesystem for Sublime to use as a comparison.
If you need an option "Show Unsaved Changes", just save opened page to file - option will work. For work with big scopes of changes in source code, I prefer to use the tools specially made for this. This is one of the reasons why I was doing the plugin under ST - a lot of plugins that simplify the work with text.
P.S. I added this issue into backlog, if I find good way to make this without additional files - I will make it.
Thing is, you can use the Mediawiki API to get the diff from the server. This is better because if someone edited the article while you were editing it, it would show up.
See an example query: http://wiki.garrysmod.com/api.php?action=query&prop=revisions&titles=User:NeatNit/sandbox&rvdifftotext=test+2+and+4 For editing this page with custom text: http://wiki.garrysmod.com/page/User:NeatNit/sandbox
The format of the diff is HTML which is supposed to go inside a <table>
but it's not hard to work with IMO.
<tr><td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td class='diff-deletedline'><div>test 2</div></td><td class='diff-marker'>+</td><td class='diff-addedline'><div>test 2 <ins class="diffchange diffchange-inline">and 4</ins></div></td></tr>
I also don't know if the library you use makes it any easier
Yes, API based diff is a good point. I'll try to implement this. Thanks.
For the record, my custom fork have a "Page diff vs. server version" command that does exactly this. https://github.com/scholer/Mediawiker/blob/master/mediawiker.py#L595
The implementation is pretty straight-forward: Download the page version from the server and diff against the current view/buffer, and place the unified diff in a new view/buffer.
It seems weird to me that this isn't already a feature, so perhaps I'm missing something. The closest thing I found was #33 but I don't understand what it was discussing.
On mediawiki there is a Show Changes button, which on wikipedia produces this:
The button looks like this:
In Sublime there exists a "Show unsaved changes..." option for local files:
How do I view the same diff for mediawiki pages I edited? The Sublime option is greyed out and I found no matching Mediawiker option.