6.14.5. HTML Weaver

The most commonly used weaver is sure to be the HTML weaver. This weaver attempts to generate HTML compliant with the proposed strict HTML 4.0 DTD. See http://www.w3.org/TR/REC/-html40

Interscript uses a different markup model to HTML. While interscript uses begin and end methods like many HTML tags, HTML paragraph elements are not indicated by such methods. Instead, text written in many places is implicitly a paragraph element, and interscript must detect these places and insert an appropriate start tag. Similarly, interscript paragraphs are separated by @p() commands, and terminated by some other block level construction like a heading or table.

On the other hand, not all text lines are paragraph content, for example list body content.

Start python section to interscript/weavers/html.py[1 /22 ] Next Last
     1: #line 21 "html_weaver.ipk"
     2: from interscript.weavers.base import weaver_base
     3: import string
     4: def cvt_code(line):
     5:   l = ''
     6:   for ch in line:
     7:     if ch in '<>':
     8:       l = l + {'<':'<','>':'>'}[ch]
     9:     else:
    10:       l = l + ch
    11:   return l
    12: 
    13: def cvt_text(line):
    14:   l = ''
    15:   for ch in line:
    16:     if ch in '<>&':
    17:       l = l + {'<':'<','>':'>','&':'&'}[ch]
    18:     else:
    19:       l = l + ch
    20:   return l
    21: 
    22: from interscript.drivers.sinks.bufdisk import named_file_sink
    23: def mk_html(pass_frame,basename, directory, prefix, eol, title, language):
    24:   if language: filename = directory + language + '_' + basename + '.html'
    25:   else: filename = directory + basename + '.html'
    26:   w = named_file_sink(pass_frame,filename, prefix, eol=eol)
    27:   if not title: title = basename
    28:   return html_weaver(pass_frame,w,title=title,language=language)
    29: 
    30: class html_weaver(weaver_base):
    31: 
End python section to interscript/weavers/html.py[1]


6.14.5.1. Initialisation
6.14.5.2. Termination
6.14.5.3. Body Output and Mode Control
6.14.5.4. Reference Processor
6.14.5.5. Headings
6.14.5.6. Lists
6.14.5.7. Code Output
6.14.5.8. Citations
6.14.5.9. Paragraphs
6.14.5.10. Fonts
6.14.5.11. Identifier Cross Reference Table
6.14.5.12. Class Reference Table
6.14.5.13. Table of Contents
6.14.5.14. Code File List
6.14.5.15. Code File Status
6.14.5.16. Input File List
6.14.5.17. Include List
6.14.5.18. Tables
6.14.5.19. HTML Header
6.14.5.20. Interscript Style Sheet