Skip to content

Commit

Permalink
Remove trailing space when item has no text
Browse files Browse the repository at this point in the history
  • Loading branch information
rwstauner committed Aug 16, 2015
1 parent 72207e4 commit 3773358
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Pod/Markdown.pm
Expand Up @@ -917,7 +917,11 @@ sub _start_item {

sub _end_item {
my ($self, $marker) = @_;
$self->_save_line($self->_indent($marker . ' ' . $self->_pop_stack_text));
my $text = $self->_pop_stack_text;
$self->_save_line($self->_indent($marker .
# Add a space only if there is text after the marker.
(defined($text) && length($text) ? ' ' . $text : '')
));

# Store any possible contents in a new stack (like a sub-document).
$self->_increase_indent;
Expand Down
16 changes: 16 additions & 0 deletions t/lists.t
Expand Up @@ -76,6 +76,12 @@ And
1. B
2. D
## No text after number
1.
verbatim item
EOMARKDOWN

# check out Pod::IkiWiki (or something like that)...
Expand Down Expand Up @@ -219,4 +225,14 @@ D
=back
=head2 No text after number
=over
=item 1
verbatim item
=back
=cut

0 comments on commit 3773358

Please sign in to comment.