Skip to content

Commit

Permalink
Handle space at end of line
Browse files Browse the repository at this point in the history
  • Loading branch information
mdom committed Jan 27, 2019
1 parent 094ba9d commit 1ebfa5c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/App/termpub/Renderer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ sub render_nodes {
my $max = $columns - $column - $left_margin - 2;

if ( $length > $max ) {
next if !$preserve_whitespace && $word =~ /^\s+$/;
$buffer .= "\n";
$column = 0;
}
Expand Down
12 changes: 12 additions & 0 deletions t/01renderer.t
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ render_ok( 'test10.in', 'test10.out', 'pre block' );
render_ok( 'test11.in', 'test11.out', 'nested lists with content' );
render_ok( 'test12.in', 'test12.out', 'nested ordered lists' );
render_ok( 'test13.in', 'test13.out', 'numbered links' );
render_ok( 'test14.in', 'test14.out', 'space at end of line' );

done_testing;

Expand Down Expand Up @@ -186,3 +187,14 @@ foo
@@ test13.out
[1]Acknowledgments
@@ test14.in
<body>
<p>xxxxx xxxx xxxxxx xxxxx xx xxx xxxxxxxx xxxx xx xxxxx, xxxxxxxxx xx xxxxxxxxx.</p>
<p>Still</p>
</body>
@@ test14.out
xxxxx xxxx xxxxxx xxxxx xx xxx xxxxxxxx xxxx xx xxxxx, xxxxxxxxx xx xxxxxxxxx.
Still

0 comments on commit 1ebfa5c

Please sign in to comment.