http://www.perlmonks.org?node_id=990569

mpersico has asked for the wisdom of the Perl Monks concerning the following question:

I have found numerous modules that will do a text diff on two objects (strings, files, etc) and then produce HTML. However the HTML-izer function is typically not part of the public API. Does any one know if there is module that takes an already produced diff and converts that to HTML before I go and code one up (I don't even know what namespace that should live in...) Thank you.

Replies are listed 'Best First'.
Re: See if it exists before I reinvent it
by bart (Canon) on Aug 29, 2012 at 21:11 UTC
    It could be that it exists. Maybe not in the exact form you're imagining, but ...

    I found these:

    1. colordiff, a Perl script to colorize diff output (but in ANSI console)
    2. Convert diff output to colorized HTML, a bash script

    As for namespace, I'd think in the direction of "Text::Diff::Colorized::HTML", which is quite a mouthful.

      I am actually using the code at your #2 in a pipeline. That is going to be my jumping off point for he module. I'll check out colordiff also. Thanks.
Re: See if it exists before I reinvent it (.patch .diff syntax highlighter)
by Anonymous Monk on Aug 29, 2012 at 23:08 UTC
      Yes, I have a unified diff comming out of svn and I want to convert that to html. All of the modules I saw would have been perfect IF they let me plug in my own diff command. But they were all set up to actually do the diff themselves. Ill check the Syntax::Highlight* modules. Thanks.
Re: See if it exists before I reinvent it
by influx (Beadle) on Aug 29, 2012 at 22:31 UTC
    If you have an idea for a module, would like criticisms or namespace suggestions you could try http://prepan.org - I think it's still in its infancy, but I like the idea of it. It does what it says on the tin: prepan it, before you CPAN it. I should trademark that..
      http://perpan.org - what a fantastic idea. Will do! Thank you