Skip to content

Commit

Permalink
Change empty =over/=back block to have list_type "empty" instead of "…
Browse files Browse the repository at this point in the history
…block".
  • Loading branch information
marcgreen committed Aug 4, 2011
1 parent 7b1744e commit 328b8d1
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/Pod/Simple/BlackBox.pm
Expand Up @@ -1118,7 +1118,7 @@ sub _ponder_over {
} elsif($paras->[0][0] eq '=back') {
# Ignore empty lists by default
if ($self->{'parse_empty_lists'}) {
$list_type = 'block'; # Not sure what else it would be
$list_type = 'empty';
} else {
shift @$paras;
return 1;
Expand Down
47 changes: 41 additions & 6 deletions lib/Pod/Simple/Subclassing.pod
Expand Up @@ -490,7 +490,7 @@ message might be issued to the user.

=item events with an element_name of over-text

These events are are somewhat unlike the other over-*
These events are somewhat unlike the other over-*
structures, as far as what their contents are. When
an "=over ... Z<>=back" block is parsed where the items are
a list of text "subheadings", it will produce this event structure:
Expand Down Expand Up @@ -545,7 +545,7 @@ produces this event structure:

=item events with an element_name of over-block

These events are are somewhat unlike the other over-*
These events are somewhat unlike the other over-*
structures, as far as what their contents are. When
an "=over ... Z<>=back" block is parsed where there are no items,
it will produce this event structure:
Expand All @@ -569,7 +569,7 @@ For example, this Pod source:
circumstances of cruelty and perfidy scarcely paralleled in the most
barbarous ages, and totally unworthy the head of a civilized nation.

=cut
=back

will produce this event structure:

Expand All @@ -585,6 +585,42 @@ will produce this event structure:
</Para>
</over-block>

=item events with an element_name of over-empty

B<Note: These events are only triggered if C<parse_empty_lists()> is set to a
true value.>

These events are somewhat unlike the other over-*
structures, as far as what their contents are. When
an "=over ... Z<>=back" block is parsed where there is no content,
it will produce this event structure:

<over-empty indent="4" start_line="543">
</over-empty>

The I<indent> attribute is as with the other over-* events.

For example, this Pod source:

=over

=over

=back

=back

will produce this event structure:

<over-block indent="4" start_line="1">
<over-empty indent="4" start_line="3">
</over-empty>
</over-block>

Note that the outer C<=over> is a block because it has no C<=item>s but still
has content: the inner C<=over>. The inner C<=over>, in turn, is completely
empty, and is treated as such.

=item events with an element_name of item-bullet

See L</"events with an element_name of over-bullet">, above.
Expand Down Expand Up @@ -857,9 +893,8 @@ significant (such as text or *roff, but not HTML).
=item C<< $parser->parse_empty_lists( I<SOMEVALUE> ) >>

If this attribute is set to true, the parser will not ignore empty
C<=over>/C<=back> blocks. The type of C<=over> will be I<block>.

=back
C<=over>/C<=back> blocks. The type of C<=over> will be I<empty>, documented
above, L<events with an element_name of over-empty>.


=head1 SEE ALSO
Expand Down
2 changes: 1 addition & 1 deletion t/emptylists.t
Expand Up @@ -60,7 +60,7 @@ ok( $x->_out(\&off, $pod),
print "# Testing parse_empty_lists( TRUE ) ...\n";

ok( $x->_out(\&on, $pod),
'<Document><over-block indent="4"><over-block indent="4"><over-block indent="4"><over-block indent="4"></over-block><over-block indent="4"></over-block></over-block></over-block></over-block></Document>'
'<Document><over-block indent="4"><over-block indent="4"><over-block indent="4"><over-empty indent="4"></over-empty><over-empty indent="4"></over-empty></over-block></over-block></over-block></Document>'
);

print "# Wrapping up... one for the road...\n";
Expand Down

0 comments on commit 328b8d1

Please sign in to comment.