Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
formatter Namespace Reference

Data Structures

class  NullFormatter
 
class  AbstractFormatter
 
class  NullWriter
 
class  AbstractWriter
 
class  DumbWriter
 

Functions

def test
 

Variables

 AS_IS = None
 

Detailed Description

Generic output formatting.

Formatter objects transform an abstract flow of formatting events into
specific output events on writer objects. Formatters manage several stack
structures to allow various properties of a writer object to be changed and
restored; writers need not be able to handle relative changes nor any sort
of ``change back'' operation. Specific writer properties which may be
controlled via formatter objects are horizontal alignment, font, and left
margin indentations. A mechanism is provided which supports providing
arbitrary, non-exclusive style settings to a writer as well. Additional
interfaces facilitate formatting events which are not reversible, such as
paragraph separation.

Writer objects encapsulate device interfaces. Abstract devices, such as
file formats, are supported as well as physical devices. The provided
implementations all work with abstract devices. The interface makes
available mechanisms for setting the properties which formatter objects
manage and inserting data into the output.

Function Documentation

def formatter.test (   file = None)

Definition at line 398 of file formatter.py.

References aifc.open().

399 def test(file = None):
400  w = DumbWriter()
401  f = AbstractFormatter(w)
402  if file:
403  fp = open(file)
404  elif sys.argv[1:]:
405  fp = open(sys.argv[1])
406  else:
407  fp = sys.stdin
408  while 1:
409  line = fp.readline()
410  if not line:
411  break
412  if line == '\n':
413  f.end_paragraph(1)
414  else:
415  f.add_flowing_data(line)
416  f.end_paragraph(0)
417 

Variable Documentation

AS_IS = None

Definition at line 26 of file formatter.py.