diff --git a/perl_lib/EPrints/Test/Pod2Wiki.pm b/perl_lib/EPrints/Test/Pod2Wiki.pm index a80c30e7..c7b2a3de 100644 --- a/perl_lib/EPrints/Test/Pod2Wiki.pm +++ b/perl_lib/EPrints/Test/Pod2Wiki.pm @@ -1,4 +1,13 @@ -package EPrints::Test::Pod2Wiki; +###################################################################### +# +# EPrints::Test::Pod2Wiki +# +###################################################################### +# +# +###################################################################### + +=pod =for Pod2Wiki @@ -14,7 +23,7 @@ Pages generated by this module have Pod2Wiki markers inserted. These markers are ==SYNOPSIS== use EPrints::Test::Pod2Wiki; my $p = EPrints::Test::Pod2Wiki->new( - wiki_index => "http://wiki.foo.org/index.php", + wiki_api => "http://wiki.foo.org/api.php", username => "johnd", password => "xiPi00", ); @@ -44,7 +53,7 @@ The rest of this page concerns the I module. use EPrints::Test::Pod2Wiki; my $p = EPrints::Test::Pod2Wiki->new( - wiki_index => "http://wiki.foo.org/index.php", + wiki_api => "http://wiki.foo.org/api.php", username => "johnd", password => "xiPi00", ); @@ -57,10 +66,10 @@ This module enables the integration of EPrints POD (documentation) and MediaWiki =head1 METHODS -=over 4 - =cut +package EPrints::Test::Pod2Wiki; + use Pod::Parser; @ISA = qw( Pod::Parser ); @@ -78,15 +87,21 @@ my $PREFIX = "Pod2Wiki="; my $END_PREFIX = "Edit below this comment"; my $STYLE = "background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; "; -=item EPrints::Test::Pod2Wiki->new( ... ) +###################################################################### +=pod + +=over 4 + +=item EPrints::Test::Pod2Wiki->new( $class, %opts ) Create a new Pod2Wiki parser. Required options: - wiki_index - URL of the MediaWiki "index.php" page + wiki_api - URL of the MediaWiki "api.php" page username - MediaWiki username password - MediaWiki password =cut +###################################################################### sub new { @@ -107,11 +122,15 @@ sub new return $self; } +###################################################################### +=pod + =item $ok = $pod->update_page( $package_name ) Update the MediaWiki page for $package_name. =cut +###################################################################### sub update_page { @@ -211,7 +230,7 @@ sub _p2w_preamble my( $self, $package_name, $title ) = @_; my $blurb = <", "\n\n\n", ); @@ -367,11 +386,15 @@ sub _p2w_add_uncovered -name => "back" ) ); } -=item $parser->command( ... ) +###################################################################### +=pod + +=item $parser->command( $cmd, $text, $line_num, $pod_para ) L callback. =cut +###################################################################### sub command { @@ -417,6 +440,11 @@ sub command { $self->{_p2w_methods} = $self->{_p2w_head_depth}; } + elsif( $ref eq "copyright" ) + { + $self->{_p2w_methods} = 0; + push @{$self->{_out}}, "{{API:Copyright}}\n"; + } elsif( $self->{_p2w_methods} == $self->{_p2w_head_depth} ) { $self->{_p2w_methods} = 0; @@ -478,11 +506,15 @@ sub command } } -=item $parser->verbatim( ... ) +###################################################################### +=pod + +=item $parser->verbatim( $text, $line_num, $pod_para ) L callback. =cut +###################################################################### sub verbatim { @@ -497,11 +529,15 @@ sub verbatim push @{$self->{_out}}, $text; } -=item $parser->textblock( ... ) +###################################################################### +=pod + +=item $parser->textblock( $text, $line_num, $pod_para ) L callback. =cut +###################################################################### sub textblock { @@ -520,11 +556,15 @@ sub textblock push @{$self->{_out}}, $text; } -=item $parser->interpolate( ... ) +###################################################################### +=pod + +=item $parser->interpolate( $text, $line_num ) L callback. Overloaded to also escape HTML entities. =cut +###################################################################### sub interpolate { @@ -539,11 +579,15 @@ sub interpolate return $text; } -=item $parser->interior_sequence( ... ) +###################################################################### +=pod + +=item $parser->interior_sequence( $seq_cmd, $seq_arg, $pod_seq ) L callback. =cut +###################################################################### sub interior_sequence { @@ -649,7 +693,8 @@ sub _p2w_fragment_id my $generate = shift; # optional flag $text =~ s/\s+\Z//s; - if( $text ){ + + if( $text ){ # a method or function? return $1 if $text =~ /(\w+)\s*\(/; return $1 if $text =~ /->\s*(\w+)\s*\(?/; @@ -670,7 +715,7 @@ sub _p2w_fragment_id return _fragment_id_readable($text, $generate); } else { - return; + return ""; } }