Text::Trac - Perl extension for formatting text with Trac Wiki Style.


Text-Trac documentation Contained in the Text-Trac distribution.

Index


Code Index:

NAME

Top

Text::Trac - Perl extension for formatting text with Trac Wiki Style.

VERSION

Top

Version 0.12

SYNOPSIS

Top

    use Text::Trac;

    my $parser = Text::Trac->new(
        trac_url      => 'http://trac.mizzy.org/public/',
        disable_links => [ qw( changeset ticket ) ],
    );

    $parser->parse($text);

    print $parser->html;

DESCRIPTION

Top

Text::Trac parses text with Trac WikiFormatting and convert it to html format.

METHODS

Top

new

Constructs Text::Trac object.

Available arguments are:

trac_url

Base URL for TracLinks.Default is /. You can specify each type of URL individually. Available URLs are:

trac_attachment_url
trac_changeset_url
trac_log_url
trac_milestone_url
trac_report_url
trac_source_url
trac_ticket_url
trac_wiki_url

parse

Parses text and converts it to html format.

process

An alias of parse method.

html

Return converted html string.

SEE ALSO

Top

Text::Hatena
Trac http://www.edgewall.com/trac/
Trac WikiFormatting http://projects.edgewall.com/trac/wiki/WikiFormatting

AUTHORS

Top

Gosuke Miyashita, <gosukenator at gmail.com>

Hideaki Tanaka, <drawn.boy at gmail.com)>

BUGS

Top

Please report any bugs or feature requests to bug-text-trac at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-Trac. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Text::Trac

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Text-Trac

* CPAN Ratings

http://cpanratings.perl.org/d/Text-Trac

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text-Trac

* Search CPAN

http://search.cpan.org/dist/Text-Trac

COPYRIGHT & LICENSE

Top


Text-Trac documentation Contained in the Text-Trac distribution.

package Text::Trac;

use strict;

use Text::Trac::Context;
use Text::Trac::BlockNode;

our $VERSION = '0.15';

my %Defaults = (
    html              => '',
    permalink         => '',
    min_heading_level => 1,
);

sub new {
    my ( $class, %args ) = @_;

    my $self = {
        %Defaults,
        %args,
    };

    bless $self, $class;
}

sub parse {
    my $self = shift;
    my $text = shift or return;

    $self->{trac_url} = '/' unless defined $self->{trac_url};
    for ( keys %$self ) {
        if ( $_ =~ /^trac.+url$/ ) {
            $self->{$_} .= '/' if $self->{$_} !~ m!/$!;
        }
    }

    my $c = Text::Trac::Context->new({
        %$self,
        text => $text,
    });

    my $node = Text::Trac::BlockNode->new({
        context  => $c,
    });
    $node->parse;

    $self->{html} = $c->html;
}

sub html { $_[0]->{html}; }

*process = \&parse;

1;
__END__