Home Page Contents Back Web Node Structure Previous Up Next

How to Use wenost and htm2txt

Introduction

On this page are descriptions of:

Batch files

The Python interpreter must be used to run wenost, htm2txt and cpdate. For example to run wenost on structure.txt:

   python wenost.py structure.txt

To simplify using wenost, htm2txt and cpdate under Dos or Windows three batch files are available:

Batch file to run wenost
 
@echo off
rem wenost.bat - simple script to run wenost.py
rem $Id: wenost.bat,v 1.3 2003/03/01 00:10:42 mbaker5153 Exp $
rem $Log: wenost.bat,v $
rem Revision 1.3  2003/03/01 00:10:42  mbaker5153
rem Update for release 0.91
rem
rem Revision 1.2  2002/02/09 16:12:52  michael
rem tidy up and change email address
rem
rem Revision 1.1.1.1  2002/02/08 23:25:47  michael
rem initial import
rem
python c:\apps\wenost\src\wenost.py %1 %2 %3 %4 %5 %6 %7 %8 %9

Batch file to run htm2txt
 
@echo off
rem htm2txt.bat - simple script to run htm2txt.py
rem $Id: htm2txt.bat,v 1.3 2003/03/01 00:10:41 mbaker5153 Exp $
rem $Log: htm2txt.bat,v $
rem Revision 1.3  2003/03/01 00:10:41  mbaker5153
rem Update for release 0.91
rem
rem Revision 1.2  2002/02/09 16:12:52  michael
rem tidy up and change email address
rem
rem Revision 1.1.1.1  2002/02/08 23:25:47  michael
rem initial import
rem
python c:\apps\wenost\src\htm2txt.py %1 %2 %3 %4 %5 %6 %7 %8 %9

Batch file to run cpdate
 
@echo off
rem cpdate.bat - simple script to run cpdate.py
rem $Id: cpdate.bat,v 1.1 2003/03/01 00:10:41 mbaker5153 Exp $
rem $Log: cpdate.bat,v $
rem Revision 1.1  2003/03/01 00:10:41  mbaker5153
rem Update for release 0.91
rem
python c:\apps\wenost\src\cpdate.py %1 %2 %3 %4 %5 %6 %7 %8 %9

To use these batchfiles they should be placed on your PATH and the locations of wenost.py and htm2txt.py should be changed to where they are located on your machine.

It may be useful to write similar scripts for use on other architectures.

The following descriptions assume the use of these batch files (or equivalent scripts) plus a similar batch file (or script) to run PPWizard.

Running wenost - example 1

To run the example in examples/ex1 first run wenost on example.wen, then optionally add text to each of the newly generated .txt files (this can be done by using the mk-txt.bat batch file or equivalent script), and finally running PPWizard. For example:

   cd examples\ex1
   wenost example.wen
   mk-txt
   ppwizard *.it

Alternatively use the batch file ex1.bat to run the example:

   cd examples\ex1
   ex1

This produces a number of linked HTML files. Start by looking at index.html and follow the links to the other pages. Note that the navigation follows the structure in example.wen illustrated below.

Example 1 structure file
 
; example.wen - example input node structure file

; $Id: example.wen,v 1.2 2002/02/09 16:12:52 michael Exp $

; $Log: example.wen,v $
; Revision 1.2  2002/02/09 16:12:52  michael
; tidy up and change email address
;
; Revision 1.1.1.1  2002/02/08 23:25:47  michael
; initial import
;
; comments start with a ";" as the first non white space character

; The first node can have arbitary amounts of white space before it
; Sub nodes are indented.
; The amount of white space before the first sub node encountered
; at a given level determines the white space for that level.

; node name               node title

  index                   Home Page
    Contents                Contents
    Node1                   First level node
      Node1a                  Second level node
      Node1b                  Another second level node
    Node2                   Another first level node
      Node2a                  And another second level node
      Node2b                  Yet another second level node

; end of example input

