Module q3html
[frames] | no frames]

Module q3html

source code

This program takes files named *.q in the current directory, and converts them to HTML. To do that, it looks for a python script called '' or '../' or ... . This script needs to define one variable ( server ) and two functions (header and footer).

The .q files have the following format:

       TITLE title string
       OTHER_HEADER_KEYWORD header info
               Text is 3>5 ?
               A ref="foo.html" No!
                       More text inside the link.
               IMG ref="foo.gif"
                       LI List item
                       LI Another List item

The header info is separated from the body with a blank line. HTML tags are always the first thing on a line. Line continuations and enclosures are indicated with indentation. Tags automatically close when the indentation gets smaller.

The PRE tag is the only exception. You have to close it with a line beginning '/PRE'. No indenting is needed inside a PRE /PRE pair.

The user needs to define one thing: the address of the web server. This address is prepended to all hyperlinks and image references that aren't absolute.

All the header information gets put into a dictionary, and is passed into the header() and footer() functions. That dictionary has 'filename' and '_server_root' entries added.

The user can also define three things:

DEFAULT_HEADER, a dictionary passed to the header() and footer functions(). Useful things to put in DEFAULT_HEADER are:

Header(thd, hinfo) takes two arguments, a file descriptor to which it should write the HTML, and a dictionary of header information.

Footer(thd, hinfo) takes the same arguments.

See _header() and _footer() below, for examples.

qfiles(dir) source code
av(k, v) source code
measure_indent(s) source code
prepare_text(l) source code
starts_with_a_tag(l) source code
tokenize(l) source code
format_dict(d, drop=None) source code
dequote(a) source code
urlq(s) source code
prepend(a, b)
Process a URL.
source code
process_tag(d, od, hinfo, eol) source code
escape(s) source code
get_logical_line(lines) source code
process(lines, od, hinfo) source code
swapend(a, e) source code
aget(dic, alist) source code
sw(s, prefix) source code
dpre(s, prefix) source code
agp(dic, prefix) source code
get(dic, key, dfl) source code
readheader(fd, t) source code
needcopy(a, b, force=None)
Do we need to reconstruct file b from file a? Also reconstruct b if it is older than the date in force.
source code
Given a URL, just return the file part, not the target specifier inside the file.
source code
del_fin_sl(s) source code
go(env, force=None) source code
easygo() source code
  XML = 0
  LL = 60
  TABW = 8
  MTIME = 8
  DEFF = ''
  __package__ = None
  nm = 'lang'
  q = 9001

Imports: os, re, time, urlparse, ED, die, g_pipe

Function Details

prepend(a, b)

source code 

Process a URL. Pathnames are prepended with the server root. Complete URLs are untouched.