Permalink
Browse files

docs

  • Loading branch information...
1 parent e2070d3 commit e6150483df08c714284906492a525c011d668290 @rjbs rjbs committed Oct 27, 2009
Showing with 52 additions and 0 deletions.
  1. +50 −0 lib/Pod/Elemental/Transformer/WikiDoc.pm
  2. +2 −0 t/simple.t
@@ -1,26 +1,76 @@
package Pod::Elemental::Transformer::WikiDoc;
use Moose;
with 'Pod::Elemental::Transformer';
+# ABSTRACT: a transformer to replace "wikidoc" data regions with Pod5 elements
+
+=head1 SYNOPSIS
+
+ my $document = Pod::Elemental->read_string( $string );
+ Pod::Elemental::Transformer::Pod5->new->transform_node( $document );
+
+ Pod::Elemental::Transformer::WikiDoc->new->transform_node( $document );
+
+...and if you had a section like this:
+
+ =begin wikidoc
+
+ == Look, a header!
+
+ * Foo
+ * Bar
+ * Baz
+
+ =end wikidoc
+
+...you now have something more like this:
+
+ =head2 Look, a header!
+
+ =over 4
+
+ =item Foo
+
+ =item Bar
+
+ =item Baz
+
+For complete documentation on this dialect, see L<Pod::WikiDoc>.
+
+=cut
+
use namespace::autoclean;
use Moose::Autobox;
use Pod::Elemental::Types qw(FormatName);
use Pod::WikiDoc;
+=attr format_name
+
+This attribute indicates the format name of regions to be transformed from
+WikiDoc. By default, the transformer will look for regions of the format
+"wikidoc."
+
+=cut
+
has format_name => (
is => 'ro',
isa => FormatName,
default => 'wikidoc',
);
+=method transform_node
+
+=cut
+
sub transform_node {
my ($self, $node) = @_;
my $children = $node->children;
PASS: for my $i (0 .. $children->length - 1) {
my $para = $children->[$i];
next unless $para->isa('Pod::Elemental::Element::Pod5::Region')
+ and ! $para->is_pod
and $para->format_name eq $self->format_name;
confess "wikidoc transformer expects wikidoc region to contain 1 Data para"
View
@@ -18,6 +18,8 @@ __DATA__
=head1 Welcome to Pod!
+Right??
+
=begin wikidoc
== Reasons to use WikiDoc:

0 comments on commit e615048

Please sign in to comment.