[REBOL] Re: Tags, anyone?
From: brett:codeconscious at: 16-Apr-2002 16:39
> > There is also form-markup which converts this representation back into a
> > string:
> >
> > >> form-markup [ [p] "paragraph 1" [p] "paragraph2" ]
> > == "<p>paragraph 1<p>paragraph2"
> Quick question: Why? You could just as easily work with <p> instead,
since
> it's valid.
It is the opposite of my load-markup function. My example was poor.
> > I did this to give a basic markup manipulation facility:
> >
> > m: load-markup {<body bgcolor="white">some <b>text</b></body>}
> > change next find first m 'bgcolor "blue"
> > form-markup m
> You could also use your import-tag and build-tag for the same purposes,
if I
> follow correctly.
Yep. These are what load-markup and form-markup actually use to produce
their results.
All I am doing with load-markup is to first do LOAD/MARKUP an to change each
tag!
into a block! so that manipulating the attributes of the tag is much easier.
form-markup just converts the block back to a string so that you can for
example
write out that html file you just edited.
> And how would load-markup display the value of m there?
You could have tried that for yourself! :^)
>> m: load-markup {<body bgcolor="white">some <b>text</b></body>}
== [[body bgcolor "white"] "some " [b] "text" [/b] [/body]]
>> change next find first m 'bgcolor "blue"
== []
>> m
== [[body bgcolor "blue"] "some " [b] "text" [/b] [/body]]
>> form-markup m
== {<body bgcolor="blue">some <b>text</b></body>}
> I'm not critiquing so much as asking for verifications and
exaplanations.
> Thanks for the work, Brett!
You're most welcome.
Brett.