--- /usr/bin/code2html 2005-05-24 21:37:56.000000000 -0400
+++ xcode2html 2005-06-16 04:49:04.000000000 -0400
@@ -10,9 +10,9 @@
# #
# Code2Html, peter@palfrader.org #
# #
-# $Date: 2002/01/12 21:17:02 $
-# $Revision: 1.13 $
-# $Id: code2html,v 1.13 2002/01/12 21:17:02 weaselp Exp $
+# Date: 2002/01/12 21:17:02
+# Revision: 1.13
+# Id: code2html,v 1.13 2002/01/12 21:17:02 weaselp Exp
# #
# AUTHOR #
# Peter Palfrader. Written in 1999, 2000, 2001, 2002. #
@@ -28,6 +28,12 @@
# #
########################################################################
+## $Id: xcode2html,v 1.1 2005/06/16 08:49:04 vyzo Exp $
+## vyzo: this is a hacked version of code2html 0.9.1, which:
+## + adds scheme support
+## + fixes the mess in python matching
+## + adds an external stylesheet
+
use strict;
use Getopt::Long;
@@ -1742,6 +1748,153 @@
};
+## external style sheet (vyzo)
+## (for embedding code2html output, user must define css stylesheet)
+%{$STYLESHEET{'external'}} = %{$STYLESHEET{'html-nocolor'}};
+${ $STYLESHEET{'external'}} {'tags'} = {
+ 'comment' => {
+ 'start' => ''
+ },
+ 'doc comment' => {
+ 'start' => ''
+ },
+ 'string' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'esc string' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'character' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'esc character' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'numeric' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'identifier' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'predefined identifier' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'type' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'predefined type' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'reserved word' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'library function' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'include' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'preprocessor' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'braces' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'symbol' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'function header' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'function header name' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'function header args' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'regex' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'text' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ # HTML
+ 'entity' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ # MAKEFILE
+ 'assignment' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'dependency line' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'dependency target' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'dependency continuation' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'continuation' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'macro' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'int macro' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'esc $$$' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ # PATCH
+ 'separator' => {
+ 'start' => '',
+ 'stop' => '' },
+ 'line spec' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'deletion' => {
+ 'start' => '',
+ 'stop' => ''
+ },
+ 'insertion' => {
+ 'start' => '',
+ 'stop' => ''
+ }
+};
#####
#
@@ -2837,7 +2990,46 @@
};
-
+## very basic scheme support (vyzo)
+$LANGUAGE{'scheme'} = {'filename' => '\\.(scm|ss)$',
+ 'regex' => '',
+ 'patterns' => [{'name' => 'parens',
+ 'regex' => '[()]',
+ 'style' => 'braces',
+ 'childregex' => []
+ },
+ {'name' => 'comment',
+ 'regex' => ';.*?$',
+ 'style' => 'comment',
+ 'childregex' => []
+ },
+ {'name' => 'string',
+ 'regex' => '".*?("|$)',
+ 'style' => 'string',
+ 'childregex' => []
+ },
+ {'name' => 'keywords',
+ 'regex' => '\\b(lambda|let|letrec|let[*]|define|if|cond|else|begin|for-each|map|do)\\b',
+ 'style' => 'reserved word',
+ 'childregex' => []
+ },
+ {'name' => 'numeric constant',
+ 'regex' => '(#\([0-9]+ [0-9]+\)|[0-9]+)',
+ 'style' => 'numeric',
+ 'childregex' => []
+ },
+ {'name' => 'symbols',
+ 'regex' => '(\'[^\s().\']+)',
+ 'style' => 'symbol',
+ 'childregex' => []
+ },
+ {'name' => 'identifiers',
+ 'regex' => '([^\s().\']+)',
+ 'style' => 'identifier',
+ 'childregex' => []
+ }
+ ]
+ };
@@ -3384,109 +3576,93 @@
-# by Tom Good
-$LANGUAGE{'python'} = {
- 'filename' => '(?i)\\.py$',
- 'regex' => '^\\s*#\\s*![^\\s]*python',
- 'patterns' => [
- {
- 'name' => 'python comment',
- 'regex' => '#.*?$',
- 'style' => 'comment',
- 'childregex' => []
- },
- {
- 'name' => 'single quote string',
- 'regex' => '\'.*?\'',
- 'style' => 'string',
- 'childregex' => []
- },
-
- {
- 'name' => 'string',
- 'regex' => '""|"\\\\\\\\"|".*?([^\\\\](\\\\\\\\)*)"',
- 'regex' => '""|".*?([^\\\\](\\\\\\\\)*)"|"\\\\\\\\"',
- 'regex' => '""|"\\\\\\\\"|"[^"\\\\]"|"[^"].*?[^\\\\]"',
- 'style' => 'string',
- 'childregex' => [
- {
- 'name' => 'esc character',
- 'regex' => '\\\\.',
- 'style' => 'esc character',
- 'childregex' => []
- }
- ]
- },
- {
- 'name' => 'character constant',
- 'regex' => '\'(\\\\)?.\'',
- 'style' => 'character',
- 'childregex' => [
- {
- 'name' => 'esc character',
- 'regex' => '\\\\.',
- 'style' => 'esc character',
- 'childregex' => []
- }
- ]
- },
- {
- 'name' => 'numeric constant',
- 'regex' => '\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?\\b',
- 'style' => 'numeric',
- 'childregex' => []
- },
- {
- 'name' => 'keyword',
- 'regex' => '\\b(and|assert|break|class|continue|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while)\\b',
- 'style' => 'reserved word',
- 'childregex' => []
- },
- {
- 'name' => 'braces',
- 'regex' => '[\\{\\}]',
- 'style' => 'braces',
- 'childregex' => []
- },
- {
- 'name' => 'symbols',
- 'regex' => '([\\*\\-\\+=:;%&\\|<>\\(\\)\\[\\]!])',
- 'style' => 'symbol',
- 'childregex' => []
- },
- {
- 'name' => 'identifiers',
- 'regex' => '([a-zA-Z_][a-zA-Z_0-9]*)',
- 'style' => 'identifier',
- 'childregex' => []
- },
- {
- 'name' => 'function',
- 'regex' => '[\\t ]*def[\\t ]+([a-zA-Z0-9_]+)[\\t \\(]+.*?[\\n{]',
- 'style' => 'function header',
- 'childregex' => [
- {
- 'name' => 'function args',
- 'regex' => '\\(.*?\\)',
- 'style' => 'function header args',
- 'childregex' => []
- },
- {
- 'name' => 'function name',
- 'regex' => '[\\t ][a-zA-Z0-9_]+',
- 'style' => 'function header name',
- 'childregex' => []
- }
- ]
- },
- {
- 'name' => 'library functions',
- 'regex' => '\\b(__import__|abs|apply|buffer|callable|chr|cmp|coerce|compile|complex|delatter|dir|divmod|eval|execfile|filter|float|getattr|globals|hasattr|hash|hex|id|input|int|intern|isinstance|issubclass|len|list|locals|long|map|max|min|oct|open|ord|pow|range|raw_input|reduce|reload|repr|round|setattr|slice|str|tuple|type|unichr|unicode|vars|xrange|zip)\\b',
- 'style' => 'library function',
- 'childregex' => []
- },
- ]
- };
+# by Tom Good - further hacked by vyzo
+$LANGUAGE{'python'} = {'filename' => '(?i)\\.py$',
+ 'regex' => '^\\s*#\\s*![^\\s]*python',
+ 'patterns' => [{'name' => 'python comment',
+ 'regex' => '#.*?$',
+ 'style' => 'comment',
+ 'childregex' => []
+ },
+ {'name' => 'single quote string',
+ 'regex' => '\'.*?\'',
+ 'style' => 'string',
+ 'childregex' => []
+ },
+ {'name' => 'string',
+ 'regex' => '""|"\\\\\\\\"|".*?([^\\\\](\\\\\\\\)*)"',
+ 'regex' => '""|".*?([^\\\\](\\\\\\\\)*)"|"\\\\\\\\"',
+ 'regex' => '""|"\\\\\\\\"|"[^"\\\\]"|"[^"].*?[^\\\\]"',
+ 'style' => 'string',
+ 'childregex' => [{'name' => 'esc character',
+ 'regex' => '\\\\.',
+ 'style' => 'esc character',
+ 'childregex' => []
+ }]
+ },
+ {'name' => 'character constant',
+ 'regex' => '\'(\\\\)?.\'',
+ 'style' => 'character',
+ 'childregex' => [{'name' => 'esc character',
+ 'regex' => '\\\\.',
+ 'style' => 'esc character',
+ 'childregex' => []
+ }]
+ },
+ {'name' => 'numeric constant',
+ 'regex' => '\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?\\b',
+ 'style' => 'numeric',
+ 'childregex' => []
+ },
+ {'name' => 'function',
+ 'regex' => '[\\t ]*def[\\t ]+([a-zA-Z0-9_]+)[\\t \\(]+.*?[\\n{]',
+ 'style' => 'function header',
+ 'childregex' => [{'name' => 'keyword',
+ 'regex' => 'def',
+ 'style' => 'reserved word',
+ 'childregex' => []
+ },
+ {
+ 'name' => 'function name',
+ 'regex' => '[\\t ][a-zA-Z0-9_]+[\\t ]*\\(',
+ 'style' => 'function header',
+ 'childregex' => [{'name' => 'function name',
+ 'regex' => '[\\t ][a-zA-Z0-9_]+',
+ 'style' => 'function header name',
+ 'childregex' => []
+ }]
+ },
+ {'name' => 'function args',
+ 'regex' => '\\(.*?\\)',
+ 'style' => 'function header args',
+ 'childregex' => []}]
+ },
+ {'name' => 'keyword',
+ 'regex' => '\\b(and|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|yield)\\b',
+ 'style' => 'reserved word',
+ 'childregex' => []
+ },
+ {'name' => 'braces',
+ 'regex' => '[\\{\\}]',
+ 'style' => 'braces',
+ 'childregex' => []
+ },
+ {'name' => 'symbols',
+ 'regex' => '([\\*\\-\\+=:;%&\\|<>\\(\\)\\[\\]!])',
+ 'style' => 'symbol',
+ 'childregex' => []
+ },
+ {'name' => 'identifiers',
+ 'regex' => '([a-zA-Z_][a-zA-Z_0-9]*)',
+ 'style' => 'identifier',
+ 'childregex' => []
+ },
+ {'name' => 'library functions',
+ 'regex' => '\\b(__import__|abs|apply|buffer|callable|chr|cmp|coerce|compile|complex|delatter|dir|divmod|eval|execfile|filter|float|getattr|globals|hasattr|hash|hex|id|input|int|intern|isinstance|issubclass|len|list|locals|long|map|max|min|oct|open|ord|pow|range|raw_input|reduce|reload|repr|round|setattr|slice|str|tuple|type|unichr|unicode|vars|xrange|zip)\\b',
+ 'style' => 'library function',
+ 'childregex' => []
+ }]
+ };