Pod-Simple-Wiki-0.20/ 000755 000765 000024 00000000000 12620222005 014335 5 ustar 00John staff 000000 000000 Pod-Simple-Wiki-0.20/.travis.yml 000644 000765 000024 00000000126 12476714653 016475 0 ustar 00John staff 000000 000000 language: perl perl: - "5.18" - "5.16" - "5.14" - "5.12" - "5.10" - "5.8" Pod-Simple-Wiki-0.20/bin/ 000755 000765 000024 00000000000 12620222004 015104 5 ustar 00John staff 000000 000000 Pod-Simple-Wiki-0.20/Changes 000644 000765 000024 00000005044 12620221575 015646 0 ustar 00John staff 000000 000000 Revision history for Pod::Simple::Wiki. 0.20 November 9 2015 ! Fix pod error in pod2wiki. Thanks Gregor Herrmann. Issue #19. 0.19 October 27 2015 + Added Emacs Muse format. Thanks to Marco Pessotto. 0.18 March 8 2015 + Fixed escaping of special symbols in text and headers for the Confluence wiki format. Thanks to Lubo Rintel and Zoffix Znet. RT#38833 / Issue #4. 0.17 March 8 2015 + Fix for Markdown CPAN text. 0.16 May 4 2014 + Added support for Markdown. Thanks to Daniel T. Staal. 0.15 Oct 14 2012 + Added options for beautifying MediaWiki output. Changes provided by Peter Hallam. + Added rudimentary link support to Confluence. 0.14 Sept 17 2010 ! Fix for RT#37480. Allow the output encoding to be specified by the --encoding pod2wiki option. 0.13 Aug 24 2010 ! Fix for RT#60650: Escape TiddlyWiki words. Patch by Olivier 'dolmen' Mengue'. 0.12 Aug 22 2010 ! Fix for RT#60304: Escape TiddlyWiki format sequences. Patch by Olivier 'dolmen' Mengue'. ! Fix for RT#60307: Ignore X<>. Patch by Olivier 'dolmen' Mengue'. 0.11 Aug 29 2009 ! Fix for literal newline in
block in Textile filter.
0.10 Aug 28 2009
+ Added Textile support for github wikis.
0.09 May 24 2008
+ Added Confluence support.
Thanks to David Bartle, Andrew Hobbs and
Jim Renwick for patches.
0.08 August 25 2007
+ Added TiddlyWiki support.
Thanks Tim Bunce and Ron Savage.
+ Added better MediaWiki support and tests.
Thanks Christopher J. Madsen.
0.07 February 1 2007
+ Refactored format handlers into separate modules
to make them easier to port and test.
+ Added Pod::Simple::Wiki::Template as an example
of how to port a format.
0.06 January 30 2007
+ Added MoinMoin support (Michael Matthews)
0.05 March 30 2005
+ Added support for TWiki formatting (Sam Tregar)
+ Added support for Wikipedia formatting (Tony Sidaway)
! Updated to the new C2 Wiki bullet list format.
+ Added more tests.
0.04 August 24 2004
! Fixed bug when parsing F<> formats.
Reported by Markus Dreyer.
! Fixed bug in kwiki h4 directives.
+ Added tests for formats and headings.
+ Added pod2wiki command line utility.
0.03 July 21 2003
+ First CPAN release.
+ Added usemod support.
0.02 May 21 2003
+ First release to pod+people mailing list.
+ Added Kwiki support.
0.01 May 21 2003
+ Initial version.
+ c2wiki support.
Pod-Simple-Wiki-0.20/examples/ 000755 000765 000024 00000000000 12620222005 016153 5 ustar 00John staff 000000 000000 Pod-Simple-Wiki-0.20/lib/ 000755 000765 000024 00000000000 12620222004 015102 5 ustar 00John staff 000000 000000 Pod-Simple-Wiki-0.20/Makefile.PL 000644 000765 000024 00000001733 12476714653 016343 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
use ExtUtils::MakeMaker;
use strict;
require 5.008;
my %deps = (
'Pod::Simple' => 0,
);
my %resources = (
homepage => 'http://jmcnamara.github.com/pod-simple-wiki/',
repository => 'http://github.com/jmcnamara/pod-simple-wiki',
bugtracker => 'http://github.com/jmcnamara/pod-simple-wiki/issues',
);
my %params = (
'AUTHOR' => 'John McNamara (jmcnamara@cpan.org)',
'NAME' => 'Pod::Simple::Wiki',
'ABSTRACT_FROM' => 'lib/Pod/Simple/Wiki.pm',
'VERSION_FROM' => 'lib/Pod/Simple/Wiki.pm',
'NEEDS_LINKING' => 0,
'dist' => { COMPRESS => 'gzip --best', SUFFIX => 'gz' },
'EXE_FILES' => ['bin/pod2wiki'],
'LICENSE' => 'perl',
'PREREQ_PM' => \%deps,
);
if ( $ExtUtils::MakeMaker::VERSION ge '6.46' ) {
$params{META_MERGE} = { resources => \%resources };
}
if ( $ExtUtils::MakeMaker::VERSION ge '6.30_01' ) {
$params{LICENSE} = 'perl';
}
WriteMakefile(%params);
Pod-Simple-Wiki-0.20/MANIFEST 000644 000765 000024 00000002720 12620222005 015467 0 ustar 00John staff 000000 000000 .travis.yml
Changes
MANIFEST
Makefile.PL
README
bin/pod2wiki
examples/pod2wiki.pl
examples/pod2wiki_simple.pl
lib/Pod/Simple/Wiki.pm
lib/Pod/Simple/Wiki/Confluence.pm
lib/Pod/Simple/Wiki/Kwiki.pm
lib/Pod/Simple/Wiki/Markdown.pm
lib/Pod/Simple/Wiki/Mediawiki.pm
lib/Pod/Simple/Wiki/Moinmoin.pm
lib/Pod/Simple/Wiki/Muse.pm
lib/Pod/Simple/Wiki/Template.pm
lib/Pod/Simple/Wiki/Textile.pm
lib/Pod/Simple/Wiki/Tiddlywiki.pm
lib/Pod/Simple/Wiki/Twiki.pm
lib/Pod/Simple/Wiki/Usemod.pm
t/confluence_format.t
t/confluence_head.t
t/confluence_links.t
t/confluence_lists.t
t/kwiki_format.t
t/kwiki_head.t
t/kwiki_lists.t
t/markdown_escapes.t
t/markdown_format.t
t/markdown_head.t
t/markdown_links.t
t/markdown_lists.t
t/mediawiki_custom_tags.t
t/mediawiki_format.t
t/mediawiki_head.t
t/mediawiki_link_prefix.t
t/mediawiki_links.t
t/mediawiki_lists.t
t/mediawiki_remove_name_section.t
t/mediawiki_sentence_case_headers.t
t/mediawiki_transformer_lists.t
t/moinmoin_format.t
t/moinmoin_lists.t
t/muse_format.t
t/muse_head.t
t/muse_links.t
t/muse_lists.t
t/textile_format.t
t/textile_head.t
t/textile_lists.t
t/tiddlywiki_format.t
t/tiddlywiki_head.t
t/tiddlywiki_lists.t
t/tiddlywiki_text.t
t/twiki_format.t
t/twiki_head.t
t/twiki_lists.t
t/usemod_format.t
t/usemod_head.t
t/usemod_lists.t
t/wiki_format.t
t/wiki_head.t
t/wiki_lists.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
Pod-Simple-Wiki-0.20/META.json 000644 000765 000024 00000002237 12620222005 015762 0 ustar 00John staff 000000 000000 {
"abstract" : "A class for creating Pod to Wiki filters.",
"author" : [
"John McNamara (jmcnamara@cpan.org)"
],
"dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.142060",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "Pod-Simple-Wiki",
"no_index" : {
"directory" : [
"t",
"inc"
]
},
"prereqs" : {
"build" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"runtime" : {
"requires" : {
"Pod::Simple" : "0"
}
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
"web" : "http://github.com/jmcnamara/pod-simple-wiki/issues"
},
"homepage" : "http://jmcnamara.github.com/pod-simple-wiki/",
"repository" : {
"url" : "http://github.com/jmcnamara/pod-simple-wiki"
}
},
"version" : "0.20"
}
Pod-Simple-Wiki-0.20/META.yml 000644 000765 000024 00000001304 12620222005 015604 0 ustar 00John staff 000000 000000 ---
abstract: 'A class for creating Pod to Wiki filters.'
author:
- 'John McNamara (jmcnamara@cpan.org)'
build_requires:
ExtUtils::MakeMaker: '0'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.142060'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: Pod-Simple-Wiki
no_index:
directory:
- t
- inc
requires:
Pod::Simple: '0'
resources:
bugtracker: http://github.com/jmcnamara/pod-simple-wiki/issues
homepage: http://jmcnamara.github.com/pod-simple-wiki/
repository: http://github.com/jmcnamara/pod-simple-wiki
version: '0.20'
Pod-Simple-Wiki-0.20/README 000644 000765 000024 00000002635 12476714653 015253 0 ustar 00John staff 000000 000000 NAME
Pod::Simple::Wiki - A class for creating Pod to Wiki filters.
DESCRIPTION
The `Pod::Simple::Wiki' module is used for converting Pod text
to Wiki text.
Pod (Plain Old Documentation) is a simple markup language used
for writing Perl documentation.
A Wiki is a user extensible web site. It uses very simple mark-
up that is converted to Html.
For an introduction to Wikis see: http://en.wikipedia.org/wiki/Wiki
SYNOPSIS
To create a simple `pod2wiki' filter:
#!/usr/bin/perl
use strict;
use warnings;
use Pod::Simple::Wiki;
my $parser = Pod::Simple::Wiki->new();
if ( defined $ARGV[0] ) {
open IN, $ARGV[0] or die "Couldn't open $ARGV[0]: $!\n";
}
else {
*IN = *STDIN;
}
if ( defined $ARGV[1] ) {
open OUT, ">$ARGV[1]" or die "Couldn't open $ARGV[1]: $!\n";
}
else {
*OUT = *STDOUT;
}
$parser->output_fh( *OUT );
$parser->parse_file( *IN );
__END__
SEE ALSO
This module also installs a `pod2wiki' command line utility. See
`pod2wiki --help' for details.
AUTHOR
John McNamara jmcnamara@cpan.org
COPYRIGHT
Copyright MMIII-MMXV, John McNamara.
All Rights Reserved. This module is free software. It may be
used, redistributed and/or modified under the same terms as Perl
itself.
Pod-Simple-Wiki-0.20/t/ 000755 000765 000024 00000000000 12620222005 014600 5 ustar 00John staff 000000 000000 Pod-Simple-Wiki-0.20/t/confluence_format.t 000644 000765 000024 00000003417 12476714653 020513 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for I<>, B<>, C<> etc., formatting codes.
#
# Copyright (c), August 2004, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 6;
my $style = 'confluence';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple formatting tests
[ "=pod\n\nI" => qq(_Foo_\n\n), 'Italic' ],
[ "=pod\n\nB" => qq(*Foo*\n\n), 'Bold' ],
[ "=pod\n\nC" => qq({{Foo}}\n\n), 'Monospace' ],
[ "=pod\n\nF" => qq(_Foo_\n\n), 'Filename' ],
# Nested formatting tests
[ "=pod\n\nB>" => qq(*_Foo_*\n\n), 'Bold Italic' ],
[ "=pod\n\nI>" => qq(_*Foo*_\n\n), 'Italic Bold' ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/confluence_head.t 000644 000765 000024 00000003734 12477131273 020116 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =head pod directives.
#
# Copyright (c), August 2004, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 5;
my $style = 'confluence';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
[ "=pod\n\n=head1 Head 1" => qq(h1. Head 1\n\n) ],
[ "=pod\n\n=head2 Head 2" => qq(h2. Head 2\n\n) ],
[ "=pod\n\n=head3 Head 3" => qq(h3. Head 3\n\n) ],
[ "=pod\n\n=head4 Head 4" => qq(h4. Head 4\n\n) ],
[
"=pod\n\n=head1 [head] {head} -head- _head_ *head*" =>
qq(h1. \\[head] \\{head} \\-head\\- \\_head\\_ \\*head\\*\n\n)
],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: " . encode_escapes( $pod ) );
}
###############################################################################
#
# Encode escapes to make them visible in the test output.
#
sub encode_escapes {
my $data = $_[0];
for ( $data ) {
s/\t/\\t/g;
s/\n/\\n/g;
}
return $data;
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $pod2 = encode_escapes( $pod );
$pod2 =~ s/^=pod\\n\\n//;
print "h2. Test ", $test++, ":\t", $pod2, "\n";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/confluence_links.t 000644 000765 000024 00000003314 12476714653 020337 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for L<> link formatting codes.
#
# Copyright (c), January 2011, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 4;
my $style = 'confluence';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple URLs.
[ "=pod\n\nL" => qq([www.perl.com]\n\n), 'Simple URL' ],
[
"=pod\n\nL" => qq([Perl|www.perl.com]\n\n),
'Simple URL with text'
],
[ "=pod\n\nL" => qq([Document]\n\n), 'Simple doc link' ],
[ "=pod\n\nL" => qq([Doc Link]\n\n), 'Simple doc link' ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/confluence_lists.t 000644 000765 000024 00000015246 12476714653 020364 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =over ... =back regions.
#
# Copyright (c), March 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 12;
my $style = 'confluence';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests;
#
# Extract tests embedded in _DATA_ section.
#
my $test_no = 1;
my $pod;
my $test = '';
my $todo = '';
my $name;
while ( ) {
if ( /^#/ ) {
$name = $1 if /NAME: (.*)/;
$todo = $1 if /TODO: (.*)/;
if ( $test ) {
if ( $test_no % 2 ) {
$pod = $test;
}
else {
push @tests, [ $pod, $test, $name, $todo ];
$name = '';
$todo = '';
}
$test = '';
$test_no++;
}
next;
}
s/\r//; # Remove any \r chars that slip in.
s/\\t/\t/g; # Sub back in any escaped tabs.
s/\\#/#/g; # Sub back in any escaped comments.
$test .= $_;
}
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, " \t" . $name );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
print "h2. Test ", $test++, ":\t", $name, "\n";
$parser->parse_string_document( $pod );
}
}
__DATA__
################################################################################
#
# Test data.
#
################################################################################
#
# NAME: Test for single unordered (bullet) item.
#
=pod
=over
=item *
Bullet item
=back
=cut
#
#
# Expected output.
#
#
* Bullet item
################################################################################
#
# NAME: Test for unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=item *
Bullet item 2.0
=item *
Bullet item 3.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
* Bullet item 2.0
* Bullet item 3.0
###############################################################################
#
# NAME: Test for nested unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=over
=item *
Bullet item 1.1
=over
=item *
Bullet item 1.2
=item *
Bullet item 2.2
=back
=item *
Bullet item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
** Bullet item 1.1
*** Bullet item 1.2
*** Bullet item 2.2
** Bullet item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for single ordered (number) item.
#
=pod
=over
=item 1
Number item
=back
=cut
#
#
# Expected output.
#
#
\# Number item
###############################################################################
#
# NAME: Test for ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=item 2
Number item 2.0
=item 3
Number item 3.0
=back
=cut
#
#
# Expected output.
#
#
\# Number item 1.0
\# Number item 2.0
\# Number item 3.0
###############################################################################
#
# NAME: Test for nested ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=over
=item 1
Number item 1.1
=over
=item 1
Number item 1.2
=item 2
Number item 2.2
=back
=item 2
Number item 2.1
=back
=item 2
Number item 2.0
=back
=cut
#
#
# Expected output.
#
#
\# Number item 1.0
\## Number item 1.1
\### Number item 1.2
\### Number item 2.2
\## Number item 2.1
\# Number item 2.0
################################################################################
#
# NAME: Test for single definition list item.
#
=pod
=over
=item Foo
Definition item
=back
=cut
#
#
# Expected output.
#
#
* *Foo* Definition item
###############################################################################
#
# NAME: Test for definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=item Bar
Definition item 2.0
=item Baz
Definition item 3.0
=back
=cut
#
#
# Expected output.
#
#
* *Foo* Definition item 1.0
* *Bar* Definition item 2.0
* *Baz* Definition item 3.0
###############################################################################
#
# NAME: Test for nested definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=over
=item Foo
Definition item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item Bar
Definition item 2.1
=back
=item Bar
Definition item 2.0
=back
=cut
#
#
# Expected output.
#
#
* *Foo* Definition item 1.0
** *Foo* Definition item 1.1
*** *Foo* Definition item 1.2
*** *Bar* Definition item 2.2
** *Bar* Definition item 2.1
* *Bar* Definition item 2.0
###############################################################################
#
# NAME: Test for varied nested list.
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
\## Number item 1.1
*** *Foo* Definition item 1.2
*** *Bar* Definition item 2.2
\## Number item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for definition list without =items, .
#
#
=pod
=over
This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
bq. This is a long sentence that forms part of a definition block.
################################################################################
#
# NAME: Test for definition list without a definition.
#
# TODO: Fix this later.
#
=pod
=over
=item This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
* *This is a long sentence that forms part of a definition block.*
###############################################################################
#
# End
#
###############################################################################
Pod-Simple-Wiki-0.20/t/kwiki_format.t 000644 000765 000024 00000003406 12476714653 017506 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for I<>, B<>, C<> etc., formatting codes.
#
# Copyright (c), August 2004, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 6;
my $style = 'kwiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple formatting tests
[ "=pod\n\nI" => qq(/Foo/\n\n), 'Italic' ],
[ "=pod\n\nB" => qq(*Foo*\n\n), 'Bold' ],
[ "=pod\n\nC" => qq([=Foo]\n\n), 'Monospace' ],
[ "=pod\n\nF" => qq(/Foo/\n\n), 'Filename' ],
# Nested formatting tests
[ "=pod\n\nB>" => qq(*/Foo/*\n\n), 'Bold Italic' ],
[ "=pod\n\nI>" => qq(/*Foo*/\n\n), 'Italic Bold' ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/kwiki_head.t 000644 000765 000024 00000003563 12476714653 017123 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =head pod directives.
#
# Copyright (c), August 2004, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 4;
my $style = 'kwiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
[ "=pod\n\n=head1 Head 1" => qq(\n----\n= Head 1 =\n\n) ],
[ "=pod\n\n=head2 Head 2" => qq(\n== Head 2 ==\n\n) ],
[ "=pod\n\n=head3 Head 3" => qq(\n=== Head 3 ===\n\n) ],
[ "=pod\n\n=head4 Head 4" => qq(==== Head 4\n\n) ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: " . encode_escapes( $pod ) );
}
###############################################################################
#
# Encode escapes to make them visible in the test output.
#
sub encode_escapes {
my $data = $_[0];
for ( $data ) {
s/\t/\\t/g;
s/\n/\\n/g;
}
return $data;
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $pod2 = encode_escapes( $pod );
$pod2 =~ s/^=pod\\n\\n//;
print "Test ", $test++, ":\t", $pod2, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__END__
Pod-Simple-Wiki-0.20/t/kwiki_lists.t 000644 000765 000024 00000015313 12476714653 017354 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =over ... =back regions.
#
# Copyright (c), March 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 12;
my $style = 'kwiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests;
#
# Extract tests embedded in _DATA_ section.
#
my $test_no = 1;
my $pod;
my $test = '';
my $todo = '';
my $name;
while ( ) {
if ( /^#/ ) {
$name = $1 if /NAME: (.*)/;
$todo = $1 if /TODO: (.*)/;
if ( $test ) {
if ( $test_no % 2 ) {
$pod = $test;
}
else {
push @tests, [ $pod, $test, $name, $todo ];
$name = '';
$todo = '';
}
$test = '';
$test_no++;
}
next;
}
s/\r//; # Remove any \r chars that slip in.
s/\\t/\t/g; # Sub back in any escaped tabs.
s/\\#/#/g; # Sub back in any escaped comments.
$test .= $_;
}
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, " \t" . $name );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
print "Test ", $test++, ":\t", $name, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__DATA__
################################################################################
#
# Test data.
#
################################################################################
#
# NAME: Test for single unordered (bullet) item.
#
=pod
=over
=item *
Bullet item
=back
=cut
#
#
# Expected output.
#
#
* Bullet item
################################################################################
#
# NAME: Test for unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=item *
Bullet item 2.0
=item *
Bullet item 3.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
* Bullet item 2.0
* Bullet item 3.0
###############################################################################
#
# NAME: Test for nested unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=over
=item *
Bullet item 1.1
=over
=item *
Bullet item 1.2
=item *
Bullet item 2.2
=back
=item *
Bullet item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
** Bullet item 1.1
*** Bullet item 1.2
*** Bullet item 2.2
** Bullet item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for single ordered (number) item.
#
=pod
=over
=item 1
Number item
=back
=cut
#
#
# Expected output.
#
#
0 Number item
###############################################################################
#
# NAME: Test for ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=item 2
Number item 2.0
=item 3
Number item 3.0
=back
=cut
#
#
# Expected output.
#
#
0 Number item 1.0
0 Number item 2.0
0 Number item 3.0
###############################################################################
#
# NAME: Test for nested ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=over
=item 1
Number item 1.1
=over
=item 1
Number item 1.2
=item 2
Number item 2.2
=back
=item 2
Number item 2.1
=back
=item 2
Number item 2.0
=back
=cut
#
#
# Expected output.
#
#
0 Number item 1.0
00 Number item 1.1
000 Number item 1.2
000 Number item 2.2
00 Number item 2.1
0 Number item 2.0
################################################################################
#
# NAME: Test for single definition list item.
#
=pod
=over
=item Foo
Definition item
=back
=cut
#
#
# Expected output.
#
#
; Foo ; Definition item
###############################################################################
#
# NAME: Test for definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=item Bar
Definition item 2.0
=item Baz
Definition item 3.0
=back
=cut
#
#
# Expected output.
#
#
; Foo ; Definition item 1.0
; Bar ; Definition item 2.0
; Baz ; Definition item 3.0
###############################################################################
#
# NAME: Test for nested definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=over
=item Foo
Definition item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item Bar
Definition item 2.1
=back
=item Bar
Definition item 2.0
=back
=cut
#
#
# Expected output.
#
#
; Foo ; Definition item 1.0
;; Foo ; Definition item 1.1
;;; Foo ; Definition item 1.2
;;; Bar ; Definition item 2.2
;; Bar ; Definition item 2.1
; Bar ; Definition item 2.0
###############################################################################
#
# NAME: Test for varied nested list.
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
00 Number item 1.1
;;; Foo ; Definition item 1.2
;;; Bar ; Definition item 2.2
00 Number item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for definition list without =items, .
#
# TODO: Fix this later.
#
=pod
=over
This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
; ; This is a long sentence that forms part of a definition block.
################################################################################
#
# NAME: Test for definition list without a definition.
#
# TODO: Fix this later.
#
=pod
=over
=item This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
; This is a long sentence that forms part of a definition block. ;
###############################################################################
#
# End
#
###############################################################################
Pod-Simple-Wiki-0.20/t/markdown_escapes.t 000644 000765 000024 00000006667 12476714653 020361 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =over ... =back regions.
#
# Copyright 2003-2014, John McNamara, jmcnamara@cpan.org, Daniel T. Staal,
# DStaal@usa.net
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 4;
my $style = 'markdown';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests;
#
# Extract tests embedded in _DATA_ section.
#
my $test_no = 1;
my $pod;
my $test = '';
my $todo = '';
my $name;
while ( ) {
if ( /^#/ ) {
$name = $1 if /NAME: (.*)/;
$todo = $1 if /TODO: (.*)/;
if ( $test ) {
if ( $test_no % 2 ) {
$pod = $test;
}
else {
push @tests, [ $pod, $test, $name, $todo ];
$name = '';
$todo = '';
}
$test = '';
$test_no++;
}
next;
}
s/\r//; # Remove any \r chars that slip in.
s/\\t/\t/g; # Sub back in any escaped tabs.
s/\\#/#/g; # Sub back in any escaped comments.
$test .= $_;
}
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, " \t" . $name );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$name =~ s/</g;
$name =~ s/>/>/g;
print "h2. Test ", $test++, ":\t", $name, "\n\n";
$parser->parse_string_document( $pod );
}
}
__DATA__
################################################################################
#
# Test data.
#
################################################################################
#
# NAME: Test for asterisks.
#
=pod
This text has *asterisks* that need to be escaped.
=cut
#
#
# Expected output.
#
#
This text has \*asterisks\* that need to be escaped.
################################################################################
#
# NAME: Test for underlines.
#
=pod
This text has _underlines_ that need to be escaped.
=cut
#
#
# Expected output.
#
#
This text has \_underlines\_ that need to be escaped.
################################################################################
#
# NAME: Test for backticks.
#
=pod
This text has `backticks` that need to be escaped.
=cut
#
#
# Expected output.
#
#
This text has \`backticks\` that need to be escaped.
################################################################################
#
# NAME: Test for backslash.
#
=pod
This text has \backslashes\ that need to be escaped.
=cut
#
#
# Expected output.
#
#
This text has \\backslashes\\ that need to be escaped.
###############################################################################
#
# End
#
###############################################################################
Pod-Simple-Wiki-0.20/t/markdown_format.t 000644 000765 000024 00000003455 12476714653 020216 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for I<>, B<>, C<> etc., formatting codes.
#
# Copyright 2003-2014, John McNamara, jmcnamara@cpan.org, Daniel T. Staal,
# DStaal@usa.net
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 6;
my $style = 'markdown';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple formatting tests
[ "=pod\n\nI" => qq(_Foo_\n\n), 'Italic' ],
[ "=pod\n\nB" => qq(**Foo**\n\n), 'Bold' ],
[ "=pod\n\nC" => qq(`Foo`\n\n), 'Monospace' ],
[ "=pod\n\nF" => qq(_Foo_\n\n), 'Filename' ],
# Nested formatting tests
[ "=pod\n\nB>" => qq(**_Foo_**\n\n), 'Bold Italic' ],
[ "=pod\n\nI>" => qq(_**Foo**_\n\n), 'Italic Bold' ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/markdown_head.t 000644 000765 000024 00000003566 12476714653 017632 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =head pod directives.
#
# Copyright 2003-2014, John McNamara, jmcnamara@cpan.org, Daniel T. Staal,
# DStaal@usa.net
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 4;
my $style = 'markdown';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
[ "=pod\n\n=head1 Head 1" => qq(# Head 1\n\n) ],
[ "=pod\n\n=head2 Head 2" => qq(## Head 2\n\n) ],
[ "=pod\n\n=head3 Head 3" => qq(### Head 3\n\n) ],
[ "=pod\n\n=head4 Head 4" => qq(#### Head 4\n\n) ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: " . encode_escapes( $pod ) );
}
###############################################################################
#
# Encode escapes to make them visible in the test output.
#
sub encode_escapes {
my $data = $_[0];
for ( $data ) {
s/\t/\\t/g;
s/\n/\\n/g;
}
return $data;
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
for my $test_ref ( @tests ) {
print "\n";
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $pod2 = encode_escapes( $pod );
$pod2 =~ s/^=pod\\n\\n//;
print "*Test ", $test++, "*: @", $pod2, "@\n\n";
$parser->parse_string_document( $pod );
print "\n";
}
}
__END__
Pod-Simple-Wiki-0.20/t/markdown_links.t 000644 000765 000024 00000004043 12476714653 020040 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for L<> links.
#
# Copyright (c), December 2005, John McNamara, jmcnamara@cpan.org,
# Christopher J. Madsen, and Daniel T. Staal
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 4;
my $style = 'markdown';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Links
[
qq(=pod\n\nL.) =>
qq{[http://www.perl.org](http://www.perl.org).\n\n},
'http'
],
[
qq(=pod\n\nL"METHODS">) => qq{["METHODS"](#METHODS)\n\n},
'Internal link'
],
[
qq(=pod\n\nL) => qq{[Other::Module](Other::Module)\n\n},
'Other::Module'
],
[
qq(=pod\n\nL) =>
qq{["METHODS" in Other::Module](Other::Module#METHODS)\n\n},
'Other::Module/METHODS'
],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
} ## end for my $test_ref ( @tests)
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head1 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
} ## end for my $test_ref ( @tests)
} ## end sub output_tests
__END__
Pod-Simple-Wiki-0.20/t/markdown_lists.t 000644 000765 000024 00000015535 12476714653 020066 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =over ... =back regions.
#
# Copyright 2003-2014, John McNamara, jmcnamara@cpan.org, Daniel T. Staal,
# DStaal@usa.net
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 12;
my $style = 'markdown';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests;
#
# Extract tests embedded in _DATA_ section.
#
my $test_no = 1;
my $pod;
my $test = '';
my $todo = '';
my $name;
while ( ) {
if ( /^#/ ) {
$name = $1 if /NAME: (.*)/;
$todo = $1 if /TODO: (.*)/;
if ( $test ) {
if ( $test_no % 2 ) {
$pod = $test;
}
else {
push @tests, [ $pod, $test, $name, $todo ];
$name = '';
$todo = '';
}
$test = '';
$test_no++;
}
next;
}
s/\r//; # Remove any \r chars that slip in.
s/\\t/\t/g; # Sub back in any escaped tabs.
s/\\#/#/g; # Sub back in any escaped comments.
$test .= $_;
}
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, " \t" . $name );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$name =~ s/</g;
$name =~ s/>/>/g;
print "h2. Test ", $test++, ":\t", $name, "\n\n";
$parser->parse_string_document( $pod );
}
}
__DATA__
################################################################################
#
# Test data.
#
################################################################################
#
# NAME: Test for single unordered (bullet) item.
#
=pod
=over
=item *
Bullet item
=back
=cut
#
#
# Expected output.
#
#
* Bullet item
################################################################################
#
# NAME: Test for unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=item *
Bullet item 2.0
=item *
Bullet item 3.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
* Bullet item 2.0
* Bullet item 3.0
###############################################################################
#
# NAME: Test for nested unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=over
=item *
Bullet item 1.1
=over
=item *
Bullet item 1.2
=item *
Bullet item 2.2
=back
=item *
Bullet item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
* Bullet item 1.1
* Bullet item 1.2
* Bullet item 2.2
* Bullet item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for single ordered (number) item.
#
=pod
=over
=item 1
Number item
=back
=cut
#
#
# Expected output.
#
#
1 Number item
###############################################################################
#
# NAME: Test for ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=item 2
Number item 2.0
=item 3
Number item 3.0
=back
=cut
#
#
# Expected output.
#
#
1 Number item 1.0
1 Number item 2.0
1 Number item 3.0
###############################################################################
#
# NAME: Test for nested ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=over
=item 1
Number item 1.1
=over
=item 1
Number item 1.2
=item 2
Number item 2.2
=back
=item 2
Number item 2.1
=back
=item 2
Number item 2.0
=back
=cut
#
#
# Expected output.
#
#
1 Number item 1.0
1 Number item 1.1
1 Number item 1.2
1 Number item 2.2
1 Number item 2.1
1 Number item 2.0
################################################################################
#
# NAME: Test for single definition list item.
#
=pod
=over
=item Foo
Definition item
=back
=cut
#
#
# Expected output.
#
#
Foo
: Definition item
###############################################################################
#
# NAME: Test for definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=item Bar
Definition item 2.0
=item Baz
Definition item 3.0
=back
=cut
#
#
# Expected output.
#
#
Foo
: Definition item 1.0
Bar
: Definition item 2.0
Baz
: Definition item 3.0
###############################################################################
#
# NAME: Test for nested definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=over
=item Foo
Definition item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item Bar
Definition item 2.1
=back
=item Bar
Definition item 2.0
=back
=cut
#
#
# Expected output.
#
#
Foo
: Definition item 1.0
Foo
: Definition item 1.1
Foo
: Definition item 1.2
Bar
: Definition item 2.2
Bar
: Definition item 2.1
Bar
: Definition item 2.0
###############################################################################
#
# NAME: Test for varied nested list.
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
1 Number item 1.1
Foo
: Definition item 1.2
Bar
: Definition item 2.2
1 Number item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for definition list without =items, .
#
=pod
=over
This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
This is a long sentence that forms part of a definition block.
################################################################################
#
# NAME: Test for definition list without a definition.
#
# TODO: Fix this later.
#
=pod
=over
=item This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
- := This is a long sentence that forms part of a definition block.
###############################################################################
#
# End
#
###############################################################################
Pod-Simple-Wiki-0.20/t/mediawiki_custom_tags.t 000644 000765 000024 00000003275 12476714653 021377 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for custom formatting codes.
#
# Copyright (c), October 2012, Peter Hallam, pragmatic@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 1;
my $style = 'mediawiki';
my $opts = {
custom_tags => {
'' => "\n",
'
' => "\n\n\n",
}
};
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple formatting tests
[
"=pod\n\n Foo" =>
qq(\n Foo\n \n\n),
'Syntaxhighlight code'
],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style, $opts );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style, $opts );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/mediawiki_format.t 000644 000765 000024 00000003775 12477131260 020330 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for I<>, B<>, C<> etc., formatting codes.
#
# Copyright (c), December 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 7;
my $style = 'mediawiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple formatting tests
[ "=pod\n\nI" => qq(''Foo''\n\n), 'Italic' ],
[ "=pod\n\nB" => qq('''Foo'''\n\n), 'Bold' ],
[ "=pod\n\nC" => qq(Foo\n\n), 'Monospace' ],
[ "=pod\n\nF" => qq(''Foo''\n\n), 'Filename' ],
# Nested formatting tests
[ "=pod\n\nB>" => qq('''''Foo'''''\n\n), 'Bold Italic' ],
[ "=pod\n\nI>" => qq('''''Foo'''''\n\n), 'Italic Bold' ],
# Character escaping
[
"=pod\n\nThis is neither ''italic'' nor '''bold'''" =>
qq(This is neither ''italic'' nor '''bold'''\n\n),
'Single quotes'
],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/mediawiki_head.t 000644 000765 000024 00000003550 12476714653 017744 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =head pod directives.
#
# Copyright (c), August 2004, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 4;
my $style = 'mediawiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
[ "=pod\n\n=head1 Head 1" => qq(==Head 1==\n) ],
[ "=pod\n\n=head2 Head 2" => qq(===Head 2===\n) ],
[ "=pod\n\n=head3 Head 3" => qq(====Head 3====\n) ],
[ "=pod\n\n=head4 Head 4" => qq(=====Head 4=====\n) ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: " . encode_escapes( $pod ) );
}
###############################################################################
#
# Encode escapes to make them visible in the test output.
#
sub encode_escapes {
my $data = $_[0];
for ( $data ) {
s/\t/\\t/g;
s/\n/\\n/g;
}
return $data;
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $pod2 = encode_escapes( $pod );
$pod2 =~ s/^=pod\\n\\n//;
print "Test ", $test++, ":\t", $pod2, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__END__
Pod-Simple-Wiki-0.20/t/mediawiki_link_prefix.t 000644 000765 000024 00000003446 12476714653 021361 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for the CPANification of L<> links.
#
# Copyright (c), October 2012, Peter Hallam, pragmatic@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 2;
my $style = 'mediawiki';
my $opts = { link_prefix => 'http://search.cpan.org/perldoc?' };
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Links
[
qq(=pod\n\nL) =>
qq([http://search.cpan.org/perldoc?Other::Module Other::Module]\n\n),
'Other::Module'
],
[
qq(=pod\n\nL) =>
qq([http://search.cpan.org/perldoc?Other::Module#METHODS "METHODS" in Other::Module]\n\n),
'Other::Module/METHODS'
],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style, $opts );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style, $opts );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head1 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/mediawiki_links.t 000644 000765 000024 00000004257 12476714653 020170 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for L<> links.
#
# Copyright (c), December 2005, John McNamara, jmcnamara@cpan.org
# and Christopher J. Madsen
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 6;
my $style = 'mediawiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Links
[
"=pod\n\nL." => qq(http://www.perl.org.\n\n),
'http'
],
[
"=pod\n\nL." =>
qq([http://www.google.com Google].\n\n),
'http with text'
],
[
"=pod\n\nL." =>
qq([https://www.google.com Google(s)].\n\n),
'https with text'
],
[
qq(=pod\n\nL"METHODS">) => qq([[#METHODS|"METHODS"]]\n\n),
'Internal link'
],
[
qq(=pod\n\nL) => qq([[Other::Module]]\n\n),
'Other::Module'
],
[
qq(=pod\n\nL) =>
qq([[Other::Module#METHODS|"METHODS" in Other::Module]]\n\n),
'Other::Module/METHODS'
],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head1 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/mediawiki_lists.t 000644 000765 000024 00000017300 12476714653 020177 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =over ... =back regions.
#
# Copyright (c), March 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 14;
my $style = 'mediawiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests;
#
# Extract tests embedded in _DATA_ section.
#
my $test_no = 1;
my $pod;
my $test = '';
my $todo = '';
my $name;
while ( ) {
if ( /^#/ ) {
$name = $1 if /NAME: (.*)/;
$todo = $1 if /TODO: (.*)/;
if ( $test ) {
if ( $test_no % 2 ) {
$pod = $test;
}
else {
push @tests, [ $pod, $test, $name, $todo ];
$name = '';
$todo = '';
}
$test = '';
$test_no++;
}
next;
}
s/\r//; # Remove any \r chars that slip in.
s/\\t/\t/g; # Sub back in any escaped tabs.
s/\\#/#/g; # Sub back in any escaped comments.
$test .= $_;
}
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, " \t" . $name );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
print "Test ", $test++, ":\t", $name, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__DATA__
################################################################################
#
# Test data.
#
################################################################################
#
# NAME: Test for single unordered (bullet) item.
#
=pod
=over
=item *
Bullet item
=back
=cut
#
#
# Expected output.
#
#
* Bullet item
################################################################################
#
# NAME: Test for unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=item *
Bullet item 2.0
=item *
Bullet item 3.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
* Bullet item 2.0
* Bullet item 3.0
###############################################################################
#
# NAME: Test for nested unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=over
=item *
Bullet item 1.1
=over
=item *
Bullet item 1.2
=item *
Bullet item 2.2
=back
=item *
Bullet item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
** Bullet item 1.1
*** Bullet item 1.2
*** Bullet item 2.2
** Bullet item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for single ordered (number) item.
#
=pod
=over
=item 1
Number item
=back
=cut
#
#
# Expected output.
#
#
\# Number item
###############################################################################
#
# NAME: Test for ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=item 2
Number item 2.0
=item 3
Number item 3.0
=back
=cut
#
#
# Expected output.
#
#
\# Number item 1.0
\# Number item 2.0
\# Number item 3.0
###############################################################################
#
# NAME: Test for nested ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=over
=item 1
Number item 1.1
=over
=item 1
Number item 1.2
=item 2
Number item 2.2
=back
=item 2
Number item 2.1
=back
=item 2
Number item 2.0
=back
=cut
#
#
# Expected output.
#
#
\# Number item 1.0
\## Number item 1.1
\### Number item 1.2
\### Number item 2.2
\## Number item 2.1
\# Number item 2.0
################################################################################
#
# NAME: Test for single definition list item.
#
=pod
=over
=item Foo
Definition item
=back
=cut
#
#
# Expected output.
#
#
; Foo
:Definition item
###############################################################################
#
# NAME: Test for definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=item Bar
Definition item 2.0
=item Baz
Definition item 3.0
=back
=cut
#
#
# Expected output.
#
#
; Foo
:Definition item 1.0
; Bar
:Definition item 2.0
; Baz
:Definition item 3.0
###############################################################################
#
# NAME: Test for nested definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=over
=item Foo
Definition item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item Bar
Definition item 2.1
=back
=item Bar
Definition item 2.0
=back
=cut
#
#
# Expected output.
#
#
; Foo
:Definition item 1.0
:; Foo
::Definition item 1.1
::; Foo
:::Definition item 1.2
::; Bar
:::Definition item 2.2
:; Bar
::Definition item 2.1
; Bar
:Definition item 2.0
###############################################################################
#
# NAME: Test for varied nested list (incorrect).
#
# Note that the output is not formatted correctly (see the next TODO test)
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
\## Number item 1.1
::; Foo
:::Definition item 1.2
::; Bar
:::Definition item 2.2
\## Number item 2.1
* Bullet item 2.0
###############################################################################
#
# NAME: Test for varied nested list.
#
# TODO: Nest lists correctly
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
*# Number item 1.1
*#; Foo
*#:Definition item 1.2
*#; Bar
*#:Definition item 2.2
*# Number item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for definition list without =items, .
#
=pod
=over
This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
:This is a long sentence that forms part of a definition block.
################################################################################
#
# NAME: Test for definition list without a definition.
#
=pod
=over
=item This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
; This is a long sentence that forms part of a definition block.
################################################################################
#
# NAME: Test 2 for definition list without a definition.
#
# TODO: Needs a newline after the first item
#
=pod
=over
=item This is a long sentence that forms part of a definition block.
=item This is the next item.
=back
=cut
#
#
# Expected output.
#
#
; This is a long sentence that forms part of a definition block.
; This is the next item.
###############################################################################
#
# End
#
###############################################################################
Pod-Simple-Wiki-0.20/t/mediawiki_remove_name_section.t 000644 000765 000024 00000003414 12476714653 023063 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for the removal of a NAME section.
#
# Copyright (c), October 2012, Peter Hallam, pragmatic@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 1;
my $style = 'mediawiki';
my $opts = { remove_name_section => 1 };
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Links
[
qq(=pod\n\n=head1 NAME\n\nOther::Module - Other abstract\n\n=head1 DESCRIPTION\n\nSome description)
=> qq(Other abstract\n\n==DESCRIPTION==\nSome description\n\n),
'Other::Module'
],
# [ qq(=pod\n\n=head1 Name\n\nOther::Module - Other abstract) => qq(Other abstract\n\n), 'Other::Module'],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style, $opts );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style, $opts );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head1 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
print $pod;
}
}
__END__
Pod-Simple-Wiki-0.20/t/mediawiki_sentence_case_headers.t 000644 000765 000024 00000003544 12476714653 023340 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =head1 pod sentence-cased directives.
#
# Copyright (c), October 2012, Peter Hallam, pragmatic@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 2;
my $style = 'mediawiki';
my $opts = { sentence_case_headers => 1 };
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
[ "=pod\n\n=head1 DESCRIPTION" => qq(==Description==\n) ],
[ "=pod\n\n=head1 COPYRIGHT & LICENSE" => qq(==Copyright & license==\n) ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style, $opts );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: " . encode_escapes( $pod ) );
}
###############################################################################
#
# Encode escapes to make them visible in the test output.
#
sub encode_escapes {
my $data = $_[0];
for ( $data ) {
s/\t/\\t/g;
s/\n/\\n/g;
}
return $data;
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style, $opts );
my $pod = $test_ref->[0];
my $pod2 = encode_escapes( $pod );
$pod2 =~ s/^=pod\\n\\n//;
print "Test ", $test++, ":\t", $pod2, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__END__
Pod-Simple-Wiki-0.20/t/mediawiki_transformer_lists.t 000644 000765 000024 00000005767 12476714653 022637 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =over ... =back regions.
#
# Copyright (c), October 2012, Peter Hallam, pragmatic@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 1;
my $style = 'mediawiki';
my $opts = { transformer_lists => 1 };
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests;
#
# Extract tests embedded in _DATA_ section.
#
my $test_no = 1;
my $pod;
my $test = '';
my $todo = '';
my $name;
while ( ) {
if ( /^#/ ) {
$name = $1 if /NAME: (.*)/;
$todo = $1 if /TODO: (.*)/;
if ( $test ) {
if ( $test_no % 2 ) {
$pod = $test;
}
else {
push @tests, [ $pod, $test, $name, $todo ];
$name = '';
$todo = '';
}
$test = '';
$test_no++;
}
next;
}
s/\r//; # Remove any \r chars that slip in.
s/\\t/\t/g; # Sub back in any escaped tabs.
s/\\#/#/g; # Sub back in any escaped comments.
$test .= $_;
}
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style, $opts );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, " \t" . $name );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style, $opts );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
print "Test ", $test++, ":\t", $name, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__DATA__
################################################################################
#
# Test data.
#
################################################################################
#
# NAME: Test for varied nested list (incorrect).
#
# Note that the output is not formatted correctly (see the next TODO test)
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
\## Number item 1.1::; FooDefinition item 1.2::; Bar
Definition item 2.2## Number item 2.1
* Bullet item 2.0
###############################################################################
#
# End
#
###############################################################################
Pod-Simple-Wiki-0.20/t/moinmoin_format.t 000644 000765 000024 00000003443 12476714653 020216 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for I<>, B<>, C<> etc., formatting codes.
#
# Copyright (c), December 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 6;
my $style = 'moinmoin';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple formatting tests
[ "=pod\n\nI" => qq(''Foo''\n\n), 'Italic' ],
[ "=pod\n\nB" => qq('''Foo'''\n\n), 'Bold' ],
[ "=pod\n\nC" => qq(`Foo`\n\n), 'Monospace' ],
[ "=pod\n\nF" => qq(''Foo''\n\n), 'Filename' ],
# Nested formatting tests
[ "=pod\n\nB>" => qq('''''Foo'''''\n\n), 'Bold Italic' ],
[ "=pod\n\nI>" => qq('''''Foo'''''\n\n), 'Italic Bold' ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/moinmoin_lists.t 000644 000765 000024 00000017662 12476714653 020074 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =over ... =back regions.
#
# Copyright (c), December 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 15;
my $style = 'moinmoin';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests;
#
# Extract tests embedded in _DATA_ section.
#
my $test_no = 1;
my $pod;
my $test = '';
my $todo = '';
my $name;
while ( ) {
if ( /^#/ ) {
$name = $1 if /NAME: (.*)/;
$todo = $1 if /TODO: (.*)/;
if ( $test ) {
if ( $test_no % 2 ) {
$pod = $test;
}
else {
push @tests, [ $pod, $test, $name, $todo ];
$name = '';
$todo = '';
}
$test = '';
$test_no++;
}
next;
}
s/\r//; # Remove any \r chars that slip in.
s/\\t/\t/g; # Sub back in any escaped tabs.
s/\\s/ /g; # Sub back in any escaped spaces.
s/\\#/#/g; # Sub back in any escaped comments.
$test .= $_;
}
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, " \t" . $name );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
print "=== Test ", $test++, ":\t", $name, " ===\n\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__DATA__
################################################################################
#
# Test data.
#
################################################################################
#
# NAME: Test for single unordered (bullet) item.
#
=pod
=over
=item *
Bullet item
=back
=cut
#
#
# Expected output.
#
#
* Bullet item
################################################################################
#
# NAME: Test for unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=item *
Bullet item 2.0
=item *
Bullet item 3.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
* Bullet item 2.0
* Bullet item 3.0
###############################################################################
#
# NAME: Test for nested unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=over
=item *
Bullet item 1.1
=over
=item *
Bullet item 1.2
=item *
Bullet item 2.2
=back
=item *
Bullet item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
* Bullet item 1.1
* Bullet item 1.2
* Bullet item 2.2
* Bullet item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for single ordered (number) item.
#
=pod
=over
=item 1
Number item
=back
=cut
#
#
# Expected output.
#
#
1. Number item
###############################################################################
#
# NAME: Test for ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=item 2
Number item 2.0
=item 3
Number item 3.0
=back
=cut
#
#
# Expected output.
#
#
1. Number item 1.0
1. Number item 2.0
1. Number item 3.0
###############################################################################
#
# NAME: Test for nested ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=over
=item 1
Number item 1.1
=over
=item 1
Number item 1.2
=item 2
Number item 2.2
=back
=item 2
Number item 2.1
=back
=item 2
Number item 2.0
=back
=cut
#
#
# Expected output.
#
#
1. Number item 1.0
1. Number item 1.1
1. Number item 1.2
1. Number item 2.2
1. Number item 2.1
1. Number item 2.0
################################################################################
#
# NAME: Test for single definition list item.
#
=pod
=over
=item Foo
Definition item
=back
=cut
#
#
# Expected output.
#
#
Foo:: Definition item
###############################################################################
#
# NAME: Test for definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=item Bar
Definition item 2.0
=item Baz
Definition item 3.0
=back
=cut
#
#
# Expected output.
#
#
Foo:: Definition item 1.0
Bar:: Definition item 2.0
Baz:: Definition item 3.0
###############################################################################
#
# NAME: Test for nested definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=over
=item Foo
Definition item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item Bar
Definition item 2.1
=back
=item Bar
Definition item 2.0
=back
=cut
#
#
# Expected output.
#
#
Foo:: Definition item 1.0
Foo:: Definition item 1.1
Foo:: Definition item 1.2
Bar:: Definition item 2.2
Bar:: Definition item 2.1
Bar:: Definition item 2.0
###############################################################################
#
# NAME: Test for varied nested list.
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
1. Number item 1.1
Foo:: Definition item 1.2
Bar:: Definition item 2.2
1. Number item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for definition list without =items, .
#
=pod
=over
This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
This is a long sentence that forms part of a definition block.
################################################################################
#
# NAME: Test for definition list without a definition.
#
# TODO: Fix this later.
#
=pod
=over
=item This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
This is a long sentence that forms part of a definition block.::\s
################################################################################
#
# NAME: Test for unordered list with included paragraphs.
#
# TODO: Fix this later.
#
#
=pod
=over
=item *
This is the main item.
This is a follow-on paragraph.
And this is another.
=back
=cut
#
#
# Expected output.
#
#
* This is the main item.
This is a follow-on paragraph.
And this is another.
################################################################################
#
# NAME: Test for numbered list with included paragraphs.
#
#
# TODO: Fix this later.
#
#
=pod
=over
=item 1.
This is the main item.
This is a follow-on paragraph.
And this is another.
=back
=cut
#
#
# Expected output.
#
#
1. This is the main item.
This is a follow-on paragraph.
And this is another.
################################################################################
#
# NAME: Test for unordered list with included paragraphs.
#
# TODO: Fix this later.
#
#
=pod
=over
=item Term
This is the main item.
This is a follow-on paragraph.
And this is another.
=back
=cut
#
#
# Expected output.
#
#
Term:: This is the main item.
This is a follow-on paragraph.
And this is another.
###############################################################################
#
# End
#
###############################################################################
Pod-Simple-Wiki-0.20/t/muse_format.t 000644 000765 000024 00000003750 12611235310 017316 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for I<>, B<>, C<> etc., formatting codes.
#
# Copyright (c), December 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 7;
my $style = 'muse';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple formatting tests
[ "=pod\n\nI" => qq(*Foo*\n\n), 'Italic' ],
[ "=pod\n\nB" => qq(**Foo**\n\n), 'Bold' ],
[ "=pod\n\nC" => qq(Foo\n\n), 'Monospace' ],
[ "=pod\n\nF" => qq(*Foo*\n\n), 'Filename' ],
# Nested formatting tests
[ "=pod\n\nB>" => qq(***Foo***\n\n), 'Bold Italic' ],
[ "=pod\n\nI>" => qq(***Foo***\n\n), 'Italic Bold' ],
# Character escaping
[
"=pod\n\nThis is neither 'it' ''italic'' nor '''bold'''" =>
qq(This is neither 'it' ''italic'' nor '''bold'''\n\n),
'Single quotes'
],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/muse_head.t 000644 000765 000024 00000003541 12611235310 016725 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =head pod directives.
#
# Copyright (c), August 2004, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 4;
my $style = 'muse';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
[ "=pod\n\n=head1 Head 1" => qq(** Head 1\n\n) ],
[ "=pod\n\n=head2 Head 2" => qq(*** Head 2\n\n) ],
[ "=pod\n\n=head3 Head 3" => qq(**** Head 3\n\n) ],
[ "=pod\n\n=head4 Head 4" => qq(***** Head 4\n\n) ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: " . encode_escapes( $pod ) );
}
###############################################################################
#
# Encode escapes to make them visible in the test output.
#
sub encode_escapes {
my $data = $_[0];
for ( $data ) {
s/\t/\\t/g;
s/\n/\\n/g;
}
return $data;
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $pod2 = encode_escapes( $pod );
$pod2 =~ s/^=pod\\n\\n//;
print "Test ", $test++, ":\t", $pod2, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__END__
Pod-Simple-Wiki-0.20/t/muse_links.t 000644 000765 000024 00000004401 12611235310 017140 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for L<> links.
#
# Copyright (c), December 2005, John McNamara, jmcnamara@cpan.org
# and Christopher J. Madsen
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 6;
my $style = 'muse';
# use_ok('Pod::Simple::Wiki::Muse');
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Links
[
"=pod\n\nL." => qq([[http://www.perl.org][http://www.perl.org]].\n\n),
'http'
],
[
"=pod\n\nL." =>
qq([[http://www.google.com][Google]].\n\n),
'http with text'
],
[
"=pod\n\nL." =>
qq([[https://www.google.com][Google(s)]].\n\n),
'https with text'
],
[
qq(=pod\n\nL"METHODS">) => qq([[#METHODS]["METHODS"]]\n\n),
'Internal link'
],
[
qq(=pod\n\nL) => qq([[Other::Module][Other::Module]]\n\n),
'Other::Module'
],
[
qq(=pod\n\nL) =>
qq([[Other::Module#METHODS]["METHODS" in Other::Module]]\n\n),
'Other::Module/METHODS'
],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head1 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/muse_lists.t 000644 000765 000024 00000017364 12611235310 017172 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =over ... =back regions.
#
# Copyright (c), March 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 14;
my $style = 'muse';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests;
#
# Extract tests embedded in _DATA_ section.
#
my $test_no = 1;
my $pod;
my $test = '';
my $todo = '';
my $name;
while ( ) {
if ( /^#/ ) {
$name = $1 if /NAME: (.*)/;
$todo = $1 if /TODO: (.*)/;
if ( $test ) {
if ( $test_no % 2 ) {
$pod = $test;
}
else {
push @tests, [ $pod, $test, $name, $todo ];
$name = '';
$todo = '';
}
$test = '';
$test_no++;
}
next;
}
s/\r//; # Remove any \r chars that slip in.
s/\\t/\t/g; # Sub back in any escaped tabs.
s/\\#/#/g; # Sub back in any escaped comments.
$test .= $_;
}
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, " \t" . $name );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
print "Test ", $test++, ":\t", $name, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__DATA__
################################################################################
#
# Test data.
#
################################################################################
#
# NAME: Test for single unordered (bullet) item.
#
=pod
=over
=item *
Bullet item
=back
=cut
#
#
# Expected output.
#
#
- Bullet item
################################################################################
#
# NAME: Test for unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=item *
Bullet item 2.0
=item *
Bullet item 3.0
=back
=cut
#
#
# Expected output.
#
#
- Bullet item 1.0
- Bullet item 2.0
- Bullet item 3.0
###############################################################################
#
# NAME: Test for nested unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=over
=item *
Bullet item 1.1
=over
=item *
Bullet item 1.2
=item *
Bullet item 2.2
=back
=item *
Bullet item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
- Bullet item 1.0
- Bullet item 1.1
- Bullet item 1.2
- Bullet item 2.2
- Bullet item 2.1
- Bullet item 2.0
################################################################################
#
# NAME: Test for single ordered (number) item.
#
=pod
=over
=item 1
Number item
=back
=cut
#
#
# Expected output.
#
#
1. Number item
###############################################################################
#
# NAME: Test for ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=item 2
Number item 2.0
=item 3
Number item 3.0
=back
=cut
#
#
# Expected output.
#
#
1. Number item 1.0
1. Number item 2.0
1. Number item 3.0
###############################################################################
#
# NAME: Test for nested ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=over
=item 1
Number item 1.1
=over
=item 1
Number item 1.2
=item 2
Number item 2.2
=back
=item 2
Number item 2.1
=back
=item 2
Number item 2.0
=back
=cut
#
#
# Expected output.
#
#
1. Number item 1.0
1. Number item 1.1
1. Number item 1.2
1. Number item 2.2
1. Number item 2.1
1. Number item 2.0
################################################################################
#
# NAME: Test for single definition list item.
#
=pod
=over
=item Foo
Definition item
=back
=cut
#
#
# Expected output.
#
#
Foo :: Definition item
###############################################################################
#
# NAME: Test for definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=item Bar
Definition item 2.0
=item Baz
Definition item 3.0
=back
=cut
#
#
# Expected output.
#
#
Foo :: Definition item 1.0
Bar :: Definition item 2.0
Baz :: Definition item 3.0
###############################################################################
#
# NAME: Test for nested definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=over
=item Foo
Definition item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item Bar
Definition item 2.1
=back
=item Bar
Definition item 2.0
=back
=cut
#
#
# Expected output.
#
#
Foo :: Definition item 1.0
Foo :: Definition item 1.1
Foo :: Definition item 1.2
Bar :: Definition item 2.2
Bar :: Definition item 2.1
Bar :: Definition item 2.0
###############################################################################
#
# NAME: Test for varied nested list (incorrect).
#
# Note that the output is not formatted correctly (see the next TODO test)
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
- Bullet item 1.0
1. Number item 1.1
Foo :: Definition item 1.2
Bar :: Definition item 2.2
1. Number item 2.1
- Bullet item 2.0
###############################################################################
#
# NAME: Test for varied nested list.
#
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
- Bullet item 1.0
1. Number item 1.1
Foo :: Definition item 1.2
Bar :: Definition item 2.2
1. Number item 2.1
- Bullet item 2.0
################################################################################
#
# NAME: Test for definition list without =items, .
#
=pod
=over
This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
This is a long sentence that forms part of a definition block.
################################################################################
#
# NAME: Test for definition list without a definition.
#
=pod
=over
=item This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
This is a long sentence that forms part of a definition block. ::
################################################################################
#
# NAME: Test 2 for definition list without a definition.
#
#
=pod
=over
=item This is a long sentence that forms part of a definition block.
=item This is the next item.
=back
=cut
#
#
# Expected output.
#
#
This is a long sentence that forms part of a definition block. ::
This is the next item. ::
###############################################################################
#
# End
#
###############################################################################
Pod-Simple-Wiki-0.20/t/textile_format.t 000644 000765 000024 00000003416 12476714653 020047 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for I<>, B<>, C<> etc., formatting codes.
#
# Copyright (c), December 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 6;
my $style = 'textile';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple formatting tests
[ "=pod\n\nI" => qq(_Foo_\n\n), 'Italic' ],
[ "=pod\n\nB" => qq(*Foo*\n\n), 'Bold' ],
[ "=pod\n\nC" => qq(\@Foo\@\n\n), 'Monospace' ],
[ "=pod\n\nF" => qq(_Foo_\n\n), 'Filename' ],
# Nested formatting tests
[ "=pod\n\nB>" => qq(*_Foo_*\n\n), 'Bold Italic' ],
[ "=pod\n\nI>" => qq(_*Foo*_\n\n), 'Italic Bold' ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/textile_head.t 000644 000765 000024 00000003533 12476714653 017460 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =head pod directives.
#
# Copyright (c), August 2004, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 4;
my $style = 'textile';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
[ "=pod\n\n=head1 Head 1" => qq(h1. Head 1\n\n) ],
[ "=pod\n\n=head2 Head 2" => qq(h2. Head 2\n\n) ],
[ "=pod\n\n=head3 Head 3" => qq(h3. Head 3\n\n) ],
[ "=pod\n\n=head4 Head 4" => qq(h4. Head 4\n\n) ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: " . encode_escapes( $pod ) );
}
###############################################################################
#
# Encode escapes to make them visible in the test output.
#
sub encode_escapes {
my $data = $_[0];
for ( $data ) {
s/\t/\\t/g;
s/\n/\\n/g;
}
return $data;
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
for my $test_ref ( @tests ) {
print "\n";
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $pod2 = encode_escapes( $pod );
$pod2 =~ s/^=pod\\n\\n//;
print "*Test ", $test++, "*: @", $pod2, "@\n\n";
$parser->parse_string_document( $pod );
print "\n";
}
}
__END__
Pod-Simple-Wiki-0.20/t/textile_lists.t 000644 000765 000024 00000015342 12476714653 017716 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =over ... =back regions.
#
# Copyright (c), March 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 12;
my $style = 'textile';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests;
#
# Extract tests embedded in _DATA_ section.
#
my $test_no = 1;
my $pod;
my $test = '';
my $todo = '';
my $name;
while ( ) {
if ( /^#/ ) {
$name = $1 if /NAME: (.*)/;
$todo = $1 if /TODO: (.*)/;
if ( $test ) {
if ( $test_no % 2 ) {
$pod = $test;
}
else {
push @tests, [ $pod, $test, $name, $todo ];
$name = '';
$todo = '';
}
$test = '';
$test_no++;
}
next;
}
s/\r//; # Remove any \r chars that slip in.
s/\\t/\t/g; # Sub back in any escaped tabs.
s/\\#/#/g; # Sub back in any escaped comments.
$test .= $_;
}
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, " \t" . $name );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$name =~ s/</g;
$name =~ s/>/>/g;
print "h2. Test ", $test++, ":\t", $name, "\n\n";
$parser->parse_string_document( $pod );
}
}
__DATA__
################################################################################
#
# Test data.
#
################################################################################
#
# NAME: Test for single unordered (bullet) item.
#
=pod
=over
=item *
Bullet item
=back
=cut
#
#
# Expected output.
#
#
* Bullet item
################################################################################
#
# NAME: Test for unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=item *
Bullet item 2.0
=item *
Bullet item 3.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
* Bullet item 2.0
* Bullet item 3.0
###############################################################################
#
# NAME: Test for nested unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=over
=item *
Bullet item 1.1
=over
=item *
Bullet item 1.2
=item *
Bullet item 2.2
=back
=item *
Bullet item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
** Bullet item 1.1
*** Bullet item 1.2
*** Bullet item 2.2
** Bullet item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for single ordered (number) item.
#
=pod
=over
=item 1
Number item
=back
=cut
#
#
# Expected output.
#
#
\# Number item
###############################################################################
#
# NAME: Test for ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=item 2
Number item 2.0
=item 3
Number item 3.0
=back
=cut
#
#
# Expected output.
#
#
\# Number item 1.0
\# Number item 2.0
\# Number item 3.0
###############################################################################
#
# NAME: Test for nested ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=over
=item 1
Number item 1.1
=over
=item 1
Number item 1.2
=item 2
Number item 2.2
=back
=item 2
Number item 2.1
=back
=item 2
Number item 2.0
=back
=cut
#
#
# Expected output.
#
#
\# Number item 1.0
\## Number item 1.1
\### Number item 1.2
\### Number item 2.2
\## Number item 2.1
\# Number item 2.0
################################################################################
#
# NAME: Test for single definition list item.
#
=pod
=over
=item Foo
Definition item
=back
=cut
#
#
# Expected output.
#
#
- Foo := Definition item
###############################################################################
#
# NAME: Test for definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=item Bar
Definition item 2.0
=item Baz
Definition item 3.0
=back
=cut
#
#
# Expected output.
#
#
- Foo := Definition item 1.0
- Bar := Definition item 2.0
- Baz := Definition item 3.0
###############################################################################
#
# NAME: Test for nested definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=over
=item Foo
Definition item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item Bar
Definition item 2.1
=back
=item Bar
Definition item 2.0
=back
=cut
#
#
# Expected output.
#
#
- Foo := Definition item 1.0
- Foo := Definition item 1.1
- Foo := Definition item 1.2
- Bar := Definition item 2.2
- Bar := Definition item 2.1
- Bar := Definition item 2.0
###############################################################################
#
# NAME: Test for varied nested list.
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
\## Number item 1.1
- Foo := Definition item 1.2
- Bar := Definition item 2.2
\## Number item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for definition list without =items, .
#
=pod
=over
This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
bq.. This is a long sentence that forms part of a definition block.
################################################################################
#
# NAME: Test for definition list without a definition.
#
# TODO: Fix this later.
#
=pod
=over
=item This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
- := This is a long sentence that forms part of a definition block.
###############################################################################
#
# End
#
###############################################################################
Pod-Simple-Wiki-0.20/t/tiddlywiki_format.t 000644 000765 000024 00000003437 12476714653 020551 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for I<>, B<>, C<> etc., formatting codes.
#
# Copyright (c), August 2004, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 6;
my $style = 'tiddlywiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple formatting tests
[ "=pod\n\nI" => qq(//Foo//\n\n), 'Italic' ],
[ "=pod\n\nB" => qq(''Foo''\n\n), 'Bold' ],
[ "=pod\n\nC" => qq({{{Foo}}}\n\n), 'Monospace' ],
[ "=pod\n\nF" => qq(//Foo//\n\n), 'Filename' ],
# Nested formatting tests
[ "=pod\n\nB>" => qq(''//Foo//''\n\n), 'Bold Italic' ],
[ "=pod\n\nI>" => qq(//''Foo''//\n\n), 'Italic Bold' ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/tiddlywiki_head.t 000644 000765 000024 00000003467 12476714653 020165 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =head pod directives.
#
# Copyright (c), August 2004, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 4;
my $style = 'tiddlywiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
[ "=pod\n\n=head1 Head 1" => qq(!Head 1\n) ],
[ "=pod\n\n=head2 Head 2" => qq(!!Head 2\n) ],
[ "=pod\n\n=head3 Head 3" => qq(!!!Head 3\n) ],
[ "=pod\n\n=head4 Head 4" => qq(!!!!Head 4\n) ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: " . encode_escapes( $pod ) );
}
###############################################################################
#
# Encode escapes to make them visible in the test output.
#
sub encode_escapes {
my $data = $_[0];
for ( $data ) {
s/\t/\\t/g;
s/\n/\\n/g;
}
return $data;
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $pod2 = encode_escapes( $pod );
$pod2 =~ s/^=pod\\n\\n//;
print "Test ", $test++, ":\t", $pod2, "\n";
$parser->parse_string_document( $pod );
print "\n";
}
}
__END__
Pod-Simple-Wiki-0.20/t/tiddlywiki_lists.t 000644 000765 000024 00000015257 12476714653 020422 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =over ... =back regions.
#
# Copyright (c), March 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 12;
my $style = 'tiddlywiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests;
#
# Extract tests embedded in _DATA_ section.
#
my $test_no = 1;
my $pod;
my $test = '';
my $todo = '';
my $name;
while ( ) {
if ( /^#/ ) {
$name = $1 if /NAME: (.*)/;
$todo = $1 if /TODO: (.*)/;
if ( $test ) {
if ( $test_no % 2 ) {
$pod = $test;
}
else {
push @tests, [ $pod, $test, $name, $todo ];
$name = '';
$todo = '';
}
$test = '';
$test_no++;
}
next;
}
s/\r//; # Remove any \r chars that slip in.
s/\\t/\t/g; # Sub back in any escaped tabs.
s/\\#/#/g; # Sub back in any escaped comments.
$test .= $_;
}
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, " \t" . $name );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
print "!Test ", $test++, ":\t", $name, "\n";
$parser->parse_string_document( $pod );
print "\n";
}
}
__DATA__
################################################################################
#
# Test data.
#
################################################################################
#
# NAME: Test for single unordered (bullet) item.
#
=pod
=over
=item *
Bullet item
=back
=cut
#
#
# Expected output.
#
#
* Bullet item
################################################################################
#
# NAME: Test for unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=item *
Bullet item 2.0
=item *
Bullet item 3.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
* Bullet item 2.0
* Bullet item 3.0
###############################################################################
#
# NAME: Test for nested unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=over
=item *
Bullet item 1.1
=over
=item *
Bullet item 1.2
=item *
Bullet item 2.2
=back
=item *
Bullet item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
** Bullet item 1.1
*** Bullet item 1.2
*** Bullet item 2.2
** Bullet item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for single ordered (number) item.
#
=pod
=over
=item 1
Number item
=back
=cut
#
#
# Expected output.
#
#
\# Number item
###############################################################################
#
# NAME: Test for ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=item 2
Number item 2.0
=item 3
Number item 3.0
=back
=cut
#
#
# Expected output.
#
#
\# Number item 1.0
\# Number item 2.0
\# Number item 3.0
###############################################################################
#
# NAME: Test for nested ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=over
=item 1
Number item 1.1
=over
=item 1
Number item 1.2
=item 2
Number item 2.2
=back
=item 2
Number item 2.1
=back
=item 2
Number item 2.0
=back
=cut
#
#
# Expected output.
#
#
\# Number item 1.0
\#\# Number item 1.1
\#\#\# Number item 1.2
\#\#\# Number item 2.2
\#\# Number item 2.1
\# Number item 2.0
################################################################################
#
# NAME: Test for single definition list item.
#
=pod
=over
=item Foo
Definition item
=back
=cut
#
#
# Expected output.
#
#
* Foo Definition item
###############################################################################
#
# NAME: Test for definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=item Bar
Definition item 2.0
=item Baz
Definition item 3.0
=back
=cut
#
#
# Expected output.
#
#
* Foo Definition item 1.0
* Bar Definition item 2.0
* Baz Definition item 3.0
###############################################################################
#
# NAME: Test for nested definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=over
=item Foo
Definition item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item Bar
Definition item 2.1
=back
=item Bar
Definition item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Foo Definition item 1.0
** Foo Definition item 1.1
*** Foo Definition item 1.2
*** Bar Definition item 2.2
** Bar Definition item 2.1
* Bar Definition item 2.0
###############################################################################
#
# NAME: Test for varied nested list.
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
\#\# Number item 1.1
*** Foo Definition item 1.2
*** Bar Definition item 2.2
\#\# Number item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for definition list without =items, .
#
# TODO: Fix this later.
#
=pod
=over
This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
<<<
This is a long sentence that forms part of a definition block.
>>>
################################################################################
#
# NAME: Test for definition list without a definition.
#
# TODO: Fix this later.
#
=pod
=over
=item This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
* This is a long sentence that forms part of a definition block.
###############################################################################
#
# End
#
###############################################################################
Pod-Simple-Wiki-0.20/t/tiddlywiki_text.t 000644 000765 000024 00000005707 12476714653 020247 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for I<>, B<>, C<> etc., formatting codes.
#
# Copyright (c), August 2004, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 24;
my $style = 'tiddlywiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple formatting tests
[ "=pod\n\nxxC<-->xx" => qq(xx{{{--}}}xx\n\n), 'Escape C<-->' ],
[ "=pod\n\nxx--xx--" => qq(xx{{{--}}}xx{{{--}}}\n\n), 'Escape --' ],
[ "=pod\n\nxx---xx---" => qq(xx{{{---}}}xx{{{---}}}\n\n), 'Escape ---' ],
(
map {
[
"=pod\n\nxx$_${_}xx$_$_" => qq(xx{{{$_$_}}}xx{{{$_$_}}}\n\n),
"Escape $_$_"
]
} qw( - / ' _ ^ > ~ @ )
),
[
"=pod\n\nxxEExxEExxEExx" =>
qq(xx{{{>>}}}xx{{{<<}}}xx{{{//}}}xx\n\n),
'Escape doubles E E E'
],
[ "=pod\n\nxx/E/xx" => qq(xx{{{///}}}xx\n\n), 'Escape /E/' ],
# WikiWords RT#60650
[ "=pod\n\nWikiWord" => qq(~WikiWord\n\n), 'Escape WikiWord' ],
[ "=pod\n\nWikiWWW" => qq(~WikiWWW\n\n), 'Escape -WikiWWW' ],
[ "=pod\n\nxxWikiWord" => qq(xxWikiWord\n\n), 'No Escape xxWikiWord' ],
[ "=pod\n\n01WikiWord" => qq(01WikiWord\n\n), 'No Escape 01WikiWord' ],
[ "=pod\n\nxx_WikiWord" => qq(xx_~WikiWord\n\n), 'Escape xx_WikiWord' ],
[ "=pod\n\nWikiWord2" => qq(~WikiWord2\n\n), 'Escape WikiWord2' ],
[ "=pod\n\nWiki2Word" => qq(~Wiki2Word\n\n), 'Escape Wiki2Word' ],
[ "=pod\n\nWiki-Word" => qq(~Wiki-Word\n\n), 'Escape Wiki-Word' ],
[ "=pod\n\n-WikiWord" => qq(-~WikiWord\n\n), 'Escape -WikiWord' ],
[ "=pod\n\n-Wiki-Word" => qq(-~Wiki-Word\n\n), 'Escape -Wiki-Word' ],
[
"=pod\n\n-Wiki-Word+Wiki-Word" => qq(-~Wiki-Word+~Wiki-Word\n\n),
'Escape -Wiki-Word+Wiki-Word'
],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/twiki_format.t 000644 000765 000024 00000003543 12476714653 017521 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for I<>, B<>, C<> etc., formatting codes.
#
# Copyright (c), March 2005, Sam Tregar, sam@tregar.com
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 6;
my $style = 'twiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple formatting tests
[ "=pod\n\nI" => qq(_Foo_\n\n), 'Italic' ],
[ "=pod\n\nB" => qq(*Foo*\n\n), 'Bold' ],
[ "=pod\n\nC" => qq(=Foo=\n\n), 'Monospace' ],
[ "=pod\n\nF" => qq(_Foo_\n\n), 'Filename' ],
# Nested formatting tests
[ "=pod\n\nB>" => qq(*_Foo_*\n\n), 'Bold Italic' ],
[
"=pod\n\nI>" => qq(__Foo__\n\n),
'Italic Bold',
'Fix this later.'
],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/twiki_head.t 000644 000765 000024 00000003634 12476714653 017133 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =head pod directives.
#
# Copyright (c), March 2005, Sam Tregar, sam@tregar.com
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 4;
my $style = 'twiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
[ "=pod\n\n=head1 Head 1" => qq(---+ Head 1\n\n) ],
[ "=pod\n\n=head2 Head 2" => qq(---++ Head 2\n\n) ],
[ "=pod\n\n=head3 Head 3" => qq(---+++ Head 3\n\n) ],
[ "=pod\n\n=head4 Head 4" => qq(---++++ Head 4\n\n) ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: " . encode_escapes( $pod ) );
}
###############################################################################
#
# Encode escapes to make them visible in the test output.
#
sub encode_escapes {
my $data = $_[0];
for ( $data ) {
s/\t/\\t/g;
s/\n/\\n/g;
}
return $data;
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $pod2 = encode_escapes( $pod );
$pod2 =~ s/^=pod\\n\\n//;
$pod2 =~ s/</g;
$pod2 =~ s/>/>/g;
print "Test ", $test++, ":\t", $pod2, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__END__
Pod-Simple-Wiki-0.20/t/twiki_lists.t 000644 000765 000024 00000015650 12476714653 017371 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =over ... =back regions.
#
# Copyright (c), March 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 12;
my $style = 'twiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests;
#
# Extract tests embedded in _DATA_ section.
#
my $test_no = 1;
my $pod;
my $test = '';
my $todo = '';
my $name;
while ( ) {
if ( /^#/ ) {
$name = $1 if /NAME: (.*)/;
$todo = $1 if /TODO: (.*)/;
if ( $test ) {
if ( $test_no % 2 ) {
$pod = $test;
}
else {
push @tests, [ $pod, $test, $name, $todo ];
$name = '';
$todo = '';
}
$test = '';
$test_no++;
}
next;
}
s/\r//; # Remove any \r chars that slip in.
s/\\t/\t/g; # Sub back in any escaped tabs.
s/\\#/#/g; # Sub back in any escaped comments.
$test .= $_;
}
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, " \t" . $name );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$name =~ s[<][<]g;
$name =~ s[>][>]g;
print "Test ", $test++, ":\t", $name, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__DATA__
################################################################################
#
# Test data.
#
################################################################################
#
# NAME: Test for single unordered (bullet) item.
#
=pod
=over
=item *
Bullet item
=back
=cut
#
#
# Expected output.
#
#
* Bullet item
################################################################################
#
# NAME: Test for unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=item *
Bullet item 2.0
=item *
Bullet item 3.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
* Bullet item 2.0
* Bullet item 3.0
###############################################################################
#
# NAME: Test for nested unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=over
=item *
Bullet item 1.1
=over
=item *
Bullet item 1.2
=item *
Bullet item 2.2
=back
=item *
Bullet item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
* Bullet item 1.1
* Bullet item 1.2
* Bullet item 2.2
* Bullet item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for single ordered (number) item.
#
=pod
=over
=item 1
Number item
=back
=cut
#
#
# Expected output.
#
#
1. Number item
###############################################################################
#
# NAME: Test for ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=item 2
Number item 2.0
=item 3
Number item 3.0
=back
=cut
#
#
# Expected output.
#
#
1. Number item 1.0
2. Number item 2.0
3. Number item 3.0
###############################################################################
#
# NAME: Test for nested ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=over
=item 1
Number item 1.1
=over
=item 1
Number item 1.2
=item 2
Number item 2.2
=back
=item 2
Number item 2.1
=back
=item 2
Number item 2.0
=back
=cut
#
#
# Expected output.
#
#
1. Number item 1.0
1. Number item 1.1
1. Number item 1.2
2. Number item 2.2
2. Number item 2.1
2. Number item 2.0
################################################################################
#
# NAME: Test for single definition list item.
#
=pod
=over
=item Foo
Definition item
=back
=cut
#
#
# Expected output.
#
#
$ Foo: Definition item
###############################################################################
#
# NAME: Test for definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=item Bar
Definition item 2.0
=item Baz
Definition item 3.0
=back
=cut
#
#
# Expected output.
#
#
$ Foo: Definition item 1.0
$ Bar: Definition item 2.0
$ Baz: Definition item 3.0
###############################################################################
#
# NAME: Test for nested definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=over
=item Foo
Definition item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item Bar
Definition item 2.1
=back
=item Bar
Definition item 2.0
=back
=cut
#
#
# Expected output.
#
#
$ Foo: Definition item 1.0
$ Foo: Definition item 1.1
$ Foo: Definition item 1.2
$ Bar: Definition item 2.2
$ Bar: Definition item 2.1
$ Bar: Definition item 2.0
###############################################################################
#
# NAME: Test for varied nested list.
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
* Bullet item 1.0
1. Number item 1.1
$ Foo: Definition item 1.2
$ Bar: Definition item 2.2
2. Number item 2.1
* Bullet item 2.0
################################################################################
#
# NAME: Test for definition list without =items, .
#
# TODO: Fix this later.
#
=pod
=over
This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
: This is a long sentence that forms part of a definition block.
################################################################################
#
# NAME: Test for definition list without a definition.
#
# TODO: Fix this later.
#
=pod
=over
=item This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
$ This is a long sentence that forms part of a definition block.:
###############################################################################
#
# End
#
###############################################################################
Pod-Simple-Wiki-0.20/t/usemod_format.t 000644 000765 000024 00000003463 12476714653 017667 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for I<>, B<>, C<> etc., formatting codes.
#
# Copyright (c), August 2004, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 6;
my $style = 'usemod';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple formatting tests
[ "=pod\n\nI" => qq(Foo\n\n), 'Italic' ],
[ "=pod\n\nB" => qq(Foo\n\n), 'Bold' ],
[ "=pod\n\nC" => qq(Foo\n\n), 'Monospace' ],
[ "=pod\n\nF" => qq(Foo\n\n), 'Filename' ],
# Nested formatting tests
[ "=pod\n\nB>" => qq(Foo\n\n), 'Bold Italic' ],
[ "=pod\n\nI>" => qq(Foo\n\n), 'Italic Bold' ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/usemod_head.t 000644 000765 000024 00000003563 12476714653 017301 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =head pod directives.
#
# Copyright (c), August 2004, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 4;
my $style = 'usemod';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
[ "=pod\n\n=head1 Head 1" => qq(\n= Head 1 =\n\n) ],
[ "=pod\n\n=head2 Head 2" => qq(\n== Head 2 ==\n\n) ],
[ "=pod\n\n=head3 Head 3" => qq(\n=== Head 3 ===\n) ],
[ "=pod\n\n=head4 Head 4" => qq(\n==== Head 4 ====\n\n) ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: " . encode_escapes( $pod ) );
}
###############################################################################
#
# Encode escapes to make them visible in the test output.
#
sub encode_escapes {
my $data = $_[0];
for ( $data ) {
s/\t/\\t/g;
s/\n/\\n/g;
}
return $data;
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $pod2 = encode_escapes( $pod );
$pod2 =~ s/^=pod\\n\\n//;
print "Test ", $test++, ":\t", $pod2, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__END__
Pod-Simple-Wiki-0.20/t/usemod_lists.t 000644 000765 000024 00000015231 12476714653 017531 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =over ... =back regions.
#
# Copyright (c), March 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 12;
my $style = 'usemod';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests;
#
# Extract tests embedded in _DATA_ section.
#
my $test_no = 1;
my $pod;
my $test = '';
my $todo = '';
my $name;
while ( ) {
if ( /^#/ ) {
$name = $1 if /NAME: (.*)/;
$todo = $1 if /TODO: (.*)/;
if ( $test ) {
if ( $test_no % 2 ) {
$pod = $test;
}
else {
push @tests, [ $pod, $test, $name, $todo ];
$name = '';
$todo = '';
}
$test = '';
$test_no++;
}
next;
}
s/\r//; # Remove any \r chars that slip in.
s/\\t/\t/g; # Sub back in any escaped tabs.
s/\\#/#/g; # Sub back in any escaped comments.
$test .= $_;
}
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, " \t" . $name );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
print "Test ", $test++, ":\t", $name, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__DATA__
################################################################################
#
# Test data.
#
################################################################################
#
# NAME: Test for single unordered (bullet) item.
#
=pod
=over
=item *
Bullet item
=back
=cut
#
#
# Expected output.
#
#
*Bullet item
################################################################################
#
# NAME: Test for unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=item *
Bullet item 2.0
=item *
Bullet item 3.0
=back
=cut
#
#
# Expected output.
#
#
*Bullet item 1.0
*Bullet item 2.0
*Bullet item 3.0
###############################################################################
#
# NAME: Test for nested unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=over
=item *
Bullet item 1.1
=over
=item *
Bullet item 1.2
=item *
Bullet item 2.2
=back
=item *
Bullet item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
*Bullet item 1.0
**Bullet item 1.1
***Bullet item 1.2
***Bullet item 2.2
**Bullet item 2.1
*Bullet item 2.0
################################################################################
#
# NAME: Test for single ordered (number) item.
#
=pod
=over
=item 1
Number item
=back
=cut
#
#
# Expected output.
#
#
\#Number item
###############################################################################
#
# NAME: Test for ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=item 2
Number item 2.0
=item 3
Number item 3.0
=back
=cut
#
#
# Expected output.
#
#
\#Number item 1.0
\#Number item 2.0
\#Number item 3.0
###############################################################################
#
# NAME: Test for nested ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=over
=item 1
Number item 1.1
=over
=item 1
Number item 1.2
=item 2
Number item 2.2
=back
=item 2
Number item 2.1
=back
=item 2
Number item 2.0
=back
=cut
#
#
# Expected output.
#
#
\#Number item 1.0
\##Number item 1.1
\###Number item 1.2
\###Number item 2.2
\##Number item 2.1
\#Number item 2.0
################################################################################
#
# NAME: Test for single definition list item.
#
=pod
=over
=item Foo
Definition item
=back
=cut
#
#
# Expected output.
#
#
;Foo:Definition item
###############################################################################
#
# NAME: Test for definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=item Bar
Definition item 2.0
=item Baz
Definition item 3.0
=back
=cut
#
#
# Expected output.
#
#
;Foo:Definition item 1.0
;Bar:Definition item 2.0
;Baz:Definition item 3.0
###############################################################################
#
# NAME: Test for nested definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=over
=item Foo
Definition item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item Bar
Definition item 2.1
=back
=item Bar
Definition item 2.0
=back
=cut
#
#
# Expected output.
#
#
;Foo:Definition item 1.0
;;Foo:Definition item 1.1
;;;Foo:Definition item 1.2
;;;Bar:Definition item 2.2
;;Bar:Definition item 2.1
;Bar:Definition item 2.0
###############################################################################
#
# NAME: Test for varied nested list.
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
*Bullet item 1.0
\##Number item 1.1
;;;Foo:Definition item 1.2
;;;Bar:Definition item 2.2
\##Number item 2.1
*Bullet item 2.0
################################################################################
#
# NAME: Test for definition list without =items, .
#
# TODO: Fix this later.
#
=pod
=over
This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
; :This is a long sentence that forms part of a definition block.
################################################################################
#
# NAME: Test for definition list without a definition.
#
# TODO: Fix this later.
#
=pod
=over
=item This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
;This is a long sentence that forms part of a definition block.:
###############################################################################
#
# End
#
###############################################################################
Pod-Simple-Wiki-0.20/t/wiki_format.t 000644 000765 000024 00000003437 12476714653 017337 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for I<>, B<>, C<> etc., formatting codes.
#
# Copyright (c), December 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 6;
my $style = 'wiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
# Simple formatting tests
[ "=pod\n\nI" => qq(''Foo''\n\n), 'Italic' ],
[ "=pod\n\nB" => qq('''Foo'''\n\n), 'Bold' ],
[ "=pod\n\nC" => qq("Foo"\n\n), 'Monospace' ],
[ "=pod\n\nF" => qq(''Foo''\n\n), 'Filename' ],
# Nested formatting tests
[ "=pod\n\nB>" => qq('''''Foo'''''\n\n), 'Bold Italic' ],
[ "=pod\n\nI>" => qq('''''Foo'''''\n\n), 'Italic Bold' ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: $name" );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
$pod =~ s/=pod\n\n//;
$pod = "=pod\n\n=head2 Test " . $test++ . " $name\n\n$pod";
$parser->parse_string_document( $pod );
}
}
__END__
Pod-Simple-Wiki-0.20/t/wiki_head.t 000644 000765 000024 00000003561 12476714653 016746 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =head pod directives.
#
# Copyright (c), August 2004, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 4;
my $style = 'wiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests = (
[ "=pod\n\n=head1 Head 1" => qq(\n----\n'''Head 1'''\n\n) ],
[ "=pod\n\n=head2 Head 2" => qq(\n'''''Head 2'''''\n\n) ],
[ "=pod\n\n=head3 Head 3" => qq(\n''Head 3''\n\n) ],
[ "=pod\n\n=head4 Head 4" => qq(\nHead 4\n\n) ],
);
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
is( $wiki, $target, "\tTesting: " . encode_escapes( $pod ) );
}
###############################################################################
#
# Encode escapes to make them visible in the test output.
#
sub encode_escapes {
my $data = $_[0];
for ( $data ) {
s/\t/\\t/g;
s/\n/\\n/g;
}
return $data;
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $pod2 = encode_escapes( $pod );
$pod2 =~ s/^=pod\\n\\n//;
print "Test ", $test++, ":\t", $pod2, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__END__
Pod-Simple-Wiki-0.20/t/wiki_lists.t 000644 000765 000024 00000015305 12476714653 017202 0 ustar 00John staff 000000 000000 #!/usr/bin/perl -w
###############################################################################
#
# A test for Pod::Simple::Wiki.
#
# Tests for =over ... =back regions.
#
# Copyright (c), March 2005, John McNamara, jmcnamara@cpan.org
#
use strict;
use Pod::Simple::Wiki;
use Test::More tests => 12;
my $style = 'wiki';
# Output the tests for visual testing in the wiki.
# END{output_tests()};
my @tests;
#
# Extract tests embedded in _DATA_ section.
#
my $test_no = 1;
my $pod;
my $test = '';
my $todo = '';
my $name;
while ( ) {
if ( /^#/ ) {
$name = $1 if /NAME: (.*)/;
$todo = $1 if /TODO: (.*)/;
if ( $test ) {
if ( $test_no % 2 ) {
$pod = $test;
}
else {
push @tests, [ $pod, $test, $name, $todo ];
$name = '';
$todo = '';
}
$test = '';
$test_no++;
}
next;
}
s/\r//; # Remove any \r chars that slip in.
s/\\t/\t/g; # Sub back in any escaped tabs.
s/\\#/#/g; # Sub back in any escaped comments.
$test .= $_;
}
###############################################################################
#
# Run the tests.
#
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $target = $test_ref->[1];
my $name = $test_ref->[2];
my $todo = $test_ref->[3];
my $wiki;
$parser->output_string( \$wiki );
$parser->parse_string_document( $pod );
local $TODO = $todo;
is( $wiki, $target, " \t" . $name );
}
###############################################################################
#
# Output the tests for visual testing in the wiki.
#
sub output_tests {
my $test = 1;
print "\n----\n\n";
for my $test_ref ( @tests ) {
my $parser = Pod::Simple::Wiki->new( $style );
my $pod = $test_ref->[0];
my $name = $test_ref->[2];
print "Test ", $test++, ":\t", $name, "\n";
$parser->parse_string_document( $pod );
print "\n----\n\n";
}
}
__DATA__
################################################################################
#
# Test data.
#
################################################################################
#
# NAME: Test for single unordered (bullet) item.
#
=pod
=over
=item *
Bullet item
=back
=cut
#
#
# Expected output.
#
#
*Bullet item
################################################################################
#
# NAME: Test for unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=item *
Bullet item 2.0
=item *
Bullet item 3.0
=back
=cut
#
#
# Expected output.
#
#
*Bullet item 1.0
*Bullet item 2.0
*Bullet item 3.0
###############################################################################
#
# NAME: Test for nested unordered (bullet) list, .
#
=pod
=over
=item *
Bullet item 1.0
=over
=item *
Bullet item 1.1
=over
=item *
Bullet item 1.2
=item *
Bullet item 2.2
=back
=item *
Bullet item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
*Bullet item 1.0
**Bullet item 1.1
***Bullet item 1.2
***Bullet item 2.2
**Bullet item 2.1
*Bullet item 2.0
################################################################################
#
# NAME: Test for single ordered (number) item.
#
=pod
=over
=item 1
Number item
=back
=cut
#
#
# Expected output.
#
#
\t1Number item
###############################################################################
#
# NAME: Test for ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=item 2
Number item 2.0
=item 3
Number item 3.0
=back
=cut
#
#
# Expected output.
#
#
\t1Number item 1.0
\t2Number item 2.0
\t3Number item 3.0
###############################################################################
#
# NAME: Test for nested ordered (number) list, .
#
=pod
=over
=item 1
Number item 1.0
=over
=item 1
Number item 1.1
=over
=item 1
Number item 1.2
=item 2
Number item 2.2
=back
=item 2
Number item 2.1
=back
=item 2
Number item 2.0
=back
=cut
#
#
# Expected output.
#
#
\t1Number item 1.0
\t\t1Number item 1.1
\t\t\t1Number item 1.2
\t\t\t2Number item 2.2
\t\t2Number item 2.1
\t2Number item 2.0
################################################################################
#
# NAME: Test for single definition list item.
#
=pod
=over
=item Foo
Definition item
=back
=cut
#
#
# Expected output.
#
#
\tFoo:\tDefinition item
###############################################################################
#
# NAME: Test for definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=item Bar
Definition item 2.0
=item Baz
Definition item 3.0
=back
=cut
#
#
# Expected output.
#
#
\tFoo:\tDefinition item 1.0
\tBar:\tDefinition item 2.0
\tBaz:\tDefinition item 3.0
###############################################################################
#
# NAME: Test for nested definition list, .
#
=pod
=over
=item Foo
Definition item 1.0
=over
=item Foo
Definition item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item Bar
Definition item 2.1
=back
=item Bar
Definition item 2.0
=back
=cut
#
#
# Expected output.
#
#
\tFoo:\tDefinition item 1.0
\t\tFoo:\tDefinition item 1.1
\t\t\tFoo:\tDefinition item 1.2
\t\t\tBar:\tDefinition item 2.2
\t\tBar:\tDefinition item 2.1
\tBar:\tDefinition item 2.0
###############################################################################
#
# NAME: Test for varied nested list.
#
=pod
=over
=item *
Bullet item 1.0
=over
=item 1
Number item 1.1
=over
=item Foo
Definition item 1.2
=item Bar
Definition item 2.2
=back
=item 2
Number item 2.1
=back
=item *
Bullet item 2.0
=back
=cut
#
#
# Expected output.
#
#
*Bullet item 1.0
\t\t1Number item 1.1
\t\t\tFoo:\tDefinition item 1.2
\t\t\tBar:\tDefinition item 2.2
\t\t2Number item 2.1
*Bullet item 2.0
################################################################################
#
# NAME: Test for definition list without =items, .
#
=pod
=over
This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
\t :\tThis is a long sentence that forms part of a definition block.
################################################################################
#
# NAME: Test for definition list without a definition.
#
# TODO: Fix this later.
#
=pod
=over
=item This is a long sentence that forms part of a definition block.
=back
=cut
#
#
# Expected output.
#
#
\tThis is a long sentence that forms part of a definition block.:\t
###############################################################################
#
# End
#
###############################################################################
Pod-Simple-Wiki-0.20/lib/Pod/ 000755 000765 000024 00000000000 12620222004 015624 5 ustar 00John staff 000000 000000 Pod-Simple-Wiki-0.20/lib/Pod/Simple/ 000755 000765 000024 00000000000 12620222004 017055 5 ustar 00John staff 000000 000000 Pod-Simple-Wiki-0.20/lib/Pod/Simple/Wiki/ 000755 000765 000024 00000000000 12620222005 017761 5 ustar 00John staff 000000 000000 Pod-Simple-Wiki-0.20/lib/Pod/Simple/Wiki.pm 000644 000765 000024 00000040165 12620221661 020334 0 ustar 00John staff 000000 000000 package Pod::Simple::Wiki;
###############################################################################
#
# Pod::Simple::Wiki - A class for creating Pod to Wiki filters.
#
#
# Copyright 2003-2015, John McNamara, jmcnamara@cpan.org
#
# Documentation after __END__
#
# perltidy with the following options: -mbl=2 -pt=0 -nola
use strict;
#use Pod::Simple::Debug (5);
use Pod::Simple;
use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Simple);
$VERSION = '0.20';
###############################################################################
#
# The tag to wiki mappings.
#
my $tags = {
'' => "'''",
'' => "'''",
'' => "''",
'' => "''",
'' => '"',
'' => '"',
'' => '',
'' => "\n\n",
'' => "\n----\n'''",
'
' => "'''\n\n",
'' => "\n'''''",
'
' => "'''''\n\n",
'' => "\n''",
'
' => "''\n\n",
'' => "\n",
'
' => "\n\n",
};
###############################################################################
#
# new()
#
# Simple constructor inheriting from Pod::Simple.
#
sub new {
my $class = shift;
my $format = lc( shift || 'wiki' );
$format = 'mediawiki' if $format eq 'wikipedia';
$format = 'moinmoin' if $format eq 'moin';
my $module = "Pod::Simple::Wiki::" . ucfirst $format;
# Try to load a sub-module unless the format type is 'wiki' in which
# case we use this, the parent, module.
if ( $format ne 'wiki' ) {
eval "require $module";
die "Module $module not implemented for wiki format $format\n" if $@;
return $module->new( @_ );
}
my $self = Pod::Simple->new( @_ );
$self->{_wiki_text} = '';
$self->{_tags} = $tags;
$self->{output_fh} ||= *STDOUT{IO};
$self->{_item_indent} = 0;
$self->{_debug} = 0;
# Set Pod::Simple parser options
# - Merge contiguous text RT#60304
$self->merge_text( 1 );
# - Ignore X<> (index entries) RT#60307
$self->nix_X_codes( 1 );
bless $self, $class;
return $self;
}
###############################################################################
#
# _debug()
#
# Sets the debug flag for some Pod::Simple::Wiki debugging. See also the
# Pod::Simple::Debug module.
#
sub _debug {
my $self = shift;
$self->{_debug} = $_[0];
}
###############################################################################
#
# _append()
#
# Appends some text to the buffered Wiki text.
#
sub _append {
my $self = shift;
$self->{_wiki_text} .= $_[0];
}
###############################################################################
#
# _output()
#
# Appends some text to the buffered Wiki text and then emits it. Also resets
# the buffer.
#
sub _output {
my $self = shift;
my $text = $_[0];
$text = '' unless defined $text;
print { $self->{output_fh} } $self->{_wiki_text}, $text;
$self->{_wiki_text} = '';
}
###############################################################################
#
# _indent_item()
#
# Indents an "over-item" to the correct level.
#
sub _indent_item {
my $self = shift;
my $item_type = $_[0];
my $item_param = $_[1];
my $indent_level = $self->{_item_indent};
if ( $item_type eq 'bullet' ) {
$self->_append( "*" x $indent_level );
# This was the way C2 Wiki used to define a bullet list
# $self->_append("\t" x $indent_level . '*');
}
elsif ( $item_type eq 'number' ) {
$self->_append( "\t" x $indent_level . $item_param );
}
elsif ( $item_type eq 'text' ) {
$self->_append( "\t" x $indent_level );
}
}
###############################################################################
#
# _skip_headings()
#
# Formatting in headings doesn't look great or is ignored in some formats.
#
sub _skip_headings {
my $self = shift;
return 0;
}
###############################################################################
#
# _append_tag()
#
# Add an open or close tag to the current text.
#
sub _append_tag {
my $self = shift;
my $tag = $_[0];
$self->_append( $self->{_tags}->{$tag} );
}
###############################################################################
###############################################################################
#
# The methods in the following section are required by Pod::Simple to handle
# Pod directives and elements.
#
# The methods _handle_element_start() _handle_element_end() and _handle_text()
# are called by Pod::Simple in response to Pod constructs. We use
# _handle_element_start() and _handle_element_end() to generate calls to more
# specific methods. This is basically a long-hand version of Pod::Simple::
# Methody with the addition of location tracking.
#
###############################################################################
#
# _handle_element_start()
#
# Call a method to handle the start of a element if one has been defined.
# We also set a flag to indicate that we are "in" the element type.
#
sub _handle_element_start {
my $self = shift;
my $element = $_[0];
$element =~ tr/-/_/;
if ( $self->{_debug} ) {
print ' ' x $self->{_item_indent}, "<$element>\n";
}
$self->{ "_in_" . $element }++;
if ( my $method = $self->can( '_start_' . $element ) ) {
$method->( $self, $_[1] );
}
}
###############################################################################
#
# _handle_element_end()
#
# Call a method to handle the end of a element if one has been defined.
# We also set a flag to indicate that we are "out" of the element type.
#
sub _handle_element_end {
my $self = shift;
my $element = $_[0];
$element =~ tr/-/_/;
if ( my $method = $self->can( '_end_' . $element ) ) {
$method->( $self );
}
$self->{ "_in_" . $element }--;
if ( $self->{_debug} ) {
print "\n", ' ' x $self->{_item_indent}, "$element>\n\n";
}
}
###############################################################################
#
# _handle_text()
#
# Perform any necessary transforms on the text. This is mainly used to escape
# inadvertent CamelCase words.
#
sub _handle_text {
my $self = shift;
my $text = $_[0];
# Split the text into tokens but maintain the whitespace
my @tokens = split /(\s+)/, $text;
for ( @tokens ) {
next unless /\S/; # Ignore the whitespace
next if m[^(ht|f)tp://]; # Ignore URLs
s/([A-Z][a-z]+)(?=[A-Z])/$1''''''/g # Escape with 6 single quotes
}
# Rejoin the tokens and whitespace.
$self->{_wiki_text} .= join '', @tokens;
}
###############################################################################
#
# Functions to deal with the I<>, B<> and C<> formatting codes.
#
sub _start_I { $_[0]->_append_tag( '' ) unless $_[0]->_skip_headings() }
sub _start_B { $_[0]->_append_tag( '' ) unless $_[0]->_skip_headings() }
sub _start_C { $_[0]->_append_tag( '' ) unless $_[0]->_skip_headings() }
sub _start_F { $_[0]->_start_I }
sub _end_I { $_[0]->_append_tag( '' ) unless $_[0]->_skip_headings() }
sub _end_B { $_[0]->_append_tag( '
' ) unless $_[0]->_skip_headings() }
sub _end_C { $_[0]->_append_tag( '' ) unless $_[0]->_skip_headings() }
sub _end_F { $_[0]->_end_I }
###############################################################################
#
# Functions to deal with the Pod =head directives
#
sub _start_head1 { $_[0]->_append_tag( '' ) }
sub _start_head2 { $_[0]->_append_tag( '' ) }
sub _start_head3 { $_[0]->_append_tag( '' ) }
sub _start_head4 { $_[0]->_append_tag( '' ) }
sub _end_head1 { $_[0]->_append_tag( '
' ); $_[0]->_output() }
sub _end_head2 { $_[0]->_append_tag( '' ); $_[0]->_output() }
sub _end_head3 { $_[0]->_append_tag( '' ); $_[0]->_output() }
sub _end_head4 { $_[0]->_append_tag( '' ); $_[0]->_output() }
###############################################################################
#
# Functions to deal with verbatim paragraphs. We emit the text "as is" for now.
# TODO: escape any Wiki formatting in text such as ''code''.
#
sub _start_Verbatim { $_[0]->_append_tag( '' ) }
sub _end_Verbatim { $_[0]->_append_tag( '' ); $_[0]->_output() }
###############################################################################
#
# Functions to deal with =over ... =back regions for
#
# Bulleted lists
# Numbered lists
# Text lists
# Block lists
#
sub _start_over_bullet { $_[0]->{_item_indent}++ }
sub _start_over_number { $_[0]->{_item_indent}++ }
sub _start_over_text { $_[0]->{_item_indent}++ }
sub _end_over_bullet {
$_[0]->{_item_indent}--;
$_[0]->_output( "\n" ) unless $_[0]->{_item_indent};
}
sub _end_over_number {
$_[0]->{_item_indent}--;
$_[0]->_output( "\n" ) unless $_[0]->{_item_indent};
}
sub _end_over_text {
$_[0]->{_item_indent}--;
$_[0]->_output( "\n" ) unless $_[0]->{_item_indent};
}
sub _start_item_bullet { $_[0]->_indent_item( 'bullet' ) }
sub _start_item_number { $_[0]->_indent_item( 'number', $_[1]->{number} ) }
sub _start_item_text { $_[0]->_indent_item( 'text' ) }
sub _end_item_bullet { $_[0]->_output( "\n" ) }
sub _end_item_number { $_[0]->_output( "\n" ) }
sub _end_item_text { $_[0]->_output( ":\t" ) } # Format specific.
sub _start_over_block { $_[0]->{_item_indent}++ }
sub _end_over_block { $_[0]->{_item_indent}-- }
###############################################################################
#
# _start_Para()
#
# Special handling for paragraphs that are part of an "over" block.
#
sub _start_Para {
my $self = shift;
my $indent_level = $self->{_item_indent};
if ( $self->{_in_over_block} ) {
$self->_append( ( "\t" x $indent_level ) . " :\t" );
}
}
###############################################################################
#
# _end_Para()
#
# Special handling for paragraphs that are part of an "over_text" block.
#
sub _end_Para {
my $self = shift;
# Only add a newline if the paragraph isn't part of a text
if ( $self->{_in_over_text} ) {
# Do nothing in this format.
}
else {
$self->_output( "\n" );
}
$self->_output( "\n" );
}
1;
__END__
=pod
=encoding utf8
=head1 NAME
Pod::Simple::Wiki - A class for creating Pod to Wiki filters.
=head1 SYNOPSIS
To create a simple filter to convert from Pod to a wiki format:
#!/usr/bin/perl
use strict;
use warnings;
use Pod::Simple::Wiki;
my $parser = Pod::Simple::Wiki->new('kwiki');
if ( defined $ARGV[0] ) {
open IN, $ARGV[0] or die "Couldn't open $ARGV[0]: $!\n";
}
else {
*IN = *STDIN;
}
if ( defined $ARGV[1] ) {
open OUT, ">$ARGV[1]" or die "Couldn't open $ARGV[1]: $!\n";
}
else {
*OUT = *STDOUT;
}
$parser->output_fh( *OUT );
$parser->parse_file( *IN );
__END__
To convert Pod to a wiki format using the installed C utility:
pod2wiki --style mediawiki file.pod > file.wiki
=head1 DESCRIPTION
The C module is used for converting Pod text to Wiki text.
Pod (Plain Old Documentation) is a simple markup language used for writing Perl documentation.
A Wiki is a user extensible web site. It uses very simple mark-up that is converted to Html. For an introduction to Wikis see: L
=head1 METHODS
=head2 new('wiki_format')
The C method is used to create a new C object. It is also used to set the output Wiki format.
my $parser1 = Pod::Simple::Wiki->new( 'wiki' );
my $parser2 = Pod::Simple::Wiki->new( 'mediawiki' );
my $parser3 = Pod::Simple::Wiki->new(); # Defaults to 'wiki'
The currently supported formats are:
wiki
kwiki
usemod
twiki
tiddlywiki
textile
wikipedia or mediawiki
markdown
moinmoin
confluence
=head2 Other methods
Pod::Simple::Wiki inherits all of the methods of C. See L for more details.
=head1 Supported Formats
The following wiki formats are supported by C:
=over 4
=item wiki
This is the original Wiki format as used on Ward Cunningham's Portland repository of Patterns. See L.
=item kwiki
This is the format as used by Brian Ingerson's Kwiki: L.
=item usemod
This is the format used by the Usemod wikis. See: L.
=item twiki
This is the format used by TWiki wikis. See: L .
=item tiddlywiki
This is the format used by the TiddlyWiki. See: L .
=item textile
The Textile markup format as used on GitHub. See: L .
=item wikipedia or mediawiki
This is the format used by Wikipedia and MediaWiki wikis. See: L .
=item markdown
This is the format used by GitHub and other sites. See: L.
=item moinmoin
This is the format used by MoinMoin wikis. See: L.
=item muse
Emacs Muse (also known as "Muse" or "Emacs-Muse") is an authoring and publishing environment for Emacs.
=item confluence
This is the format used by Confluence. See: L .
=back
If no format is specified the parser defaults to C.
Any other parameters in C will be passed on to the parent C object. See L for more details.
=head1 Porting New Wiki Formats
If you are interested in porting a new wiki format have a look at L.
The C git repository is: L .
=head1 SEE ALSO
This module also installs a C command line utility. See C for details.
=head1 TODO
=over 4
=item *
Fix some of the C<=over> edge cases. See the TODOs in the test programs.
=back
=head1 ACKNOWLEDGEMENTS
Thanks to Sean M. Burke for C. It may not be simple but sub-classing it is. C<:-)>
Thanks to Zoffix Znet for various pull requests and fixes.
Thanks to Sam Tregar for TWiki support.
Thanks Tony Sidaway for Wikipedia/MediaWiki support.
Thanks to Daniel T. Staal for Markdown support.
Thanks to Michael Matthews for MoinMoin support.
Thanks to Christopher J. Madsen for several MediaWiki additions and tests.
Thanks Tim Bunce for the TiddlyWiki prod and Ron Savage for the port.
Thanks to Olivier 'dolmen' MenguE for various TiddlyWiki patches.
Thanks to David Bartle, Andrew Hobbs and Jim Renwick for confluence patches.
Thanks to Peter Hallam for MediaWiki enhancements.
Thanks to Marco Pessotto for the Muse format.
=head1 DISCLAIMER OF WARRANTY
Because this software is licensed free of charge, there is no warranty for the software, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the software "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the software is with you. Should the software prove defective, you assume the cost of all necessary servicing, repair, or correction.
In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute the software as permitted by the above licence, be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use the software (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the software to operate with any other software), even if such holder or other party has been advised of the possibility of such damages.
=head1 LICENSE
Either the Perl Artistic Licence L or the GPL L.
=head1 AUTHOR
John McNamara jmcnamara@cpan.org
=head1 COPYRIGHT
MMIII-MMIV, John McNamara.
All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
Pod-Simple-Wiki-0.20/lib/Pod/Simple/Wiki/Confluence.pm 000644 000765 000024 00000013561 12620221661 022415 0 ustar 00John staff 000000 000000 package Pod::Simple::Wiki::Confluence;
###############################################################################
#
# Pod::Simple::Wiki::Confluence - A class for creating Pod to Confluence filters.
#
#
# Copyright 2003-2012, John McNamara, jmcnamara@cpan.org
#
# Documentation after __END__
#
# perltidy with the following options: -mbl=2 -pt=0 -nola
use Pod::Simple::Wiki;
use strict;
use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Simple::Wiki);
$VERSION = '0.20';
###############################################################################
#
# The tag to wiki mappings.
#
my $tags = {
'' => '*',
'' => '*',
'' => '_',
'' => '_',
'' => '{{',
'' => '}}',
'' => "{noformat}\n",
'' => "\n{noformat}\n",
'' => 'h1. ',
'
' => "\n\n",
'' => 'h2. ',
'
' => "\n\n",
'' => 'h3. ',
'
' => "\n\n",
'' => 'h4. ',
'
' => "\n\n",
};
###############################################################################
#
# new()
#
# Simple constructor inheriting from Pod::Simple::Wiki.
#
sub new {
my $class = shift;
my $self = Pod::Simple::Wiki->new( 'wiki', @_ );
$self->{_tags} = $tags;
bless $self, $class;
return $self;
}
###############################################################################
#
# _indent_item()
#
# Indents an "over-item" to the correct level.
#
sub _indent_item {
my $self = shift;
my $item_type = $_[0];
my $item_param = $_[1];
my $indent_level = $self->{_item_indent};
if ( $item_type eq 'bullet' ) {
$self->_append( '*' x $indent_level . ' ' );
}
elsif ( $item_type eq 'number' ) {
$self->_append( '#' x $indent_level . ' ' );
}
# Confluence doesn't have the equivalent of a list so we use a
# bullet list with a bolded "item" as a workaround.
elsif ( $item_type eq 'text' ) {
$self->_append( '*' x $indent_level . ' *' );
}
}
###############################################################################
#
# _handle_text()
#
# Perform any necessary transforms on the text. This is mainly used to escape
# inadvertent CamelCase words.
#
sub _handle_text {
my $self = shift;
my $text = $_[0];
# Split the text into tokens but maintain the whitespace
my @tokens = split /(\s+)/, $text;
# Escape any tokens here, if necessary.
@tokens = map { s/([[{*_-])/\\$1/g; $_ } @tokens;
# Rejoin the tokens and whitespace.
$self->{_wiki_text} .= join '', @tokens;
}
###############################################################################
#
# Functions to deal with =over ... =back regions for
#
# Bulleted lists
# Numbered lists
# Text lists
# Block lists
#
sub _end_item_text { $_[0]->_output( '* ' ) }
###############################################################################
#
# _start_Para()
#
# Special handling for paragraphs that are part of an "over" block.
#
sub _start_Para {
my $self = shift;
my $indent_level = $self->{_item_indent};
if ( $self->{_in_over_block} ) {
$self->_append( 'bq. ' );
}
}
###############################################################################
#
# _start_L()
#
# Handle the start of a link element.
#
sub _start_L {
my $self = shift;
my $link_attrs = shift;
$self->{_link_attrs} = $link_attrs;
# Ouput start of Confluence link and flush the _wiki_text buffer.
$self->_output( '[' );
}
###############################################################################
#
# _end_L()
#
# Handle the end of a link element.
#
sub _end_L {
my $self = shift;
my $link_attrs = $self->{_link_attrs};
my $link_target = $link_attrs->{to};
my $link_section = $link_attrs->{section};
# Handle links that are parsed as Pod links.
if ( defined $link_section ) {
$link_target = $link_section;
# Remove quotes around link name.
$self->{_wiki_text} =~ s/^"//;
$self->{_wiki_text} =~ s/"$//;
}
# Only write [text|link] if text and link are different.
if ( $self->{_wiki_text} ne $link_target ) {
$self->_append( "|$link_target]" );
}
else {
$self->_append( "]" );
}
}
1;
__END__
=head1 NAME
Pod::Simple::Wiki::Confluence - A class for creating Pod to Confluence wiki filters.
=head1 SYNOPSIS
This module isn't used directly. Instead it is called via C:
#!/usr/bin/perl -w
use strict;
use Pod::Simple::Wiki;
my $parser = Pod::Simple::Wiki->new('confluence');
...
Convert Pod to a Confluence wiki format using the installed C utility:
pod2wiki --style confluence file.pod > file.wiki
=head1 DESCRIPTION
The C module is used for converting Pod text to Wiki text.
Pod (Plain Old Documentation) is a simple markup language used for writing Perl documentation.
For an introduction to Confluence see: L
This module isn't generally invoked directly. Instead it is called via C. See the L and L documentation for more information.
=head1 METHODS
Pod::Simple::Wiki::Confluence inherits all of the methods of C and C. See L and L for more details.
=head1 SEE ALSO
This module also installs a C command line utility. See C for details.
=head1 ACKNOWLEDGEMENTS
Thanks to David Bartle, Andrew Hobbs and Jim Renwick for patches.
=head1 DISCLAIMER OF WARRANTY
Please refer to the DISCLAIMER OF WARRANTY in L.
=head1 AUTHORS
John McNamara jmcnamara@cpan.org
=head1 COPYRIGHT
MMIII-MMXV, John McNamara.
All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
Pod-Simple-Wiki-0.20/lib/Pod/Simple/Wiki/Kwiki.pm 000644 000765 000024 00000013277 12620221661 021416 0 ustar 00John staff 000000 000000 package Pod::Simple::Wiki::Kwiki;
###############################################################################
#
# Pod::Simple::Wiki::Kwiki - A class for creating Pod to Kwiki filters.
#
#
# Copyright 2003-2012, John McNamara, jmcnamara@cpan.org
#
# Documentation after __END__
#
# perltidy with the following options: -mbl=2 -pt=0 -nola
use Pod::Simple::Wiki;
use strict;
use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Simple::Wiki);
$VERSION = '0.20';
###############################################################################
#
# The tag to wiki mappings.
#
my $tags = {
'' => '*',
'' => '*',
'' => '/',
'' => '/',
'' => '[=',
'' => ']',
'' => '',
'' => "\n\n",
'' => "\n----\n= ",
'
' => " =\n\n",
'' => "\n== ",
'
' => " ==\n\n",
'' => "\n=== ",
'
' => " ===\n\n",
'' => "==== ",
'
' => "\n\n",
};
###############################################################################
#
# new()
#
# Simple constructor inheriting from Pod::Simple::Wiki.
#
sub new {
my $class = shift;
my $self = Pod::Simple::Wiki->new( 'wiki', @_ );
$self->{_tags} = $tags;
bless $self, $class;
return $self;
}
###############################################################################
#
# _indent_item()
#
# Indents an "over-item" to the correct level.
#
sub _indent_item {
my $self = shift;
my $item_type = $_[0];
my $item_param = $_[1];
my $indent_level = $self->{_item_indent};
if ( $item_type eq 'bullet' ) {
$self->_append( '*' x $indent_level . ' ' );
}
elsif ( $item_type eq 'number' ) {
$self->_append( '0' x $indent_level . ' ' );
}
elsif ( $item_type eq 'text' ) {
$self->_append( ';' x $indent_level . ' ' );
}
}
###############################################################################
#
# _skip_headings()
#
# Formatting in headings doesn't look great or is ignored in some formats.
#
sub _skip_headings {
my $self = shift;
if ( $self->{_in_head1}
or $self->{_in_head2}
or $self->{_in_head3}
or $self->{_in_head4} )
{
return 1;
}
}
###############################################################################
#
# _handle_text()
#
# Perform any necessary transforms on the text. This is mainly used to escape
# inadvertent CamelCase words.
#
sub _handle_text {
my $self = shift;
my $text = $_[0];
# Only escape CamelCase in Kwiki paragraphs
if ( not $self->{_in_Para} ) {
$self->{_wiki_text} .= $text;
return;
}
# Split the text into tokens but maintain the whitespace
my @tokens = split /(\s+)/, $text;
for ( @tokens ) {
next unless /\S/; # Ignore the whitespace
next if m[^(ht|f)tp://]; # Ignore URLs
s/([A-Z][a-z]+[A-Z]\w+)/!$1/g; # Escape with !
}
# Rejoin the tokens and whitespace.
$self->{_wiki_text} .= join '', @tokens;
}
###############################################################################
#
# Functions to deal with =over ... =back regions for
#
# Bulleted lists
# Numbered lists
# Text lists
# Block lists
#
sub _end_item_text { $_[0]->_output( ' ; ' ) }
###############################################################################
#
# _start_Para()
#
# Special handling for paragraphs that are part of an "over" block.
#
sub _start_Para {
my $self = shift;
my $indent_level = $self->{_item_indent};
if ( $self->{_in_over_block} ) {
# Do something here is necessary
}
}
###############################################################################
#
# _end_Para()
#
# Special handling for paragraphs that are part of an "over_text" block.
# This is mainly required be Kwiki.
#
sub _end_Para {
my $self = shift;
# Only add a newline if the paragraph isn't part of a text.
if ( $self->{_in_over_text} ) {
# Workaround for the fact that Kwiki doesn't have a definition block.
#$self->_output("\n");
}
else {
$self->_output( "\n" );
}
$self->_output( "\n" );
}
1;
__END__
=head1 NAME
Pod::Simple::Wiki::Kwiki - A class for creating Pod to Kwiki wiki filters.
=head1 SYNOPSIS
This module isn't used directly. Instead it is called via C:
#!/usr/bin/perl -w
use strict;
use Pod::Simple::Wiki;
my $parser = Pod::Simple::Wiki->new('kwiki');
...
Convert Pod to a Kwiki wiki format using the installed C utility:
pod2wiki --style kwiki file.pod > file.wiki
=head1 DESCRIPTION
The C module is used for converting Pod text to Wiki text.
Pod (Plain Old Documentation) is a simple markup language used for writing Perl documentation.
For an introduction to Kwiki see: L
This module isn't generally invoked directly. Instead it is called via C. See the L and L documentation for more information.
=head1 METHODS
Pod::Simple::Wiki::Kwiki inherits all of the methods of C and C. See L and L for more details.
=head1 SEE ALSO
This module also installs a C command line utility. See C for details.
=head1 ACKNOWLEDGEMENTS
Submit a bugfix or test and your name will go here.
=head1 DISCLAIMER OF WARRANTY
Please refer to the DISCLAIMER OF WARRANTY in L.
=head1 AUTHORS
John McNamara jmcnamara@cpan.org
=head1 COPYRIGHT
MMIII-MMXV, John McNamara.
All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
Pod-Simple-Wiki-0.20/lib/Pod/Simple/Wiki/Markdown.pm 000644 000765 000024 00000017063 12620221661 022117 0 ustar 00John staff 000000 000000 package Pod::Simple::Wiki::Markdown;
###############################################################################
#
# Pod::Simple::Wiki::Markdown - A class for creating Pod to Markdown filters.
#
#
# Copyright 2003-2014, John McNamara, jmcnamara@cpan.org, Daniel T. Staal,
# DStaal@usa.net
#
# Documentation after __END__
#
# perltidy with the following options: -mbl=2 -pt=0 -nola
use Pod::Simple::Wiki;
use strict;
use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Simple::Wiki);
$VERSION = '0.20';
###############################################################################
#
# The tag to wiki mappings.
#
my $tags = {
'' => '**',
'' => '**',
'' => '_',
'' => '_',
'' => '`',
'' => '`',
'' => "\n```\n",
'' => "\n```\n",
'' => '# ',
'
' => "\n\n",
'' => '## ',
'
' => "\n\n",
'' => '### ',
'
' => "\n\n",
'' => '#### ',
'
' => "\n\n",
};
###############################################################################
#
# new()
#
# Simple constructor inheriting from Pod::Simple::Wiki.
#
sub new {
my $class = shift;
my $self = Pod::Simple::Wiki->new( 'wiki', @_ );
$self->{_tags} = $tags;
bless $self, $class;
return $self;
}
###############################################################################
#
# _indent_item()
#
# Indents an "over-item" to the correct level.
#
sub _indent_item {
my $self = shift;
my $item_type = $_[0];
my $item_param = $_[1];
my $indent_level = $self->{_item_indent} - 1;
if ( $item_type eq 'bullet' ) {
$self->_append( ' ' x $indent_level . '* ' );
}
elsif ( $item_type eq 'number' ) {
$self->_append( ' ' x $indent_level . '1 ' );
}
# In theory Markdown supports nested definition lists - but *everything* has to be indented.
elsif ( $item_type eq 'text' ) {
$self->_append( ' ' x $indent_level . '' );
}
}
###############################################################################
#
# _start_L()
#
# Handle the start of a link element.
#
sub _start_L {
my $self = shift;
my $link_attrs = shift;
$self->{_link_attrs} = $link_attrs;
# Ouput start of Confluence link and flush the _wiki_text buffer.
$self->_output( '[' );
}
###############################################################################
#
# _end_L()
#
# Handle the end of a link element.
#
sub _end_L {
my $self = shift;
my $link_attrs = $self->{_link_attrs};
my $link_target = $link_attrs->{to};
my $link_section = $link_attrs->{section};
$link_target = '' if( !defined($link_target));
# Handle links that are parsed as Pod links.
if ( defined $link_section ) {
$link_target = "$link_target#$link_section";
}
$self->_append( "]($link_target)" );
}
###############################################################################
#
# _handle_text()
#
# Perform any necessary transforms on the text. This is mainly used to escape
# inadvertent CamelCase words.
#
sub _handle_text {
my $self = shift;
my $text = $_[0];
# Only escape words in paragraphs
if ( not $self->{_in_Para} ) {
$self->{_wiki_text} .= $text;
return;
}
# Split the text into tokens but maintain the whitespace
my @tokens = split /(\s+)/, $text;
# Escape any tokens here, if necessary.
# The following characters are escaped by prepending a backslash: \`*_
# (Markdown has other escapes as well, but these cover most cases, and the others
# are usually optional.)
@tokens = map { s/([\\`\*\_])/\\$1/g; $_ } @tokens;
# Rejoin the tokens and whitespace.
$self->{_wiki_text} .= join '', @tokens;
}
###############################################################################
#
# Functions to deal with =over ... =back regions for
#
# Bulleted lists
# Numbered lists
# Text lists
# Block lists
#
sub _end_item_text {
my $self = shift;
my $indent_level = $self->{_item_indent} - 1;
$self->_output( "\n" . ' ' x $indent_level . ': ' );
}
###############################################################################
#
# _start_Para()
#
# Special handling for paragraphs that are part of an "over" block.
#
sub _start_Para {
my $self = shift;
my $indent_level = $self->{_item_indent} - 1;
if ( $self->{_in_over_block} ) {
$self->_append( ' ' x $indent_level . '' );
}
}
1;
__END__
=head1 NAME
Pod::Simple::Wiki::Markdown - A class for creating Pod to Markdown wiki filters.
=head1 SYNOPSIS
This module isn't used directly. Instead it is called via C:
#!/usr/bin/perl -w
use strict;
use Pod::Simple::Wiki;
my $parser = Pod::Simple::Wiki->new('markdown');
...
Convert Pod to a markdown wiki format using the installed C utility:
pod2wiki --style markdown file.pod > file.wiki
=head1 DESCRIPTION
The C module is used for converting Pod text to Markdown text.
Pod (Plain Old Documentation) is a simple markup language used for writing Perl documentation.
This module isn't generally invoked directly. Instead it is called via C. See the L and L documentation for more information.
=head1 METHODS
Pod::Simple::Wiki::Markdown inherits all of the methods of C and C. See L and L for more details.
=head1 Markdown Specific information
Some format features of Pod are not present in base Markdown (and vice-versa). In particular this module supports both code blocks and definition lists - in a somewhat inconsistent fashion. Code blocks are supported using GitHub Markdown syntax: three backticks at the start and end of the codeblock. Definition lists are (crudely) supported in the PHP Markdown Extra syntax: A colon followed by three spaces starting the line with the definition. PHP Markdown Extra works with the GitHub syntax, so this should not cause a problem. (GitHub does not support definition lists.) This module also creates nested definition lists - which may or may not be supported. (And may need extra newlines entered, which is beyond the technical limits of this module.)
Links are always output in the universal [link text](link source) format, even when it's redundant, or overlong. Anything POD considers a link will be treated as one, even if it's not a valid link. (In particular, automatic 'man page' links will not point to anything useful - the user will be required to turn C<(Pod::Simple)> into something useful, likely your favorite interface for CPAN.)
Escapes are automatically applied to asterisks, underscores, backticks, and backslashes, and they are always required. Markdown provides escapes for other characters (in particular braces and parenthesis), but they are not required in all cases. I leave it up to the user to determine when they would be considered formatting and when they wouldn't.
=head1 SEE ALSO
This module also installs a C command line utility. See C for details.
=head1 ACKNOWLEDGEMENTS
Thanks to Daniel T. Staal for patches, documentation or bugfixes.
=head1 DISCLAIMER OF WARRANTY
Please refer to the DISCLAIMER OF WARRANTY in L.
=head1 AUTHORS
John McNamara jmcnamara@cpan.org
Daniel T. Staal DStaal@usa.net
=head1 COPYRIGHT
MMIII-MMXV, John McNamara, Daniel T. Staal
All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
Pod-Simple-Wiki-0.20/lib/Pod/Simple/Wiki/Mediawiki.pm 000644 000765 000024 00000031047 12620221661 022236 0 ustar 00John staff 000000 000000 package Pod::Simple::Wiki::Mediawiki;
###############################################################################
#
# Pod::Simple::Wiki::Mediawiki - A class for creating Pod to MediaWiki filters.
#
#
# Copyright 2003-2012, John McNamara, jmcnamara@cpan.org
#
# Documentation after __END__
#
# perltidy with the following options: -mbl=2 -pt=0 -nola
use Pod::Simple::Wiki;
use strict;
use vars qw(@ISA $VERSION);
@ISA = qw(Pod::Simple::Wiki);
$VERSION = '0.20';
###############################################################################
#
# The tag to wiki mappings.
#
my $tags = {
'' => "'''",
'' => "'''",
'' => "''",
'' => "''",
'' => '',
'' => '',
'' => "\n",
'
' => "\n\n",
'' => '==',
'
' => "==\n",
'' => '===',
'
' => "===\n",
'' => '====',
'
' => "====\n",
'' => '=====',
'
' => "=====\n",
};
###############################################################################
#
# The default module options
#
my $default_opts = {
transformer_lists => 0,
link_prefix => 0,
sentence_case_headers => 0,
remove_name_section => 0,
};
###############################################################################
#
# new()
#
# Simple constructor inheriting from Pod::Simple::Wiki.
#
sub new {
my $class = shift;
my $opts = {};
if ( ref $_[-1] eq 'HASH' ) {
$opts = pop @_;
# Merge custom tags with the default tags, if passed.
$opts->{tags} = {
%$tags,
%{
exists $opts->{custom_tags}
? delete $opts->{custom_tags}
: {}
}
};
}
else {
$opts->{tags} = $tags;
}
$opts = { %$default_opts, %$opts };
my $self = Pod::Simple::Wiki->new( 'wiki', @_ );
$self->{_tags} = $opts->{tags};
$self->{_transformer_lists} = $opts->{transformer_lists};
$self->{_link_prefix} = $opts->{link_prefix};
$self->{_sentence_case_headers} = $opts->{sentence_case_headers};
$self->{_remove_name_section} = $opts->{remove_name_section};
bless $self, $class;
$self->accept_targets( 'mediawiki' );
$self->nbsp_for_S( 1 );
return $self;
}
###############################################################################
#
# _append()
#
# Appends some text to the buffered Wiki text.
#
sub _append {
my $self = shift;
if ( $self->{_indent_text} ) {
$self->{_wiki_text} .= $self->{_indent_text};
$self->{_indent_text} = '';
}
$self->{_wiki_text} .= $_[0];
}
###############################################################################
#
# _indent_item()
#
# Indents an "over-item" to the correct level.
#
sub _indent_item {
my $self = shift;
my $item_type = $_[0];
my $item_param = $_[1];
my $indent_level = $self->{_item_indent};
if ( $item_type eq 'bullet' ) {
$self->_append( '*' x $indent_level . ' ' );
}
elsif ( $item_type eq 'number' ) {
$self->_append( '#' x $indent_level . ' ' );
}
elsif ( $item_type eq 'text' ) {
$self->_append( ':' x ( $indent_level - 1 ) . '; ' );
}
}
###############################################################################
#
# Functions to deal with links.
sub _start_L {
my ( $self, $attr ) = @_;
if ( !$self->_skip_headings ) {
$self->_append( '' ); # In case we have _indent_text pending
# Flush the text buffer, so it will contain only the link text
$self->_output;
$self->{_link_attr} = $attr; # Save for later
}
}
sub _end_L {
my $self = $_[0];
my $attr = delete $self->{_link_attr};
if ( $attr and my $method = $self->can( '_format_link' ) ) {
$self->{_wiki_text} = $method->( $self, $self->{_wiki_text}, $attr );
}
}
###############################################################################
#
# _format_link
sub _format_link {
my ( $self, $text, $attr ) = @_;
if ( $attr->{type} eq 'url' ) {
my $link = $attr->{to};
return $link if $attr->{'content-implicit'};
return "[$link $text]";
}
# Manpage:
if ( $attr->{type} eq 'man' ) {
# FIXME link to http://www.linuxmanpages.com?
return "$text" if $attr->{'content-implicit'};
return "$text ($attr->{to})";
}
die "Unknown link type $attr->{type}" unless $attr->{type} eq 'pod';
# Handle a link within this page:
return "[[#$attr->{section}|$text]]" unless defined $attr->{to};
# Handle a link to a specific section in another page:
if ( defined $attr->{section} ) {
return $self->{_link_prefix}
? "[$self->{_link_prefix}$attr->{to}#$attr->{section} $text]"
: "[[$attr->{to}#$attr->{section}|$text]]";
}
if ( $attr->{'content-implicit'} ) {
return $self->{_link_prefix}
? "[$self->{_link_prefix}$attr->{to} $attr->{to}]"
: "[[$attr->{to}]]";
}
return "[[$attr->{to}|$text]]";
}
###############################################################################
#
# _handle_text()
#
# Perform any necessary transforms on the text. This is mainly used to escape
# inadvertent CamelCase words.
#
sub _handle_text {
my $self = shift;
my $text = $_[0];
if ( $self->{_sentence_case_headers} ) {
if ( $self->{_in_head1} ) {
$text = ucfirst( lc( $text ) );
}
}
if ( !$self->{_in_Data} ) {
# Escape colons in definition lists:
if ( $self->{_in_item_text} ) {
$text =~ s/:/:/g; # A colon would end the item
}
# Escape empty lines in verbatim sections:
if ( $self->{_in_Verbatim} ) {
$text =~ s/^$/ /mg; # An empty line would split the section
}
$text =~ s/\xA0/ /g; # Convert non-breaking spaces to entities
$text =~ s/''/''/g; # It's not a formatting code
$text =~ s/\xA9/©/g; # Convert copyright symbols to entities
}
$self->_append( $text );
}
###############################################################################
#
# Functions to deal with =over ... =back regions for
#
# Bulleted lists
# Numbered lists
# Text lists
# Block lists
#
sub _end_item_text { } # _start_Para will insert the :
###############################################################################
#
# _start_Para()
#
# Special handling for paragraphs that are part of an "over" block.
#
sub _start_Para {
my $self = shift;
my $indent_level = $self->{_item_indent};
if ( $self->{_in_over_block} ) {
$self->{_indent_text} = ( ':' x $indent_level );
}
if ( $self->{_in_over_text} ) {
$self->{_indent_text} = "\n" . ( ':' x $indent_level );
}
if ( $self->{_transformer_lists} ) {
if ( $self->{_in_over_bullet} || $self->{_in_over_number} ) {
if ( $self->{output_string} ) {
chomp( ${ $self->{output_string} } );
}
$self->{_indent_text} = "";
}
}
}
###############################################################################
#
# _end_Para()
#
# Special handling for paragraphs that are part of an "over_text" block.
#
sub _end_Para {
my $self = shift;
# Only add a newline if the paragraph isn't part of a text
if ( $self->{_in_over_text} ) {
# Do nothing in this format.
}
elsif ( $self->{_transformer_lists}
&& ( $self->{_in_over_bullet} || $self->{_in_over_number} ) )
{
$self->_output( "
\n" );
}
else {
$self->_output( "\n" );
}
if ( !$self->{_transformer_lists}
|| ( !$self->{_in_over_bullet} && !$self->{_in_over_number} ) )
{
$self->_output( "\n" );
}
}
######################################################################
#
# _end_Data
#
# Special handling for data paragraphs
sub _end_Data { $_[0]->_output( "\n\n" ) }
###############################################################################
#
# parse_string_document()
#
# Optional overriding of Pod::Simple method to remove the "NAME" section
#
sub parse_string_document {
my $self = shift;
$self = $self->SUPER::parse_string_document( @_ );
if ( $self->{_remove_name_section} ) {
no warnings 'uninitialized';
${ $self->{output_string} } =~
s/^==\s*NAME\s*==\n(?:[\w:]+)(?: - (.*))*/$1||''/iesg;
}
return $self;
}
1;
__END__
=pod
=encoding utf8
=head1 NAME
Pod::Simple::Wiki::Mediawiki - A class for creating Pod to Mediawiki wiki filters.
=head1 SYNOPSIS
This module isn't used directly. Instead it is called via C:
#!/usr/bin/perl -w
use strict;
use Pod::Simple::Wiki;
my $parser = Pod::Simple::Wiki->new('mediawiki', \%opts);
...
Convert Pod to a Mediawiki wiki format using the installed C utility:
pod2wiki --style mediawiki file.pod > file.wiki
=head1 DESCRIPTION
The C module is used for converting Pod text to Wiki text.
Pod (Plain Old Documentation) is a simple markup language used for writing Perl documentation.
For an introduction to Mediawiki see: http://www.mediawiki.org/wiki/MediaWiki
This module isn't generally invoked directly. Instead it is called via C. See the L and L documentation for more information.
=head1 METHODS
Pod::Simple::Wiki::Mediawiki inherits all of the methods of C and C. See L and L for more details.
=head2 new
The following options are supported by the C