4 * Copyright 2004 $ThePhpWikiProgrammingTeam
6 * This file is part of PhpWiki.
8 * PhpWiki is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * PhpWiki is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 class WikiPlugin_SyntaxHighlighter
26 function getDescription()
28 return _("Source code syntax highlighter (via http://highlightjs.org/).");
31 function managesValidators()
36 function getDefaultArguments()
39 'syntax' => null, // required argument
40 'style' => null, // optional argument ["ansi", "gnu", "kr", "java", "linux"]
41 'color' => null, // optional, see highlight/themes
47 function handle_plugin_args_cruft($argstr, $args)
49 $this->source = $argstr;
52 function run($dbi, $argstr, &$request, $basepage)
54 extract($this->getArgs($argstr, $request));
55 $source =& $this->source;
57 return HTML::div(array('class' => "error"),
58 "Please provide source code to SyntaxHighlighter plugin");
61 $code = "\n<code>\n".htmlspecialchars($source)."\n</code>\n";
62 $pre = HTML::pre(HTML::raw($code));
63 $html->pushContent($pre);
72 // c-hanging-comment-ender-p: nil
73 // indent-tabs-mode: nil