Scribe to HTML: Postprocessing the .HTML file

Producing HTML Documents with Scribe

(Prev) (Next)

11. Postprocessing the .HTML file

After Scribe has produced the .html file, it must be post-processed, in order to split it apart into individual HTML files, and to add the <DD> tag for @description environments.

The following command does the actual work:

awk -f html-post.awk <file.html
 
All of the resulting HTML files are placed in a subdirectory named html, which must already exist.

Here is the actual awk script, which should be named html-post.awk:

BEGIN { file = "" }

/<P> %DOCUMENT%/ {
        if (file!="") close(file);
        file = "html/" $3 ".html";
        next;
}

file == "" { next }

#  Remove all backspaces.
{  gsub("^H", "", $0)  }

#  Add the <DD> tag to the line after the <DT> tag.
/<DT>/  {
        if (file == "") { print $0 ; printf "<DD> " }
        else { print $0 >file ; printf "<DD> " >file }
        next;
}

{
        if (file == "") print $0;
        else print $0 >file;
}


Copyright (C) 1993, 1994 Digital Equipment Corporation
Glenn Trewitt, trewitt@pa.dec.com