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


Python HTML.br方法代码示例

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


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

示例1: test_html

# 需要导入模块: from webhelpers.html import HTML [as 别名]
# 或者: from webhelpers.html.HTML import br [as 别名]
def test_html():
    a = HTML.a(href='http://mostlysafe\" <tag', c="Bad <script> tag")
    eq_(a,
        u'<a href="http://mostlysafe&#34; &lt;tag">Bad &lt;script&gt; tag</a>')

    img = HTML.img(src='http://some/image.jpg')
    eq_(img, u'<img src="http://some/image.jpg" />')

    br = HTML.br()
    eq_(u'<br />', br)
开发者ID:gjhiggins,项目名称:WebHelpers2,代码行数:12,代码来源:test_html.py

示例2: markdown

# 需要导入模块: from webhelpers.html import HTML [as 别名]
# 或者: from webhelpers.html.HTML import br [as 别名]
import re

from webhelpers.html import HTML, escape, literal, lit_sub
import webhelpers.textile as textile
import webhelpers.markdown as _markdown

__all__ = [
    "markdown", 
    "textilize",
    "nl2br",
    "format_paragraphs",
    ]

_universal_newline_rx = re.compile(R"\r\n|\n|\r")  # All types of newline.
_paragraph_rx = re.compile(R"\n{2,}")  # Paragraph break: 2 or more newlines.
br = HTML.br() + "\n"

def markdown(text, **kwargs):
    """Format the text to HTML with MarkDown formatting.
    
    This function uses the `Python MarkDown library 
    <http://www.freewisdom.org/projects/python-markdown/>`_
    which is included with WebHelpers.  It does not include extensions
    due to circular import issues.  If you need the footnotes or RSS
    extensions, use the full Markdown package instead.  
    
    IMPORTANT:
    If your source text is untrusted and may contain malicious HTML markup,
    pass ``safe_mode="escape"`` to escape it, ``safe_mode="replace"`` to
    replace it with a scolding message, or ``safe_mode="remove"`` to strip it.
开发者ID:adrianpike,项目名称:wwscc,代码行数:32,代码来源:converters.py


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