Article View: news.software.nntp
Article #84675--
From: Anon
Date: Tue, 03 Apr 2012 17:30
Date: Tue, 03 Apr 2012 17:30
155 lines
7718 bytes
7718 bytes
ďťż
How do you ( Michaelâ
Moroney ) manage to keep missing the point ? !
Google Groups is the best way to link to a post.
Variableâ
width glyphs are the default there and elsewhere;
so, to insure a monospaced font, use the PRE tag.
There are many ways to display HTML,
emacs and slrn â
shouldâ
be one way, but they can't manage it;
so Ray Banana's noobâ
fest, Eternalâ
September, drops HTML posts.
My HTMLâ
toâ
Plainâ
Text code has changed again ( and again ).
>From Jeff-Relf.Me/X.CPP:
#define While( âť ) Ch = 1, P-- ; while( ( Châ1 = Ch ) && ( Ch = *++P, Ch2 = !Ch ? 0 : P[1], âť ) )
// "While(0)" ( for example ) would loop zero times and not alter P,
// but sets Ch and Ch2 to P[0] and P[1], respectively.
//
// Essentially, the macro is "while( A && B )" where
// B sets Ch and increments P.
//
// B won't happen unless A is true. First time through the loop,
// A is true. Second pass, A is false when, initially, "*P == 0".
#define WhileBac( âť ) \
Ch = Ch2 = 0, E ? 0 : E = B + szStr( B ), P = E ; \
while ( P >= B && ( Ch2 = *P, ( Ch = --P < B ? 0 : *P ) && ( âť ) ) )
// Don't indent "footers" ( i.e. links, tag IDs and Alt text ).
// Make plainâ
text stand out, indent it 4 spaces and
// put a newline before and after each block of plainâ
text.
// Wrap to "mxCols" ( 121 columns, monospaced ).
const int mxCols = ColsWin - 6 ;
int âĄ, iPP, PRE, inTag, Openâ
A ; LnT _id, _Alt, _Src, _hRef ;
Cat( LnP B², int Sz² ) { if ( Sz² <= 0 ) return;
LnP &Bš = *Ln.PP, BšâşÂ˛ ; int Szš = szStr( Bš ), SzšâşÂ˛ = Szš + Sz² ;
if ( !Szš || SzšâşÂ˛ > mxCols ) {
// Start a new line, don't append.
//
// When the current console line is blank (!Szš)
// and it's not Topâ
Most ( Topâ
Most must be a blank line )
// and the line above isn't a "Footer", remove it.
Ln.PP -= !Szš && Ln.PP > Ln.BB + iPP && *Ln.PP[-1] <= 32 ;
if ( Sz² < 4 || B²[2] != L'â' )
// Print the plainâ
text, indented.
Sh( L" %.*s", Sz², B² );
else
// Print the tag ID, not indented, omit the leading " ,".
Sh( L"%.*s", Sz²-=2, B²+=2 );
return; }
// Append, tag ID or plainâ
text.
BšâşÂ˛ = MallocTmp( ++SzšâşÂ˛ * szChr ), Str( BšâşÂ˛, L"%s%.*s", Bš, Sz², B² ), Bš = BšâşÂ˛ ; }
Cat( wchar_t Ch ) { Cat( &Ch, 1 ); }
// Print a new line or "âĄ", print footers.
Trim() { if ( ⥠= 0, Openâ
A ) return ; int Footers = _Alt.BB || _Src.BB || _hRef.BB || _id.BB ;
// Remove trailing whitespace and leading blank lines.
LOOP { B = *Ln.PP, E = 0 ; WhileBac( Ch == L'âĄ' || Ch <= 32 || Ch == L'\xA0' );
if ( ++P < E ) *P = 0 ; if ( !*B && Ln.PP > Ln.BB + iPP && !PRE ) Ln.PP-- ; else break ; }
if ( !PRE && *B == 32 && !( ⥠= !Footers ) )
// "Footers" follow plain text, print a blank line.
Sh(0);
if ( _hRef.BB ) { LoopXx( Ln, _hRef ) Sh( L"%s%s", âşFolder( B ), Human( B ) ); Zero( _hRef ); }
if ( _Alt.BB ) { LoopXx( Ln, _Alt ) Sh( L"%s", Human( B ) ); Zero( _Alt ); }
if ( _Src.BB ) { LoopXx( Ln, _Src ) Sh( L"%s%s", âşFolder( B ), Human( B ) ); Zero( _Src ); }
if ( _id.BB ) {
LoopXx( Ln, _id )
if ( Human(B), **Ln.PP != L'â' )
// Start a line of tag IDs.
Sh( L"â%s", B );
else
// Add to the line of tag IDs.
rv = Str( _T, L", â%s", B ), Cat( _T, rv );
Zero( _id ); } }
// Print a new line or "âĄ", print footers.
#define Br ( Trim(), Openâ
A ? Cat( 32 ) : !**Ln.PP && !*Ln.PP[-1] ? 0 : ⥠? Cat( L'âĄ' ) : Sh(0) )
#define feedMe { if ( !feedMeââ( B, P, PP, EE ) ) return ; }
int feedMeââ( LnP &B, LnP &P, LnA &PP, LnA EE ) { While(0); if ( Ch ) return 1 ;
// Read in a new line.
if ( PRE && !inTag ) Br;
else { LnP &T = *Ln.PP ; if ( rv = szStr( T ), rv && T[ rv - 1 ] > 32 ) Cat( 32 ); }
if ( ++PP >= EE || ( P = B = *PP, B && MimeSep && EqN( B, *MimeSep, Sz_MimeSep ) ) ) {
// All done !
Trim(); return 0 ; }
// Keep parsing.
While(0); return 1 ; }
// Parse out plainâ
text from tags/entities.
#define Châ
BoTagďź ( \
Ch == '&' && ( Ch2 == '#' || isAlpha( Ch2 ) ) \
|| Ch == '<' && ( Ch2 == '!' || Ch2 == '?' || isAlpha( Ch2 ) || Ch2 == '/' && isAlpha( P[2] ) ) )
HTMLâ
toâ
Text( LnA BB, LnA EE ) { static rv ; LnA PP = BB - 1 ;
if ( **Ln.PP ) Sh(0); iPP = Ln.PP - Ln.BB ;
LnP euText, B = L"", P = B, Alt, Src, id, hRef = 0 ; int PlainText ;
Zero( _Alt ), Zero( _Src ), Zero( _hRef ), Zero( _id );
PlainText = PRE = Ch = Openâ
A = 0 ;
â¤BoTagďź:
inTag = 0 ; feedMe
if ( PlainText ) { // Print unparsed.
euText = P, P += szStr( P ), Ch = 0 ; }
else { // Parse out plainâ
text from tags/entities.
euText = 0 ; While( !Châ
BoTagďź ) if ( !euText && Ch ) euText = P ; }
LnP BoTagďź = P ; LnA BoTagPP = PP ; if ( !euText ) goto Parseâ
Tag ;
{ LnP Bš, B², P², Eš, E² ; int Szš, Sz², SzâťÂ˛, SzšâşÂ˛, SP, SP², Ch, Ch2 ;
Bš = Eš = *Ln.PP, Szš = szStr( Bš ), Eš += Szš ;
if ( B² = euText, E² = BoTagďź, !PRE ) {
// Pemove redundent whitespace. What's left will be printed.
Ch = !Szš ? 0 : Eš[-1], SP = Ch <= 32, P² = B², D = B² - 1 ;
While²( P² < E² )
if ( SP² = Ch <= 32 || Ch == L'\xFeFF', !SP && SP² ) *++D = 32, SP = 1 ; else if ( !SP² ) *++D = Ch, SP = 0 ;
E² = ++D ; }
if ( Sz² = E² - B², Sz² <= 0 || Sz² == 1 && *B² <= 32 ) goto Parseâ
Tag ;
if ( PRE ) {
// Print the "PREâ
formatted" text, no wrapping.
Cat( B², Sz² ); goto Parseâ
Tag ; }
LOOP {
if ( SzšâşÂ˛ = Szš + Sz², SzšâşÂ˛ <= mxCols ) {
// Print as is, don't wrap.
Cat( B², Sz² ); goto Parseâ
Tag ; }
E² = B² + ER( 0, mxCols - Szš ); WhileBac²( Iden( Ch ) );
if ( SzâťÂ˛ = P² - B² + 1, SzâťÂ˛ >= 22 )
// Append part of the text to the current line.
Cat( B², SzâťÂ˛ ), Szš = Sh(0);
else
// Start a line, instead of appending.
if ( !SzâťÂ˛ )
// Start a blank line.
Szš = Sh(0);
else
// Start a new line with the text.
Szš = Sh( L" %.*s", SzâťÂ˛, B² );
// Print the rest of it, might be blank.
Sz² -= SzâťÂ˛, B² = ++P² ; } }
Parseâ
Tag:
// Parse the tag or entity.
inTag = 1 ; While(0); if ( !Ch ) goto â¤BoTagďź ;
Technical Details
Message-ID:
<Jeff-Relf.Me@2012_Apr.3^10.30^AM>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.free.newsservers.20150605.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mailReferences:
<52419e8532dca12c0d42ed3dc6692d9f@tioat.net> <5h4oah.n9v.19.1@news.alt.net> <Jeff-Relf.Me@2012_Apr.1^0.57^AM> <jl9ubp$d5d$1@pcls6.std.com> <X.Invalid@2012_Apr.1^11.37^AM> <jlf475$i2v$1@pcls6.std.com>Show Full Headers
Complete Article Headers
Message-ID: <Jeff-Relf.Me@2012_Apr.3^10.30^AM> Subject: -- Date: Tue, 03 Apr 2012 17:30:10 +0000 From: @Jeff-Relf.Me References: <52419e8532dca12c0d42ed3dc6692d9f@tioat.net> <5h4oah.n9v.19.1@news.alt.net> <Jeff-Relf.Me@2012_Apr.1^0.57^AM> <jl9ubp$d5d$1@pcls6.std.com> <X.Invalid@2012_Apr.1^11.37^AM> <jlf475$i2v$1@pcls6.std.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.free.newsservers.20150605.mbox.gz!border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Newsgroups: alt.free.newsservers,news.software.readers,news.software.nntp Lines: 155 Content-Type: Text/plain; charset=UTF-8 X-Trace: individual.net 73dOSAOfjiDGE61Z6v1nlA+KygLBvHFVn+wygqNl3KfEq5e8Da Cancel-Lock: sha1:3c72wXJf7NUQXBxoBlnbB9gunkg= User-Agent: Jeff-Relf.Me/X.TXT X-Original-Bytes: 7701