Subject:
|
Re: Summary display not correct
|
Newsgroups:
|
lugnet.admin.general
|
Date:
|
Sun, 29 Aug 1999 02:46:55 GMT
|
Viewed:
|
198 times
|
| |
| |
In lugnet.admin.general, "Simon Robinson" <simon@simonrobinson.com> writes:
> Todd -
>
> check out this message:
>
> http://www.lugnet.com/off-topic/debate/?n=1916
>
> I just posted it and there's a reference in it early on
> to the figure $40000. This displays correctly when you
> view the message, but appears as $4000 in the summary
> page, http://www.lugnet.com/off-topic/debate.
>
> Is something funny happening?
LOL! Yes, something funny is happening. :) Not intentional.
The code which takes a message and crunches it down to brief format (by
compressing whitespace and quoted material, joining lines, and finally
chopping the body of the article to 250 characters maximum) contains a regex
transformation for compressing long characters runs like ---------- and
========== and ___________ and ~~~~~~~~~~~ and ++++++++++ and **********
and <<<<<<<<<< and so forth. Here is (was) the actual transformation:
s/(.)\1\1\1+/$1$1$1/g;
Of course, this catch-all regex compresses *any* character run of length 4
or more. While that's fine for symbols (like shown above) and probably even
fine for things like "aaaaaaaaaaaaaaaaaaaaaaaargh" ==> "aaargh", I agree
that "$40000" => "$4000" is pretty darn broken. And collapsing hexadecimal
numbers like "FFFFFFFF" => "FFF" would be pretty broken too. I'll bet
that's appeared at least once somewhere...
The fix: I just changed the regex to require a run of at least 9 characters
(instead of only 4) and to insert "..." to show that something has been
collapsed. This coincides with the way long words such as URLs are
collapsed in brief-display mode to a maximum of about 30 characters:
s/(\S{32,})/substr($1,0,20) . "..." . substr($1,-10)/eg;
So, for example:
aaaaaaaaaaaaaaaaargh ==> aaa...aaargh
*********************************** ==> ***...***
------------------------ ==> ---...---
+++++++++ ==> +++...+++
......... ==> .........
$40000 ==> $40000
$400000000 ==> $400000000
$4000000000 ==> $4000...000
FFFFFFFF ==> FFFFFFFF
FFFFFFFFF ==> FFF...FFF
yeeeeeeeeeeeeeoooooooooooowww! ==> yeee...eeeooo...ooowww!
and
http://www.gort.com/klaatu/barada/nikto/
==> http://www.gort.com/...ada/nikto/
http://www.lugnet.com/fibblesnork/lego/guide/space/set/6987-1.html
==> http://www.lugnet.co...987-1.html
and one that would be hit by both compressors in succession (rare indeed):
yyyeeeeeeeeeeeeeeeeeoooooooooooooowwwwwwwwwwww!!!!
==> yyyeee...eeeooo...ooowww...www!!!!
==> yyyeee...eeeooo...oo......www!!!!
--Todd
p.s. Many thanks for pointing out this problem.
|
|
Message is in Reply To:
| | Summary display not correct
|
| Todd - check out this message: (URL) just posted it and there's a reference in it early on to the figure $40000. This displays correctly when you view the message, but appears as $4000 in the summary page, (URL) something funny happening? Simon (URL) (25 years ago, 29-Aug-99, to lugnet.admin.general)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|