Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
[[tags: egg]] == colorize === Description Colorize programming code as HTML (syntax highlighting). === Author Brian Mastenbrook, ported to Chicken by [[/users/peter-bex|Peter Bex]] === Repository This egg is hosted on the CHICKEN Subversion repository: [[https://anonymous@code.call-cc.org/svn/chicken-eggs/release/6/colorize|https://anonymous@code.call-cc.org/svn/chicken-eggs/release/6/colorize]] If you want to check out the source code repository of this egg and you are not familiar with Subversion, see [[/egg-svn-checkout|this page]]. === Documentation This extension is a port of [[http://www.common-lisp.net/project/lisppaste|lisppaste's]] colorizing code. It currently supports syntax highlighting for the following languages: * Basic Lisp * Scheme * Emacs Lisp * Common Lisp * C * C++ * Java * Objective C * Erlang * Python * Ruby * Haskell * Unified Context Diff * Cascading Style Sheets (CSS) * Extensible Markup Language (XML) * (Extensible) HyperText Markup Language ((X)HTML) === Colorizing procedures <procedure>(coloring-type-names)</procedure> Returns an alist of supported coloring types (recognised languages). The keys of this list are simple symbols which encode the internal name of the colorizer, the values of this list are human-readable strings describing the language. <procedure>(coloring-type-exists? name)</procedure> If you don't need to know the name of a coloring type, this is a faster way to check if a given coloring type exists. {{name}} is a symbol which encodes the internal name of the coloring type. If the coloring type with that name exists, {{#t}} is returned, {{#f}} otherwise. <procedure>(html-colorize coloring-type string)</procedure> Colorize the given {{string}} with the named {{coloring-type}}. <enscript highlight="scheme"> (use colorize) (html-colorize 'c "int main(void) {\n return 1;\n}") => "<span class=\"symbol\">int</span> main<span class=\"paren1\">(<span class=\"default\"><span class=\"symbol\">void</span></span>)</span> <span class=\"paren1\">{<span class=\"default\">\n <span class=\"symbol\">return</span> 1;\n</span>}</span>" </enscript> === Helper procedures <procedure>(htmlize str)</procedure> Escape characters from the string {{str}} to make it safe for embedding in HTML. This is just a helper procedure taken from [[Spiffy]] that could be useful when highlighting code offline or outside of Spiffy. === Used CSS classes The HTML can be easily and extensively styled using CSS. The colorizers use the following classes: * {{comment}} for comments * {{character}} for character literals * {{string}} for string literals * {{variable}} for user variables that can be distinguished as such * {{function}} for function definitions if they can be distinguished as such (currently only used by the Erlang and Haskell coloring-types) * {{attribute}} for Erlang attributes * {{macro}} for macros (Erlang only) * {{atom}} for atoms (Erlang and Haskell only) * {{special}} for "special" variables. These include preprocessor directives in C, {{*starred-global-identifiers*}} for Lisps etc * {{symbol}} for symbols, identifiers, user variables that cannot be distinguished from regular symbols * {{keyword}} for keyword types (actual keywords in Lisps, variables containing unusual characters in Haskell, etc) * {{paren1}} through {{paren6}} to indicate parenthetical nesting level * {{default}} to support displaying a different background of the code inside parens (for example to support mouse hover highlighting of matching parens) * {{syntax-error}} for syntax errors detected during parsing (currently unused) * {{diff-normal}} Lines of diff context without changes (Unified Diff only) * {{diff-added}} Added lines (Unified Diff only) * {{diff-deleted}} Deleted lines (Unified Diff only) === Changelog * 0.6 - Port to CHICKEN 6 (by felix) * 0.5 - Fix accidentally quadratic code, improving performance greatly when colorizing large files, and export {{htmlize}} (fixes #1799, thanks to "curium") * 0.4.5 - More bugfixes * 0.4.4 - Bugfixes * 0.4.3 - Ported to CHICKEN 5 (by felix) * 0.4.2 - Fix tests by adding an explicit {{use}} clause for the {{utils}} unit which was being used by the tests. * 0.4.1 - Fix tests by adding the [[test]] egg as a dependency. * 0.4 - Do not rely on {{set!}}'s undefined return value. Add some basic tests and try to lower compilation time by making the macro expansions less bulky. Improve "keyword" detection in Scheme code. Add {{css}} and {{xml}} (with {{xhtml}} and {{html}} alias) colorizers. Remove dependency on [[defstruct]]. * 0.3.1 - Fix a potential bug in colorize setter code (thanks to [[/users/felix-winkelmann|Felix]]) * 0.3 - Fix a few bugs in the Lisp colorizer that didn't always trigger in lisppaste's colorizer because it processes strings a line at a time(?) * 0.2.2 - More silly bugfixes * 0.2.1 - Fixed stupid bug caused by 0.2 and added {{coloring-type-exists?}} predicate * 0.2 - Ensured variables were not kept around in coloring type objects from previous invocations of html-colorize. * 0.1 - Initial port === License Copyright (c) 2010-2024 Peter Bex Copyright (c) 2003-2010 Brian Mastenbrook Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 24 to 20?