Frage

Ich bin die Speicherung meines neuen Lua Code in einem Dokuwiki System, das den geshi Highlighter verwendet (in PHP geschrieben). Wie auch immer ich habe ein Problem mit langen String-Definitionen in lua zum Beispiel

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

Es ist möglich, dies mit der geshi lua.php Datei zu korrigieren, ich habe schon einen kurzen Blick auf die Dokumentation unter http://qbnz.com/highlighter/geshi-doc.html und mehrzeilige Kommentare arbeiten gut, es ist nur mehrzeilige Strings, die nicht sind.

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top