Am Mittwoch, 15. Oktober 2003 22:33 schrieb Andrew Martin:
> What do people think about extending 'compose to work within tag!
> values? For example:
>
>               paragraph_colour: "green"
>               compose [
>                       <p style="Color: (paragraph_colour);">
>                       ]
>       which results in:
>               [
>                       <p style="Color: green;">
>                       ]
>
> Comments, criticism, witticisms? :)
>

Something similar was suggested by Carl a while ago.
He wanted to process perl-based templates,
which mark their variables with "$".
IIRC he thought about a native.
Gabriele posted a parse-based prototype.
I think its usefull. aboids a lot clutter.
The idea of integrating it in compose is interesting.
Carl mentions somewhere how cool 'repend is for html-building.
integrating tag-expansions could be even better.

my personal favorite favorite function gets its replace-arguments
explicitely, so one would write
 subst[ #PG paragraph_color ] [
                        <p style="Color:($PG;">
 ]
which i find more readable.
(shows me which variables are hidden in the html)
source:
        subst: func [vars string] [
            string: copy string
            foreach [var val] reduce vars [
                replace/all string join "$" var val
            ]
            string
        ]
has a bug with
 subst[#a "$b" #b "demo"] {this is a $a}
== "this is a demo"
instead of {this is a $b},
but works otherwise.

recently i discovered i like to create c-style code
with rebol. C has all this {} which fit very well with rebols strings.
so c-code can be pasted in rebol-source without problems, then
the $..-values are replaced.
subst[#what "world]{
 int main(){
  printf("Hello $what");
 }
}
works then :)

> Andrew J Martin

-Volker

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to