From 2b8d02bf0a560f0ee8fa887fed0d2bbf66b10bae Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 23 Mar 2009 10:42:53 +0100 Subject: GeSHi 1.0.8.3 update Ignore-this: d204f804a634d5a537737dc4a50c3c13 darcs-hash:20090323094253-7ad00-003ea6c7b9cb1306ad0623274917bbfc042a0103.gz --- inc/geshi/latex.php | 180 +++++++++++++++++++++++++--------------------------- 1 file changed, 85 insertions(+), 95 deletions(-) (limited to 'inc/geshi/latex.php') diff --git a/inc/geshi/latex.php b/inc/geshi/latex.php index 14238aea4..e4926d956 100644 --- a/inc/geshi/latex.php +++ b/inc/geshi/latex.php @@ -2,15 +2,27 @@ /************************************************************************************* * latex.php * ----- - * Author: efi, Matthias Pospiech (mail@matthiaspospiech.de) - * Copyright: (c) 2006 efi, Matthias Pospiech (mail@matthiaspospiech.de), Nigel McNie (http://qbnz.com/highlighter) - * Release Version: 1\.0\.8 + * Author: efi, Matthias Pospiech (matthias@pospiech.eu) + * Copyright: (c) 2006 efi, Matthias Pospiech (matthias@pospiech.eu), Nigel McNie (http://qbnz.com/highlighter) + * Release Version: 1.0.8.3 * Date Started: 2006/09/23 * * LaTeX language file for GeSHi. * * CHANGES * ------- + * 2008/08/18 (1.0.8.1) + * - Changes in color and some additional command recognition + * - No special Color for Brackets, it is only distracting + * if color should be reintroduced it should be less bright + * - Math color changed from green to violett, since green is now used for comments + * - Comments are now colored and the only green. The reason for coloring the comments + * is that often important information is in the comments und was merely unvisible before. + * - New Color for [Options] + * - color for labels not specialised anymore. It makes sence in large documents but less in + * small web examples. + * - \@keyword introduced + * - Fixed \& escaped ampersand * 2006/09/23 (1.0.0) * - First Release * @@ -48,18 +60,29 @@ $language_data = array ( 'QUOTEMARKS' => array(), 'ESCAPE_CHAR' => '', 'KEYWORDS' => array( + 1 => array( + 'appendix','backmatter','caption','captionabove','captionbelow', + 'def','documentclass','edef','equation','flushleft','flushright', + 'footnote','frontmatter','hline','include','input','item','label', + 'let','listfiles','listoffigures','listoftables','mainmatter', + 'makeatletter','makeatother','makebox','mbox','par','raggedleft', + 'raggedright','raisebox','ref','rule','table','tableofcontents', + 'textbf','textit','texttt','today' + ) ), 'SYMBOLS' => array( - '.', ',','\\',"~", "{", "}", "[", "]", "$" + "&", "\\", "{", "}", "[", "]" ), 'CASE_SENSITIVE' => array( + 1 => true, GESHI_COMMENTS => false, ), 'STYLES' => array( 'KEYWORDS' => array( + 1 => 'color: #800000; font-weight: bold;', ), 'COMMENTS' => array( - 1 => 'color: #808080; font-style: italic;' + 1 => 'color: #2C922C; font-style: italic;' ), 'ESCAPE_CHAR' => array( 0 => 'color: #000000; font-weight: bold;' @@ -74,26 +97,27 @@ $language_data = array ( 'METHODS' => array( ), 'SYMBOLS' => array( - 1 => 'color: #800000; font-weight: bold;' + 0 => 'color: #E02020; ' ), 'REGEXPS' => array( - 1 => 'color: #00A000; font-weight: bold;', // Math inner - 2 => 'color: #800000; font-weight: normal;', // \keyword #202020 - 3 => 'color: #2222D0; font-weight: normal;', // {...} - 4 => 'color: #2222D0; font-weight: normal;', // [Option] - 5 => 'color: #00A000; font-weight: normal;', // Mathe #CCF020 - 6 => 'color: #F00000; font-weight: normal;', // Structure \begin - 7 => 'color: #F00000; font-weight: normal;', // Structure \end - 8 => 'color: #F00000; font-weight: normal;', // Structure: Labels - //9 => 'color: #F00000; font-weight: normal;', // Structure - 10 => 'color: #0000D0; font-weight: bold;', // Environment - 11 => 'color: #0000D0; font-weight: bold;', // Environment - 12 => 'color: #800000; font-weight: normal;', // Escaped char + 1 => 'color: #8020E0; font-weight: normal;', // Math inner + 2 => 'color: #C08020; font-weight: normal;', // [Option] + 3 => 'color: #8020E0; font-weight: normal;', // Maths + 4 => 'color: #800000; font-weight: normal;', // Structure: Labels + 5 => 'color: #00008B; font-weight: bold;', // Structure (\section{->x<-}) + 6 => 'color: #800000; font-weight: normal;', // Structure (\section) + 7 => 'color: #0000D0; font-weight: normal;', // Environment \end or \begin{->x<-} (brighter blue) + 8 => 'color: #C00000; font-weight: normal;', // Structure \end or \begin + 9 => 'color: #2020C0; font-weight: normal;', // {...} + 10 => 'color: #800000; font-weight: normal;', // \%, \& etc. + 11 => 'color: #E00000; font-weight: normal;', // \@keyword + 12 => 'color: #800000; font-weight: normal;', // \keyword ), 'SCRIPT' => array( ) ), 'URLS' => array( + 1 => 'http://www.golatex.de/wiki/index.php?title=\\{FNAME}', ), 'OOLANG' => false, 'OBJECT_SPLITTERS' => array( @@ -101,102 +125,64 @@ $language_data = array ( 'REGEXPS' => array( // Math inner 1 => array( - GESHI_SEARCH => "(\\\\begin\\{)(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)(\\})(.*)(\\\\end\\{)(\\2)(\\})", - GESHI_REPLACE => '\4', - GESHI_MODIFIERS => 'Us', - GESHI_BEFORE => '\1\2\3', - GESHI_AFTER => '\5\6\7' - ), - // \keywords - 2 => array( - GESHI_SEARCH => "(\\\\)([a-zA-Z]+)", - GESHI_REPLACE => '\1\2', - GESHI_MODIFIERS => '', - GESHI_BEFORE => '', - GESHI_AFTER => '' - ), - // {parameters} - 3 => array( - GESHI_SEARCH => "(\\{)(.*)(\\})", - GESHI_REPLACE => '\2', + GESHI_SEARCH => "(\\\\begin\\{(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)\\})(.*)(\\\\end\\{\\2\\})", + GESHI_REPLACE => '\3', GESHI_MODIFIERS => 'Us', GESHI_BEFORE => '\1', - GESHI_AFTER => '\3' + GESHI_AFTER => '\4' ), // [options] - 4 => array( - GESHI_SEARCH => "(\[)(.+)(\])", - GESHI_REPLACE => '\2', - GESHI_MODIFIERS => 'Us', - GESHI_BEFORE => '\1', - GESHI_AFTER => '\3' - ), - // Math mode with $ ... $ - 5 => array( - GESHI_SEARCH => "(\\$)(.+)(\\$)", - GESHI_REPLACE => '\1\2\3', + 2 => array( + GESHI_SEARCH => "(?<=\[).+(?=\])", + GESHI_REPLACE => '\0', GESHI_MODIFIERS => 'Us', GESHI_BEFORE => '', GESHI_AFTER => '' ), - // Structure begin - 6 => array( - GESHI_SEARCH => "(\\\\begin)(?=[^a-zA-Z])", - GESHI_REPLACE => '\\1', - GESHI_MODIFIERS => '', - GESHI_BEFORE => '', - GESHI_AFTER => '' - ), - // Structure end - 7 => array( - GESHI_SEARCH => "(\\\\end)(?=[^a-zA-Z])", - GESHI_REPLACE => '\\1', - GESHI_MODIFIERS => '', + // Math mode with $ ... $ + 3 => array( + GESHI_SEARCH => "\\$.+\\$", + GESHI_REPLACE => '\0', + GESHI_MODIFIERS => 'Us', GESHI_BEFORE => '', GESHI_AFTER => '' ), // Structure: Label - 8 => array( - GESHI_SEARCH => "(\\\\)(label|pageref|ref|cite)(?=[^a-zA-Z])", - GESHI_REPLACE => '\\1\\2', - GESHI_MODIFIERS => '', - GESHI_BEFORE => '', - GESHI_AFTER => '' - ), + 4 => "\\\\(?:label|pageref|ref|cite)(?=[^a-zA-Z])", // Structure: sections - /*9 => array( - GESHI_SEARCH => "(\\\\)(part|chapter|section|subsection|subsubsection|paragraph|subparagraph)(?=[^a-zA-Z])", - GESHI_REPLACE => '\1\\2', - GESHI_MODIFIERS => '', - GESHI_BEFORE => '', - GESHI_AFTER => '\\3' - ),*/ - - // environment begin - 10 => array( - GESHI_SEARCH => "(\\\\begin)(\\{)(.*)(\\})", - GESHI_REPLACE => '\\3', + 5 => array( + GESHI_SEARCH => "(\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?\\{)(.*)(?=\\})", + GESHI_REPLACE => '\\2', GESHI_MODIFIERS => 'U', - GESHI_BEFORE => '', + GESHI_BEFORE => '\\1', GESHI_AFTER => '' ), - // environment end - 11 => array( - GESHI_SEARCH => "(\\\\end)(\\{)(.*)(\\})", - GESHI_REPLACE => '\\3', + // Structure: sections + 6 => "\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?(?=[^a-zA-Z])", + // environment \begin{} and \end{} (i.e. the things inside the {}) + 7 => array( + GESHI_SEARCH => "(\\\\(?:begin|end)\\{)(.*)(?=\\})", + GESHI_REPLACE => '\\2', GESHI_MODIFIERS => 'U', - GESHI_BEFORE => '', + GESHI_BEFORE => '\\1', GESHI_AFTER => '' ), - - // environment end - 12 => array( - GESHI_SEARCH => "(\\\\[_$%])", - GESHI_REPLACE => '\\1', - GESHI_MODIFIERS => '', + // Structure \begin and \end + 8 => "\\\\(?:end|begin)(?=[^a-zA-Z])", + // {parameters} + 9 => array( + GESHI_SEARCH => "(?<=\\{)(?!<\|!REG3XP5!>).*(?=\\})", + GESHI_REPLACE => '\0', + GESHI_MODIFIERS => 'Us', GESHI_BEFORE => '', GESHI_AFTER => '' - ) + ), + // \%, \& usw. + 10 => "\\\\(?:[_$%]|&)", + // \@keywords + 11 => "(?)\\\\@[a-zA-Z]+\*?", + // \keywords + 12 => "(?)\\\\[a-zA-Z]+\*?", // --------------------------------------------- ), @@ -209,11 +195,15 @@ $language_data = array ( 'COMMENTS' => array( 'DISALLOWED_BEFORE' => '\\' ), + 'KEYWORDS' => array( + 'DISALLOWED_BEFORE' => "(?<=\\\\)", + 'DISALLOWED_AFTER' => "(?=\b)(?!\w)" + ), 'ENABLE_FLAGS' => array( 'NUMBERS' => GESHI_NEVER, - 'SYMBOLS' => GESHI_NEVER, + 'BRACKETS' => GESHI_NEVER ) ) ); -?> +?> \ No newline at end of file -- cgit v1.2.3