Compose on tag! values
[1/4] from: andrew::martin::colenso::school::nz at: 24-Dec-2003 22:40
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? :)
Andrew J Martin
Attendance Officer
& Grail Jedi.
Colenso High School
Arnold Street, Napier.
Tel: 64-6-8310180 ext 826
Fax: 64-6-8336759
http://colenso.net/scripts/Wiki.r?AJM
http://www.colenso.school.nz/
DISCLAIMER: Colenso High School and its Board of Trustees is not responsible (or legally
liable) for materials distributed to or acquired from user e-mail accounts. You can report
any
misuse of an e-mail account to our ICT Manager and the complaint will be investigated.
(Misuse can come in many forms, but can be viewed as any material sent/received that
indicate or suggest pornography, unethical or illegal solicitation, racism, sexism, inappropriate
language and/or other issues described in our Acceptable Use Policy.)
All outgoing messages are certified virus-free by McAfee GroupShield Exchange 5.10.285.0
Phone: +64 6 843 5095 or Fax: +64 6 833 6759 or E-mail: [postmaster--colenso--school--nz]
[2/4] from: joel:neely:fedex at: 15-Oct-2003 16:04
Hi, Andrew,
Here's a QAD RYO...
Andrew Martin wrote:
> What do people think about extending 'compose to work within tag!
> values? For example:
<<quoted lines omitted: 6>>
> <p style="Color: green;">
> ]
One function definition...
compose-tag: func [blk [block!]] [to-tag rejoin compose blk]
...after which...
>> paragraph_color: "green"
== "green"
>> compose-tag [{p } {style="Color:} (paragraph_color) {"}]
== <p style="Color:green">
-jn-
--
----------------------------------------------------------------------
Joel Neely joelDOTneelyATfedexDOTcom 901-263-4446
Counting lines of code is to software development as
counting bricks is to urban development.
[3/4] from: nitsch-lists:netcologne at: 16-Oct-2003 0:51
Am Mittwoch, 15. Oktober 2003 22:33 schrieb Andrew Martin:
> What do people think about extending 'compose to work within tag!
> values? For example:
<<quoted lines omitted: 7>>
> ]
> 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
[4/4] from: rotenca:telvia:it at: 16-Oct-2003 15:25
Hi Martin,
> What do people think about extending 'compose to work within tag!
> values? For example:
Carl S. already proposed it:
http://www.escribe.com/internet/rebol/index.html?by=OneThread&t=%5BREBOL%5D
REBOL embedded %24variables
And about compose-string code, see also this thread:
http://www.escribe.com/internet/rebol/index.html?by=OneThread&t=%5BREBOL%5D
parse%2Frecycle bug
---
Ciao
Romano
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted