[REBOL] Re: Rebol Server Pages
From: sharriff:aina:med-iq at: 3-Nov-2000 11:17
I want to code a XML parser/validator when I´m chanced (project "Markup") .
I thought it would be a good idea to create an Object with functions
directly from the given HTML/XML/XHTML :
give a file caleed test.html
<title> test </test>
<span id="dynamic-content-name"> hello world! </span>
testobject: markup/read %test.html
this produces an Object! with Words! that contains the markup and "change"
methods for the dynamic content:
testobject: make object! [
dynamic-content-name: function [ my-new-content-for-id ] [
change id my-new-content-for-id ]
then I could say:
testobject/dynamic-content-name " hello earthling! "
markup should have the refinements:
markup/print "to print the object created from the marked-up file"
markup/read " to read and create functions for the marked up file"
markup/validate " to validate markup against a given DTD"
This is by no means valid or tested code, I have just a hazy idea how it
should be implemented, but its´too complicated for a 4 week old REBOler
that I am. I think this approch separates the code from the content a step
further from server pages.
med.iq information & quality in healthcare AG
Martin" An: <[rebol-list--rebol--com]>
co.nz> Thema: [REBOL] Rebol Server Pages
Rebol Server Pages could be implemented like this:
*.RSP is the file name extension. RSP: Rebol Server Pages.
The embedded Rebol script in the .RSP would look like this:
<head><title><%: Title: "Rebol Server Pages test" %></title>
<h1><%: Title %></h1>
The date and time at the server is: <%: now %>. <br>
There should be four "Hello"'s following this:
<% for i 4 1 -1 [
%><h<%: i %>>Hello</h<%: i %>><%
opens a tag that contain Rebol script that doesn't need it's value
embedded in the resulting HTML code.
opens a tag that contains Rebol script that should be converted to a
string and embedded in the resulting HTML code.
closes either of the above tags.
The implementation of the above could occur in a object, like this:
RSP: make object! [
prin Title: "Rebol Server Pages test"
prin "</h1>^/The date and time at the server is: "
prin ">. <br>^/There should be four "Hello"'s following this:"
for i 4 1 -1 [
Hmmmm, and after painstakingly writing out all those 'prin, it might be
easier to rewrite it into a block suitable for 'rejoin.
Also the above object/block would predefine 'set, 'prin, 'print and maybe
'system to mean other things.
Rebol Server Pages Guru...