Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1307 from softmoth/pod-text-newlines
Drop extraneous spaces in code and table blocks
- Loading branch information
Showing
4 changed files
with
84 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
use v6.c; | ||
use lib <t/spec/packages>; | ||
use Test; | ||
|
||
use Pod::To::Text; | ||
|
||
plan 2; | ||
|
||
my $ix = -1; | ||
|
||
subtest 'Code blocks' => { | ||
plan 3; | ||
|
||
=begin code | ||
say 1; | ||
say 2; | ||
=end code | ||
|
||
is Pod::To::Text.render($=pod[++$ix]), | ||
q:to/END/, "Empty lines don't get added spaces"; | ||
say 1; | ||
say 2; | ||
END | ||
|
||
=begin code | ||
my $a = -5; | ||
say ++$a.=abs; | ||
# OUTPUT: «6» | ||
=end code | ||
|
||
is Pod::To::Text.render($=pod[++$ix]), | ||
q:to/END/, "Plain continuation lines are aligned"; | ||
my $a = -5; | ||
say ++$a.=abs; | ||
# OUTPUT: «6» | ||
END | ||
|
||
=begin code :allow<B L> | ||
sub exclaim B<($phrase)> { | ||
say $phrase L<~> "!!!!" | ||
} | ||
exclaim "Howdy, World"; | ||
=end code | ||
is Pod::To::Text.render($=pod[++$ix]), | ||
q:to/END/, "Formatting Codes in code block"; | ||
sub exclaim ($phrase) { | ||
say $phrase ~ "!!!!" | ||
} | ||
exclaim "Howdy, World"; | ||
END | ||
} | ||
|
||
subtest 'Tables' => { | ||
plan 1; | ||
|
||
=begin table | ||
\+term | prefix | ||
term1 \+ term2 | infix | ||
term\+\+ | postfix | ||
(term) | circumfix | ||
term1[term2] | postcircumfix | ||
=end table | ||
is Pod::To::Text.render($=pod[++$ix]), | ||
q:to/END/, "Final table row is not space-padded"; | ||
+term prefix | ||
term1 + term2 infix | ||
term++ postfix | ||
(term) circumfix | ||
term1[term2] postcircumfix | ||
END | ||
} | ||
|
||
# vim: expandtab shiftwidth=4 ft=perl6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters