Skip to content

Commit

Permalink
Small tunes in Pod::To::Text, sanitize newline handling, interpret pa…
Browse files Browse the repository at this point in the history
…ckage declarators correctly
  • Loading branch information
Tadeusz Sośnierz committed Aug 9, 2011
1 parent c61a8d5 commit 083287a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions lib/Pod/To/Text.pm
Expand Up @@ -4,12 +4,12 @@ sub pod2text($pod) is export {
my @declarators;
given $pod {
when Pod::Heading { heading2text($pod) }
when Pod::Block::Code { code2text($pod) ~ "\n\n" }
when Pod::Block::Named { named2text($pod) ~ "\n" }
when Pod::Block::Para { para2text($pod) ~ "\n\n" }
when Pod::Block::Code { code2text($pod) }
when Pod::Block::Named { named2text($pod) }
when Pod::Block::Para { para2text($pod) }
when Pod::Block::Declarator { declarator2text($pod) }
when Pod::Item { item2text($pod) ~ "\n" }
when Positional { $pod.map({pod2text($_)}).join }
when Pod::Item { item2text($pod) }
when Positional { $pod.map({pod2text($_)}).join("\n\n")}
default { $pod.Str }
}
}
Expand Down Expand Up @@ -53,7 +53,10 @@ sub declarator2text($pod) {
when nqp::p6bool(nqp::istype($_.HOW, Metamodel::ModuleHOW)) {
'module'
}
} ~ ' ' ~ $pod.WHEREFORE.perl ~ ': ' ~ $pod.WHEREFORE.WHY ~ "\n"
when nqp::p6bool(nqp::istype($_.HOW, Metamodel::PackageHOW)) {
'package'
}
} ~ ' ' ~ $pod.WHEREFORE.perl ~ ': ' ~ $pod.WHEREFORE.WHY
}

# vim: ft=perl6
2 changes: 1 addition & 1 deletion src/Perl6/Actions.pm
Expand Up @@ -246,7 +246,7 @@ class Perl6::Actions is HLL::Actions {
$block.push(
PAST::Op.new(
:pasttype<call>, :node($/),
:name('&print'), $pod2text,
:name('&say'), $pod2text,
),
);
$*ST.pop_lexpad();
Expand Down

0 comments on commit 083287a

Please sign in to comment.