Lua long strings not displaying correctly using geshi syntax highlighting

413 views Asked by At

I am storing my new Lua code in to a Dokuwiki system which uses the geshi highlighter (written in php). How ever I am having a problem with long string definitions in lua for example

strLong = [[If this is a long string then I don't want it 
highlighted as code else it looks very silly]]

It is possible to correct this using the geshi lua.php file, I have already taken a quick look at the documentation at http://qbnz.com/highlighter/geshi-doc.html and multiline comments are working fine it's just multiline strings which are not.

1

There are 1 answers

0
Jane T On BEST ANSWER

With Thanks to Benny Baumann on the geshi-users list

Strings in GeSHi 1.0.X have the limitation that start and end marker need to be the same. If this constraint is not fulfilled you have to resort to highlighting the strings using COMMENT_REGEXP.

To correctly colour code the long strings In lua.php In the $language_data = array ( add

    'COMMENT_REGEXP' => array(2 => '/\[\[(?s:.*?)\]\]/'),

In the style sheet add

.lua  .co2  { color: #ff0000; font-style: normal;} 

to change only second comment type to look like a string, when used on a Lua source.