Revision [3161]

This is an old revision of WikkaGeshiIntegration made by JavaWoman on 2004-12-14 17:11:02.

 

Integration of GeSHI into Wikka

The intention is to bundle GeSHi with Wikka as of version 1.1.6.0, and it can be seen here now in a beta implementation. While it "works", I'd like a more rigorous and at the same time more flexible integration than what we have now. I'll outline how I've done the integration (into my version of Wikka 1.1.5.3) on this page.

Goals
My integration method derives from the following goals:

Implementation steps

Implementation of the integration consists of the following steps:
  1. latest GeSHi version (>= 1.0.4)
  1. extension of the configuration file
  1. adaptation of the routine in the wakka formatter that handles a code block
  1. method in wikka.php that forms the actual interface to GeSHi
  1. adaptation of the Format() method in wikka.php
  1. some additional rules in the wikka stylesheet

1. Latest GeSHi version
Download the latest version from http://qbnz.com/highlighter/ and use this to replace the one now in Wikka 1.1.6.0beta. (However, see also WikkaCodeStructure!)

2. Extension of the configuration file
In order to accomplish the goal of automatic recognition of syntax highlighter files, we need to let the program look in the directory where these are stored, instead of hard-coding the (now) available languages. This means we need to define the path where these files are stored in the configuration file; for even more flexibility, we follow the same approach for the built-in Wikka code highlighters. And to allow a WikkaAdmin to use an already-installed package, the path to the package itself needs to be defined as well.

Add the following to /wikka.config.php:
    // formatter and code hilighting paths
    'wikka_formatter' => 'formatters',  # (location of Wikka formatter - REQUIRED)
    'wikka_lang_path' => 'formatters',  # (location of Wikka code highlighters - REQUIRED)
    'geshi_path' => 'geshi',            # (location of GeSHi package)
    'geshi_lang_path' => 'geshi/geshi', # (location of GeSHi language hilighting files)

The paths should not end in a slash.
Note that these paths are relative - and only serve as an example; it's also possible to define absolute paths, which would be required anyway if elements of Wikka or GeSHi were to be located away from the webserver's docroot.

In order to accomplish the goal of configurability without having to hack the wikka code, the following configuration parameters should also be added to /wikka.config.php:
    // code hilighting with GeSHi
    'geshi_header' => 'div',        # 'div' (default) or 'pre' to surround code block
    'geshi_line_numbers' => '1',        # disable line numbers (0), or enable normal (1) or fancy line numbers (2)
    'geshi_tab_width' => '4',       # set tab width
There are 6 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki