2. Getting Started
To create a webpage with Weave we need to give its description a name, say mydoc, specify the pathname of the HTML file that is to contain it, say by a string expression mypage, and its title, say the literal string mytitle. We do this by writing
mydoc = BEGIN(mypage) ;
mydoc.TITLE = [[mytitle]] ;
We describe the body of the webpage by assigning a value to the expression mydoc.BODY and the page is finally created and written out to the specified file by the command
END(mydoc) ;
after which no more can be done with mydoc. Note that semicolons are used to terminate assignments and commands. You can create many pages in the same script and interleave the definitions and commands affecting them. The words FILE,TITLE and BODY are properties of mydoc. The fact that they are in capitals should tell you that these names are fixed by Weave, not chosen by you. If we had wanted to specify that mypage was in the same directory as the script and had leafname fred/html we would have written
mypage = OBEY$DIR..SEP..[[fred/html]] ;
first. The expression OBEY$DIR evaluates to the pathname of the directory containing the current script. The operator .. concatenates strings. The expression SEP evaluates to the directory separator (.). The pathname of the current script is given by the Lua expression arg[1].
Expressions in Weave can denote different types of object. These types are:
· strings
· numbers
· booleans
· tables (including sequences)
· functions
Well defined pieces of webpage are described by objects of type rope; this type can be defined recursively by
rope : : = string | nonempty sequence of ropes ;
|
|
|