newlines in saved blocks
[1/4] from: sharriff:aina:med-iq at: 13-Oct-2000 12:26
I´m trying to save "newlines" to a block, the block is then saved to a file
per CGI:
>> q: make block! 0
== []
>> append q to-word "name"
== [name]
>> append q "sharriff"
== [name "sharriff"]
>> append q to-word "log-name" newline
== #"^/"
>> q
== [name "sharriff" log-name]
why is this not possible? I would like my blocks formatted:
[
name "sharriff"
log-name "sharriff"
other-label "value"
]
best regards
Sharriff Aina
med.iq information & quality in healthcare AG
[2/4] from: al:bri:xtra at: 13-Oct-2000 4:54
> I´m trying to save "newlines" to a block, the block is then saved to a
file per CGI:
> >> q: make block! 0
> == []
<<quoted lines omitted: 7>>
> == [name "sharriff" log-name]
> why is this not possible?
Rebol reflects the block as it prefers, not as you'd like.
> I would like my blocks formatted:
> [
> name "sharriff"
> log-name "sharriff"
> other-label "value"
> ]
You could try constructing a string equivalent like this:
>> s: rejoin [{
{ name } mold "sharrif" {
{ log-name } mold "sharrif" {
{ other-label } mold "value" {
{ }
[ ]
== {
name "sharrif"
log-name "sharrif"
other-label "value"
}
>> to-block s
== [
name "sharrif"
log-name "sharrif"
other-label "value"
]
I hope that helps!
Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
[3/4] from: sharriff::aina::med-iq::de at: 13-Oct-2000 13:07
Thanks Andrew!
Sharriff Aina
med.iq information & quality in healthcare AG
[4/4] from: joel:neely:fedex at: 13-Oct-2000 12:04
Hi, Sharriff,
How about separating presentation from content?
>> somedata: [
[ name "sharriff"
[ log-name "sharriff"
[ other-label "value"
[ ]
>> append somedata [language "REBOL"]
>> append somedata [flavor "strawberry"]
>> append somedata [phone "800-555-1212"]
== [
name "sharriff"
log-name "sharriff"
other-label "value" language "REBOL" flavor "strawberry"
phone "800-555-1212...
>> present: func [b [block!]] [
[ print "["
[ foreach [name value] b [
[ print [" " mold name mold value]
[ ]
[ print "]"
[ ]
>> present somedata
[
name "sharriff"
log-name "sharriff"
other-label "value"
language "REBOL"
flavor "strawberry"
phone "800-555-1212"
]
-jn-
[Sharriff--Aina--med-iq--de] wrote:
> I´m trying to save "newlines" to a block, the block is then saved to a file
> per CGI:
<<quoted lines omitted: 17>>
> Sharriff Aina
> med.iq information & quality in healthcare AG
--
; Joel Neely [joel--neely--fedex--com] 901-263-4460 38017/HKA/9677
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted