🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #127653

Re: [Dialog] Customising Posts

#127653
From: Alain GUERIN
Date: Fri, 04 Jul 2003 10:20
114 lines
6049 bytes
Hello,

On Thu, 3 Jul 2003 10:19:12 +0200, Jarrod Cifer wrote:


> Ideally you would mark the text in question, hit a key and the script would
> automagically insert a box quote with the marked contents. Maybe asking for
> a title first, so that something analog to the 'Sorting/Scoring' part in
> the example above would be inserted with it.


OK, just a try: I first put the tittle before the future quoted box.
Then I select the text, title included, I delete it and I paste it with the
paste as custom quote option, with, "|" as custom quote character.

In the OnBeforeSendingMessage script, I detect the custom quote character
and I build the box with the following procedure. 

procedure Buildquotedbox(VAR MessageQB : TStringlist);

var
   firstline : integer;
   lastline : integer;
   LineIndex : integer;
   BoxIndex : integer;
   linelength : integer;
   maxlength : integer;
   spaces : integer;
   newline : string;
   CenterCustomQuoteChar : CHAR;                           
   HorizontalborderChar : CHAR;  
   VerticalBorderChar : CHAR;
   LeftTopBottomRightChar : CHAR;
   RightTopBottomLeftChar : CHAR;
   Proceed : boolean;         
   
BEGIN
   LineIndex:=0;
   CenterCustomQuoteChar := '|';
   HorizontalborderChar := '-';
   VerticalBorderChar := '|';
   LeftTopBottomRightChar := '/';
   RightTopBottomLeftChar := '\';
   WHILE LineIndex < MessageQB.count DO
   BEGIN
      IF pos(CenterCustomQuoteChar, MessageQB.Strings[LineIndex])=1 THEN
      BEGIN
      	 firstline:=LineIndex;
      	 maxlength :=length(MessageQB.Strings[LineIndex]);
      	 LineIndex:=LineIndex+1;                 
         Proceed := LineIndex < MessageQB.count;
      	 IF Proceed THEN
      	    Proceed := (pos(CenterCustomQuoteChar, MessageQB.Strings[LineIndex])=1);
      	 WHILE Proceed DO
      	 BEGIN
      	    IF length(MessageQB.Strings[LineIndex]) > maxlength THEN
      	       maxlength :=length(MessageQB.Strings[LineIndex]);
writeln(inttostr(maxlength));
            LineIndex:=LineIndex+1;
      	    Proceed := LineIndex < MessageQB.count;
      	    IF Proceed THEN
      	       Proceed := (pos(CenterCustomQuoteChar, MessageQB.Strings[LineIndex])=1)
      	 END;
      	 lastline := LineIndex-1;
      	 spaces := (maxlength+1) div 2;
      	{proceed title}
      	 newline := MessageQB.Strings[firstline];
      	 {delete custom char}
      	 delete(newline,1,1);
      	 linelength := length(newline);
      	 IF Odd(linelength) THEN
            newline := LeftTopBottomRightChar+StringOfChar(HorizontalborderChar, (maxlength-length(newline))DIV 2)+
                        newline+StringOfChar(HorizontalborderChar, ((maxlength-length(newline))DIV 2) +1)+RightTopBottomLeftChar
         ELSE
            newline := LeftTopBottomRightChar+StringOfChar(HorizontalborderChar, (maxlength-length(newline)DIV 2))+
                        newline+StringOfChar(HorizontalborderChar, (maxlength-length(newline))DIV 2)+RightTopBottomLeftChar;
         MessageQB.delete(firstline);
         MessageQB.insert(firstline,newline);
        {procrrd box}
         FOR BoxIndex := firstline+1 to lastline DO
         BEGIN
            newline := MessageQB.Strings[BoxIndex];
            delete(newline,1,1);
            linelength := length(newline);
      	    IF Odd(linelength) THEN
      	       newline := padr(newline,linelength+(spaces-(linelength div 2)-1))
      	    ELSE
      	       newline := padr(newline,linelength+spaces-(linelength div 2));
      	    newline := VerticalBorderChar+padl(newline, spaces-(linelength div 2))+VerticalBorderChar;
            MessageQB.delete(BoxIndex);
            MessageQB.insert(BoxIndex,newline);
      	  END;
      	{proceed last box line}
      	IF Odd(maxlength) THEN
            newline := RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength+1)+LeftTopBottomRightChar
        ELSE
            newline := RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength)+LeftTopBottomRightChar;
         MessageQB.insert(lastline+1,newline);
      END;
      LineIndex := LineIndex+1;
   END;   
END;



Does it fit your requirement ?

As I am not on my ADSL line, I did not tested it on line in the
OnBeforeSendingMessage event procedure.

I put variables for the box delimiter characters as I prefer a '*' if I use
it for me ;-)
-- 
A.G.
Technical Details
Message-ID: <3f0554f9$0$5242$626a54ce@news.free.fr>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!mephistopheles.news.clara.net!news.clara.net!usenet-fr.net!proxad.net!feeder2-1.proxad.net!news1-1.free.fr!not-for-mail
References: <3f03353e$0$5400$626a54ce@news.free.fr> <3f03484e$0$5442$626a54ce@news.free.fr> <6tudnRrDCvmRMJ6iU-KYuQ@giganews.com> <3f03c01d$0$12435$626a54ce@news.free.fr> <QwSdnS7w_MKaep6iXTWJkQ@giganews.com>

Show Full Headers
Complete Article Headers
Message-ID: <3f0554f9$0$5242$626a54ce@news.free.fr>
Subject: Re: [Dialog] Customising Posts
Date: Fri, 4 Jul 2003 12:20:37 +0200
From: Alain GUERIN <news40@spamout-alain-guerin.com.invalid>
References: <3f03353e$0$5400$626a54ce@news.free.fr> <3f03484e$0$5442$626a54ce@news.free.fr> <6tudnRrDCvmRMJ6iU-KYuQ@giganews.com> <3f03c01d$0$12435$626a54ce@news.free.fr> <QwSdnS7w_MKaep6iXTWJkQ@giganews.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!mephistopheles.news.clara.net!news.clara.net!usenet-fr.net!proxad.net!feeder2-1.proxad.net!news1-1.free.fr!not-for-mail
Newsgroups: news.software.readers
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Reply-To: news40@alain-guerin.com
Organization: NA
X-Face: GOI#J$,onz-'Uz6us^h!d&!=/wSO@@FxWc?}1i_p@/E%ViONg.TD9>V7VA4(S/j%&mb%4uD
 ,=8(bmy`{t`AM[~^Y#8*]ZJ;
 {y2%EU,B'%$9[qEDa)B{/P4+eTD5E4{Un+XE$|RWd(=aNN%(,yP,cG
 =k=7dqQ"euLbBTVKLCV-Ql@aFEdzF1F6GU4b}qG%JPDjL'~T2;
 -03s=7s5[QUH@>GQ!CLJ@S{%K[m1
 $j`EsD+M&'5>>&-'tfiB0p',<4e0SN,4NDZ:f._qI9vVW0[r\~yk7{.GmY^cN*&/=5qjcH&Q; $
User-Agent: 40tude_Dialog/2.0.5.1
Lines: 114
NNTP-Posting-Date: 04 Jul 2003 12:20:43 MEST
NNTP-Posting-Host: 62.147.141.49
X-Trace: 1057314043 news1-1.free.fr 5242 62.147.141.49:1154
X-Complaints-To: abuse@proxad.net