Rebol Server Pages
[1/4] 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
<html>
<head>
<title> test </test>
</head>
<body>
<span id="dynamic-content-name"> hello world! </span>
</body>
</html>
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! [
print start-html
print start-head
print start-title
print end-head
print start-body
dynamic-content-name: function [ my-new-content-for-id ] [
change id my-new-content-for-id ]
print end-body
print end-html
]
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.
Sharriff Aina
med.iq information & quality in healthcare AG
"Andrew
Martin" An: <[rebol-list--rebol--com]>
<[Al--Bri--xtra]. Kopie:
co.nz> Thema: [REBOL] Rebol Server Pages
Gesendet von:
rebol-bounce@
rebol.com
03.11.00
23:35
Bitte
antworten an
rebol-list
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:
<html>
<head><title><%: Title: "Rebol Server Pages test" %></title>
<body>
<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 %>><%
] %>
</body>
</html>
<%
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 "<html>^/<head><title>"
prin Title: "Rebol Server Pages test"
prin "</title>^/<body>^/<h1>"
prin Title
prin "</h1>^/The date and time at the server is: "
prin now
prin ">. <br>^/There should be four "Hello"'s following this:"
for i 4 1 -1 [
prin "<h"
prin i
prin ">Hello</h"
prin i
]
prin "</body>^/</html>"
]
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.
Opinions?
Andrew Martin
Rebol Server Pages Guru...
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
[2/4] from: al::bri::xtra::co::nz at: 3-Nov-2000 23:35
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:
<html>
<head><title><%: Title: "Rebol Server Pages test" %></title>
<body>
<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 %>><%
] %>
</body>
</html>
<%
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 "<html>^/<head><title>"
prin Title: "Rebol Server Pages test"
prin "</title>^/<body>^/<h1>"
prin Title
prin "</h1>^/The date and time at the server is: "
prin now
prin ">. <br>^/There should be four "Hello"'s following this:"
for i 4 1 -1 [
prin "<h"
prin i
prin ">Hello</h"
prin i
]
prin "</body>^/</html>"
]
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.
Opinions?
Andrew Martin
Rebol Server Pages Guru...
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
[3/4] from: bo:rebol at: 3-Nov-2000 9:58
On my webserver that handles embedded REBOL (I'm not sure if this is the
same as your .RSP idea), it is as simple as this:
<HTML><HEAD><TITLE>Example</TITLE></HEAD>
<H1>Bo's embedded REBOL example</H1>
<P>The time is <REBOL>output now</REBOL>
<P>This webserver is running on REBOL/<REBOL>
output [system/product system/version]
</REBOL>
</HTML>
I've done much more complex things with it in the past like building HTML
tables on the fly from dynamic data, etc. I like to keep it clean looking.
Just a thought!
-Bo
On 3-Nov-2000/8:56:18-7:00, [Al--Bri--xtra--co--nz] wrote:
>Rebol Server Pages could be implemented like this:
>*.RSP is the file name extension. RSP: Rebol Server Pages.
<<quoted lines omitted: 46>>
>[rebol-request--rebol--com] with "unsubscribe" in the
>subject, without the quotes.
--
Bohdan "Bo" Lechnowsky
REBOL Adventure Guide
REBOL Technologies 707-467-8000 (http://www.rebol.com)
The Official Source for REBOL Books (http://www.REBOLpress.com)
[4/4] from: al:bri:xtra at: 4-Nov-2000 8:28
Bo wrote:
> On my webserver that handles embedded REBOL (I'm not sure if this is the
same as your .RSP idea), it is as simple as this:
> <HTML><HEAD><TITLE>Example</TITLE></HEAD>
> <H1>Bo's embedded REBOL example</H1>
<<quoted lines omitted: 3>>
> </REBOL>
> </HTML>
In my current working HTML dialect the above can be written as:
HTML [
title "Example"
body
h1 "Bo's embedded REBOL example"
ip ["The time is " now]
p ["This webserver is running on REBOL/" system/product " "
system/version]
]
Much like this:
>> do %html.r
>> print HTML [
[ title "Example"
[ body
[ h1 "Bo's embedded REBOL example"
[ ip ["The time is " now]
[ p ["This webserver is running on REBOL/" system/product " "
system/version]
[ ]
<html>
<head>
<title>Example</title>
</head>
<body>
<h1>Bo's embedded REBOL example</h1>
The time is 4-Nov-2000/8:26:34+13:00<br>     
This webserver is running on REBOL/View 0.10.38.3.1
</body>
</html>
It even generates correct HTML! :-) A .RSP is more to attract attention.
People might ask of Rebol (and web servers): "Does it run ASP?" And the
answer will be: "No, but it runs RSP, the Rebol equivalent."
> I've done much more complex things with it in the past like building HTML
tables on the fly from dynamic data, etc. I like to keep it clean looking.
Me too, as shown by my HTML "dialect". But RSP provides an equivalent to ASP
(and JSP) that management (I think) could understand, and tick off in
feature comparison. It also provides a easier way for newcomers with ASP and
JSP experience another way into Rebol.
I hope that explains my motivation for that.
Andrew Martin
ICQ: 26227169
http://members.nbci.com/AndrewMartin/
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted