Ejemplo n.º 1
0
 def __init__(self, name="Generator"):
     SP_EH.__init__(self, name)
     self.generator = name
     # first set the DTD related settings
     self.setup_HTML()
     self.dtd_line = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'
     # The TREE TOP element has to be created manually
     HTML_info = self.dtd_info.get_elem_info("HTML")
     HTML = spin_py.SPIN_elem_obj(HTML_info, [], [])
     self.tree = HTML
Ejemplo n.º 2
0
    def __init__(self, name):
        # parent constructor
        SP_EH.__init__(self, name)
        self.debug3 = 0
        # elemen_info's used by TOC_TREE
        # pre-registered elem_info's
        self.ul = self.dtd_info.set_elem_block('UL')
        self.li = self.dtd_info.set_elem_block('LI')
        self.div = self.dtd_info.set_elem_block('DIV')
        self.body = self.dtd_info.set_elem_block('BODY')
        self.title = self.dtd_info.set_elem_defaults('TITLE')
        self.br = self.dtd_info.set_elem_empty('BR')
        self.hr = self.dtd_info.set_elem_empty('HR')
        self.h1 = self.dtd_info.set_elem_block('H1')
        self.h2 = self.dtd_info.set_elem_block('H2')
        self.h3 = self.dtd_info.set_elem_block('H3')
        self.a = self.dtd_info.set_elem_inline('A')
        # pre-built elem_obj's (only works for empty)
        self.br_el = spin_py.SPIN_elem_obj(self.br, [], [])
        self.hr_el = spin_py.SPIN_elem_obj(self.hr, [], [])

        self.lvl = {}
        self.lvl['H1'] = 1
        self.lvl['H2'] = 2
        self.lvl['H3'] = 3
        self.lvl_curr = 0
        self.list = {}
        self.list[0] = []  # holds entire result
        self.list[1] = []
        self.list[2] = []
        self.list[3] = []
        self.count = {}
        self.count[1] = 0
        self.count[2] = 0
        self.count[3] = 0
        self.div_toc = None
        self.kept_title = "NO-TITLE"

        self.request_callbacks_on_elem_infos()