Update of /cvsroot/geshi/geshi-1.0.X/src
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6638/src
Modified Files:
geshi.php
Log Message:
Changed keyword and regexp detection and parsing slightly to
allow more "meta characters" (like #) in
keywords.
Index: geshi.php
============================================================
=======
RCS file: /cvsroot/geshi/geshi-1.0.X/src/geshi.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** geshi.php 11 Mar 2006 21:44:08 -0000 1.31
--- geshi.php 23 Mar 2006 07:24:17 -0000 1.32
***************
*** 41,45 ****
/** The version of this GeSHi file */
! define('GESHI_VERSION', '1.0.7.7');
/** Set the correct directory separator */
--- 41,45 ----
/** The version of this GeSHi file */
! define('GESHI_VERSION', '1.0.7.8');
/** Set the correct directory separator */
***************
*** 1986,1990 ****
function parse_non_string_part (&$stuff_to_parse)
{
! $stuff_to_parse = ' ' . quotemeta( htmlspecialchars($stuff_to_parse, ENT_COMPAT,
$this->encoding));
// These vars will disappear in the future
$func = '$this->change_case';
--- 1986,1991 ----
function parse_non_string_part (&$stuff_to_parse)
{
! $stuff_to_parse = ' ' . htmlspecialchars($stuff_to_parse, ENT_COMPAT,
$this->encoding);
! $stuff_to_parse_pregquote =
preg_quote($stuff_to_parse, '/');
// These vars will disappear in the future
$func = '$this->change_case';
***************
*** 1998,2009 ****
if (is_array($regexp)) {
$stuff_to_parse = preg_replace(
! "#" .
! $regexp[GESHI_SEARCH] .
!
"#{$regexp[GESHI_MODIFIERS]}",
"{$regexp[GESHI_BEFORE]}<|!REG3XP$key!>{$regexp[
GESHI_REPLACE]}|>{$regexp[GESHI_AFTER]}",
$stuff_to_parse
);
} else {
! $stuff_to_parse = preg_replace( "#(" .
$regexp . ")#",
"<|!REG3XP$key!>\\1|>",
$stuff_to_parse);
}
}
--- 1999,2010 ----
if (is_array($regexp)) {
$stuff_to_parse = preg_replace(
! "/" .
! str_replace('/', '\/',
$regexp[GESHI_SEARCH]) .
!
"/{$regexp[GESHI_MODIFIERS]}",
"{$regexp[GESHI_BEFORE]}<|!REG3XP$key!>{$regexp[
GESHI_REPLACE]}|>{$regexp[GESHI_AFTER]}",
$stuff_to_parse
);
} else {
! $stuff_to_parse = preg_replace( "/(" .
str_replace('/', '\/', $regexp) . ")/",
"<|!REG3XP$key!>\\1|>",
$stuff_to_parse);
}
}
***************
*** 2033,2037 ****
if ($this->lexic_permissions['KEYWORDS'][$k]) {
foreach ($keywordset as $keyword) {
! $keyword = quotemeta($keyword);
//
// This replacement checks the word is on it's own
(except if brackets etc
--- 2034,2038 ----
if ($this->lexic_permissions['KEYWORDS'][$k]) {
foreach ($keywordset as $keyword) {
! $keyword = preg_quote($keyword, '/');
//
// This replacement checks the word is on it's own
(except if brackets etc
***************
*** 2040,2044 ****
// a fit.
//
! if (false !== stristr($stuff_to_parse, $keyword )) {
$stuff_to_parse .= ' ';
// Might make a more unique string for putting the
number in soon
--- 2041,2045 ----
// a fit.
//
! if (false !== stristr($stuff_to_parse_pregquote,
$keyword )) {
$stuff_to_parse .= ' ';
// Might make a more unique string for putting the
number in soon
***************
*** 2046,2053 ****
// get highlighted if the language has a CSS
keyword in it (like CSS, for example ;))
$styles = "/$k/";
- $keyword = quotemeta($keyword);
if
($this->language_data['CASE_SENSITIVE'][$k]) {
$stuff_to_parse = preg_replace(
!
"#([^a-zA-Z0-9\$_\|\#;>/|^])($keyword)(?=[^a-zA-
Z0-9_<\|%\-&])#e",
"'\\1' .
$func2('\\2', '$k', 'BEGIN') . '<|$styles>'
. $func('\\2') . '|>' . $func2('\\2', '$k',
'END')",
$stuff_to_parse
--- 2047,2053 ----
// get highlighted if the language has a CSS
keyword in it (like CSS, for example ;))
$styles = "/$k/";
if
($this->language_data['CASE_SENSITIVE'][$k]) {
$stuff_to_parse = preg_replace(
!
"/([^a-zA-Z0-9\$_\|\#;>|^])($keyword)(?=[^a-zA-Z
0-9_<\|%\-&])/e",
"'\\1' .
$func2('\\2', '$k', 'BEGIN') . '<|$styles>'
. $func('\\2') . '|>' . $func2('\\2', '$k',
'END')",
$stuff_to_parse
***************
*** 2055,2060 ****
} else {
// Change the case of the word.
$stuff_to_parse = preg_replace(
!
"#([^a-zA-Z0-9\$_\|\#;>/|^])($keyword)(?=[^a-zA-
Z0-9_<\|%\-&])#ie",
"'\\1' .
$func2('\\2', '$k', 'BEGIN') . '<|$styles>'
. $func('\\2') . '|>' . $func2('\\2', '$k',
'END')",
$stuff_to_parse
--- 2055,2062 ----
} else {
// Change the case of the word.
+ // hackage again...
must... release... 1.2...
+ if ('smarty' ==
$this->language) { $hackage = '\/'; } else { $hackage
= ''; }
$stuff_to_parse = preg_replace(
!
"/([^a-zA-Z0-9\$_\|\#;>$hackage|^])($keyword)(?=
[^a-zA-Z0-9_<\|%\-&])/ie",
"'\\1' .
$func2('\\2', '$k', 'BEGIN') . '<|$styles>'
. $func('\\2') . '|>' . $func2('\\2', '$k',
'END')",
$stuff_to_parse
***************
*** 2099,2103 ****
$attributes = ' class="me' . $key .
'"';
}
! $stuff_to_parse = preg_replace("#(" .
quotemeta($this->language_data['OBJECT_SPLITTERS'][$key
]) . "[\s]*)([a-zA-Z\*\(][a-zA-Z0-9_\*]*)#",
"\\1<|$attributes>\\2|>",
$stuff_to_parse);
}
}
--- 2101,2105 ----
$attributes = ' class="me' . $key .
'"';
}
! $stuff_to_parse = preg_replace("/(" .
preg_quote($this->language_data['OBJECT_SPLITTERS'][$ke
y], 1) .
"[\s]*)([a-zA-Z\*\(][a-zA-Z0-9_\*]*)/",
"\\1<|$attributes>\\2|>",
$stuff_to_parse);
}
}
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking
scripting language
that extends applications into web and mobile media. Attend
the live webcast
and join the prime developer group breaking into this new
coding territory!
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
geshi-cvs mailing list
geshi-cvs lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geshi-cvs
|