Syntax Highlighting

2 views
Skip to first unread message

rpSetzer

unread,
Mar 18, 2008, 4:10:30 PM3/18/08
to Docebo international developers
Hello! As this is my first post, I think I should introduce myself. My
name is Grigoruta Paul and I'm from Romania. I want to use Docebo as
part of some web development courses I plan to deliver.
One thing I am working on is the Romanian translation.

The other thing I'm interested in is syntax highlighting. As I plan to
use Docebo for web development courses, syntax highlighting is a must
for php, html, css and javascript.

First of all, is there something like this implemented or under
development?

If not, I plan to integrate GeSHi. My idea is like this:
The user inserts the code that should appear highlighted like this:
[code lang="php"]echo "Hello, world!";[/code].
Whenever the code is rendered for display, the code tags are found and
fed to GeSHI for highlighting. Is there a function that "cleans" the
text for display? That would be an ideal point to make the link with
GeSHI. Any help is appreciated.

Thanks!

Fabio Pirovano

unread,
Mar 19, 2008, 6:12:41 AM3/19/08
to doc...@googlegroups.com
HI Paul,
the best place in which you can put the parser, imho, is in the
page_writer, that is a class that cache all the Docebo output and flush
it at the end, so you can add here the GeShi parser

look at this file: doceboCore/lib/lib.pagewriter.php
you can add the parser in this method:

line 153

function getContent() {
$out = '';

if(empty($this->_contentOut) && $this->print_if_empty === false)
return $out;

$out.=implode($this->_startOut);
$out.=implode($this->_contentOut);
$out.=implode($this->_endOut);

$out =fillSiteBaseUrlTag($out);

// add the parser here modifing the $out var

return $out;
}

If you want, take a look to this project :
http://code.google.com/p/syntaxhighlighter/
it work via js, so you don't need to add a server parser

Cya
Fabio


rpSetzer ha scritto:

Reply all
Reply to author
Forward
0 new messages