Each page on the Vision site (okay, at the moment, the page on the Vision site) consists of two files: the Vision script that generates the output, and the content file giving the body text. The Vision file is very simple:
#!/home/groups/v/vi/vision-language/vision
@include Page;
Page {
"Vision Web Templating Language";
../htdocs/MainPage
}
This gives the path to the Vision interpreter, includes a page template in a file called Page, and then invokes the template of the same name with some text and the contents of a file. That's it. The Page template is very simple, too, and looks like this:
@define Page (TITLE; BODY) {
html {
head {
title { "Vision > "; TITLE }
link (rel "stylesheet"; type "text/css"; href "/style.css");
}
body {
div main {
div (class "cell") { h1 { TITLE } }
div (class "cell") { BODY }
}
}
}
}
As you can see, the template produces an HTML document with whatever title and body content were specified. Everything else on the site is controlled by the CSS document style.css. New pages can be created quite easily by authoring a new content file and duplicating the Vision script with a reference to the new file.
No comments:
Post a Comment