Hello George,

Tuesday, August 12, 2003 at 10:53 GMT +0300, was when inspiration
required George M. Menegakis [GMM] to compose:

GMM> This is exactly what I mean! The problem is that the quick template that
GMM> you kindly provided doesn't strip empty lines. It keeps quoting them.

The one in my last posting too?  It stripped all blank lines here...

GMM> Basically what I wanted was is to compress 2 or more empty lines to one.
<snip>
GMM> I  thought  that  it was not possible (using template "language") till I
GMM> saw  that block quote did this.

My wrap template does this too.  Just removing the macro that actually
wraps the text, find:

=====[Begin wrap_mod QT]=====
%REM='
       Modified Multi-Paragraph wrapping routine using features from
       TB 1.63b11 
       Written August 2003 by Januk Aggarwal

       Notes:
          1. This template can be used alone to wrap clipboard
             contents or can be used as a wrapping engine by assigning
             text to the variable, %_Wrap_Text, in the driver template.
'%-
%-
%IF:'%_Wrap_FirstTime'='':'%-
%___%IF:"%_Wrap_Text"="":"%_Wrap_Text(%Clipboard)"%-
%___%_Wrap_FirstTime="No"'%-
%-
%IF:'%-
%SetPattRegexp="(?is-m)[^\n]+"%-
%RegexpMatch(%_Wrap_Text)'<>'':'%-
%-
%SetPattRegexp="(?is-m)^(.*?)((\n((\w{0,5}(\>\s*)+)?\s*\n)+)(.*)\s*$|\z)"%-
%RegexpBlindMatch(%_Wrap_Text)%-
%-
%_Wrap_Paragraph_1(%Subpatt(1))%-
%_Wrap_Blank_Space(%Subpatt(3))%-
%_Wrap_Remainder_Of_Text(%Subpatt(7))%-
%-
%Quotes(%_Wrap_Paragraph_1)
>
%_Wrap_Text(%_Wrap_Remainder_of_Text)%-
%-
%QInclude(wrap_mod)'%-
=====[ End  wrap_mod QT]=====

The part in your main template would be something like:

=====[Begin]=====
%_Wrap_Text="%Text"%-
%Qinclude="wrap_mod"%-
=====[ End ]=====


GMM>  But as I said the syntax of templates is
GMM> confusing  me.  I know I should try to understand it (due its tremendous
GMM> power), but before doing this I should learn how to think in regex.

Well, the regex and the templates can be learned separately,
especially in the current betas.  Obviously the regular expressions
give a huge amount of power, but you can still do a fair bit with
minimal knowledge of TB's regexps.

-- 
Thanks for writing,
 Januk Aggarwal




________________________________________________________

http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to