plugins/geshi/geshi/bibtex.php
changeset 3 f3e2bbbd2155
equal deleted inserted replaced
2:9e3258dfae15 3:f3e2bbbd2155
       
     1 <?php
       
     2 /********************************************************************************
       
     3  * bibtex.php
       
     4  * -----
       
     5  * Author: Quinn Taylor (quinntaylor@mac.com)
       
     6  * Copyright: (c) 2009 Quinn Taylor (quinntaylor@mac.com), Nigel McNie (http://qbnz.com/highlighter)
       
     7  * Release Version: 1.0.8.4
       
     8  * Date Started: 2009/04/29
       
     9  *
       
    10  * BibTeX language file for GeSHi.
       
    11  *
       
    12  * CHANGES
       
    13  * -------
       
    14  * 2009/04/29 (1.0.8.4)
       
    15  *  -  First Release
       
    16  *
       
    17  * TODO
       
    18  * -------------------------
       
    19  *  - Add regex for matching and replacing URLs with corresponding hyperlinks
       
    20  *  - Add regex for matching more LaTeX commands that may be embedded in BibTeX
       
    21  *    (Someone who understands regex better than I should borrow from latex.php)
       
    22  ********************************************************************************
       
    23  *
       
    24  *     This file is part of GeSHi.
       
    25  *
       
    26  *   GeSHi is free software; you can redistribute it and/or modify
       
    27  *   it under the terms of the GNU General Public License as published by
       
    28  *   the Free Software Foundation; either version 2 of the License, or
       
    29  *   (at your option) any later version.
       
    30  *
       
    31  *   GeSHi is distributed in the hope that it will be useful,
       
    32  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    33  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    34  *   GNU General Public License for more details.
       
    35  *
       
    36  *   You should have received a copy of the GNU General Public License
       
    37  *   along with GeSHi; if not, write to the Free Software
       
    38  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    39  *
       
    40  *
       
    41 *******************************************************************************/
       
    42 
       
    43 // http://en.wikipedia.org/wiki/BibTeX
       
    44 // http://www.fb10.uni-bremen.de/anglistik/langpro/bibliographies/jacobsen-bibtex.html
       
    45 
       
    46 $language_data = array (
       
    47     'LANG_NAME' => 'BibTeX',
       
    48     'OOLANG' => false,
       
    49     'COMMENT_SINGLE' => array(
       
    50         1 => '%%'
       
    51         ),
       
    52     'COMMENT_MULTI' => array(),
       
    53     'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
       
    54     'QUOTEMARKS' => array(),
       
    55     'ESCAPE_CHAR' => '',
       
    56     'KEYWORDS' => array(
       
    57         0 => array(
       
    58             '@comment','@preamble','@string'
       
    59             ),
       
    60         // Standard entry types
       
    61         1 => array(
       
    62             '@article','@book','@booklet','@conference','@inbook',
       
    63             '@incollection','@inproceedings','@manual','@mastersthesis',
       
    64             '@misc','@phdthesis','@proceedings','@techreport','@unpublished'
       
    65             ),
       
    66         // Custom entry types
       
    67         2 => array(
       
    68             '@collection','@patent','@webpage'
       
    69             ),
       
    70         // Standard entry field names
       
    71         3 => array(
       
    72             'address','annote','author','booktitle','chapter','crossref',
       
    73             'edition','editor','howpublished','institution','journal','key',
       
    74             'month','note','number','organization','pages','publisher','school',
       
    75             'series','title','type','volume','year'
       
    76             ),
       
    77         // Custom entry field names
       
    78         4 => array(
       
    79             'abstract','affiliation','chaptername','cited-by','cites',
       
    80             'contents','copyright','date-added','date-modified','doi','eprint',
       
    81             'isbn','issn','keywords','language','lccn','lib-congress',
       
    82             'location','price','rating','read','size','source','url'
       
    83             )
       
    84         ),
       
    85     'URLS' => array(
       
    86         0 => '',
       
    87         1 => '',
       
    88         2 => '',
       
    89         3 => '',
       
    90         4 => ''
       
    91         ),
       
    92     'SYMBOLS' => array(
       
    93         '{', '}', '#', '=', ','
       
    94         ),
       
    95     'CASE_SENSITIVE' => array(
       
    96         1 => false,
       
    97         2 => false,
       
    98         3 => false,
       
    99         4 => false,
       
   100         GESHI_COMMENTS => false,
       
   101         ),
       
   102     // Define the colors for the groups listed above
       
   103     'STYLES' => array(
       
   104         'KEYWORDS' => array(
       
   105             1 => 'color: #C02020;', // Standard entry types
       
   106             2 => 'color: #C02020;', // Custom entry types
       
   107             3 => 'color: #C08020;', // Standard entry field names
       
   108             4 => 'color: #C08020;'  // Custom entry field names
       
   109             ),
       
   110         'COMMENTS' => array(
       
   111             1 => 'color: #2C922C; font-style: italic;'
       
   112             ),
       
   113         'STRINGS' => array(
       
   114             0 => 'color: #2020C0;'
       
   115             ),
       
   116         'SYMBOLS' => array(
       
   117             0 =>  'color: #E02020;'
       
   118             ),
       
   119         'REGEXPS' => array(
       
   120             1 => 'color: #2020C0;', // {...}
       
   121             2 => 'color: #C08020;',  // BibDesk fields
       
   122             3 => 'color: #800000;'   // LaTeX commands
       
   123             ),
       
   124         'ESCAPE_CHAR' => array(
       
   125             0 =>  'color: #000000; font-weight: bold;'
       
   126             ),
       
   127         'BRACKETS' => array(
       
   128             0 =>  'color: #E02020;'
       
   129             ),
       
   130         'NUMBERS' => array(
       
   131             ),
       
   132         'METHODS' => array(
       
   133             ),
       
   134         'SCRIPT' => array(
       
   135             )
       
   136         ),
       
   137     'REGEXPS' => array(
       
   138         // {parameters}
       
   139         1 => array(
       
   140             GESHI_SEARCH => "(?<=\\{)(?:\\{(?R)\\}|[^\\{\\}])*(?=\\})",
       
   141             GESHI_REPLACE => '\0',
       
   142             GESHI_MODIFIERS => 's',
       
   143             GESHI_BEFORE => '',
       
   144             GESHI_AFTER => ''
       
   145             ),
       
   146         2 => array(
       
   147             GESHI_SEARCH => "\bBdsk-(File|Url)-\d+",
       
   148             GESHI_REPLACE => '\0',
       
   149             GESHI_MODIFIERS => 'Us',
       
   150             GESHI_BEFORE => '',
       
   151             GESHI_AFTER => ''
       
   152             ),
       
   153         3 => array(
       
   154             GESHI_SEARCH => "\\\\[A-Za-z0-9]*+",
       
   155             GESHI_REPLACE => '\0',
       
   156             GESHI_MODIFIERS => 'Us',
       
   157             GESHI_BEFORE => '',
       
   158             GESHI_AFTER => ''
       
   159             ),
       
   160         ),
       
   161     'HIGHLIGHT_STRICT_BLOCK' => array(
       
   162         ),
       
   163     'OBJECT_SPLITTERS' => array(
       
   164         ),
       
   165     'STRICT_MODE_APPLIES' => GESHI_NEVER,
       
   166     'SCRIPT_DELIMITERS' => array(
       
   167         ),
       
   168     'PARSER_CONTROL' => array(
       
   169         'ENABLE_FLAGS' => array(
       
   170             'NUMBERS' => GESHI_NEVER
       
   171             ),
       
   172         'KEYWORDS' => array(
       
   173             3 => array(
       
   174                 'DISALLOWED_AFTER' => '(?=\s*=)'
       
   175                 ),
       
   176             4 => array(
       
   177                 'DISALLOWED_AFTER' => '(?=\s*=)'
       
   178                 ),
       
   179             )
       
   180         )
       
   181 );
       
   182 
       
   183 ?>