svn commit: r264558 - in user/des/fbp/lib/Template: . Plugin

Dag-Erling Smørgrav des at FreeBSD.org
Wed Apr 16 21:11:02 UTC 2014


Author: des
Date: Wed Apr 16 21:11:01 2014
New Revision: 264558
URL: http://svnweb.freebsd.org/changeset/base/264558

Log:
  Template::Toolkit plugin for Text::WikiFormat.

Added:
  user/des/fbp/lib/Template/
  user/des/fbp/lib/Template/Plugin/
  user/des/fbp/lib/Template/Plugin/WikiFormat.pm   (contents, props changed)

Added: user/des/fbp/lib/Template/Plugin/WikiFormat.pm
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/des/fbp/lib/Template/Plugin/WikiFormat.pm	Wed Apr 16 21:11:01 2014	(r264558)
@@ -0,0 +1,63 @@
+use utf8;
+package Template::Plugin::WikiFormat;
+
+=head1 NAME
+
+Template::Plugin::WikiFormat
+
+=cut
+
+use strict;
+use warnings;
+use base 'Template::Plugin::Filter';
+use Text::WikiFormat;
+
+=head1 DESCRIPTION
+
+L<Template::Toolkit> filter plugin for L<Text::WikiFormat>
+
+=head1 METHODS
+
+=head2 init
+
+The initialization function.
+
+=cut
+
+sub init($) {
+    my ($self) = @_;
+
+    my $name = $self->{_CONFIG}->{name} || 'wiki';
+    $self->{_DYNAMIC} = 1;
+    $self->install_filter($name);
+    return $self;
+}
+
+=head2 filter
+
+The filter function.
+
+=cut
+
+sub filter($$) {
+    my ($self, $raw) = @_;
+
+    print(STDERR "Template::Plugin::WikiFormat::filter()\n");
+    return Text::WikiFormat::format($raw, {}, {
+	implicit_links => 0, extended => 1, absolute_links => 1 });
+}
+
+=head1 AUTHOR
+
+Dag-Erling Smørgrav <des at freebsd.org>
+
+=head1 LICENSE
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
+
+# $FreeBSD$


More information about the svn-src-user mailing list