| 1 | package Text::Markup::Pod; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use 5.8.1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use Text::Markup; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use Pod::Simple::XHTML 3.15; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 3 | ▶ | sub import { | ||||||||
|
Subroutine
import: called CC=2 SCAR=6.9
| |||||||||||
| 10 | # Replace the regex if passed one. | ||||||||||
| 11 | 3 | ▶ | Text::Markup->register( pod => $_[1] ) if $_[1]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | } | ||||||||||
| 13 | |||||||||||
| 14 | # Disable the use of HTML::Entities. | ||||||||||
| 15 | 2 | $Pod::Simple::XHTML::HAS_HTML_ENTITIES = 0; | |||||||||
| 16 | |||||||||||
| 17 | 2 | our $VERSION = '0.43'; | |||||||||
| 18 | |||||||||||
| 19 | 4 | ▶ | sub parser { | ||||||||
|
Subroutine
parser: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 20 | 4 | my ($file, $encoding, $opts) = @_; | |||||||||
| 21 | 4 | my $p = Pod::Simple::XHTML->new; | |||||||||
| 22 | # Output everything as UTF-8. | ||||||||||
| 23 | 4 | $p->html_header_tags('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'); | |||||||||
| 24 | 4 | ▶ | $p->strip_verbatim_indent(sub { (sort map { /^(\s+)/ } @{$_[0]})[0] }); | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 4 | $p->html_encode_chars('&<>">'); | |||||||||
| 26 | 4 | $p->output_string(\my $html); | |||||||||
| 27 | # Want user supplied options to override even these default behaviors, | ||||||||||
| 28 | # if necessary | ||||||||||
| 29 | 4 | ▶ | my $opt = $opts ? { @$opts } : {}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 4 | foreach my $method ( keys %$opt ) { | |||||||||
| 31 | 3 | my $v = $opt->{$method}; | |||||||||
| 32 | 3 | $p->$method($v); | |||||||||
| 33 | } | ||||||||||
| 34 | 4 | $p->parse_file($file); | |||||||||
| 35 | 4 | ▶ | return unless $p->content_seen; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 3 | utf8::encode($html); | |||||||||
| 37 | 3 | return $html; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 2 | 1; | |||||||||
| 41 | __END__ | ||||||||||