
brewt at bricolage
Mar 23, 2009, 5:17 PM
Post #1 of 1
(501 views)
Permalink
|
|
[8516] Fixed bug where extra newlines after a =begin without a default
|
|
Revision: 8516 Author: brewt Date: 2009-03-23 17:17:15 -0700 (Mon, 23 Mar 2009) ViewCVS: http://viewsvn.bricolage.cc/?rev=8516&view=rev Log Message: ----------- Fixed bug where extra newlines after a =begin without a default would result in an error. Modified Paths: -------------- bricolage/trunk/lib/Bric/Biz/Element/Container.pm bricolage/trunk/lib/Bric/Changes.pod bricolage/trunk/t/Bric/Biz/Element/Container/DevTest.pm Modified: bricolage/trunk/lib/Bric/Biz/Element/Container.pm =================================================================== --- bricolage/trunk/lib/Bric/Biz/Element/Container.pm 2009-03-20 15:56:20 UTC (rev 8515) +++ bricolage/trunk/lib/Bric/Biz/Element/Container.pm 2009-03-24 00:17:15 UTC (rev 8516) @@ -2611,6 +2611,12 @@ else { $kn = $def_field; $field_type = $field_types{$kn}; + + # we weren't expecting this default field *here*, + # so just ignore it + if (not defined $field_type) { + next POD; + } my $field_occurrence = $self->get_field_occurrence($field_type->get_key_name); my $max_occur = $field_type->get_max_occurrence; if (defined $field_type && $field_ord{$kn} && $max_occur && $field_occurrence > $max_occur) { @@ -2637,12 +2643,6 @@ last DEF_FIELD if $line =~ /^\s*$/; ($content .= "$line\n") =~ s/^$indent//mg; } - - # we weren't expecting this default field *here*, - # so just ignore it - if (not defined $field_type) { - next POD; - } } # Fix up the content. Modified: bricolage/trunk/lib/Bric/Changes.pod =================================================================== --- bricolage/trunk/lib/Bric/Changes.pod 2009-03-20 15:56:20 UTC (rev 8515) +++ bricolage/trunk/lib/Bric/Changes.pod 2009-03-24 00:17:15 UTC (rev 8516) @@ -375,11 +375,16 @@ Fixed C<< Bric::Biz::Element::Field->get_max_length >> to correctly return the max_length. [Adrian Yee] -=item * +=item * Fixed bug in L<auto_complete.html> so that lookups of parent categories now correctly use the site id [Rolf Schaufelberger, Paul Orrock] +=item * + +Fixed bug where extra newlines after a C<=begin> without a default would result +in an error. [Adrian Yee] + =back =head1 VERSION 1.11.1 (2008-10-03) Modified: bricolage/trunk/t/Bric/Biz/Element/Container/DevTest.pm =================================================================== --- bricolage/trunk/t/Bric/Biz/Element/Container/DevTest.pm 2009-03-20 15:56:20 UTC (rev 8515) +++ bricolage/trunk/t/Bric/Biz/Element/Container/DevTest.pm 2009-03-24 00:17:15 UTC (rev 8516) @@ -596,7 +596,7 @@ ############################################################################## # Test pod. -sub test_pod : Test(227) { +sub test_pod : Test(229) { my $self = shift->create_element_types; my $story_type = $self->{story_type}; my $para = $self->{para}; @@ -747,6 +747,12 @@ is $pq->get_value('by'), 'John F. Kennedy', 'Check pull quote by'; is $pq->get_value('date'), '1961-01-20 00:00:00', 'Check pull quote date'; + my $orig_pod = $self->pod_output; + (my $mod_pod = $orig_pod) =~ s/(=begin _pull_quote_)/$1\n/g; + ok $elem->update_from_pod($mod_pod), + "Update from POD with extra newlines after a =begin without a default"; + is $self->pod_output, $orig_pod, 'Resulting POD should be the same'; + # Try deserializeing with a default field. (my $stripped_pod = $self->pod_output) =~ s/(?: )?=para\n\n//g; ok $elem->update_from_pod($stripped_pod, 'para'),
|