bobtfish/text-markdown — pull request #16 by tokuhirom (2011-11-09 02:55:49+00:00)
Title: support first argument of markdown as blessed string like Text::Xslate::Type::Raw.

markdown with xslate.

This is a example failing code:

use strict;
use warnings;
use utf8;
use File::Spec;
use File::Basename;
use lib File::Spec->catdir(dirname(__FILE__), 'extlib', 'lib', 'perl5');
use lib File::Spec->catdir(dirname(__FILE__), 'lib');
use Plack::Builder;
use Amon2::Lite;

use Text::Xslate qw/html_builder mark_raw/;
use Text::Markdown qw/markdown/;

sub config {
+{
'Text::Xslate' => {
'function' => {
markdown => html_builder { Text::Markdown::markdown(@_) },
},
}
}
}

get '/markdown_sample' => sub { $_[0]->render('markdown_sample.tx') };

builder {
enable 'Plack::Middleware::Static',
path => qr{^(?:/static/|/robot\.txt$|/favicon\.ico$)},
root => File::Spec->catdir(dirname(__FILE__));
enable 'Plack::Middleware::ReverseProxy';
enable 'Plack::Middleware::Session';

__PACKAGE__->to_app();
};

__DATA__
@@ markdown_sample.tx

[% FILTER markdown %]
[% INCLUDE 'docs.txt' %]
[% END %]

@@ docs.txt
text