Skip Menu |

This queue is for tickets about the Text-Autoformat CPAN distribution.

Report information
The Basics
Id: 26510
Status: open
Priority: 0/
Queue: Text-Autoformat

People
Owner: Nobody in particular
Requestors: ask [...] develooper.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.13
Fixed in: (no value)



Subject: case => "sentence" capitalizes paragraphs rather than sentences
case => "sentence" capitalizes paragraphs rather than sentences Test script included below and attached. - ask #!/usr/bin/perl use strict; use warnings; use Text::Autoformat; use Test::More qw(no_plan); my $input = "LOREM IPSUM DOLOR SIT AMET, CONSECTETUER ADIPISCING ELIT. ETIAM INTERDUM ULTRICES MAGNA. FUSCE EU DIAM."; my $expected = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam interdum ultrices magna. Fusce eu diam."; my $output = autoformat $input, { case => 'sentences', all => 1, right => length($input), }; is($output, $expected, "correct capitalization"); $ /pkg/bin/prove -v /tmp/af_sent.pl /tmp/af_sent....not ok 1 - correct capitalization # Failed test 'correct capitalization' # at /tmp/af_sent.pl line 20. # got: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. etiam interdum ultrices magna. # # Fusce eu diam. # ' # expected: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam interdum ultrices magna. # # Fusce eu diam.' 1..1 # Looks like you failed 1 test of 1.
Subject: af_sent.pl
#!/usr/bin/perl use strict; use warnings; use Text::Autoformat; use Test::More qw(no_plan); my $input = "LOREM IPSUM DOLOR SIT AMET, CONSECTETUER ADIPISCING ELIT. ETIAM INTERDUM ULTRICES MAGNA. FUSCE EU DIAM."; my $expected = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam interdum ultrices magna. Fusce eu diam."; my $output = autoformat $input, { case => 'sentences', all => 1, right => length($input), }; is($output, $expected, "correct capitalization");
Subject: Re: [rt.cpan.org #26510] case => "sentence" capitalizes paragraphs rather than sentences
Date: Fri, 20 Apr 2007 13:42:06 +1000
To: bug-Text-Autoformat [...] rt.cpan.org
From: "Damian Conway" <damian [...] conway.org>
Hi Ask, Show quoted text
> case => "sentence" capitalizes paragraphs rather than sentences
Actually that's not what's happening. In detecting the end of a sentence, Autoformat ignores what it thinks are full-stops marking abbreviations. And it treats any ALLCAPS as an abbreviation. The fix, if ALLCAPS are expected, is to lowercase first: my $output = autoformat lc($input), { case => 'sentences', all => 1, right => length($input), }; Damian PS: Thanks so much for including a proper test case. If only more bug reports were so considerately filed.