'. t('Syntax highlighting of source code can be enabled with the following tags:') .'
'; $items = array(); // generic tags $tags = array(); foreach ($generic_code_tags as $tag) { $tags[] = '"'. $bracket_open . $tag . $bracket_close .'
"';
}
$items[] = t('Generic syntax highlighting tags: !tags.', array('!tags' => implode(', ', $tags)));
// language tags
$tags = array();
foreach ($language_tags as $tag) {
$tags[] = t('"@tag-code
" for @lang source code', array('@tag-code' => $bracket_open . $tag . $bracket_close, '@lang' => $languages[$tag_to_lang[$tag]]));
}
$items[] = t('Language specific syntax highlighting tags: !tags.', array('!tags' => implode(', ', $tags)));
// PHP specific delimiters
if (_geshifilter_php_delimeters($format)) {
$items[] = t('PHP source code can also be enclosed in <?php ... ?> or <% ... %>, but additional options like line numbering are not possible here.');
}
$output .= theme('item_list', $items);
// Options and tips
$output .= ''. t('Options and tips:') .'
'; $items = array(); // info about language attribute to language mapping $att_to_full = array(); foreach ($languages as $langcode => $fullname) { $att_to_full[$langcode] = $fullname; } foreach ($tag_to_lang as $tag => $lang) { $att_to_full[$tag] = $languages[$lang]; } ksort($att_to_full); $att_for_full = array(); foreach ($att_to_full as $att => $fullname) { $att_for_full[] = t('"@langcode
" (for @fullname)', array('@langcode' => $att, '@fullname' => $fullname));
}
$items[] = t('The language for the generic syntax highlighting tags can be specified with one of the attribute(s): %attributes. The possible values are: !languages.', array('%attributes' => implode(', ', $lang_attributes), '!languages' => implode(', ', $att_for_full)));
// line numbering options
$items[] = t('Line numbering can be enabled/disabled with the attribute "%linenumbers". Possible values are: "%off" for no line numbers, "%normal" for normal line numbers and "%fancy" for fancy line numbers (every nth line number highlighted). The start line number can be specified with the attribute "%start", which implicitly enables normal line numbering. For fancy line numbering the interval for the highlighted line numbers can be specified with the attribute "%fancy", which implicitly enables fancy line numbering.', array('%linenumbers' => GESHIFILTER_ATTRIBUTE_LINE_NUMBERING, '%off' => 'off', '%normal' => 'normal', '%fancy' => 'fancy', '%start' => GESHIFILTER_ATTRIBUTE_LINE_NUMBERING_START, '%fancy' => GESHIFILTER_ATTRIBUTE_FANCY_N));
// block versus inline
$items[] = t('If the source code between the tags contains a newline (e.g. immediatly after the opening tag), the highlighted source code will be displayed as a code block. Otherwise it will be displayed inline.');
if (_geshifilter_brackets($format) == GESHIFILTER_BRACKETS_BOTH) {
$items[] = t('Beside the tag style "!angle" it is also possible to use "!bracket".' , array('!angle' => '<foo>
', '!bracket' => '[foo]
'));
}
$output .= theme('item_list', $items);
// Defaults
$output .= ''. t('Defaults:') .'
'; $items = array(); $default_highlighting = variable_get('geshifilter_default_highlighting', GESHIFILTER_DEFAULT_PLAINTEXT); switch ($default_highlighting) { case GESHIFILTER_DEFAULT_DONOTHING: $description = t('when no language attribute is specified the code block won\'t be processed by the GeSHi filter'); break; case GESHIFILTER_DEFAULT_PLAINTEXT: $description = t('when no language attribute is specified, no syntax highlighting will be done'); break; default: $description = t('the default language used for syntax highlighting is "%default_lang"', array('%default_lang' => $default_highlighting)); break; } $items[] = t('Default highlighting mode for generic syntax highlighting tags: !description.', array('!description' => $description)); $default_line_numbering = variable_get('geshifilter_default_line_numbering', GESHIFILTER_LINE_NUMBERS_DEFAULT_NONE); switch ($default_line_numbering) { case GESHIFILTER_LINE_NUMBERS_DEFAULT_NONE: $description = t('no line numbers'); break; case GESHIFILTER_LINE_NUMBERS_DEFAULT_NORMAL: $description = t('normal line numbers'); break; default: $description = t('fancy line numbers (every @n lines)', array('@n' => $default_line_numbering)); break; } $items[] = t('Default line numbering: !description.', array('!description' => $description)); $output .= theme('item_list', $items); // Examples $output .= ''. t('Examples:') .'
'; $header = array(t('You type'), t('You get')); $rows = array(); if (count($generic_code_tags)) { $generic_code_tag = $generic_code_tags[0]; $lang = array_rand($languages); $generic_code_tag_open = $bracket_open . $generic_code_tag; $generic_code_tag_close = $bracket_open .'/'. $generic_code_tag . $bracket_close; $rows[] = array( ''. $generic_code_tag_open . $bracket_close .'foo = "bar";'. $generic_code_tag_close .'
',
t('Inline code with the default syntax highlighting mode.'),
);
$rows[] = array(
''. $generic_code_tag_open . $bracket_close .'
foo = "bar";
baz = "foz";
'. $generic_code_tag_close .'
',
t('Code block with the default syntax highlighting mode.'),
);
$rows[] = array(
''. $generic_code_tag_open .' '. $lang_attributes[1 % count($lang_attributes)] .'="'. $lang .'" '. GESHIFILTER_ATTRIBUTE_LINE_NUMBERING .'="normal"'. $bracket_close .'
foo = "bar";
baz = "foz";
'. $generic_code_tag_close .'
',
t('Code block with syntax highlighting for @lang source code'. $generic_code_tag_open .' '. $lang_attributes[2 % count($lang_attributes)] .'="'. $lang .'" '. GESHIFILTER_ATTRIBUTE_LINE_NUMBERING_START .'="23" '. GESHIFILTER_ATTRIBUTE_FANCY_N .'="7"'. $bracket_close .'
foo = "bar";
baz = "foz";
'. $generic_code_tag_close .'
',
t('Code block with syntax highlighting for @lang source code,'. $bracket_open . $language_tag . $bracket_close .'
foo = "bar";
baz = "foz";
'. $bracket_open .'/'. $language_tag . $bracket_close .'
',
t('Code block with syntax highlighting for @lang source code.', array('@lang' => $languages[$tag_to_lang[$language_tag]])),
);
$rows[] = array(
''. $bracket_open . $language_tag .' '. GESHIFILTER_ATTRIBUTE_LINE_NUMBERING_START .'="23" '. GESHIFILTER_ATTRIBUTE_FANCY_N .'="7"'. $bracket_close .'
foo = "bar";
baz = "foz";
'. $bracket_open . $language_tag . $bracket_close .'
',
t('Code block with syntax highlighting for @lang source code,'. $bracket_open . $tag . $bracket_close .'
';
}
foreach ($language_tags as $tag) {
$tags[] = ''. $bracket_open . $tag . $bracket_close .'
';
}
$output = t('You can enable syntax highlighting of source code with the following tags: !tags.', array('!tags' => implode(', ', $tags)));
if (_geshifilter_brackets($format) == GESHIFILTER_BRACKETS_BOTH) {
$output .= ' '. t('Beside the tag style "!angle" it is also possible to use "!bracket".' , array('!angle' => '<foo>
', '!bracket' => '[foo]
'));
}
if (_geshifilter_php_delimeters($format)) {
$output .= ' '. t('PHP source code can also be enclosed in <?php ... ?> or <% ... %>.');
}
return $output;
}
}