From 1233940892b222f5961ff9c1fd20281a3aff18ec Mon Sep 17 00:00:00 2001 From: twanvl Date: Tue, 7 Aug 2007 18:28:10 +0000 Subject: [PATCH] Minor tweaks of documentation syntax highlighter git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@607 0fc631ac-6414-0410-93d0-97cfa31319b6 --- tools/website/drupal/fromfile.module | 3 ++- tools/website/drupal/mse-drupal-modules/highlight.inc | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/website/drupal/fromfile.module b/tools/website/drupal/fromfile.module index efff2d1b..a2fd5646 100644 --- a/tools/website/drupal/fromfile.module +++ b/tools/website/drupal/fromfile.module @@ -5,7 +5,8 @@ require_once('./modules/mse-drupal-modules/autoformat.inc'); global $nice_ff_names; $nice_ff_names = array( 'Function' => 'Functions', - 'Type' => 'Types' + 'Type' => 'Types', + 'Script' => 'Scripting' ); define('FROMFILE_DIR', 'doc'); diff --git a/tools/website/drupal/mse-drupal-modules/highlight.inc b/tools/website/drupal/mse-drupal-modules/highlight.inc index d8fc527c..364c3130 100644 --- a/tools/website/drupal/mse-drupal-modules/highlight.inc +++ b/tools/website/drupal/mse-drupal-modules/highlight.inc @@ -127,7 +127,7 @@ function highlight_script($code) { while(strlen($code)) { if (preg_match("@^<[^>]+>@",$code, $matches)) { $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 .= "" . $matches[0] . ""; } else if (preg_match("@^(include file:)(.*)@",$code, $matches)) { $ret .= "" . $matches[1] . "" . $matches[2]; @@ -157,8 +157,9 @@ function highlight_script($code) { } else if (preg_match("@^([a-zA-Z0-9_]+|\s+|&#?[a-zA-Z0-9]+;)@",$code, $matches)) { $m = $matches[0]; // 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]; if ($f == '') $f = $m; $f = 'function/' . $f;