function _syntaxhighlighter_do_filter_process in Syntax Highlighter 6
Same name and namespace in other branches
- 6.2 syntaxhighlighter.module \_syntaxhighlighter_do_filter_process()
- 7.2 syntaxhighlighter.module \_syntaxhighlighter_do_filter_process()
- 7 syntaxhighlighter.module \_syntaxhighlighter_do_filter_process()
Filter {syntaxhighlighter options}program code{/syntaxhighlighter} into <pre class="options">program code</pre>
We make sure if there is " inside options, they become ' so the HTML in the end is proper
1 call to _syntaxhighlighter_do_filter_process()
- syntaxhighlighter_filter in ./
syntaxhighlighter.module - Implements hook_filter()
File
- ./
syntaxhighlighter.module, line 287 - Syntax highlight code using the Syntaxhighlighter javascript library. See http://alexgorbatchev.com/wiki/SyntaxHighlighter
Code
function _syntaxhighlighter_do_filter_process($text) {
$patterns = array(
'/{ *syntaxhighlighter *([^}]+)\\}/e',
'/\\{\\/ *syntaxhighlighter *\\}/',
);
$tag_name = variable_get('syntaxhighlighter_tagname', 'pre');
$replacements = array(
"_syntaxhighlighter_replace('\$1')",
"</{$tag_name}>",
);
return preg_replace($patterns, $replacements, $text);
}