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


Python EntitySubstitution.substitute_html方法代码示例

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


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

示例1: substitute_html

# 需要导入模块: from bs4.dammit import EntitySubstitution [as 别名]
# 或者: from bs4.dammit.EntitySubstitution import substitute_html [as 别名]
def substitute_html(cls, ns):
        return cls._substitute_if_appropriate(
            ns, EntitySubstitution.substitute_html) 
开发者ID:MarcelloLins,项目名称:ServerlessCrawler-VancouverRealState,代码行数:5,代码来源:element.py

示例2: __init__

# 需要导入模块: from bs4.dammit import EntitySubstitution [as 别名]
# 或者: from bs4.dammit.EntitySubstitution import substitute_html [as 别名]
def __init__(
            self, language=None, entity_substitution=None,
            void_element_close_prefix='/', cdata_containing_tags=None,
    ):
        """Constructor.

        :param language: This should be Formatter.XML if you are formatting
           XML markup and Formatter.HTML if you are formatting HTML markup.

        :param entity_substitution: A function to call to replace special
           characters with XML/HTML entities. For examples, see 
           bs4.dammit.EntitySubstitution.substitute_html and substitute_xml.
        :param void_element_close_prefix: By default, void elements
           are represented as <tag/> (XML rules) rather than <tag>
           (HTML rules). To get <tag>, pass in the empty string.
        :param cdata_containing_tags: The list of tags that are defined
           as containing CDATA in this dialect. For example, in HTML,
           <script> and <style> tags are defined as containing CDATA,
           and their contents should not be formatted.
        """
        self.language = language
        self.entity_substitution = entity_substitution
        self.void_element_close_prefix = void_element_close_prefix
        self.cdata_containing_tags = self._default(
            language, cdata_containing_tags, 'cdata_containing_tags'
        ) 
开发者ID:V1EngineeringInc,项目名称:V1EngineeringInc-Docs,代码行数:28,代码来源:formatter.py


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