Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement simple FormattinCode handling in Pod::To::Text
  • Loading branch information
Tadeusz Sośnierz committed Aug 15, 2011
1 parent 02e5a62 commit 5f145c6
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/Pod/To/Text.pm
Expand Up @@ -10,6 +10,7 @@ sub pod2text($pod) is export {
when Pod::Block::Table { table2text($pod) }
when Pod::Block::Declarator { declarator2text($pod) }
when Pod::Item { item2text($pod) }
when Pod::FormattingCode { formatting2text($pod) }
when Positional { $pod.map({pod2text($_)}).join("\n\n")}
when Pod::Block::Comment { }
default { $pod.Str }
Expand Down Expand Up @@ -45,7 +46,7 @@ sub named2text($pod) {
}

sub para2text($pod) {
$pod.content.join("\n")
twine2text($pod.content)
}

sub table2text($pod) {
Expand Down Expand Up @@ -79,4 +80,18 @@ sub declarator2text($pod) {
return "$type {$pod.WHEREFORE.perl}: {$pod.WHEREFORE.WHY}"
}

sub formatting2text($pod) {
twine2text($pod.content)
}

sub twine2text($twine) {
return '' unless $twine.elems;
my $r = $twine[0];
for $twine[1..*] -> $f, $s {
$r ~= twine2text($f.content);
$r ~= $s;
}
return $r;
}

# vim: ft=perl6

0 comments on commit 5f145c6

Please sign in to comment.