Esempio n. 1
0
    def handle_starttag(self, tag, attrs):  # feed() callback
        new_element = MarkdownElement()

        try:
            new_element.tag = [MAP_TAG_START[tag], MAP_TAG_END[tag]]
        except KeyError:
            new_element.tag = MAP_TAG_START[tag]

        self.set_visibility(new_element)

        self.current_element.add_data(new_element)
        self.current_element = new_element
Esempio n. 2
0
 def test_comparison_inequal_tag(self):
     me1 = MarkdownElement(
         '`',
         ['text ', MarkdownElement('*', ['text2'], hidden=True)])
     me2 = MarkdownElement(
         '`',
         ['text ', MarkdownElement('*', ['text2'], hidden=True)])
     me2.tag = ''
     self.assertNotEqual(me1, me2)