enscript
to render its output.
|
|
|
|
|
<sticky> %CODE{ lang="cpp" num="10" numstep="2" }% ...code... %ENDCODE% </sticky>The
<sticky>
tags are required to prevent TWiki's WYSIWYG editor from removing line breaks inside the code block.
Parameter | Description | Default |
---|---|---|
"..." orlang="..." |
Source language. Supported languages: ada , asm , awk , bash , changelog , cpp , csh , c , delphi , diffs , diff , diffu , dylan , eiffel , elisp , Name: , forth , fortran_pp , fortran , haskell , html , icon , idl , inf , javascript , java , ksh , lua , m4 , mail , makefile , matlab , nroff , oberon2 , objc , outline , oz , pascal , perl , php , postscript , pyrex , python , rfc , ruby , scheme , sh , skill , Smalltalk , sml , sql , states , synopsys , tcl , tcsh , tex , vba , verilog , vhdl , vrml , wmlscript , zsh |
(none, required) |
num="..." |
Show line numbers next to the source code. An integer indicates the start number. Also "on" and "off" |
"off" |
step="..." |
Increment line numbers with the given step. Negative numbers will decrement. | "1" |
style="..." |
Style of box around the source code | light gray box |
numstyle="..." |
Style of line number column | light brown box |
<sticky> %CODE{"c++"}% #include <iostream> int main() { // Hello world example std::cout << "Hello, world." << std::endl; } %ENDCODE% </sticky>gives (if installed):
#include <iostream> int main() { // Hello world example std::cout << "Hello, world." << std::endl; }
<sticky> %CODE{"sh" num="1"}% #!/bin/sh languages=`enscript --help-highlight | grep 'Name:' | cut -d ' ' -f 2` for l in $languages; do cat << EOF * $l EOF done %ENDCODE% </sticky>gives (if installed):
1#!/bin/sh 2languages=`enscript --help-highlight | grep 'Name:' | cut -d ' ' -f 2` 3for l in $languages; do 4 cat << EOF 5 * $l 6EOF 7done
SyntaxHighlightingPlugin.zip
in your twiki installation directory.
$TWiki::cfg{Plugins}{SyntaxHighlightingPlugin}{EnscriptPath}
# path to enscript script
$TWiki::cfg{Plugins}{SyntaxHighlightingPlugin}{DefaultLang}
# Default language
$TWiki::cfg{Plugins}{SyntaxHighlightingPlugin}{Numbering}
# Default for line numbering, 'off' or 'on'
$TWiki::cfg{Plugins}{SyntaxHighlightingPlugin}{Step}
# Default step of numbering
$TWiki::cfg{Plugins}{SyntaxHighlightingPlugin}{Style}
# Style of pre tag containing the source code
$TWiki::cfg{Plugins}{SyntaxHighlightingPlugin}{NumStyle}
# Style of numbering column
$TWiki::cfg{Plugins}{SyntaxHighlightingPlugin}{Debug}
# Debug setting
%begin sh%
...code...
%end%
tools
directory and into your data
directory. When you run it, it will look through your webs and replace the syntax. Note that its not the best script in the world, so always test it on a copy of your data first!
data/TWiki/SyntaxHighlightingPlugin.txt | Plugin topic |
data/TWiki/VarCODE.txt | Variable documentation topic |
pub/TWiki/SyntaxHighlightingPlugin/cpp-screenshot.png | |
pub/TWiki/SyntaxHighlightingPlugin/cpp-screenshot-300.png | |
lib/TWiki/Plugins/SyntaxHighlightingPlugin.pm | Perl module |
lib/TWiki/Plugins/SyntaxHighlightingPlugin/Config.spec | |
tools/SyntaxHighlightingPlugin_covert.pl |
Plugin Author: | TWiki:Main.AndrewRJones |
Previous Authors: | TWiki:Main.NicolasTisserand, TWiki:Main.NicolasBurrus, Perceval Anichini |
License: | GPL (GNU General Public License) |
Plugin Version: | 2013-04-04 |
2013-04-04: | TWikibug:Item7211: Add Scala support -- TWiki:Main.HideyoImazu |
2013-02-14: | TWikibug:Item7091: Show source code of undefined or unsupported language, but warn user; use configure settings for defaults; rename numstep parameter to step & make numstep undocumented; add VarCODE variable documentation -- TWiki:Main.PeterThoeny |
2013-02-13: | TWikibug:Item7091: Add style and numstyle parameters -- TWiki:Main.PeterThoeny |
2013-02-13: | TWikibug:Item7123: Use TWISTY in installation instructions and change history |
2012-11-15: | TWikibug:Item7035: Number step support -- TWiki:Main.YaojunFei |
2011-05-14: | TWikibug:Item6701: Small fix in Config.spec -- TWiki:Main.PeterThoeny |
2010-10-23: | TWikibug:Item6530: Doc improvements - TWiki:Main.PeterThoeny, TWiki:Main.AndreasKeil |
2008-09-11: | TWikibug:Item5995: Rewritten to work on TWiki 4.2 |
2002-07-12: | Initial version |
TWiki Dependency: | $TWiki::Plugins::VERSION 1.1 |
Dependencies: | enscript >= 1.6.3, CPAN:IPC::Run |
Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/SyntaxHighlightingPlugin |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/SyntaxHighlightingPluginDev |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/SyntaxHighlightingPluginAppraisal |