| 1 | package Pod::Knit::Document::Mojo; | ||||||||||||||||||||
| 2 | 3 | our $AUTHORITY = 'cpan:YANICK'; | |||||||||||||||||||
| 3 | # ABSTRACT: manipulate a Pod::Knit::Document using Mojo::DOM58 | ||||||||||||||||||||
| 4 | 3 | $Pod::Knit::Document::Mojo::VERSION = '0.0.1'; | |||||||||||||||||||
| 5 | 3 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 3 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 3 | ▶ | use Mojo::DOM58; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 3 | ▶ | use Moose::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 3 | ▶ | use MooseX::MungeHas { has_ro => [ 'is_ro' ] }; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 3 | ▶ | use experimental qw/ signatures /; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 0 | ▶ | has_ro dom => sub ($self) { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
Subroutine
_build_dom: called CC=1 SCAR=1.2
| |||||||||||||||||||||
| 17 | 0 | Mojo::DOM58->new( $self->xml_pod ) | |||||||||||||||||||
| 18 | 3 | }; | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 2 | ▶ | sub find_or_create_section( $self, $name, $level = 1, $class = $name, @rest ) { | ||||||||||||||||||
|
Subroutine
find_or_create_section: called CC=5 SCAR=16.8
Pod
undocumented
| |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 2 | ▶ | $class //= $name; | ||||||||||||||||||
|
Condition33%1/3
$class //= $name
MC/DC0%0/2
$class //= $name
$class
$name
Truth table33%1/3
A //= B
A= $classB= $name
| |||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 2 | my $section = $self->dom->find( join '.', 'section', $name ); | |||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 2 | ▶ | return $section if $section->size; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 2 | $self->dom->find('document')->first->append_content( | |||||||||||||||||||
| 29 | $self->xml_write( section => [ | ||||||||||||||||||||
| 30 | ':class' => lc($class), | ||||||||||||||||||||
| 31 | 'head' . $level => $name, | ||||||||||||||||||||
| 32 | @rest, | ||||||||||||||||||||
| 33 | ]) | ||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 2 | return $self->dom->find( 'section.'. $name ); | |||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 3 | 1; | |||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | __END__ | ||||||||||||||||||||