Hi Gregg,
I've got close to what you want by using a "do string" to create a
template for your files. This at least means you only have to do a
string once. ie...
---8<---
rebol []
template: do "[^/none[^/value none^/mail none^/]^/]"
file: []
insert file copy/deep template
file/1: 'item-1
file/2/2: 1
file/2/4: [EMAIL PROTECTED]
insert file copy/deep template
file/1: 'item-2
file/2/2: 2
file/2/4: [EMAIL PROTECTED]
insert file copy/deep template
file/1: 'item-3
file/2/2: 3
file/2/4: [EMAIL PROTECTED]
sort/skip file 2 ; (;
print mold file
---8<---
This gives...
>> do %test.r
[item-1 [
value 1
mail [EMAIL PROTECTED]
] item-2 [
value 2
mail [EMAIL PROTECTED]
] item-3 [
value 3
mail [EMAIL PROTECTED]
]]
It's not quite perfect as line-hints for the item values are lost when
you change them, ((because they're in the outer block, perhaps?), but
the others are kept so it's almost how you wanted it. This is how
the file would look with no values changed...
>> blk: [] loop 3 [insert blk copy/deep template] print mold blk
[
none [
value none
mail none
]
none [
value none
mail none
]
none [
value none
mail none
]]
So close. Grrr! (: Hope that gets you some way to where you want,
anyway.
Carl.
On 25-May-02, Gregg Irwin wrote:
> hi Ammon,
> << Just a shot in the dark (I am still not sure what you are
> attempting, an example maybe?) Have you tried placing the word
> 'newline in where you wanted
> a new line? and I think that there is a similar one for tab IIRC. >>
> Yup. Tried various combinations of things, reducing, composing, etc.
> but no luck so far.
> The goal is to write out, to a file, something like this:
> item-1-id [
> value 0
> mail [EMAIL PROTECTED]
> ]
> item-2-id [
> value 1
> mail [EMAIL PROTECTED]
> ]
> which is an easy format to create and edit manually, and also very
> easy to just LOAD for use in scripts. The format you get without
> line hints is much harder to work with manually. E.g.
> item-1-id [value 0 mail [EMAIL PROTECTED]] item-2-id [value 1 mail
> [EMAIL PROTECTED]] item-3-id [value 1 mail [EMAIL PROTECTED]] item-4-id [value 1
> mail [EMAIL PROTECTED]] item-5-id [value 1 mail [EMAIL PROTECTED]]
> The new serialized format will be fine for apps you don't want to
> edit manually, and for REBOL developers, but for the average joe
> (script-tinkerer, help-desk personnel), I think the native block
> format might be much better.
> --Gregg
--
Carl Read
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.