From 083287a0692970b1191608968201cda6d7dc68c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadeusz=20So=C5=9Bnierz?= Date: Tue, 9 Aug 2011 13:28:15 +0200 Subject: [PATCH] Small tunes in Pod::To::Text, sanitize newline handling, interpret package declarators correctly --- lib/Pod/To/Text.pm | 15 +++++++++------ src/Perl6/Actions.pm | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/Pod/To/Text.pm b/lib/Pod/To/Text.pm index a563bcc7e60..59663fe71d4 100644 --- a/lib/Pod/To/Text.pm +++ b/lib/Pod/To/Text.pm @@ -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 } } } @@ -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 diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm index fcc822d36a6..851c3ca23ef 100644 --- a/src/Perl6/Actions.pm +++ b/src/Perl6/Actions.pm @@ -246,7 +246,7 @@ class Perl6::Actions is HLL::Actions { $block.push( PAST::Op.new( :pasttype, :node($/), - :name('&print'), $pod2text, + :name('&say'), $pod2text, ), ); $*ST.pop_lexpad();