Class pyglet.text.formats.html.HTMLDecoder

       markupbase.ParserBase --+    
                               |    
           HTMLParser.HTMLParser --+
                                   |
             DocumentDecoder --+   |
                               |   |
structured.StructuredTextDecoder --+
                                   |
                                  HTMLDecoder
Decoder for HTML documents.

Methods

  decode_structured(self, text, location)
  get_image(self, filename)
  prepare_for_data(self)
  handle_data(self, data)
  handle_starttag(self, tag, case_attrs)
  handle_endtag(self, tag)
  handle_entityref(self, name)
  handle_charref(self, name)
  add_element(self, element) (Inherited from pyglet.text.formats.structured.StructuredTextDecoder)
  add_text(self, text) (Inherited from pyglet.text.formats.structured.StructuredTextDecoder)
AbstractDocument decode(self, text, location=None)
Decode document text.
(Inherited from pyglet.text.formats.structured.StructuredTextDecoder)
  pop_style(self, key) (Inherited from pyglet.text.formats.structured.StructuredTextDecoder)
  push_style(self, key, styles) (Inherited from pyglet.text.formats.structured.StructuredTextDecoder)
Inherited from HTMLParser.HTMLParser: __init__, check_for_whole_start_tag, clear_cdata_mode, close, error, feed, get_starttag_text, goahead, handle_comment, handle_decl, handle_pi, handle_startendtag, parse_endtag, parse_pi, parse_starttag, reset, set_cdata_mode, unescape, unknown_decl Inherited from markupbase.ParserBase: getpos, parse_comment, parse_declaration, parse_marked_section, updatepos

Class Variables

dict default_style = {'font_name': 'Times New Roman', 'font_size': ...
Default style attributes for unstyled text in the HTML document.
dict font_sizes = {1: 8, 2: 10, 3: 12, 4: 14, 5: 18, 6: 24, 7: 48}
Map HTML font sizes to actual font sizes, in points.

Constants

Inherited from HTMLParser.HTMLParser: CDATA_CONTENT_ELEMENTS

Method Details

decode_structured

decode_structured(self, text, location)
Overrides:
structured.StructuredTextDecoder.decode_structured

handle_data

handle_data(self, data)
Overrides:
HTMLParser.HTMLParser.handle_data

handle_starttag

handle_starttag(self, tag, case_attrs)
Overrides:
HTMLParser.HTMLParser.handle_starttag

handle_endtag

handle_endtag(self, tag)
Overrides:
HTMLParser.HTMLParser.handle_endtag

handle_entityref

handle_entityref(self, name)
Overrides:
HTMLParser.HTMLParser.handle_entityref

handle_charref

handle_charref(self, name)
Overrides:
HTMLParser.HTMLParser.handle_charref

Class Variable Details

default_style

Default style attributes for unstyled text in the HTML document.
Type:
dict
Value:
{'font_name': 'Times New Roman',
 'font_size': 12,
 'margin_bottom': '12pt'}