6.4.1 The bar-baz-qux page

Prev Up Next Page 68 of 800 Search internet

To see how a page gets its name, make a file named bar.lgs with the following contents:

   ""P baz
   ""R base
   define "name" of baz as "qux" end define

Then compile it:

   > lgc bar

If lgc says 'Could not load reference base' then go back and compile the base page. Otherwise view your new page:

   > firefox bar/index.html

Firefox will display an html page entitled 'Logiweb main menu of qux'.

So what is the name of the page? Is it 'bar', 'baz', or 'qux'?

Line 1 of the source contains a ""P escape sequence (P for Page). An escape sequence in the lgs language comprises two or more double quote characters followed by one character which is not a double quote.

Line 2 contains an R escape sequence (R for Reference). That line makes all constructs on the base page available. The R escape sequence corresponds to a #include base.h source line plus a -lbase compiler option in C.

Line 3 of the source defines the name of baz to be qux. The

   define x of y as z end define

construct comes from the base page.

Line 1 of the source file says the page is named 'baz'. But that name is internal to the source file. Line 3 of the source file references the page itself under the 'baz' name. But the 'baz' name is forgotten after compilation. After compilation, the definition in Line 3 says that construct number zero of the page is named qux. That is the name the page after compilation.

The name of the lgs source is 'bar'. That is why the command for compiling it reads

   > lgc bar

Thus, the page is named 'bar' before compilation, 'baz' during compilation, and 'qux' after compilation. You can save yourself some trouble by using the same name in all three situations.

The lgc compiler generates two symbolic links to the rendering directory, one named ./bar and one named ~/.logiweb/name/bar. The symbolic links are named after the name of the lgs file. That allows you to predict that

   > lgc bar

will generate links named 'bar' without knowing the contents of bar.lgs and without knowing the other two names of the bar page.

Now look at the browser you started up using

   > firefox bar/index.html

If you click 'Main text' or 'Index' you get a 'File Not Found'. That is because the bar-baz-qux page does not define a page.pdf or index.html. You can still click the other links and get something sensible.

A page named quux which references the bar-baz-qux page may look thus:

   ""P quux
   ""R base
   ""R bar
   "We can talk about the "[ qux ]" page"

The third line references the page pointed to by the ~/.logiweb/name/bar link so we must use the 'bar' name of the bar-baz-qux page here. Elsewhere, the name of the bar-baz-qux page is 'qux' after compilation.

Prev Up Next Page 68 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05