After a little discussion on php-general[1], I wrote a patch that basically
allows two new php.ini entries: highlight.prepend and highlight.append. They
default to what the output currently is ('<code><font color="#000000">' and
'</code></font>')
The code effects four files; ext/standard/basic_functions.c, main/main.c,
Zend/zend_highlight.c, and Zend/zend_highlight.h
I didn't account for Lisa Seelye's patch, but if there's interest in both
patches I'd be happy to make the changes to mine.
Have a nice day.
[1]: http://marc.theaimsgroup.com/?l=php-general&m=106737816224797&w=2
--
Evan Nemerson
[EMAIL PROTECTED]
--
"A people who mean to be their own governors, must arm themselves with the
power knowledge gives."
-James Madison
Index: main/main.c
===================================================================
RCS file: /repository/php-src/main/main.c,v
retrieving revision 1.579
diff -u -r1.579 main.c
--- main/main.c 9 Oct 2003 02:58:34 -0000 1.579
+++ main/main.c 29 Oct 2003 17:59:24 -0000
@@ -248,6 +248,8 @@
PHP_INI_ENTRY_EX("highlight.html", HL_HTML_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
PHP_INI_ENTRY_EX("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
PHP_INI_ENTRY_EX("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
+ PHP_INI_ENTRY_EX("highlight.prepend", HL_PREPEND_STRING, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
+ PHP_INI_ENTRY_EX("highlight.append", HL_APPEND_STRING, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
STD_PHP_INI_BOOLEAN("allow_call_time_pass_reference", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, allow_call_time_pass_reference, zend_compiler_globals, compiler_globals)
STD_PHP_INI_BOOLEAN("asp_tags", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, asp_tags, zend_compiler_globals, compiler_globals)
Index: Zend/zend_highlight.c
===================================================================
RCS file: /repository/ZendEngine2/zend_highlight.c,v
retrieving revision 1.39
diff -u -r1.39 zend_highlight.c
--- Zend/zend_highlight.c 11 Aug 2003 05:24:41 -0000 1.39
+++ Zend/zend_highlight.c 29 Oct 2003 17:59:25 -0000
@@ -104,8 +104,7 @@
char *next_color;
int in_string=0;
- zend_printf("<code>");
- zend_printf("<font color=\"%s\">\n", last_color);
+ zend_printf("%s\n", syntax_highlighter_ini->highlight_prepend);
/* highlight stuff coming back from zendlex() */
token.type = 0;
while ((token_type=lex_scan(&token TSRMLS_CC))) {
@@ -194,8 +193,7 @@
if (last_color != syntax_highlighter_ini->highlight_html) {
zend_printf("</font>\n");
}
- zend_printf("</font>\n");
- zend_printf("</code>");
+ zend_printf("%s\n", syntax_highlighter_ini->highlight_append);
}
Index: Zend/zend_highlight.h
===================================================================
RCS file: /repository/ZendEngine2/zend_highlight.h,v
retrieving revision 1.23
diff -u -r1.23 zend_highlight.h
--- Zend/zend_highlight.h 10 Jun 2003 20:03:25 -0000 1.23
+++ Zend/zend_highlight.h 29 Oct 2003 17:59:25 -0000
@@ -28,6 +28,8 @@
#define HL_STRING_COLOR "#DD0000" /* red */
#define HL_BG_COLOR "#FFFFFF" /* white */
#define HL_KEYWORD_COLOR "#007700" /* green */
+#define HL_PREPEND_STRING "<code><font color=\"#000000\">"
+#define HL_APPEND_STRING "</code></font>"
typedef struct _zend_syntax_highlighter_ini {
@@ -36,6 +38,8 @@
char *highlight_default;
char *highlight_string;
char *highlight_keyword;
+ char *highlight_prepend;
+ char *highlight_append;
} zend_syntax_highlighter_ini;
Index: ext/standard/basic_functions.c
===================================================================
RCS file: /repository/php-src/ext/standard/basic_functions.c,v
retrieving revision 1.636
diff -u -r1.636 basic_functions.c
--- ext/standard/basic_functions.c 28 Oct 2003 04:02:11 -0000 1.636
+++ ext/standard/basic_functions.c 29 Oct 2003 17:59:32 -0000
@@ -2229,6 +2229,8 @@
syntax_highlighter_ini->highlight_html = INI_STR("highlight.html");
syntax_highlighter_ini->highlight_keyword = INI_STR("highlight.keyword");
syntax_highlighter_ini->highlight_string = INI_STR("highlight.string");
+ syntax_highlighter_ini->highlight_prepend = INI_STR("highlight.prepend");
+ syntax_highlighter_ini->highlight_append = INI_STR("highlight.append");
}
/* {{{ proto bool highlight_file(string file_name [, bool return] )
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php