package Kwiki::ShellBlocks; use strict; use warnings; use Kwiki::Plugin '-Base'; use Kwiki::Installer '-Base'; our $VERSION = '0.02'; const class_id => 'shell_blocks'; const class_title => 'Shell Blocks'; const css_file => 'shell_blocks.css'; sub register { my $registry = shift; $registry->add(wafl => shell => 'Kwiki::ShellBlocks::Wafl'); } package Kwiki::ShellBlocks::Wafl; use base 'Spoon::Formatter::WaflBlock'; sub to_html { return join '', qq{
}, join("\n", map $self->render_line($_), split(/\n/, $self->block_text)), qq{}; } sub render_line { my $source = shift; $source =~ s/^(\s*)//; my $spaces = $1; if ($source =~ s/^([%\$]|\w:[\w\\]+>)//) { $source = "$1$source"; } else { $source = "$source"; } $source =~ s{((?:\s|^)#\s.+)}{$1}; return $spaces.$source; } 1; package Kwiki::ShellBlocks; __DATA__ =head1 NAME Kwiki::ShellBlocks - Kwiki Shell Blocks Plugin =head1 SYNOPSIS In your F