How to use the html5lib.treebuilders._base function in html5lib

To help you get started, we’ve selected a few html5lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alibaba / AliOS-Things-Linux-Edition / bitbake / lib / bs4 / builder / _html5lib.py View on Github external
if not isinstance(value, list):
                value = whitespace_re.split(value)
        self.element[name] = value
    def items(self):
        return list(self.attrs.items())
    def keys(self):
        return list(self.attrs.keys())
    def __len__(self):
        return len(self.attrs)
    def __getitem__(self, name):
        return self.attrs[name]
    def __contains__(self, name):
        return name in list(self.attrs.keys())


class Element(treebuildersbase.Node):
    def __init__(self, element, soup, namespace):
        treebuildersbase.Node.__init__(self, element.name)
        self.element = element
        self.soup = soup
        self.namespace = namespace

    def appendChild(self, node):
        string_child = child = None
        if isinstance(node, str):
            # Some other piece of code decided to pass in a string
            # instead of creating a TextElement object to contain the
            # string.
            string_child = child = node
        elif isinstance(node, Tag):
            # Some other piece of code decided to pass in a Tag
            # instead of creating an Element object to contain the
github morpheus65535 / bazarr / libs3 / bs4 / builder / _html5lib.py View on Github external
def getFragment(self):
        return treebuilder_base.TreeBuilder.getFragment(self).element
github mtlevolio / pylinkchecker / pylinkchecker / bs4 / builder / _html5lib.py View on Github external
def getFragment(self):
        return html5lib.treebuilders._base.TreeBuilder.getFragment(self).element
github naokazuterada / MarkdownTOC / bs4 / builder / _html5lib.py View on Github external
def getFragment(self):
        return html5lib.treebuilders._base.TreeBuilder.getFragment(self).element
github Jenyay / outwiker / plugins / webpage / webpage / libs / bs4 / builder / _html5lib.py View on Github external
def getFragment(self):
        return treebuilder_base.TreeBuilder.getFragment(self).element
github wwqgtxx / wwqLyParse / wwqLyParse / lib / python-3.6.3-embed-amd64 / lxml / html / _html5builder.py View on Github external
def __init__(self, name, publicId, systemId):
        self.name = name
        self.publicId = publicId
        self.systemId = systemId

class Document(object):

    def __init__(self):
        self._elementTree = None
        self.childNodes = []

    def appendChild(self, element):
        self._elementTree.getroot().addnext(element._element)


class TreeBuilder(_base.TreeBuilder):
    documentClass = Document
    doctypeClass = DocumentType
    elementClass = None
    commentClass = None
    fragmentClass = Document

    def __init__(self, *args, **kwargs):
        html_builder = etree_builders.getETreeModule(html, fullTree=False)
        etree_builder = etree_builders.getETreeModule(etree, fullTree=False)
        self.elementClass = html_builder.Element
        self.commentClass = etree_builder.Comment
        _base.TreeBuilder.__init__(self, *args, **kwargs)

    def reset(self):
        _base.TreeBuilder.reset(self)
        self.rootInserted = False
github Sigil-Ebook / Sigil / src / Resource_Files / plugin_launchers / python / sigil_bs4 / builder / _html5lib.py View on Github external
def __init__(self, element, soup):
        treebuilder_base.Node.__init__(self, None)

        self.element = element
        self.soup = soup
github morpheus65535 / bazarr / libs3 / bs4 / builder / _html5lib.py View on Github external
def __init__(self, element, soup, namespace):
        treebuilder_base.Node.__init__(self, element.name)
        self.element = element
        self.soup = soup
        self.namespace = namespace