Commit 0dffafc8 authored by twanvl's avatar twanvl

Minor tweaks of documentation syntax highlighter

parent fa5ef830
...@@ -5,7 +5,8 @@ require_once('./modules/mse-drupal-modules/autoformat.inc'); ...@@ -5,7 +5,8 @@ require_once('./modules/mse-drupal-modules/autoformat.inc');
global $nice_ff_names; global $nice_ff_names;
$nice_ff_names = array( $nice_ff_names = array(
'Function' => 'Functions', 'Function' => 'Functions',
'Type' => 'Types' 'Type' => 'Types',
'Script' => 'Scripting'
); );
define('FROMFILE_DIR', 'doc'); define('FROMFILE_DIR', 'doc');
......
...@@ -127,7 +127,7 @@ function highlight_script($code) { ...@@ -127,7 +127,7 @@ function highlight_script($code) {
while(strlen($code)) { while(strlen($code)) {
if (preg_match("@^<[^>]+>@",$code, $matches)) { if (preg_match("@^<[^>]+>@",$code, $matches)) {
$ret .= $matches[0]; // plain tag $ret .= $matches[0]; // plain tag
} else if (preg_match("@^(if|then|else|for( each)?|in(?= )|do|and|or|xor|not|rgb|from|to)\b(?!:)@",$code, $matches)) { } else if (preg_match("@^(if|then|else|for( each)?|in(?= )|do|mod|and|or|xor|not|rgb|from|to)\b(?!:)@",$code, $matches)) {
$ret .= "<span class='hl-kw'>" . $matches[0] . "</span>"; $ret .= "<span class='hl-kw'>" . $matches[0] . "</span>";
} else if (preg_match("@^(include file:)(.*)@",$code, $matches)) { } else if (preg_match("@^(include file:)(.*)@",$code, $matches)) {
$ret .= "<span class='hl-key'>" . $matches[1] . "</span>" . $matches[2]; $ret .= "<span class='hl-key'>" . $matches[1] . "</span>" . $matches[2];
...@@ -157,8 +157,9 @@ function highlight_script($code) { ...@@ -157,8 +157,9 @@ function highlight_script($code) {
} else if (preg_match("@^([a-zA-Z0-9_]+|\s+|&#?[a-zA-Z0-9]+;)@",$code, $matches)) { } else if (preg_match("@^([a-zA-Z0-9_]+|\s+|&#?[a-zA-Z0-9]+;)@",$code, $matches)) {
$m = $matches[0]; $m = $matches[0];
// function call? // function call?
if (isset($built_in_functions[$m]) // to built in function if (isset($built_in_functions[$m]) && // to built in function
) { preg_match("@\s*[+(){}]@",substr($code, strlen($matches[0]))) // in a function context
) {
$f = $built_in_functions[$m]; $f = $built_in_functions[$m];
if ($f == '') $f = $m; if ($f == '') $f = $m;
$f = 'function/' . $f; $f = 'function/' . $f;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment