ftilmann / latexdiff

Compares two latex files and marks up significant differences between them. Releases on www.ctan.org and mirrors
GNU General Public License v3.0
514 stars 72 forks source link

Support for minted #193

Open nikAizuddin opened 4 years ago

nikAizuddin commented 4 years ago

This patch will allow minted environment to be properly marked up. However, I haven't test this patch with verbatim and listings environments.

ftilmann commented 4 years ago

Thanks, this looks interesting but I would need to test that it does not break the other verbatim environments. I have also a few other suggestions:

  1. It is cumbersome to add minted as a runtime option to VERBATIMENV. So you should add this to the default (CONFIG defaults are listed near the end of the file - near l. 5079 in current version). Alternatively you check if minted package has been loaded with

    if ( defined($packages{"minted"})) {
    ...
    }

    in the set up phase, and add minted at that stage programmatically to VERBATIMLINEENV

  2. It would be great if you provide a simple example of old and new files that exercise the new functionality in directory testsuite (and add this to the list in script "verify" in that directory). This is particularly needed to make sure, future patches don't break the functionality you add. Check out the instructions in the Wiki for running test yourself https://github.com/ftilmann/latexdiff/wiki verbatim and lstlisting tests are included in the test list, so if your patch passes, it's probably good to go.

If you are able to do this things, it would greatly accelerate acceptance of your patch (I still would plan to eventually look into it but it might be much longer until I get round to that).

nikAizuddin commented 4 years ago

@ftilmann no problem, I'll do according to your suggestions

ftilmann commented 2 months ago

Note to myself: Indeed this PR is breaking the standard verbatim environment so will put this on hold for now. minted seems quite a popular package, so still worth keeping open. Probably the easiest would be to hardcode dedicated processing for minted environment, adapting the current processing for the verbatim environments. Not so great because it would lead to some code repetition, but avoiding overly complex RegEx.

Note to others: The original author of PR @nikAizuddin never provided testing examples. I am not sure if he or others are still interested as the PR is >4 yrs old. If yes, ping this thread, and ideally provide working examples of old and new files using minted (MWE or could be more complex).