package Kwiki::VimMode; use strict; use warnings; use Kwiki::Plugin -Base; use Kwiki::Installer -base; our $VERSION = 0.05; const class_title => 'color hiliting using Vim'; const class_id => 'vim_mode'; const css_file => 'vim_mode.css'; sub register { my $registry = shift; $registry->add( wafl => vim => 'Kwiki::VimMode::Wafl' ); } package Kwiki::VimMode::Wafl; use base 'Spoon::Formatter::WaflBlock'; sub to_html { require Text::VimColor; my $string = $self->block_text; chomp $string; $ENV{PATH} = "/usr/local/bin:$ENV{PATH}"; $string =~ s/^ filetype: \s* (\w+) \s* \n+//sx; my @filetype = $1 ? ( filetype => $1 ) : (); my $vim = Text::VimColor->new( string => $string, @filetype, vim_options => [ qw( -RXZ -i NONE -u NONE -N ), "+set nomodeline" ] ); return '
' . $vim->html . "\n"; } package Kwiki::VimMode; __DATA__ =head1 NAME Kwiki::VimMode - VimMode preformatted forms of text =head1 SYNOPSIS $ cpan Kwiki::VimMode $ cd /path/to/kwiki $ echo "Kwiki::VimMode" >> plugins $ kwiki -update =head1 DESCRIPTION This module allows you to hilight the syntax of any text mode that the Vim editor recognizes: Here's some *HTML* and *Perl* for you to grok: .vim
out!
.vim
.vim
#!/usr/bin/perl
# sample perl
$name = 'Kwiki';
print "Check out $name!\n";
.vim
L