Kwiki::Autoformat - Autoformat preformatted text


Kwiki-Autoformat documentation Contained in the Kwiki-Autoformat distribution.

Index


Code Index:

NAME

Top

Kwiki::Autoformat - Autoformat preformatted text

SYNOPSIS

Top

 $ cpan Kwiki::Autoformat
 $ cd /path/to/kwiki
 $ echo "Kwiki::Autoformat" >> plugins
 $ kwiki -update

DESCRIPTION

Top

This formats preformatted text using Damian Conway's magical Text::Autoformat with the default options:

    .auto
    In comp.lang.perl.misc you wrote:
    : > <CN = Clooless Noobie> writes:
    : > CN> PERL sux because:
    : > CN>    * It doesn't have a switch statement and you have to put $
    : > CN>signs in front of everything
    : > ...
    .auto

AUTHORS

Top

Ian Langworth <langworth.com>

SEE ALSO

Top

Kwiki, Text::Autoformat

COPYRIGHT AND LICENSE

Top


Kwiki-Autoformat documentation Contained in the Kwiki-Autoformat distribution.

package Kwiki::Autoformat;
use strict;
use warnings;

use Kwiki::Plugin -Base;
use Kwiki::Installer -mixin;

our $VERSION = 0.03;

const class_title => 'Text autoformat';
const class_id => 'autoformat';

sub register {
    my $registry = shift;
    $registry->add(wafl => auto => 'Kwiki::Autoformat::Wafl');
    $registry->add(wafl => autoformat => 'Kwiki::Autoformat::Wafl');
}

package Kwiki::Autoformat::Wafl;
use base 'Spoon::Formatter::WaflBlock';

sub to_html {
    require Text::Autoformat;
    my $text = Text::Autoformat::autoformat($self->block_text);
    $text =~ s/\n+//s;
    return "<pre>$text</pre>";
}

package Kwiki::Autoformat;

__DATA__