Open Sei-Lisa opened 10 years ago
The basic underlying problem is that the core renderer does not currently output CSS; it deals with style data in the form of an internal array, and that's what getStyle returns.
There are three possible approaches that I can see to fix this:
There are arguments against each of these approaches. (1) is the simplest to implement but hardest to maintain, as fixes/improvements should be applied to both stylers and they will usually be desynched. (2) is simple and easy to maintain; the drawback is that the generation code will be present when using renderers that don't need it. (3) is the best but also the hardest to implement, and it implies more code bloat.
I am leaning towards (2).
Sorry for the very late reply on this. IMHO the XML renderer should basically provide parseable XML output describing all the single tokens encountered while parsing the source. As such retaining the CSS information is not strictly required and could thus be omitted; the encountered warnings should be fixed though.
Cf. geshi-cli.php for an example of how to use the various renderers.
Test case:
I don't know if that's the right way to set a renderer. Looking at the code, it looks like there are no alternatives.
When run with notices on, it generates a bunch of notices like:
Notice: Array to string conversion in <path>/geshi/classes/renderers/class.geshirendererxml.php on line 98That's the result of using the styler's getStyle to generate the css attribute contents, as per this snippet (which is the line referenced by the error):
because getStyle returns the internal array, not a CSS string which seems to be what that line expects.
This does not clearly demonstrate that the output is wrong (because it crashes later, which is another issue), but is hopefully convincing enough to show that it's broken.