@!345678901234567890123456789012345678901234567890123456789012345678901234567890 @!****************************************************************************** @t vskip 50 mm @t title titlefont centre "FunnelWeb Tutorial Manual Web" @t vskip 10 mm @t title smalltitlefont centre "by Ross N. Williams" @t title smalltitlefont centre "18 April 1999" @t vskip 10 mm @t title smalltitlefont centre "Copyright (c) Ross N. Williams, 1992." @t new_page @t vskip 20 mm @t title titlefont centre "Contents" @t vskip 10 mm @t table_of_contents @t new_page @!****************************************************************************** @!****************************************************************************** @A@ This document contains the FunnelWeb source for the FunnelWeb tutorial manual web. When processed by the FunnelWeb macro preprocessor, this file will generate all the text files in the web. @!****************************************************************************** @B@ This FunnelWeb source file and all works derived from it (including, but not limited to, the output files and printed documentation that can be extracted using the FunnelWeb preprocessor) are copyright as shown below, and the copyright message in the copyright macro applies to all of these works. The enclosing macro is called at the start of each FunnelWeb output file so that the copyright message appears in each output file as well as in this FunnelWeb source file. @$@@M@{@- Copyright @<(C)@> Ross N. Williams 1992,1999. All rights reserved.@} Permission is granted to redistribute and use this manual in any medium, with or without modification, provided that all notices (including, without limitation, the copyright notice, this permission notice, any record of modification, and all legal notices) are preserved on all copies, that all modifications are clearly marked, and that modified versions are not represented as the original version unless all the modifications since the manual's original release by Ross N. Williams (www.ross.net) consist of translations or other transformations that alter only the manual's form, not its content. THIS MANUAL IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. TO THE EXTENT PERMITTED BY LAW THERE IS ABSOLUTELY NO WARRANTY. @!****************************************************************************** @p maximum_input_line_length = 500 @p maximum_output_line_length = 500 @!****************************************************************************** @B@ @$@@Z@{ 18-Apr-1999 RNW Converted original 1992 FunnelWeb manual to this web (+ref web). 08-May-1999 RNW Documented new HTML +u option. 12-May-1999 RNW Documented @@L library feature. 13-May-1999 RNW Added the chapter on webmaking. 29-Dec-1999 RNW Added sidebar image strut to stop it collapsing. 30-Dec-1999 RNW Added the HTML style page. 30-Dec-1999 RNW Added the emacs mode page. 30-Dec-1999 RNW Changed manual version number scheme. 31-Dec-1999 RNW Tweaked the wholistic debugging page. 03-Jan-2000 RNW Changed copyright permission notice. 06-Jan-2000 RNW Added black background table to sidebar to cope with no-images. 09-Jan-2000 RNW Moved main version notice into a macro in the fw include file. @} @!****************************************************************************** @B@ @$@@Z@{ Checking Procedure ------------------ * Spelling check. * WebLint check. Shipping Procedure ------------------ * Use FunnelWeb to ENEO *.html * Run FunnelWeb. Eliminate all warnings. * Nuke the old web. * Upload the new web. * Briefly surf to check. @} FORMATTING NOTE: Experimentation has shown that any page containing a VERBATIM wider than 55 characters must be set to /wide. @!****************************************************************************** @B@ @$@@Z@{ TTDList ------- @} @!****************************************************************************** @B@ The FunnelWeb documentation used to be embodied in a single printed manual called The FunnelWeb User's Manual. Here's a record of how the material in the manual ended up in the FunnelWeb documentation webs: @$@@Z@{ Printed User Manual Section Where It Ended Up --------------------------- ----------------- Preface DELETED Acknowledgements Copyright page of all FunnelWeb webs. Presentation Notes DELETED 1. A Tutorial Introduction Tut: Chapters 1..4. 2. FunnelWeb Hints. Tut: Chapter 5..6. 3. FunnelWeb Definition. Ref: Most of the reference manual. 4. FunnelWeb Installation. Mainweb,Dev 5. FunnelWeb Administration. DELETED, but 5.2 => Main: stability Glossary Ref: Glossary. References Ref: References. Printed Hacker Manual Section Where It Ended Up ----------------------------- ----------------- Preface Dev: Home page intro. Acknowledgements Copyright page of all FunnelWeb webs. Presentation Notes DELETED 1. FunnelWeb Design Dev: Chapter 2. 2. FunnelWeb Implementation Dev: Chapter 3. 3. FunnelWeb Modification Dev: Chapter 4. 4. FunnelWeb Future Dev: Chapter 5. A. GNU Licence V2 Dev: Chapter 6. References Ref: References. @} @!****************************************************************************** @B@ These notes record the details of how the graphics in this web were created. This will enable the graphics to be easily recreated, duplicated, or modified if necessary. @$@@Z@{ Sidebar is 50x1200 colour=(0,0,0). Title Bookman Black SSi, 20pt, Antialias @} @!****************************************************************************** @!****************************************************************************** @B@ @$@@M@{@- TEXT="#000000" VLINK="#660000" LINK="#FF0000" ALINK="#CC0000">@} @$@@Z@M@{../@} @$@@Z@M@{@} @$@@Z@M@{../reference/@} @$@@Z@M@{../developer/@} @!****************************************************************************** @B@ The following macros provide macros to set up the top and bottom of pages. @!------------------------------------------------------------------------------ @$@@(@2@)@Z@M@{@2@@} @$@@(@3@)@M@{@@(@1@,@2@,@3@)@@} @$@@(@2@)@M@{@2@@} @$@@M@{
@@(130@)@ @ @ @} @$@@M@{ @ @} @$@@M@{@- @ @ @@ @ @@ @ @@(#000000@) @@(@index.html@,@@,Reference@) @ @@(@index.html@,@@,Developer@) @ @@(@index.html@,Tutorial@) @@(@@,@@) @@(@@,@@) @@(@@,@@) @@(@@,@@) @@(@@,@@) @@(@@,@@) @@(@@,@@) @ @@(@@,SEARCH@) @ @ @} @!------------------------------------------------------------------------------ @$@@(@1@)@Z@M@{ @
@1 @ @ @ @ @@(@1@) @} @$@@(@1@)@Z@M@{ @
@1 @ @ @ @ @@(@1@) @} @!------------------------------------------------------------------------------ @$@@Z@M@{ @ @ @@(mailto:@@,Webmaster@)@<_@>@<_@>@<_@> @
@ @ @ @} @$@@Z@M@{@} @!****************************************************************************** @B@ @$@@M@{ FunnelWeb Tutorial Manual@} @!****************************************************************************** @B@ @$@@(@1@)@M@{@- @@@(@1@)@@} @$@@(@1@)@M@{@- @@@@(@@(@1@)@)@@} @$@@(@1@)@Z@M@{@- @@@@(@@(@1@)@)@@} @$@@(@1@)@Z@M@{@- @@@@(@@(@1@)@)@@} @$@@(@1@)@Z@M@{@- @@(@@(@1@)@)@@} @$@@(@1@)@Z@M@{@- @@ @ @@(@@(@1@)@)@ @@} @!****************************************************************************** @$@@{ @} @!****************************************************************************** @!****************************************************************************** @A@ This section contains the HTML pages of the web. @!****************************************************************************** @$@@M@{FunnelWeb Tutorial Manual@} @$@@M@{index.html@} @O@@{@- @ @ @<Index HEADING@> @ @ @ @ @@@(T@)HIS TUTORIAL MANUAL provides a friendly introduction to the FunnelWeb literate programming preprocessor @This Tutorial Manual does not provide a definitive description of FunnelWeb, so if you have a specific technical question, you should refer to the @, which is definitive. To perform a keyword search of the Reference Manual and/or this Tutorial manual, click on SEARCH in the margin. @ @ @ @@(@@,@@) @ @@(@@,@@) @ @@(@@,@@) @ @@(@@,@@) @@(@@,@@) @ @@(@@,@@) @ @@(@@,@@) @ @ @ @ @} @$@@(@2@)@M@{@@2
@} @!****************************************************************************** @$@@M@{@@(1@)Introduction@} @$@@M@{@@(1@)Introduction@} @$@@M@{intro.html@} @O@@{@- @@(@@) @ @ @
@@(130@)@ @ @ @} @$@@M@{ @
## ##
##< A HREF="links.html"##>###### ####< A HREF="home.html"##>###### ####< A HREF="hobbies.html"##>##< IMG SRC="bin/right.gif"##>#### ## ## #=@@ @We can move all this to a single macro definition that has three parameters, one for each target page. @ @@=# @$@##@(@3@)@Z@M@{ @## ## ## ##
##< A HREF="@1"##>###### ####< A HREF="@2"##>###### ####< A HREF="@3"##>###### ## ## @} #=@@ @Now, to add navigation buttons to a page, we can just write (near the end of the page). @ @@=# @##@(links.html@,home.html@,hobbies.html@) #=@@ @If you wanted to, you could build the navigation buttons into the @@(@@@<<@>End page@@@<>@>@) macro and set it up with three parameters instead. @@(@@,@@,@@) @ @} @!============================================================================== @$@@M@{@@(7.4@)Avoiding Errors And Inconsistencies@} @$@@M@{web_errors.html@} @O@@{@- @@(@@) @FunnelWeb provides the opportunity to eliminate all kinds of errors and inconsistencies by replacing text names with FunnelWeb macro names that cannot be misspelt without being detected by FunnelWeb. This page provides some examples of this. @@(Minor Style Elements@) @Have you ever done this: @ @@=# This is ##! #=@@ @These kinds of errors can be eliminated by replacing HTML constructs, even simple ones, by FunnelWeb macros: @ @@=# @$@##@(@1@)@M@{##@1##@} ... This is @##@(Very Important@)! #=@@ @While this is a bit messier, it eliminates the chance of an error because if you get the syntax wrong, FunnelWeb will generate an error at "compile time", which is a lot better than receiving email from some random web visitor. It's true that the same level of checking can be obtained by running an HTML syntax checker over your web. However, if you're using FunnelWeb for all its other benefits, you might as well use this aspect too. @@(File Names In Hyperlinks@) @Another source of error in webs is bad internal links. This can occur when you rename a file and forget to "fix up" all the links to it, and when you make a typing error when typing in a filename in a hyperlink. @You can use FunnelWeb to eliminate both of these kinds of error, by defining a macro for each output file. This is easier to do than explain: @ @@=# @!************************************************ @$@##@(@1@)@M@{ ## ## ##@1## ## ## @} @$@##@M@{ ## ## @} @!************************************************ @O@##@{ @##@(Dave's Home Page@) ##Welcome to my home page. Check out my ##links page## and my ##hobbies page##. @## @} @!************************************************ @$@##@M@{links.html@} @O@##@{ @##@(Dave's Links@) ##Here are my links: ## ##Yahoo#### ##Dilbert#### @## @} @!************************************************ @$@##@M@{hobbies.html@} @O@##@{ @##@(Dave's Hobbies@) ##This page is under construction! @## @} @!************************************************ #=@@ @Again, this technique introduces a little messiness, but the benefits it brings are significant. Once you have deployed this technique throughout your web source file, you will then be free to change the names of any of your files without ever having to worry about fixing up any links - they will all be fixed automatically! Furthermore, if you delete an output file from your FunnelWeb source file, FunnelWeb will alert you to any "dangling links" because the references to the deleted page take the form of calls to a macro that is no longer defined! Of course, this only works if you don't mark your filename macros with @@(@@Z@). @The only thing you have to get right is to ensure that the filename of the output macro is the same as the value of the corresponding naming macro. This isn't too hard to do because they are always on adjacent lines. @The benefit of eliminating all bad links from one's web is a benefit that can be obtained by running an external web analysis tool over your web. However, by using FunnelWeb file naming macros, you can be SURE that the web can never be generated with a bad link, whereas the web analysis tool only works if you remember to run it! @@(People's Names@) @Sometimes you might have to create a web that contains lots of long names that are hard to remember or spell. FunnelWeb can help here by eliminating the chance of error. Just define each name as macro and always call the macro when using the name. The benefit of doing this is that FunnelWeb will always detect a spelling error because if you make a spelling error in the macro name, FunnelWeb will generate a "macro not defined" error. @ @@=# @$@##@M@{Marvin Hylrzbvwryvitz@} #=@@ @If you want to, you could used a shortened form. For example: @ @@=# @$@##@M@{Marvin Hylrzbvwryvitz@} #=@@ @@(CGI Form Fields@) @One of the organizational challenges of implementing CGI form processing is getting all the field names right. Because (normally) the form is in one file, and the CGI script that processes it is in another file, it's very easy to accidentally use different names for the same field. For example, you might use @@(email_adr@) in one and @@(email-adr@) in the other. @FunnelWeb can be used to completely eliminate this problem as follows: @ @ @Put both the HTML file containing the form and the CGI file that processes it within the @@(.fw@) file that embodies your web. @ @Define a macro for the name of each field and use the macro in both the form and the CGI script. @ @Here's an example: @ @@=# @!************************************************ @$@##@M@{email_adr@} @!************************************************ @O@##@{ @##@(Order Form@) ## ##
## ... ## @## @} @!************************************************ @O@##@{@- @## ... $v = $form{'@##'}; @## @} @!************************************************ #=@@ @This technique more or less completely eliminates mismatch errors in form field names, for if any such error is made, FunnelWeb will generate a "macro not defined" error. All you have to do to benefit from this technique is get into the habit of using it. @@(When Global Replace Fails@) @Many people who write HTML directly use nerve wracking multi-file global replaces to perform the kind of web parameterization that FunnelWeb makes so easy. Unfortunately, these global replacements can go badly wrong because the target text may be used in many different contexts. In some cases, this approach fails completely. @For example, suppose that you have to create a hundred page web that has to be laced with two email addresses: a "business" email address and a "personal" email address. No problem so far. However, suppose that you haven't yet chosen a business domain name and, as a result, at the current time, the two email addresses are the same! If this were the case, you would have to put your address throughout all the pages and would LOSE the information of which were supposed to be business addresses and which were supposed to be personal ones. @FunnelWeb solves this problem (and others like it) completely by allowing you to define two macros one for each context. For example: @ @@=# @$@##@M@{dave@@someisp.com.au@} @$@##@M@{dave@@someisp.com.au@} #=@@ @These macros can then be used as appropriate. Later, when the domain name comes through and the business address changes, all that needs to be changed is a single definition: @ @@=# @$@##@M@{dave@@megacorp.com.au@} @$@##@M@{dave@@someisp.com.au@} #=@@ @There is no need to perform a multi-file global replace and evaluate the context of the use of each email address, as the information was not lost when the web was originally created, because of the two macros. @This example is just one of many similar situations that arise. By locating all the pages of your web in a single file and allowing you to define macros for different purposes, you can eliminate much of the time and danger of global replacements. @@(@@,@@,@@) @ @} @!============================================================================== @$@@M@{@@(7.5@)Defining A Consistent Style@} @$@@M@{web_style.html@} @O@@{@- @@(@@) @We have already seen how FunnelWeb can be used, through the use of @@(@@@<<@>Begin page@@@<>@>@) and @@(@@@<<@>End page@@@<>@>@) macros to set up a particular page style throughout a web. However, this is really just the beginning of FunnelWeb's capacity to manage the style of a web. This page provides some other ideas. @@(Generic Style Macros@) @HTML contains some tags such as @@(@<<@>em@<>@>@) that have a high-level meaning (@@(emphasis@)) rather than a low-level meaning such as @@(italics@). You can use FunnelWeb to create your own high level formatting macros so that you can later change the style of the web just by changing the macro definitions. @For example, suppose that your web contains lots of latin names of plants. You've decided that you want to highlight the names, but haven't decided how. Using FunnelWeb you can just define a macro: @ @@=# @$@##@(@1@)@M@{##@1##@} #=@@ @This means that all latin names will be set in bold. However, if at a later date, you change your mind, you can just change the definition to some other format. @@(Margins@) @Here's another example. Suppose that you want some parts of the text in your web to be narrower than others. You can achive this by defining and using a macro like this: @ @@=# @$@##@(@1@)@M@{@- ######
@1 ###### @} #=@@ @If at a later date, you want to change all the widths, you just need to change the single definition. @@(@@,@@,@@) @ @} @!============================================================================== @$@@M@{@@(7.6@)Defining Macro Libraries@} @$@@M@{web_libraries.html@} @O@@{@- @@(@@) @@(Separating Macros Into An Include File@) @Once you start using FunnelWeb to make webs, you'll discover that you find yourself defining and using the same macros over and over. Rather than redefining them for each new web you make, you can place them all in a FunnelWeb include file, so that they can be included in the FunnelWeb file for each web you make. Suppose that we create a file called @@(style.fwi@) containing the following text: @ @@=# @$@##@(@1@)@M@{ ## ## ##@1## ## ## @} @$@##@{ ## ## @} @$@##@Z@M@{@- ##Dilbert##@} @$@##@Z@M@{@- ##Yahoo##@} #=@@ @Once this is done, the main web file can become: @ @@=# @!************************************************ @i style @!************************************************ @O@##@{ @##@(Dave's Home Page@) ##Welcome to my home page. Check out my ##links page##. @## @} @!************************************************ @$@##@M@{links.html@} @O@##@{ @##@(Dave's Links@) ##Check out @## and @##. @## @} @!************************************************ #=@@ @Now we're starting to see some real simplification! @Note: It's important to attach @@(@@Z@) to any macro you place in an include file that you think might not be called in some webs. If you don't, FunnelWeb will issue @@(this macro is unused@) errors for the included macros you don't use. @@(Library Macros@) @Once you've created one or more macro libraries in the form of FunnelWeb include files, you might find that sometimes you want to redefine some of the macros that the include file provides. For example, suppose that we are preparing an Australian web page and that when we refer to Yahoo, we want to refer to the Australian Yahoo site. If we try to redefine the Yahoo macro: @ @@=# @i style ... @$@##@Z@M@{@- ##Yahoo##@} #=@@ @then FunnelWeb will issue an error @@(this macro is already defined@). FunnelWeb does not allow macros to be redefined because this could be dangerous in a programming context. It would be very bad if a programmer thought they was invoking one piece of text when they were really invoking another. So FunnelWeb complains. @To stop FunnelWeb complaining, you can tag with a library macro marker @@(@@L@) any macro in the include file that you want to be able to redefine. For example: @ @@=# @$@##@Z@M@L@{@- ##Dilbert##@} @$@##@Z@M@L@{@- ##Yahoo##@} #=@@ @This allows us to redefined the Yahoo and Dilbert macros. @@(Modifying Default Behaviour@) @The library macro mechanism allows you to set up all kinds of default behaviour that can be modified in specific webs. For example, suppose that we rewrote the macro library as: @ @@=# @$@##@(@1@)@M@{ ## ## ##@1## ## @## @} @$@##@{ ## ## @} @$@##@L@{@- ##@} #=@@ @Once this is done, we can modify the page background and colours of any web by redefining the @@(Body@) macro without having to redefine the start and end of page macros. @ @@=# @!************************************************ @i style @$@##@{@- ##@} @!************************************************ @O@##@{ @##@(Dave's Home Page@) ##Welcome to my home page. Check out my ##links page##. @## @} @!************************************************ @$@##@M@{links.html@} @O@##@{ @##@(Dave's Links@) ##Check out @## and @##. @## @} @!************************************************ #=@@ @@(Use Of Additive Macros@) @Additive macros can be used to insert information into the middle of macros already defined. For example, suppose you defined: @ @@=# @$@##@(@1@)@M@{ ## ## ##@1## @##
## ## @} @$@##
+=@{@} #=@@ @Once the header fields macro is in place, you can add text such as style commands or keyword tags to each of the pages of your web without having to modify the header include file. Just add a definition, such as the following, to your main FunnelWeb file: @ @@=# @$@##
+=@{ ##