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;
54 * @param string $argstr
55 * @param WikiRequest $request
56 * @param string $basepage
59 function run($dbi, $argstr, &$request, $basepage)
61 extract($this->getArgs($argstr, $request));
62 $source =& $this->source;
64 return HTML::div(array('class' => "error"),
65 "Please provide source code to SyntaxHighlighter plugin");
68 $code = "\n<code>\n".htmlspecialchars($source)."\n</code>\n";
69 $pre = HTML::pre(HTML::raw($code));
70 $html->pushContent($pre);
79 // c-hanging-comment-ender-p: nil
80 // indent-tabs-mode: nil