6.4.4. Plain text weaver

6.4.4. Plain text weaver

This nasty weaver tries to output plain text that can be published on the Internet. It can underline headings, and flow text with left justification (and should be able to format tables), but the results are rather crude. Right justification is possible, but not implemented because, in my experience, the results are woeful.
Start python section to interscript/weavers/text.py[1]
     1: #line 11 "text_weaver.ipk"
     2: from interscript.weavers.base import weaver_base
     3: import string
     4: 
     5: class table_rule_object: pass
     6: 
     7: class plain_text_weaver(weaver_base):
     8:   def __init__(self, pass_frame,writer ,**kwds):
     9:     weaver_base.__init__(self, pass_frame)
    10:     self.verbosity = pass_frame.verbosity
    11:     if self.verbosity>=3:
    12:       print 'initialising plain text weaver, writer',writer.get_sink_name()
    13:     self.protocol = ('text/plain',1)
    14:     self.width = 55
    15:     self.c = 0
    16:     self.buffer = ''
    17:     self.strong = 0
    18:     self.string = string
    19:     self.code = 0
    20:     self.sink = writer
    21:     self.name = 'plain text weaver v1 for '+self.sink.name
    22:     self.tags = ['text']
    23:     self.margin = 0
    24:     self.numbered_list_stack = []
    25:     self.sop = 1
    26:     self.hcount = []
    27:     self.toc = []
    28: 
    29:   def _write(self,line):
    30:     if self.enabled:
    31:       self.sink.write(line)
    32:       self.c = self.c + len(line)
    33:     if line:
    34:       self.sop = 0
    35: 
    36:   def _writeline(self,line=''):
    37:     if self.enabled:
    38:       self._write(line+'\n')
    39:       self.c = 0
    40: 
    41:   def _goto(self,column):
    42:     if self.enabled:
    43:       if column < 0: column = self.width + column
    44:       if column < self.c: self._writeline()
    45:       if column > self.c: self._write(' '*(column-self.c))
    46: 
End python section to interscript/weavers/text.py[1]


6.4.4.1. reference processor
6.4.4.2. Table of Contents
6.4.4.3. Code File List
6.4.4.4. Code File Status
6.4.4.5. Input File List
6.4.4.6. Include List
6.4.4.7. Tables
6.4.4.8. Code Output
6.4.4.9. Citations
6.4.4.10. Citations