#!/usr/bin/python # otl2table.py # convert a tab-formatted outline from VIM to tab-delimited table # # Copyright (c) 2004 Noel Henson All rights reserved # # ALPHA VERSION!!! # $Revision: 1.2 $ # $Date: 2005/09/25 14:24:28 $ # $Author: noel $ # $Source: /home/noel/active/otl2table/RCS/otl2table.py,v $ # $Locker: $ ########################################################################### # Basic function # # This program accepts text outline files and converts them # the tab-delimited text tables. # This: # Test # Dog # Barks # Howls # Cat # Meows # Yowls # Becomes this: # Test Dog Barks # Test Dog Howls # Test Cat Meows # Test Cat Yowls # # This will make searching for groups of data and report generation easier. # ########################################################################### # include whatever mdules we need import sys from string import * #from time import * ########################################################################### # global variables level = 0 inputFile = "" formatMode = "tab" noTrailing = 0 columns = [] ########################################################################### # function definitions # usage # print the simplest form of help # input: none # output: simple command usage is printed on the console def showUsage(): print print "Usage:" print "otl2table.py [options] inputfile > outputfile" print "Options" print " -n Don't include trailing columns." print " -t type Specify field separator type." print " Types:" print " tab - separate fields with tabs (default)" print " csv - separate fields with ," print " qcsv - separate fields with \",\"" print " bullets - uses HTML tags