[REBOL] Re: Parse experiments: help needed
From: mario:cassani:icl at: 28-Nov-2001 9:04
Hallo Robert, Donald, Ryan, Gregg, Ammon, and, why not, all the Rebolers out
there,
> You might want to add "/" surrounded text as italic markers, too.
> One of my mailers uses that method.
>
> Donald
If is not Amiga YAM but a PC program can you tell me its
name, please?
I will do that later, actually the #"/" is used in URLs:
http://dont.italicise.me/
> The trick is to parse your string the following way, while
> reducing the valid
> character set by your special chars:
>
> chars: complement charset "_*%"
>
> rules: copy text some chars [
> "*" <this is your bold rule>
> | "_" <this is your underline rule>
> | "%" <this is your italic rule>
> ]
>
> You got the idea?
Yes, thanks!
>> sample: {This string contains *bold text* and is a sample}
== "This string contains *bold text* and is a sample"
>>
>> chars: complement charset "_*%"
== make bitset! #{
FFFFFFFFDFFBFFFFFFFFFF7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
}
>>
>> rules: [copy text some chars [
[ "*" (print "bold!")
[ | "_" (print "underline!")
[ | "%" (print "italic!")
[ ]]
== [copy text some chars [
"*" (print "bold!")
| "_" (print "underline!")
| "%" (print "italic!")
]]
>>
>> parse sample rules
bold!
== false
>> text
== "This string contains "
>>
Now extracting the rest will be easier!
Xie xie nimen
Mario