Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Apr 2014 21:11:02 +0000 (UTC)
From:      Dag-Erling Smørgrav <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r264558 - in user/des/fbp/lib/Template: . Plugin
Message-ID:  <201404162111.s3GLB2CR039904@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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$



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404162111.s3GLB2CR039904>