perl-Text-Autoformat-1.13-0.3.beta.src.rpmepel9
parent
ba0fd99d6a
commit
dcf55d6bc9
@ -0,0 +1 @@
|
||||
Text-Autoformat-1.12.tar.gz
|
@ -0,0 +1,139 @@
|
||||
--- lib/Text/Autoformat.pm.orig 2003-05-27 18:34:38.000000000 -0500
|
||||
+++ lib/Text/Autoformat.pm 2005-02-09 11:35:36.487236034 -0600
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use strict; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); use Carp;
|
||||
use 5.005;
|
||||
-$VERSION = '1.12';
|
||||
+$VERSION = '1.13beta';
|
||||
|
||||
require Exporter;
|
||||
|
||||
@@ -74,15 +74,23 @@
|
||||
return "";
|
||||
}
|
||||
|
||||
-my $ignore_headers = qr/\A(From\b.*$)?([^:]+:.*$([ \t].*$)*)+\s*\Z/m;
|
||||
+my $ignore_headers = qr/
|
||||
+ \A
|
||||
+ (?: From \b .* $)?
|
||||
+ (?: [^:\n]+ : .* \n
|
||||
+ (?: [ \t] .* \n)*
|
||||
+ )+
|
||||
+ \s*
|
||||
+ \Z
|
||||
+ /mx;
|
||||
my $ignore_indent = qr/^[^\S\n].*(\n[^\S\n].*)*$/;
|
||||
|
||||
-sub ignore_headers { $_[0]==1 && /$ignore_headers/ }
|
||||
+sub ignore_headers { $_[0] && /$ignore_headers/ }
|
||||
|
||||
# BITS OF A TEXT LINE
|
||||
|
||||
my $quotechar = qq{[!#%=|:]};
|
||||
-my $quotechunk = qq{(?:$quotechar(?![a-z])|[a-z]*>+)};
|
||||
+my $quotechunk = qq{(?:$quotechar(?![a-z])|(?:[a-z]\\w*)?>+)};
|
||||
my $quoter = qq{(?:(?i)(?:$quotechunk(?:[ \\t]*$quotechunk)*))};
|
||||
|
||||
my $separator = q/(?:[-_]{2,}|[=#*]{3,}|[+~]{4,})/;
|
||||
@@ -120,9 +128,11 @@
|
||||
$args{break} = break_at('-') unless exists $args{break};
|
||||
$args{impfill} = ! exists $args{fill};
|
||||
$args{expfill} = $args{fill};
|
||||
+ $args{tabspace} = 8 unless exists $args{tabspace};
|
||||
$args{renumber} = 1 unless exists $args{renumber};
|
||||
$args{autocentre} = 1 unless exists $args{autocentre};
|
||||
$args{_centred} = 1 if $args{justify} =~ /cent(er(ed)?|red?)/;
|
||||
+ $args{all} ||= $args{mail};
|
||||
|
||||
# SPECIAL IGNORANCE...
|
||||
if ($args{ignore}) {
|
||||
@@ -138,13 +148,16 @@
|
||||
croak "Expected suboutine reference as value for -ignore option"
|
||||
if ref $args{ignore} ne 'CODE';
|
||||
}
|
||||
- else {
|
||||
+ elsif ($args{mail}) {
|
||||
$args{ignore} = \&ignore_headers;
|
||||
}
|
||||
+ else {
|
||||
+ $args{ignore} = sub{0};
|
||||
+ }
|
||||
|
||||
# DETABIFY
|
||||
my @rawlines = split /\n/, $text;
|
||||
- use Text::Tabs;
|
||||
+ use Text::Tabs; $tabstop = $args{tabspace};
|
||||
@rawlines = expand(@rawlines);
|
||||
|
||||
# PARSE EACH LINE
|
||||
@@ -255,11 +268,13 @@
|
||||
# SELECT PARAS TO HANDLE
|
||||
|
||||
my $remainder = "";
|
||||
- if ($args{all}) { # STOP AT MAIL TERMINATOR
|
||||
+ if ($args{all}) { # STOP AT MAIL TERMINATOR IF $args{mail}
|
||||
+ my $lastignored = 1;
|
||||
for my $index (0..$#paras) {
|
||||
- local $_ = $paras[$index]{raw};
|
||||
- $paras[$index]{ignore} = $args{ignore}($index+1);
|
||||
- next unless /^--$/;
|
||||
+ local $_ = $paras[$index]{raw} . "\n";
|
||||
+ $lastignored &&=
|
||||
+ $paras[$index]{ignore} = $args{ignore}($lastignored);
|
||||
+ next unless $args{mail} && /^--$/;
|
||||
$remainder = join "\n", map { $_->{raw} } splice @paras, $index;
|
||||
$remainder .= "\n" unless $remainder =~ /\n\z/;
|
||||
last;
|
||||
@@ -513,7 +528,9 @@
|
||||
}
|
||||
|
||||
my $abbrev = join '|', qw{
|
||||
- etc[.] pp[.] ph[.]?d[.] U[.]S[.]
|
||||
+ etc[.] pp[.] ph[.]?d[.]
|
||||
+ (?:[A-Z][A-Za-z]+[.])+
|
||||
+ (?:[A-Z][.])(?:[A-Z][.])+
|
||||
};
|
||||
|
||||
my $gen_abbrev = join '|', $abbrev, qw{
|
||||
@@ -604,6 +621,7 @@
|
||||
}
|
||||
|
||||
package Hang;
|
||||
+use strict;
|
||||
|
||||
# ROMAN NUMERALS
|
||||
|
||||
@@ -658,6 +676,9 @@
|
||||
elsif ($_[1] =~ s#\A($hang)##) {
|
||||
@vals = { type => 'bul', val => $1 }
|
||||
}
|
||||
+ elsif ($_[1] =~ m#\([^\s)]+\s#) {
|
||||
+ @vals = ();
|
||||
+ }
|
||||
else {
|
||||
local $^W;
|
||||
my $cut;
|
||||
@@ -801,6 +822,7 @@
|
||||
sub empty { 0 }
|
||||
|
||||
package NullHang;
|
||||
+use strict;
|
||||
|
||||
sub new { bless {}, $_[0] }
|
||||
sub stringify { "" }
|
||||
@@ -1021,6 +1043,14 @@
|
||||
C<autoformat> will ignore any paragraph in which I<every> line begins with a
|
||||
whitespace.
|
||||
|
||||
+One other special case of ignorance is ignoring mail headers and signature.
|
||||
+This option is specified using the C<mail> argument:
|
||||
+
|
||||
+ $tidied_mesg = autoformat($messy_mesg, {mail=>1});
|
||||
+
|
||||
+Note that the C<mail> option automatically implies C<all>.
|
||||
+
|
||||
+
|
||||
=head2 Bulleting and (re-)numbering
|
||||
|
||||
Often plaintext will include lists that are either:
|
@ -0,0 +1,70 @@
|
||||
%{!?perl_vendorlib: %define perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)}
|
||||
|
||||
Name: perl-Text-Autoformat
|
||||
Version: 1.13
|
||||
Release: 0.3.beta
|
||||
Summary: Text::Autoformat Perl module
|
||||
License: Artistic
|
||||
Group: Development/Libraries
|
||||
URL: http://search.cpan.org/dist/Text-Autoformat/
|
||||
Source0: http://www.cpan.org/modules/by-module/Text/Text-Autoformat-1.12.tar.gz
|
||||
# From http://rt.cpan.org/NoAuth/Bug.html?id=8018
|
||||
Patch0: Text-Autoformat-1.12-1.13beta.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildArch: noarch
|
||||
BuildRequires: perl(Text::Reform)
|
||||
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
|
||||
|
||||
%description
|
||||
Text::Autoformat provides intelligent formatting of plaintext without the
|
||||
need for any kind of embedded mark-up. The module recognizes Internet
|
||||
quoting conventions, a wide range of bulleting and number schemes, centered
|
||||
text, and block quotations, and reformats each appropriately. Other options
|
||||
allow the user to adjust inter-word and inter-paragraph spacing, justify
|
||||
text, and impose various capitalization schemes.
|
||||
|
||||
The module also supplies a re-entrant, highly configurable replacement for
|
||||
the built-in Perl format() mechanism.
|
||||
|
||||
%prep
|
||||
%setup -q -n Text-Autoformat-1.12
|
||||
%patch0 -p0
|
||||
|
||||
%build
|
||||
%{__perl} Makefile.PL INSTALLDIRS=vendor
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
make pure_install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT
|
||||
|
||||
find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \;
|
||||
find $RPM_BUILD_ROOT -type d -depth -exec rmdir {} 2>/dev/null \;
|
||||
|
||||
chmod -R u+rwX,go+rX,go-w $RPM_BUILD_ROOT/*
|
||||
|
||||
%check || :
|
||||
make test
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc Changes README
|
||||
%{perl_vendorlib}/*
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%changelog
|
||||
* Tue May 10 2005 Steven Pritchard <steve@kspei.com> 1.13-0.3.beta
|
||||
- Drop Epoch and change Release for Fedora Extras.
|
||||
|
||||
* Wed Feb 09 2005 Steven Pritchard <steve@kspei.com> 0:1.13-0.fdr.0.2.beta
|
||||
- Minor update to 0.13beta source, from
|
||||
http://rt.cpan.org/NoAuth/Bug.html?id=8018 (pointed out by jpo@di.uminho.pt)
|
||||
|
||||
* Wed Jun 09 2004 Steven Pritchard <steve@kspei.com> 0:1.13-0.fdr.0.1.beta
|
||||
- Specfile regenerated.
|
||||
- Update to 0.13beta, which includes the upstream fix for a bug reported to
|
||||
the author.
|
Loading…
Reference in new issue