, dialect => 'MoinMoin' );
close DATA;
__DATA__
add space between [[BR]] and URL
__H__
http://example.com
__W__
http://example.com [[BR]]
__NEXT__
wrap in html
__H__
GOOGLE
NewLine
__W__
[[http://google.com|GOOGLE]][[BR]] NewLine
__NEXT__
bold
__H__
bold
__W__
'''bold'''
__NEXT__
italics
__H__
italics
__W__
''italics''
__NEXT__
bold and italics
__H__
bold and italics
__W__
'''bold''' and ''italics''
__NEXT__
bold-italics nested
__H__
bold-italics nested
__W__
'''''bold-italics''' nested''
__NEXT__
strong
__H__
strong
__W__
'''strong'''
__NEXT__
emphasized
__H__
emphasized
__W__
''emphasized''
__NEXT__
underlined
__H__
text
__W__
__text__
__NEXT__
one-line phrasals
__H__
phrasals
in one line
__W__
''phrasals in one line''
__NEXT__
sup
__H__
x2
__W__
x^2^
__NEXT__
sub
__H__
H2O
__W__
H,,2,,O
__NEXT__
code
__H__
$name = 'stan';
__W__
`$name = 'stan';`
__NEXT__
tt
__H__
tt text
__W__
`tt text`
__NEXT__
small
__H__
some small text
__W__
some ~-small-~ text
__NEXT__
big
__H__
some big text
__W__
some ~+big+~ text
__NEXT__
paragraph blocking
__H__
p1
p2
__W__
p1
p2
__NEXT__
lists
__H__
__W__
* 1
* 2
__NEXT__
nested lists
__H__
__W__
* 1
* 1a
* 1b
* 2
__NEXT__
nested lists (different types)
__H__
__W__
* 1
* a
1. i
* b
* 2
__NEXT__
hr
__H__
__W__
----
__NEXT__
pre
__H__
this
is
preformatted
text
__W__
{{{
this
is
preformatted
text
}}}
__NEXT__
h1
__H__
h1
__W__
= h1 =
__NEXT__
h2
__H__
h2
__W__
== h2 ==
__NEXT__
h3
__H__
h3
__W__
=== h3 ===
__NEXT__
h4
__H__
h4
__W__
==== h4 ====
__NEXT__
h5
__H__
h5
__W__
===== h5 =====
__NEXT__
h6
__H__
h6
__W__
====== h6 ======
__NEXT__
img
__H__
__W__
http://www.test.com/thing.gif
__NEXT__
external links
__H__
thing
__W__
[[http://www.test.com/test.html|thing]]
__NEXT__
external link (plain)
__H__
http://www.test.com
__W__
http://www.test.com
__NEXT__
definition list
__H__
- cookies
- delicious delicacies
__W__
cookies:: delicious delicacies
__NEXT__
simple table
__H__
__W__
|| name || david ||
__NEXT__
table w/ attrs
__H__
__W__
||<-2 tablestyle="width:100%; background-color:white" id="thing"> thing ||
|| next || crazy ||
__NEXT__
anchors with content (bug #29347) ::enable_anchor_macro(1)
__H__
This is the top of the page
__W__
<>
This is the top of the page
__NEXT__
anchors (bug #17813) ::enable_anchor_macro(1)
__H__
Top of page
__W__
<>
[[#href-top|Top of page]]
HTML-WikiConverter-MoinMoin-0.54/t/pod-coverage.t 0000644 0000765 0000024 00000001055 10462243114 021026 0 ustar diberri staff #!perl -T
use Test::More;
eval "use Test::Pod::Coverage 1.04";
plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
all_pod_coverage_ok( { also_private => [
# These methods are documented in HTML::WikiConverter::Dialects
qr/
get_elem_contents
|get_wiki_page
|get_attr_str
|elem_within_block
|is_camel_case
|rule
|rules
|attribute
|attributes
|preprocess_tree
|preprocess_node
|postprocess_output
|caption2para
|strip_aname
|base_url
|wiki_url
/x
] } );
HTML-WikiConverter-MoinMoin-0.54/t/pod.t 0000644 0000765 0000024 00000000214 10360764017 017240 0 ustar diberri staff #!perl -T
use Test::More;
eval "use Test::Pod 1.14";
plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
all_pod_files_ok();
HTML-WikiConverter-MoinMoin-0.54/t/runtests.pl 0000644 0000765 0000024 00000006625 11041414201 020511 0 ustar diberri staff #!/usr/bin/perl
use warnings;
use strict;
use Test::More;
use File::Spec;
use HTML::Entities;
use HTML::WikiConverter;
*e = \&encode_entities;
my $more_tests = < comment
__W__
A comment
__NEXT__
strip head
__H__
fun stuff
Crazy stuff here
__W__
Crazy stuff here
__NEXT__
strip scripts
__H__
benevolent text
__W__
benevolent text
END_TESTS
sub runtests {
my %arg = @_;
$arg{wrap_in_html} = 1;
$arg{base_uri} ||= 'http://www.test.com';
my $minimal = $arg{minimal} || 0;
my $data = $arg{data} || '';
$data .= entity_tests() . $more_tests unless $minimal;
my @tests = split /__NEXT__\n/, $data;
my $numtests = @tests;
#$numtests += 1 unless $minimal; # file test
plan tests => $numtests;
# Delete unrecognized HTML::WikiConverter options
delete $arg{$_} for qw/ data minimal /;
my $wc = new HTML::WikiConverter(%arg);
foreach my $test ( @tests ) {
$test =~ s/^(.*?)\n//; my $name = $1;
my( $html, $wiki ) = split /__W__\n/, $test;
$html =~ s/__H__\n//;
# $name =~ s{\s*\:\:(\w+\([^\)]*?\))}{
# my $method_call = $1;
# eval "\$wc->$method_call;";
# die "Failed test call ($name): $@" if $@;
# '';
# }ge;
my( $todo, $todo_reason );
$name =~ s{\s*\:\:(\w+\([^\)]*?\))}{
my $keyword = $1;
if( $keyword =~ /TODO\((\"|\')(.*?)\1/ ) {
$todo = 1;
$todo_reason = $2;
} else {
my $method_call = $keyword;
eval "\$wc->$method_call;";
die "Failed test call ($name): $@" if $@;
}
'';
}ge;
for( $html, $wiki ) { s/^\n+//; s/\n+$// }
if( $todo ) {
TODO: {
local $TODO = $todo_reason;
is( $wc->html2wiki($html), $wiki, $name );
}
} else {
is( $wc->html2wiki($html), $wiki, $name );
}
}
#file_test($wc) unless $minimal;
}
sub entity_tests {
my $tmpl = "__NEXT__\n%s\n__H__\n%s\n__W__\n%s\n"; # test-name, html-input, expected-wiki-output
my $data = '';
my @chars = ( '<', '>', '&' );
foreach my $char ( @chars ) {
( my $charname = e($char) ) =~ s/[&;]//g;
$data .= sprintf $tmpl, "literal ($charname)", $char, e($char)
. sprintf $tmpl, "encode ($charname)", e($char), e($char)
. sprintf $tmpl, "meta ($charname)", e(e($char)), e(e($char));
}
return $data;
}
sub _slurp {
my $path = shift;
open H, $path or die "couldn't open $path: $!";
local $/;
my $c = ;
close H;
return $c;
}
sub file_test {
my $wc = shift;
my $lc_dialect = lc $wc->dialect;
my $infile = File::Spec->catfile( 't', 'complete.html' );
my $outfile = File::Spec->catfile( 't', "complete.$lc_dialect" );
SKIP: {
skip "Couldn't find $infile (ignore this)", 1 unless -e $infile;
skip "Couldn't find $outfile (ignore this)", 1 unless -e $outfile;
my( $got, $expect ) = ( $wc->html2wiki( file => $infile, slurp => 1 ), _slurp($outfile) );
for( $got, $expect ) { s/^\n+//; s/\n+$// }
is( $got, $expect, 'read from file' );
};
}
1;