[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: Erasing redundant newlines, spaces and tabs



El Wed, Dec 15, 1999 at 12:33:33PM +0100, Denis Barbier contaba:
>> Is there a better, safer or faster way to do this? 

><define-container clean>
>#  inside brackets, put a space, a tab and a newline
><subst-in-string %qbody "[      
>]+" " ">
></define-container>

Good Tip! Thanks! But it still does not satisfy me so much...

Just some hours after I remembered there is a special pass to do this
kind of things...

<define-tag head-clean>
{:\
[[s/[\n\r\t ]+/ /g]]\
%body\
:}\
</define-tag>

I don't know if it is faster or better, but 'Perl Regular Expresions'
are much more flexible.

By the way, the tag itself is much more complicated. I use it to
filter the contents of the data fields in the HEAD of the page. 

#use wml::fmt::isolatin
<define-tag head-clean>
<isolatin>\
{:\
[[s/[\n\r\t ]+/ /g]]\
[[s|<.+?>||sg]]\
    [[s|&(?!\w+;)|&amp;|sg]]\
    [[s|<|&lt;|sg]]\
    [[s|\"|&quot;|sg]]\
    [[s|>|&gt;|sg]]\
    [[s|\n+\s*$||s]]\
%body\
:}\
</isolatin>\
</define-tag>

-- 
Saudos:
><ose        xmanoel@bigfoot.com   (Vigo/Galicia/Espaņa)
         http://pagina.de/xmanoel/
         http://w3.to/mikkeli/

12/16	Beethoven born, 1770
12/16	Don McLean's "American Pie" is released, 1971
12/16	Ludwig von Beethoven christened in Bonn, Germany, 1770
12/16	(12/16/1773) Boston Tea Party (30-60 patriots and 342 chests of tea). 
12/16	(12/16/1770) Ludwig Van Beethoven, composer. 
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com