| 1 | package Text::Markup::Mediawiki; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.8.1; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Text::Markup; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use File::BOM qw(open_bom); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Text::MediawikiFormat 1.0; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | our $VERSION = '0.43'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 3 | ▶ | sub import { | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 13 | # Replace the regex if passed one. | ||||||||||||||||||||||||||||
| 14 | 3 | ▶ | Text::Markup->register( mediawiki => $_[1] ) if $_[1]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 2 | ▶ | sub parser { | ||||||||||||||||||||||||||
|
Subroutine
parser: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 18 | 2 | my ($file, $encoding, $opts) = @_; | |||||||||||||||||||||||||||
| 19 | 2 | open_bom my $fh, $file, ":encoding($encoding)"; | |||||||||||||||||||||||||||
| 20 | 2 | local $/; | |||||||||||||||||||||||||||
| 21 | 2 | my $html = Text::MediawikiFormat::format(<$fh>, @{ $opts }); | |||||||||||||||||||||||||||
| 22 | 2 | ▶ | return unless $html =~ /\S/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | 1 | utf8::encode($html); | |||||||||||||||||||||||||||
| 24 | 1 | ▶ | return $html if $opts->[1] && $opts->[1]->{raw}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$opts->[1] and $opts->[1]{"raw"}
MC/DC0%0/2
$opts->[1] and $opts->[1]{"raw"}
$opts->[1]
$opts->[1]{"raw"}
Truth table33%1/3
A and B
A= $opts->[1]B= $opts->[1]{"raw"}
| |||||||||||||||||||||||||||||
| 25 | 1 | return qq{<html> | |||||||||||||||||||||||||||
| 26 | <head> | ||||||||||||||||||||||||||||
| 27 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||||||||||||||||||||||||||||
| 28 | </head> | ||||||||||||||||||||||||||||
| 29 | <body> | ||||||||||||||||||||||||||||
| 30 | $html | ||||||||||||||||||||||||||||
| 31 | </body> | ||||||||||||||||||||||||||||
| 32 | </html> | ||||||||||||||||||||||||||||
| 33 | }; | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 1 | 1; | |||||||||||||||||||||||||||
| 38 | __END__ | ||||||||||||||||||||||||||||