[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 * twig.php 4 * ---------- 5 * Author: Keyvan Akbary (keyvan@kiwwito.com) 6 * Copyright: (c) 2011 Keyvan Akbary (http://www.kiwwito.com/) 7 * Release Version: 1.0.9.1 8 * Date Started: 2011/12/05 9 * 10 * Twig template language file for GeSHi. 11 * 12 * CHANGES 13 * ------- 14 * 2012/09/28 (1.9.0 by José Andrés Puertas y Javier Eguiluz) 15 * - Added new tags, filters and functions 16 * - Added regexps for variables, objects and properties 17 * - Lots of other minor tweaks (delimites, comments, ...) 18 * 19 * 2011/12/05 (1.0.0 by Keyvan Akbary) 20 * - Initial Release 21 * 22 * TODO 23 * ---- 24 * 25 ************************************************************************************* 26 * 27 * This file is part of GeSHi. 28 * 29 * GeSHi is free software; you can redistribute it and/or modify 30 * it under the terms of the GNU General Public License as published by 31 * the Free Software Foundation; either version 2 of the License, or 32 * (at your option) any later version. 33 * 34 * GeSHi is distributed in the hope that it will be useful, 35 * but WITHOUT ANY WARRANTY; without even the implied warranty of 36 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 37 * GNU General Public License for more details. 38 * 39 * You should have received a copy of the GNU General Public License 40 * along with GeSHi; if not, write to the Free Software 41 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 42 * 43 ************************************************************************************/ 44 45 $language_data = array( 46 'LANG_NAME' => 'Twig', 47 'COMMENT_SINGLE' => array(), 48 'COMMENT_MULTI' => array('{#' => '#}'), 49 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, 50 'QUOTEMARKS' => array("'", '"'), 51 'ESCAPE_CHAR' => '', 52 'KEYWORDS' => array( 53 //TWIG 54 //Tags 55 1 => array( 56 'autoescape', 57 'endautoescape', 58 'block', 59 'endblock', 60 'do', 61 'embed', 62 'endembed', 63 'extends', 64 'filter', 65 'endfilter', 66 'for', 67 'endfor', 68 'from', 69 'if', 70 'else', 71 'elseif', 72 'endif', 73 'import', 74 'include', 75 'macro', 76 'endmacro', 77 'raw', 78 'endraw', 79 'sandbox', 80 'set', 81 'endset', 82 'spaceless', 83 'endspaceless', 84 'use', 85 'verbatim', 86 'endverbatim', 87 'trans', 88 'endtrans', 89 'transchoice', 90 'endtranschoice' 91 ), 92 //Filters 93 2 => array( 94 'abs', 95 'batch', 96 'capitalize', 97 'convert_encoding', 98 'date', 99 'date_modify', 100 'default', 101 'escape', 102 'first', 103 'format', 104 'join', 105 'json_encode', 106 'keys', 107 'last', 108 'length', 109 'lower', 110 'merge', 111 'nl2br', 112 'number_format', 113 'replace', 114 'reverse', 115 'slice', 116 'sort', 117 'split', 118 'striptags', 119 'title', 120 'trim', 121 'upper', 122 'url_encode' 123 ), 124 //Functions 125 3 => array( 126 'attribute', 127 'cycle', 128 'dump', 129 'parent', 130 'random', 131 'range', 132 'source', 133 'template_from_string' 134 ), 135 //Tests 136 4 => array( 137 'constant', 138 'defined', 139 'divisibleby', 140 'empty', 141 'even', 142 'iterable', 143 'null', 144 'odd', 145 'sameas' 146 ), 147 //Operators 148 5 => array( 149 'in', 150 'is', 151 'and', 152 'b-and', 153 'or', 154 'b-or', 155 'b-xor', 156 'not', 157 'into', 158 'starts with', 159 'ends with', 160 'matches' 161 ) 162 ), 163 'SYMBOLS' => array( 164 '{{', 165 '}}', 166 '{%', 167 '%}', 168 '+', 169 '-', 170 '/', 171 '/', 172 '*', 173 '**', //Math operators 174 '==', 175 '!=', 176 '<', 177 '>', 178 '>=', 179 '<=', 180 '===', //Logic operators 181 '..', 182 '|', 183 '~', 184 '[', 185 ']', 186 '.', 187 '?', 188 ':', 189 '(', 190 ')', //Other 191 '=' //HTML (attributes) 192 ), 193 'CASE_SENSITIVE' => array( 194 GESHI_COMMENTS => false, 195 //Twig 196 1 => true, 197 2 => true, 198 3 => true, 199 4 => true, 200 5 => true 201 ), 202 'STYLES' => array( 203 'KEYWORDS' => array( 204 1 => 'color: #0600FF;', //Tags 205 2 => 'color: #008000;', //Filters 206 3 => 'color: #0600FF;', //Functions 207 4 => 'color: #804040;', //Tests 208 5 => 'color: #008000;' 209 ), 210 'COMMENTS' => array( 211 'MULTI' => 'color: #008080; font-style: italic;' 212 ), 213 'ESCAPE_CHAR' => array( 214 0 => 'color: #000099; font-weight: bold;' 215 ), 216 'BRACKETS' => array( 217 0 => 'color: #D36900;' 218 ), 219 'STRINGS' => array( 220 0 => 'color: #ff0000;' 221 ), 222 'NUMBERS' => array( 223 0 => 'color: #cc66cc;' 224 ), 225 'METHODS' => array( 226 1 => 'color: #006600;' 227 ), 228 'SYMBOLS' => array( 229 0 => 'color: #D36900;' 230 ), 231 'SCRIPT' => array( 232 0 => '', 233 1 => 'color: #808080; font-style: italic;', 234 2 => 'color: #009000;' 235 ), 236 'REGEXPS' => array( 237 0 => 'color: #00aaff;', 238 1 => 'color: #00aaff;' 239 ) 240 ), 241 'URLS' => array( 242 1 => 'http://twig.sensiolabs.org/doc/tags/{FNAMEL}.html', 243 2 => 'http://twig.sensiolabs.org/doc/filters/{FNAMEL}.html', 244 3 => 'http://twig.sensiolabs.org/doc/functions/{FNAMEL}.html', 245 4 => 'http://twig.sensiolabs.org/doc/tests/{FNAMEL}.html', 246 5 => '', 247 ), 248 'OOLANG' => false, 249 'OBJECT_SPLITTERS' => array( 250 1 => '.', 251 ), 252 'REGEXPS' => array( 253 0 => array( 254 GESHI_SEARCH => "([[:space:]])([a-zA-Z_][a-zA-Z0-9_]*)", 255 GESHI_REPLACE => '\\2', 256 GESHI_MODIFIERS => '', 257 GESHI_BEFORE => '\\1', 258 GESHI_AFTER => '' 259 ), 260 1 => array( 261 GESHI_SEARCH => "\.([a-zA-Z_][a-zA-Z0-9_]*)", 262 GESHI_REPLACE => '.\\1', 263 GESHI_MODIFIERS => '', 264 GESHI_BEFORE => '', 265 GESHI_AFTER => '' 266 ), 267 ), 268 'STRICT_MODE_APPLIES' => GESHI_ALWAYS, 269 'SCRIPT_DELIMITERS' => array( 270 0 => array( 271 '{{' => '}}', 272 '{%' => '%}' 273 ), 274 1 => array( 275 '{#' => '#}', 276 ) 277 ), 278 'HIGHLIGHT_STRICT_BLOCK' => array( 279 0 => true, 280 1 => true, 281 2 => true 282 ), 283 'PARSER_CONTROL' => array( 284 'KEYWORDS' => array() 285 ) 286 );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body