NAME
IkiWiki::Plugin::syntax - Add syntax highlighting to ikiwiki
SYNOPSIS
In any source page include the following:
This is the example code
[[syntax language=perl text="""
#!/usr/bin/perl
print "Hello, world\n";
"""]]
and this is my bash profile (using file type autodetection )
[[syntax file="software/examples/mybash_profile"
description="My profile" ]]
In order to facilitate the life to the administrator the plugin could
create a html table with information about the engine capabilities.
Use the directive "syntax" without any parameters as is:
This is the syntax engine chart in this site:
[[syntax ]]
DESCRIPTION
This plugin adds syntax highlight capabilities to Ikiwiki using third
party modules if they are installed.
Those modules can be:
* Syntax::Highlight::Engine::Kate
Uses the Syntax::Highlight::Engine::Kate package, a port to Perl of
the syntax highlight engine of the Kate text editor.
Copyright (c) 2006 by Hans Jeuken, all rights reserved.
* Text::VimColor
This plugin uses the Text::VimColor module and the vim editor.
Copyright 2002-2006, Geoff Richards.
* IkiWiki::Plugin::syntax::Simple
This is the default engine. It's a passtrough engine with line
numering capability.
and they can be selected at runtime with the "syntax_engine" parameter.
In case of fail loading the module the plugin switch to use the simple
engine.
The module register a preprocessor directive named syntax.
Parameters
The syntax directive has the following parameters:
language (optional)
Name of the source language for select the correct plugin. If not
defined the module will try to determine the appropiated value.
description (optional)
Text description for the html link
text
Source text for syntax highlighting. Mandatory if not exists the
file parameter.
file
Ikiwiki page name as source text for syntax highlighting. The final
html includes a link to it for direct download.
linenumbers
Enable the line numbers in the final html.
bars
Enable the bars feature. The final html text will be label with css
tags on the odd lines.
force_subpage
Parameter for inline funcion to the source page
CSS
The package uses the following list of css tags:
*
METHODS/SUBROUTINES
checkconfig( )
This method is called by IkiWiki main program and the plugin uses it for
load global configuration values and initialize his internals.
preprocess( )
This method is called when the ikiwiki parser found a "syntax"
directive. Without parameters the method show information about the
external syntax parser.
CONFIGURATION AND ENVIRONMENT
IkiWiki::Plugin::syntax uses the following global parameters:
syntax_engine (optional)
Set to a keyword for select the engine to use.
Kate
Uses the Syntax::Highlight::Engine::Kate as backend.
Vim Uses the Text::VimColor as backend.
Simple
Uses the IkiWiki::Plugin::syntax::Simple as backend.
If this parameter is omitted or the external module fails, the
plugin switch to use the Simple engine.
syntax_Kate (optional)
Parameters to configure the engine (not implemented yet).
syntax_Vim (optional)
Parameters to configure the engine (not implemented yet).
syntax_Simple (optional)
Parameters to configure the engine (not implemented yet).
DEPENDENCIES
The module needs the following perl packages:
Module::Build::IkiWiki
Extension to Module::Build for build and install ikiwiki plugins.
Class::Accessor::Fast
Test::More
Exception::Class
HTML::Entities
HTML::Template
URI::Escape
And it recommends:
Syntax::Highlight::Engine::Kate
Text::VimColor
BUGS AND LIMITATIONS
Break the markdown indented chain. It can't be used between paragraphs
of one list item. Use it after the item text.
Please report any bugs or feature requests to the author.
AUTHOR
"Víctor Moral" "
[email protected]"
LICENCE AND COPYRIGHT
Copyright (c) 2008, "Víctor Moral".
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or any later
version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.