[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(LONG) Scheme HTML design program - my idea and request for comments



Patrick Giagnocavo writes:
[snip]
> Here is my idea:

> 1.  A "wptext" type,
> 
> 2.  An "outline" type, which is VERY USEFUL 
> 
> 3.  A "glossary" which is really killer.
>
> 4.  The ability to run scripts to generate the pages. 
> 
> 5.  Similar to #3 you can reference any function or object or variable
> within a wptext by using {} . 
> 
> 6.  If you pay the money for the latest commercial version you get a
> Webserver that is integrated inside the Frontier program.  This lets you
> offer up dynamic web pages.
> 
> 7.  In the future, I have this idea that dynamic pages could be "compiled"
> into scripts that run under different web server platforms
> 
> What do you guys think?  Anyone interested?

As others have said, a lot of this can be implemented reasonably
easily in Scheme. There is a system for Kawa (Scheme in Java) called
BRL that lets one embed Scheme in HTML. See
http://brl.sourceforge.net/ However, this is only part of the way to
what you want.

Addressing the requirements you've listed above, you get 1,3 and 4
without too much effort in Scheme. BRL and the AOLserver's ADP pages
give you 5 and 6 to a certain extent. 7 is somewhat more complex and
would require C hacking. I'm not entirely sure what the outline type
does, but I suspect this is where things become more complex. As I
understand it, Frontier's advantage is that it's not a system for
creating web, but for creating and managing web sites. So it lets you
see and modify the structure of your site with the graphical views, and
stores all your stuff in its database. This is particularly important
for those who (unfortunately) aren't programmers. If the outline type
represents every document as a tree then that is also very powerful as
well. Then one can define inheritance for documents. For example, if I
have a page about racing bicycles that has the structure:

Racing Bikes
|
+---- Wheels
|     |
|     +-- Aluminium
|     +-- Carbon Fibre
|
+---- Bodies
      |
      +-- Alloy
      +-- Carbon Fibre

and I can define a page about Mountain Bikes that has the structure:

Mountain Bikes
|
+---- Wheels
|     |
|     +-- Aluminium
|     +-- Carbon Fibre
|
+---- Tires
|     |
|     +-- Knobbly
|     +-- Kevlar
|
+---- Bodies
      |
      +-- Alloy
      +-- Aluminium

and I can create this by saying "Mountain Bikes has the same layout
and content as Racing Bikes, except it has this new section called
Wheels, and the other sections differ in this way, and this is the new
content", then I'd be impressed. I.e. if inheritance and overriding
can be defined for trees.

-----

As part of the Javadoc-for-Scheme system I'm writing, I'm going to
need a way to transform the information extracted from the scheme code
(definitions and comments) into viewable form (e.g. HTML). I'd like a
system where the user can mix code and text, because that seems to be
the easiest way for many people to handle these documents. So somebody
could say:

<html>
<head...
<body>
<h1>[unit-name]</h1...

where [unit-name] is replaced with the name of the unit that has been
processed. So far so good - I could hack BRL to do this. However, the
information comes in a tree, so a unit may contain many structures,
and structures have multiple fields. I'd like to hide the details of
the tree representation from the user, and avoid iteration over
collections of structures, functions and the like. So I'm thinking
that a production system approach might be a good way to go. In this
system one specifies a bunch of rules which have preconditions and
postconditions. The preconditions specify what type of data the rule
fires for (e.g. a function definition), the postconditions the text
that the rule inserts into the document. E.g:

<h2>Functions</h2>
(define-rule (function-definition?)
	(<p><strong>[function-name]</strong> [function-args]))

Everytime a function is encountered, the rule above fires, and emits
the HTML string. The tree-walking is implicit, and there is no
iteration.

This won't be finished for a few weeks, but it may be useful to you
when it's done.

cya,
Noel
-- 
Noel Welsh
http://www.dai.ed.ac.uk/~noelw/   noelw@dai.ed.ac.uk