Subject: [[email-masked]: Converting TechInfo data into HTML files]
From: [email-masked] (Steven Wade Neiterman)
To: [email-masked]
Date: Thu, 21 Apr 94 14:29:34 EST

------- Forwarded Message

Return-Path: <[email-masked]>
Date: Fri, 15 Apr 1994 11:03:20 -0400
From: [email-masked]
Posted-Date: Fri, 15 Apr 1994 11:03:20 -0400
To: [email-masked]
Cc: [email-masked], [email-masked], [email-masked]
Subject: Converting TechInfo data into HTML files
Reply-To: [email-masked]

It is available via anonmous ftp at
scotty.dccs.upenn.edu, in pub/www-techinfo-1.4.tar  Please read
the COPYRIGHT.

One request in my giving my code to you: I would like a copy of
whatever code you produce because I really think it could help other
people who decide to move their info into WWW servers from PennInfo.

The gateway isn't exactly what you want.  But it is close.

See the convert.c file.

It contains whatis_titype() and  whatis_type(), which I use
to decide what sort of node I'm dealing with.  It contains
lots of other useful conversion stuff, which is why I called it
convert.c :-)

Here's a recursive algorithm that might work for you.  It's
very rough, very sketchy...

Function: get_subtree (char *nodeid)
Purpose: Create an html file for the nodeid, and html files for all nodeids
        which are descendants of this nodeid.
Global vars: tisock (a TCP/IP connection to penninfo-srv.upenn.edu, port 9000)
Current Working Dir: whereever you want the html files to be put

Steps:
1. check to see if nodeid.html already exists.  If it does then
   we've been to this nodeid before, and we don't want to get stuck
   in a recursive loop, so simply return.

2. If not, then create nodeid.html file, get a FILE * pointer.

3. Call get_node_info (char *nodeid, struct nodeinfo *info, int tisock)
   (get_node_info() calls whatis_type, so you'll node the node type)

4. If type is a plain text document, use send_doc() function
   (only don't write the data to 'client', but to the nodeid.html file
   Then, RETURN -- no recursion on this node type.

5. If type is a GIF IMAGE document, use send_verbatim_doc() function.
   Then return, no recursion.

6. If type is "Dynamic Extension", send_verbatim_doc() but use
   the nodeid.html fileptr, not client, and return.

7. Else type is probably menu (but check it to be safe :-)
   This is the recursive case.

   7.1 Call send_menu(), only write the data into the nodeid.html
        file, instead of sending to 'client'.

   7.2 For each item in the menu's child list:
        call get_subtree (node_list[child]->nodeid)

This is the basic algorithm.  You'll have to modify it, and the
functions that it calls.

And of course, add bells & whistles as you like.

After you run it, you'll probably want to run a shell script
which changes all the file names to their titles, and changes
all the hrefs to titles instead of nodeid.html.

Or, you could build it into the algorithm above -- however, note that
document titles DON'T have to be unique, whereas NODEIDs must be
unique.  So there won't be any filename conflicts if you stick with
NODEIDs.

let me know how it goes,

--lam
____________________________________________
|                                          |
| Linda A Murphy                           |
| [email-masked]                    |
| http://lam.dccs.upenn.edu/~murphy/       |
| Lead Programmer/Analyst                  |
| PennNet Services Development & Support   |
| Data Communications & Computing Services |
| University of Pennsylvania               |
|__________________________________________|

------- End of Forwarded Message