[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/vendor/geshi/geshi/src/geshi/ -> latex.php (source)

   1  <?php
   2  /*************************************************************************************
   3   * latex.php
   4   * -----
   5   * Author: efi, Matthias Pospiech (matthias@pospiech.eu)
   6   * Copyright: (c) 2006 efi, Matthias Pospiech (matthias@pospiech.eu), Nigel McNie (http://qbnz.com/highlighter)
   7   * Release Version: 1.0.9.1
   8   * Date Started: 2006/09/23
   9   *
  10   * LaTeX language file for GeSHi.
  11   *
  12   * CHANGES
  13   * -------
  14   * 2008/08/18 (1.0.8.1)
  15   *  - Changes in color and some additional command recognition
  16   *  - No special Color for Brackets, it is only distracting
  17   *    if color should be reintroduced it should be less bright
  18   *  - Math color changed from green to violett, since green is now used for comments
  19   *  - Comments are now colored and the only green. The reason for coloring the comments
  20   *    is that often important information is in the comments und was merely unvisible before.
  21   *  - New Color for [Options]
  22   *  - color for labels not specialised anymore. It makes sence in large documents but less in
  23   *    small web examples.
  24   *  - \@keyword introduced
  25   *  - Fixed \& escaped ampersand
  26   * 2006/09/23 (1.0.0)
  27   *  -  First Release
  28   *
  29   * TODO
  30   * -------------------------
  31   * *
  32   *
  33   *************************************************************************************
  34   *
  35   *     This file is part of GeSHi.
  36   *
  37   *   GeSHi is free software; you can redistribute it and/or modify
  38   *   it under the terms of the GNU General Public License as published by
  39   *   the Free Software Foundation; either version 2 of the License, or
  40   *   (at your option) any later version.
  41   *
  42   *   GeSHi is distributed in the hope that it will be useful,
  43   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  44   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  45   *   GNU General Public License for more details.
  46   *
  47   *   You should have received a copy of the GNU General Public License
  48   *   along with GeSHi; if not, write to the Free Software
  49   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  50   *
  51   ************************************************************************************/
  52  
  53  $language_data = array (
  54      'LANG_NAME' => 'LaTeX',
  55      'COMMENT_SINGLE' => array(
  56          1 => '%'
  57          ),
  58      'COMMENT_MULTI' => array(),
  59      'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
  60      'QUOTEMARKS' => array(),
  61      'ESCAPE_CHAR' => '',
  62      'KEYWORDS' => array(
  63          1 => array(
  64              'addlinespace','and','address','appendix','author','backmatter',
  65              'bfseries','bibitem','bigskip','blindtext','caption','captionabove',
  66              'captionbelow','cdot','centering','chapter','cite','color',
  67              'colorbox','date','dedication','def','definecolor','documentclass',
  68              'edef','else','email','emph','eqref','extratitle','fbox','fi',
  69              'flushleft','flushright','footnote','frac','frontmatter',
  70              'graphicspath','hfil','hfill','hfilll','hline','hspace','huge','ifx','include',
  71              'includegraphics','infty','input','int','item','itemsep',
  72              'KOMAoption','KOMAoptions','label','LaTeX','left','let','limits',
  73              'listfiles','listoffigures','listoftables','lowertitleback',
  74              'mainmatter','makeatletter','makeatother','makebox','makeindex',
  75              'maketitle','mbox','mediumskip','newcommand','newenvironment',
  76              'newpage','nocite','nonumber','pagestyle','par','paragraph',
  77              'parbox','parident','parskip','partial','publishers','raggedleft',
  78              'raggedright','raisebox','ref','renewcommand','renewenvironment',
  79              'right','rule','section','setlength','sffamily','subject',
  80              'subparagraph','subsection','subsubsection','subtitle','sum',
  81              'table','tableofcontents','textbf','textcolor','textit',
  82              'textnormal','textsuperscript','texttt','textwidth','thanks','title',
  83              'titlehead','today','ttfamily','uppertitleback','urlstyle',
  84              'usepackage','vfil','vfill','vfilll','vspace'
  85              )
  86          ),
  87      'SYMBOLS' => array(
  88          "&", "\\", "{", "}", "[", "]"
  89          ),
  90      'CASE_SENSITIVE' => array(
  91          1 => true,
  92          GESHI_COMMENTS => false,
  93          ),
  94      'STYLES' => array(
  95          'KEYWORDS' => array(
  96              1 => 'color: #800000;',
  97              ),
  98          'COMMENTS' => array(
  99              1 => 'color: #2C922C; font-style: italic;'
 100              ),
 101          'ESCAPE_CHAR' => array(
 102              0 =>  'color: #000000; font-weight: bold;'
 103              ),
 104          'BRACKETS' => array(
 105              ),
 106          'STRINGS' => array(
 107              0 =>  'color: #000000;'
 108              ),
 109          'NUMBERS' => array(
 110              ),
 111          'METHODS' => array(
 112              ),
 113          'SYMBOLS' => array(
 114              0 =>  'color: #E02020; '
 115              ),
 116          'REGEXPS' => array(
 117              1 => 'color: #8020E0; font-weight: normal;',  // Math inner
 118              2 => 'color: #C08020; font-weight: normal;', // [Option]
 119              3 => 'color: #8020E0; font-weight: normal;', // Maths
 120              4 => 'color: #800000; font-weight: normal;', // Structure: Labels
 121              5 => 'color: #00008B; font-weight: bold;',  // Structure (\section{->x<-})
 122              6 => 'color: #800000; font-weight: normal;', // Structure (\section)
 123              7 => 'color: #0000D0; font-weight: normal;', // Environment \end or \begin{->x<-} (brighter blue)
 124              8 => 'color: #C00000; font-weight: normal;', // Structure \end or \begin
 125              9 => 'color: #2020C0; font-weight: normal;', // {...}
 126              10 => 'color: #800000; font-weight: normal;', // \%, \& etc.
 127              11 => 'color: #E00000; font-weight: normal;', // \@keyword
 128              12 => 'color: #800000; font-weight: normal;', // \keyword
 129          ),
 130          'SCRIPT' => array(
 131              )
 132          ),
 133      'URLS' => array(
 134          1 => 'http://www.golatex.de/wiki/%5C{FNAME}',
 135          ),
 136      'OOLANG' => false,
 137      'OBJECT_SPLITTERS' => array(
 138          ),
 139      'REGEXPS' => array(
 140          // Math inner
 141          1 => array(
 142              GESHI_SEARCH => "(\\\\begin\\{(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)\\})(.*)(\\\\end\\{\\2\\})",
 143              GESHI_REPLACE => '\3',
 144              GESHI_MODIFIERS => 'Us',
 145              GESHI_BEFORE => '\1',
 146              GESHI_AFTER => '\4'
 147              ),
 148          // [options]
 149          2 => array(
 150              GESHI_SEARCH => "(?<=\[).*(?=\])",
 151              GESHI_REPLACE => '\0',
 152              GESHI_MODIFIERS => 'Us',
 153              GESHI_BEFORE => '',
 154              GESHI_AFTER => ''
 155              ),
 156          // Math mode with $ ... $
 157          3 => array(
 158              GESHI_SEARCH => "\\$.+\\$",
 159              GESHI_REPLACE => '\0',
 160              GESHI_MODIFIERS => 'Us',
 161              GESHI_BEFORE => '',
 162              GESHI_AFTER => ''
 163              ),
 164          // Structure: Label
 165          4 => "\\\\(?:label|pageref|ref|cite)(?=[^a-zA-Z])",
 166          // Structure: sections
 167          5 => array(
 168              GESHI_SEARCH => "(\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?\\{)(.*)(?=\\})",
 169              GESHI_REPLACE => '\\2',
 170              GESHI_MODIFIERS => 'U',
 171              GESHI_BEFORE => '\\1',
 172              GESHI_AFTER => ''
 173              ),
 174          // Structure: sections
 175          6 => "\\\\(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph|addpart|addchap|addsec)\*?(?=[^a-zA-Z])",
 176          // environment \begin{} and \end{} (i.e. the things inside the {})
 177          7 => array(
 178              GESHI_SEARCH => "(\\\\(?:begin|end)\\{)(.*)(?=\\})",
 179              GESHI_REPLACE => '\\2',
 180              GESHI_MODIFIERS => 'U',
 181              GESHI_BEFORE => '\\1',
 182              GESHI_AFTER => ''
 183              ),
 184          // Structure \begin and \end
 185          8 => "\\\\(?:end|begin)(?=[^a-zA-Z])",
 186          // {parameters}
 187          9 => array(
 188              GESHI_SEARCH => "(?<=\\{)(?!<\|!REG3XP5!>).*?(?=\\})",
 189              GESHI_REPLACE => '\0',
 190              GESHI_MODIFIERS => 'Us',
 191              GESHI_BEFORE => '',
 192              GESHI_AFTER => ''
 193              ),
 194          // \%, \& usw.
 195          10 => "\\\\(?:[_$%]|&amp;)",
 196          //  \@keywords
 197          11 => "(?<!<\|!REG3XP[8]!>)\\\\@[a-zA-Z]+\*?",
 198          // \keywords
 199          12 => "(?<!<\|!REG3XP[468]!>)\\\\[a-zA-Z]+\*?",
 200  
 201  // ---------------------------------------------
 202          ),
 203      'STRICT_MODE_APPLIES' => GESHI_NEVER,
 204      'SCRIPT_DELIMITERS' => array(
 205          ),
 206      'HIGHLIGHT_STRICT_BLOCK' => array(
 207          ),
 208      'PARSER_CONTROL' => array(
 209          'COMMENTS' => array(
 210              'DISALLOWED_BEFORE' => '\\'
 211          ),
 212          'KEYWORDS' => array(
 213              'DISALLOWED_BEFORE' => "(?<=\\\\)",
 214              'DISALLOWED_AFTER' => "(?![A-Za-z0-9])"
 215          ),
 216          'ENABLE_FLAGS' => array(
 217              'NUMBERS' => GESHI_NEVER,
 218              'BRACKETS' => GESHI_NEVER
 219          )
 220      )
 221  );