Exemplo n.º 1
0
    def __init__(self, text, href, link, mode, maxwords=100):
        self.maxwords = maxwords
        self.href = href
        self.link = link
        self.mode = mode
        self.words = 0

        HTMLParser.__init__(self, text)
Exemplo n.º 2
0
    def __init__(self, text, href, link, mode, maxwords=100):
        self.maxwords = maxwords
        self.href = href
        self.link = link
        self.mode = mode
        self.words = 0

        HTMLParser.__init__(self, text)
Exemplo n.º 3
0
    def __init__(self, text, maxwords, href, options):
        self.href = href
        self.mode = options['mode']
        self.options = options

        self.words = 0
        self.maxwords = maxwords

        HTMLParser.__init__(self, text)
Exemplo n.º 4
0
    def __init__(self, text, maxwords, href, options):
        self.href = href
        self.mode = options['mode']
        self.options = options

        self.words = 0
        self.maxwords = maxwords

        HTMLParser.__init__(self, text)
Exemplo n.º 5
0
    def __init__(self, html, abbr, repl):
        self.abbr = abbr
        self.repl = repl

        HTMLParser.__init__(self, html)
Exemplo n.º 6
0
    def __init__(self, html, hyphenationfunc, length=10):
        self.hyphenate = hyphenationfunc
        self.length = length

        HTMLParser.__init__(self, html)
Exemplo n.º 7
0
    def __init__(self, html, abbr, repl):
        self.abbr = abbr
        self.repl = repl

        HTMLParser.__init__(self, html)
Exemplo n.º 8
0
    def __init__(self, html, hyphenationfunc, length=10):
        self.hyphenate = hyphenationfunc
        self.length = length

        HTMLParser.__init__(self, html)
Exemplo n.º 9
0
# -*- coding: utf-8 -*-

import unittest

from acrylamid.lib.html import HTMLParser
f = lambda x: ''.join(HTMLParser(x).result)


class  TestHTMLParser(unittest.TestCase):

    def test_starttag(self):

        examples = [
            '<p></p>',
            '<p id="foo"></p>',
            '<script src="/js/foo.js" type="text/javascript"></script>',
            '<iframe allowfullscreen></iframe>',
        ]

        for ex in examples:
            assert f(ex) == ex

    def test_data(self):
        assert f('<p>Data!1</p>') == '<p>Data!1</p>'

    def test_endtag(self):

        examples = [
            '<p></p></p>',
            '</p>'*3,
        ]