-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XML style output broken #3
Comments
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). |
The non-sensible ones are XML (which is waiting for Issue GeSHi#3 to be fixed, and will probably resolve itself by then) and Debug (which doesn't deal with colors at all). TROFF lacks support for background or text colors, so we just add a note. ANSI lacks alpha support, and has very primitive background color support (8 colors), but it's used. *UNTESTED - MIGHT NOT WORK* Pango lacks alpha support; background is fully supported otherwise. HTML completely supports both alpha and background color.
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 98
That'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.
The text was updated successfully, but these errors were encountered: