*** SyntaxHighlightingPlugin.txt.orig 2003-01-22 02:49:22.000000000 -0800
--- SyntaxHighlightingPlugin.txt 2005-02-14 14:25:47.000000000 -0800
***************
*** 1,5 ****
! %META:TOPICINFO{author="tisser_n" date="1043231880" format="1.0" version="1.4"}%
! %META:TOPICPARENT{name="TWikiPreferences"}%
---++ Syntax Highlighting TWiki Plugin
The Syntax Highlighting Twiki Plugin is used to emphasize the rendering of your twiki text according to several languages.
--- 1,5 ----
! %META:TOPICINFO{author="BenHouston" date="1108408251" format="1.0" version="1.1"}%
! %META:TOPICPARENT{name="TWikiPreferences"}%
---++ Syntax Highlighting TWiki Plugin
The Syntax Highlighting Twiki Plugin is used to emphasize the rendering of your twiki text according to several languages.
***************
*** 58,103 ****
* vhdl
* vrml
* wmlscript
* zsh
---+++ Syntax Rules
To enable syntax highlighting on some text, just type :
! %begin [numbered] language%
some text belonging to the language
! %end% where language is one of the list above, and numbered an optional keyword triggering the line numbering feature.
! Notice that the =%begin language%= and =%end%= must be left alone on one single line.
----+++ Example
The following text :
! %begin c++%
#include
int main()
{
std::cout << "Hello, world." << std::endl;
}
! %end%
gives :
! %begin c++%
#include
int main()
{
std::cout << "Hello, world." << std::endl;
}
! %end%
_If you do not see a nice colorized piece of code above this, you should check if the plugin is well installed._
You can also output numbered lines starting at 10 with this text:
! %begin numbered:10 sh%
#!/bin/sh
languages=`enscript --help-highlight | grep 'Name:' | cut -d ' ' -f 2`
for l in $languages; do
--- 58,110 ----
* vhdl
* vrml
* wmlscript
+ * xml (kind of - emulated as html)
* zsh
---+++ Syntax Rules
To enable syntax highlighting on some text, just type :
!
! %SYNTAX "language" [numbered]%
some text belonging to the language
! %ENDSYNTAX%
!
! where language is one of the list above, and numbered an optional keyword triggering the line numbering feature.
! Notice that the =%SYNTAX%= and =%ENDSYNTAX%= tags must be left alone on one single line.
----+++ Example
The following text :
!
! %SYNTAX{"c++"}%
#include
int main()
{
std::cout << "Hello, world." << std::endl;
}
! %ENDSYNTAX%
!
gives :
! %SYNTAX{"c++"}%
#include
int main()
{
std::cout << "Hello, world." << std::endl;
}
! %ENDSYNTAX%
_If you do not see a nice colorized piece of code above this, you should check if the plugin is well installed._
You can also output numbered lines starting at 10 with this text:
!
! %SYNTAX{"sh" numbered:10}%
#!/bin/sh
languages=`enscript --help-highlight | grep 'Name:' | cut -d ' ' -f 2`
for l in $languages; do
***************
*** 105,114 ****
* $l
EOF
done
! %end%
which outputs:
! %begin numbered:10 sh%
#!/bin/sh
languages=`enscript --help-highlight | grep 'Name:' | cut -d ' ' -f 2`
for l in $languages; do
--- 112,122 ----
* $l
EOF
done
! %ENDSYNTAX%
!
which outputs:
! %SYNTAX{"sh" numbered:10}%
#!/bin/sh
languages=`enscript --help-highlight | grep 'Name:' | cut -d ' ' -f 2`
for l in $languages; do
***************
*** 116,127 ****
* $l
EOF
done
! %end%
---+++ %TOPIC% Settings
Plugin settings are stored as preferences variables. To reference
! a plugin setting write ==%<plugin>_<setting>%==, i.e. ==%DEFAULTPLUGIN_SHORTDESCRIPTION%==
* One line description, is shown in the %TWIKIWEB%.TextFormattingRules topic:
* Set SHORTDESCRIPTION = This Plugin is used to emphasize the rendering of your twiki text according to several languages.
--- 124,135 ----
* $l
EOF
done
! %ENDSYNTAX%
---+++ %TOPIC% Settings
Plugin settings are stored as preferences variables. To reference
! a plugin setting write ==%<plugin>_<setting>%==, i.e. ==%SYNTAXHIGHLIGHTINGPLUGIN_SHORTDESCRIPTION%==
* One line description, is shown in the %TWIKIWEB%.TextFormattingRules topic:
* Set SHORTDESCRIPTION = This Plugin is used to emphasize the rendering of your twiki text according to several languages.
***************
*** 129,134 ****
--- 137,149 ----
* Debug plugin: (See output in =data/debug.txt=)
* Set DEBUG = 0
+ * Container: Allows you to determine the block container to hold the output from this plugin. Add in any valid xhtml, and include __OUTPUT__ ([underscore][underscore]OUTPUT[underscore][underscore]) to tell the plugin where to throw the formateed output. For example, if you want your code blocks output into a div with a class of =twikiSyntaxHighlightingBlock=, you could use a CONTAINER value of <div class="twikiSyntaxHighlightingBlock">__OUTPUT__</div>
+ * Set CONTAINER =
+
+ * Enscript: This plugin defaults to settings that assume enscript is on your path and that it is version 1.63. If you have a different version (especially earlier), change these settings.
+ * Set ENSCRIPT_PATH =
+ * Set ENSCRIPT_VERSION =
+
---+++ Plugin Installation Instructions
* Make sure you have GNU enscript 1.6.3 or above installed.
***************
*** 144,159 ****
---++++ Enscript oddities
! %begin numbered sh%
# youpi
! %end%
gives
! %begin numbered sh%
# youpi
! %end%
Because =enscript= strangely adds an extra line (for closing its emphasizing markers) between the matched <pre> </pre> to its html output.
--- 159,174 ----
---++++ Enscript oddities
! %SYNTAX{"sh"}%
# youpi
! %ENDSYNTAX%
gives
! %SYNTAX{"sh"}%
# youpi
! %ENDSYNTAX%
Because =enscript= strangely adds an extra line (for closing its emphasizing markers) between the matched <pre> </pre> to its html output.
***************
*** 161,177 ****
---++++ WikiWords on last line
! %begin sh%
UnmatchedWikiword :)
MatchedWikiWord :(
! %end%
gives
! %begin sh%
UnmatchedWikiword :)
MatchedWikiWord :(
! %end%
Adding a newline at the end of input stops TWiki in his greedy matching, but this workaround is not an acceptable solution. Feel free to find another one ....
---+++ Plugin Info
--- 176,194 ----
---++++ WikiWords on last line
!
! %SYNTAX{"sh"}%
UnmatchedWikiword :)
MatchedWikiWord :(
! %ENDSYNTAX%
!
gives
! %SYNTAX{"sh"}%
UnmatchedWikiword :)
MatchedWikiWord :(
! %ENDSYNTAX%
Adding a newline at the end of input stops TWiki in his greedy matching, but this workaround is not an acceptable solution. Feel free to find another one ....
---+++ Plugin Info
***************
*** 187,190 ****
__Related Topics:__ %TWIKIWEB%.TWikiPreferences, %TWIKIWEB%.TWikiPlugins, EmptyPlugin
! -- Main.NicolasTisserand - 12 Jul 2002
--- 204,208 ----
__Related Topics:__ %TWIKIWEB%.TWikiPreferences, %TWIKIWEB%.TWikiPlugins, EmptyPlugin
! -- Main.NicolasTisserand - 12 Jul 2002
!