Perl art & block text
From Simon <use...@no-dns-yet.org.uk>
· alt.ascii-art
· 14 Mar 2006 22:05 · View full thread
· report
Hi all,
This was born out of a discussion on block text on a mailing list and
Faux_Pseudo suggested that people here might appreciate it. It looks
at a paragraph of text, to make sure that the paragraph is blocktext.
I'm sure Joost will regret writing "furthermore, i will say that i am
of the opinion that you should write your perl code as a block text as
well." Trust Joost to mess up a perfectly good block text layout! :)
# Is the argument list a correct textblock?
# Thanks to Dr. Kremers for checking ideas.
# The code layout is Joost's fault too. :-)
sub _isblocktext {
my $paragraph = join("", @_); return if $paragraph =~
m{(?:(?<![\.!\?])\s{2,}|\s{3,}|([A-Z]{1}|Mr|Mrs|Miss|
Ms|Dr)\.\s{2,})}ox; my ($sentencedelim) = ($paragraph
=~ m%[\.!?](\s+)%i); for ($paragraph =~ /[\.!\?](\s+)
/gx) { return if $_ ne $sentencedelim } my $targetlen
= length(shift); if (length($_[-1])/$targetlen > 0.9)
{ pop @_ }; for (@_) { return if length != $targetlen
} return "It seems to resemble the block text style!"
}
Regards,
--
Simon <sim...@no-dns-yet.org.uk> **** GPG: F4A23C69
"We demand rigidly defined areas of doubt and uncertainty."
- Douglas Adams
Original message headers
X-Google-Thread: f996b,974d7710d5a7003,start X-Google-Attributes: gidf996b,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed-east.nntpserver.com!nntpserver.com!statler.nntpserver.com!news.glorb.com!proxad.net!proxad.net!news.clara.net!wagner.news.clara.net!195.245.201.10.MISMATCH!monkeydust.news.clara.net!doris.uk.clara.net Newsgroups: alt.ascii-art From: Simon <use...@no-dns-yet.org.uk> Subject: Perl art & block text Organization: ... Reply-To: Simon <sim...@no-dns-yet.org.uk> Message-ID: <slr...@dustpuppy.no-dns-yet.org.uk> User-Agent: slrn/0.9.8.0 (Linux) Date: Tue, 14 Mar 2006 22:05:07 +0000 X-Complaints-To: abu...@clara.net (please include full headers) X-Trace: 51753e59d063d42043d07064c950291cc22763107715300c6242006244173e18 NNTP-Posting-Date: Tue, 14 Mar 2006 22:05:12 +0000 Lines: 31 Xref: g2news1.google.com alt.ascii-art:1144
Related ASCII art in the Gallery
Explore these categories from our collection of 11,000+ artworks:
_______ /` _____ `\;, /__(^===^)__\';, / ::: \ ,; | ::: | ,;' '._______.'`jgs
_ _ (o)(o)--. \../ ( )hjw m\/m--m'`--.
_ _
/` \/ `\_ _
\ /` \/ `\
'. .\ /
\/ '. .'
\/jgs __ . . __ (o.\ \/ /.o) \__\/\/__/ /O /==\ O\ (;O/ \/ \O;)
_______ |.-----.| || jgs || ||_ _|| `--)-(--` __[=== o]___ |:::::::::::|\ `-=========-`()
,sSSs ,SSSS_/ ,_ sS/`))\// sS//|_(_/ _, SS\\\ `""-.-'` / sSS` jgs-==-'`'-._\
Make your own ASCII art
Turn images, text or 3D into ASCII, or draw your own – right in your browser.
About this message.
This message was posted publicly to the newsgroup
alt.ascii-art
in 2006 and is mirrored here unchanged as part of the Historic Archives – only email addresses are masked.
The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can.
Are you the author? Contact us to get your posts attributed, connected to your artist profile, or removed.
Report this message
Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.