By default wenost outputs navigation data in sub-node style. If you go to a page at any sub level in the example html files and follow the next link on every page you will stay in that sub level. That is previous and next wrap around at the begining and end of each sub-level in the web node structure. The alternative is book style in which previous and next wrap around at the begining and end of the whole site. To create a site in book style use the -nb option. For example (after having run the example as above):

   wenost -nb example.wen
   ppwizard *.it

Alternatively give the -nb option to the ex1.bat batch file:

   ex1 -nb

Now if you start at the home page (index.html) and follow the next link on every page you will be taken in sequence through every page on the site.

After running this example you may want to delete all generated files (*.head, *.err, *.it, *.txt, *.html). The batch file clean.bat has been provided to delete all these generated files:

   clean

Running wenost - example 2

To run the example in examples/ex2 first run wenost on structure.txt also giving it the name of the text file template skeleton.txt, then run PPWizard in the ex2 directory and the subdirectories created by wenost. For example:

   cd examples\ex2
   wenost structure.txt skeleton.txt
   ppwizard *.it
   cd 1
   ppwizard *.it
   cd 1
   ppwizard *.it
   cd ..\..\2
   ppwizard *.it
   cd ..

As an alternative use the ex2.bat batch file. For example:

   cd examples\ex2
   ex2

This produces a number of linked HTML files. This example demonstrates the inclusion of .crumbs.txt files generated by wenost as navigation aids. Start by looking at index.html and follow the links to the other pages. Note that the nodes in the structure file (structure.txt in this example) can be in sub-directories. The subdirectory separator used is "/", the separator used in URLs. See structure.txt illustrated below.

Example 2 structure file
 
; examples/ex2/structure.txt - structure to test directory level functionality

; $Id: structure.txt,v 1.3 2003/03/01 00:10:48 mbaker5153 Exp $

; $Log: structure.txt,v $
; Revision 1.3  2003/03/01 00:10:48  mbaker5153
; Update for release 0.91
;
; Revision 1.2  2002/02/09 16:12:52  michael
; tidy up and change email address
;
; Revision 1.1.1.1  2002/02/08 23:25:47  michael
; initial import
;
index           Home
 Contents         Contents
 1/index          Area 1
   1/data1          Area 1 Data 1
     1/1/data1        Sub Data 1
     1/1/data2        Sub Data 2
   1/data2          Area 1 Data 2
 2/index          Area 2
   2/data1          Area 2 Data 1
   2/data2          Area 2 Data 2

After running this example you may want to delete all generated files (*.head, *.err, *.it, *.txt except structure.txt and skeleton.txt, *.html) and directories. Warning: Do not delete structure.txt and skeleton.txt. The batch file clean.bat has been provided to delete all these generated files and directories:

   clean

Running htm2txt - example 3

To run the example in examples/ex3 connect to the directory, then run htm2txt on each .html file in the directory. For example:

  cd examples\ex3
  htm2txt tst1.html
  htm2txt test2.html
  htm2txt testfile3.html
  htm2txt testfile4.html
  htm2txt sub/test5.html
  htm2txt sub/tst6.html

Alternatively use the batch file (ex3.bat) provided:

  cd examples\ex3
  ex3

The ex3.bat batch file was created by redirecting the output from using dir /s /b *.html to ex3.bat and then editing the file (ex3.bat):

  dir /s /b *.html >ex3.bat

The result of running htm2txt is a structure file (structure.txt) illustrated below, and .head and .body files corresponding to each .html file.

Structure file from running htm2txt in example 3
 
tst1                          Test File 1
test2                         Test File 2
testfile3                     Test File 3 - no body
testfile4
sub/test5                     Test File 5
sub/tst6                      Test File 6

After running this example you may want to delete all generated files (*.head, *.body, *.txt). The batch file clean.bat has been provided to delete all these generated files:

   clean

Previous: Downloading and Installing wenost - Up: Home Page - Next: Descriptions of how htm2txt and wenost work
Top: Home Page - Contents - Back
Valid HTML 4.01! Hosted by SourceForge
This page last updated: 02/03/2003 at 2:02:03am
Please send any comments on this page to Dr Michael Baker.
Valid CSS! This page made with PPWizard