		       STRUCTURED FILES

Releases 0.4 and later of the gn gopher server have a neat feature.
It is a generalization of the mail file type found, for example, in
gopherd.  The difference is that instead of only dividing the file
into sections at a "From" line and getting the titles from "Subject"
lines you can specify any regular expressions to replace these two.
The regular expressions are set in the menu file (aka the .links or
.names file).

So for example, say you have a long document with sections that
begin with lines like

Chapter 1: The early history of the gopher protocol

you could set the separator to be  ^Chapter [0-9]*:
which would break the document into sections wherever there is a 
line starting with the word chapter followed by a space followed
by a digit string followed by a colon.  The titles for these sections
are determined by a second regular expression.  The title is everything
*after* the first match for this expression (starting with the separator
line) up to the end of the line.  Thus for this example you might use
just "^" as the regular expression.  Then the menu item would be

	Chapter 1: The early history of the gopher protocol.

If instead you used  ^Chapter [0-9]*:  for this regular expression as well
as the separator one, then the menu would show

	The early history of the gopher protocol.


Of course, there is no reason not to display a single file sectioned
in several different ways or with different menu titles.  You might,
for example have a mail file with two menus, one with Subjects on the
menu and one with authors on the menu. 

Another example of how this might be used is for an elaborate
directory.  If a file consists of entries like

Name: Franks, John
Address:  Department of Mathematics, Northwestern University
Phone: 708-491-5548
Brief Life History: etc., etc.

just set the separator to "Name:" and the title expression to be the
same and you'll get a menu of names which when selected give the
information in each section of the big file.  

Of course, searching these files is also supported so if you searched
for say, Northwestern you would get a menu of only those people with
Northwestern in their entry.


John Franks 	Dept of Math. Northwestern University
		john@math.nwu.edu


