4

Does Horde_Text_Differ_Renderer have built-in methods to format the text it outputs?

ie. colors, apply css classes? etc?

Shikiryu
  • 10,180
  • 8
  • 49
  • 75
James Huckabone
  • 615
  • 1
  • 12
  • 32
  • What is your question? So far you've only been describing what you can't (e.g. find something). It's not that you delegate jobs here on SO ;) (I can see your bounty, not that you waste it, I just want to suggest to you to improve you question a little and tell what exactly you're looking for) – hakre Oct 10 '13 at 06:42
  • And one example I know of is with Wordpress. They use that class IIRC and it is used with colors (the typical red and green). – hakre Oct 10 '13 at 06:48
  • @hakre - is that better? – James Huckabone Oct 10 '13 at 22:49

1 Answers1

1

As you can in the source, Horde just add prefix to lines it sees differences in.

For example, for added line, it will use :

protected function _added($lines) {        
    return $this->_lines($lines, '> '); // prefix with > 
}

So you can modify this class to add whatever you need here, or better, you can override it with your own class modifying only the methods you need to change, leaving the rest untouched.

Shikiryu
  • 10,180
  • 8
  • 49
  • 75
  • I've actually done this already, however, I'm looking for a built-in method to do this instead of changing the original code. Thank you for your time you spent digging around! – James Huckabone Oct 17 '13 at 00:09
  • @JamesHuckabone that's why I advised you to override this class with one of yours… – Shikiryu Oct 17 '13 at 08:29
  • I'm looking for an official method as opposed to a hack. Thank you for your time!! – James Huckabone Nov 06 '13 at 20:48
  • 1
    I don't consider extending a class a hack… That's pure OOP. Anyway, since you can see the source I linked, you can see that there's no build-in method to change that. IMHO, you got 3 choices : Extend the class with your own (thing I'll do, so that even if you update Horde, you'll still have what you want), tell the author via a Github Issue that it should be more modular or even better, do the modification yourself in a fork of that class and ask for a merge. – Shikiryu Nov 07 '13 at 08:54
  • You're right, I was just being moody. Thanks for the great advice! – James Huckabone Nov 07 '13 at 16:57