[pmwiki-users] Wanted: Code highlighter that works with WikiPublisher

John Rankin john.rankin at affinity.co.nz
Sun Sep 24 17:53:51 CDT 2006


On Sunday, 24 September 2006 4:33 AM, Nils Knappmeier <nk at knappi.org> wrote:
>Hi,
>> 3.  Create a new source-code beautifier in PHP that can go
>>     straight to wiki markup or something that WikiPublisher
>>     understands.  As evidenced by the amount of work that
>>     goes into packages by GeSHi and beautifier, I think I can
>>     safely say this would be a huge amount of work with a
>>     limited audience.
>>   
>If it helps: WikiPublisher uses LaTeX to create PDF, right?
>There is a latex package called "listings" that can be used
>to insert source code directly into LaTeX. I don't know, if it
>can beautify PHP code, but it has many options to adapt the
>look of the code supports many languages (including
>Fortran and Cobol, I think), and I am pretty sure you can
>customize it for unsupported languages as well, IF you know
>LaTeX...
>
>Nils
>
This would be the way to go, I think. You would redefine
the directive that calls the code highlighter to wrap
the source in a suitable wikibook xml tag. This tag would
tell the xsl processor to invoke the LaTeX listings
package for the specified language (if that language is
supported).

For example, in the case of Beautifier, we would change 
the markup rule that processes

=lang[=
...
=]

so that it emits <tbook:verbatim class='lang'>
...
</tbook:verbatim>

In the short term this would at least get the code
output in the pdf, but it wouldn't be beautfied.

Here is a relevant link:
http://www.usq.edu.au/users/leis/notes/latex/code.html

How useful would it be to  output unbeautified source code
in the pdf?

-- 
JR
--
John Rankin







More information about the pmwiki-users mailing list