当前位置: 首页>>代码示例>>Python>>正文


Python _base.TreeBuilder方法代码示例

本文整理汇总了Python中html5lib.treebuilders._base.TreeBuilder方法的典型用法代码示例。如果您正苦于以下问题:Python _base.TreeBuilder方法的具体用法?Python _base.TreeBuilder怎么用?Python _base.TreeBuilder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在html5lib.treebuilders._base的用法示例。


在下文中一共展示了_base.TreeBuilder方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: prepare_markup

# 需要导入模块: from html5lib.treebuilders import _base [as 别名]
# 或者: from html5lib.treebuilders._base import TreeBuilder [as 别名]
def prepare_markup(self, markup, user_specified_encoding,
                       document_declared_encoding=None, exclude_encodings=None):
        # Store the user-specified encoding for use later on.
        self.user_specified_encoding = user_specified_encoding

        # document_declared_encoding and exclude_encodings aren't used
        # ATM because the html5lib TreeBuilder doesn't use
        # UnicodeDammit.
        if exclude_encodings:
            warnings.warn("You provided a value for exclude_encoding, but the html5lib tree builder doesn't support exclude_encoding.")
        yield (markup, None, None, False)

    # These methods are defined by Beautiful Soup. 
开发者ID:it2school,项目名称:Projects,代码行数:15,代码来源:_html5lib.py

示例2: test_fragment_to_document

# 需要导入模块: from html5lib.treebuilders import _base [as 别名]
# 或者: from html5lib.treebuilders._base import TreeBuilder [as 别名]
def test_fragment_to_document(self, fragment):
        """See `TreeBuilder`."""
        return '<html><head></head><body>%s</body></html>' % fragment 
开发者ID:it2school,项目名称:Projects,代码行数:5,代码来源:_html5lib.py

示例3: getFragment

# 需要导入模块: from html5lib.treebuilders import _base [as 别名]
# 或者: from html5lib.treebuilders._base import TreeBuilder [as 别名]
def getFragment(self):
        return treebuilder_base.TreeBuilder.getFragment(self).element 
开发者ID:it2school,项目名称:Projects,代码行数:4,代码来源:_html5lib.py

示例4: __init__

# 需要导入模块: from html5lib.treebuilders import _base [as 别名]
# 或者: from html5lib.treebuilders._base import TreeBuilder [as 别名]
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) 
开发者ID:cmh2166,项目名称:isni-reconcile,代码行数:8,代码来源:_html5builder.py

示例5: reset

# 需要导入模块: from html5lib.treebuilders import _base [as 别名]
# 或者: from html5lib.treebuilders._base import TreeBuilder [as 别名]
def reset(self):
        _base.TreeBuilder.reset(self)
        self.rootInserted = False
        self.initialComments = []
        self.doctype = None 
开发者ID:cmh2166,项目名称:isni-reconcile,代码行数:7,代码来源:_html5builder.py

示例6: insertComment

# 需要导入模块: from html5lib.treebuilders import _base [as 别名]
# 或者: from html5lib.treebuilders._base import TreeBuilder [as 别名]
def insertComment(self, data, parent=None):
        if not self.rootInserted:
            self.initialComments.append(data)
        else:
            _base.TreeBuilder.insertComment(self, data, parent) 
开发者ID:cmh2166,项目名称:isni-reconcile,代码行数:7,代码来源:_html5builder.py

示例7: test_fragment_to_document

# 需要导入模块: from html5lib.treebuilders import _base [as 别名]
# 或者: from html5lib.treebuilders._base import TreeBuilder [as 别名]
def test_fragment_to_document(self, fragment):
        """See `TreeBuilder`."""
        return u'<html><head></head><body>%s</body></html>' % fragment 
开发者ID:evait-security,项目名称:weeman,代码行数:5,代码来源:_html5lib.py


注:本文中的html5lib.treebuilders._base.TreeBuilder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。