本文整理匯總了Python中webhelpers2.html.HTML.p方法的典型用法代碼示例。如果您正苦於以下問題:Python HTML.p方法的具體用法?Python HTML.p怎麽用?Python HTML.p使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類webhelpers2.html.HTML
的用法示例。
在下文中一共展示了HTML.p方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: format_paragraphs
# 需要導入模塊: from webhelpers2.html import HTML [as 別名]
# 或者: from webhelpers2.html.HTML import p [as 別名]
def format_paragraphs(text, preserve_lines=False):
"""Convert text to HTML paragraphs.
``text``:
the text to convert. Split into paragraphs at blank lines (i.e.,
wherever two or more consecutive newlines appear), and wrap each
paragraph in a <p>.
``preserve_lines``:
If true, add <br /> before each single line break
"""
if text is None:
return literal("")
text = lit_sub(_universal_newline_rx, "\n", text)
paragraphs = _paragraph_rx.split(text)
for i, para in enumerate(paragraphs):
if preserve_lines:
para = HTML(para)
para = para.replace("\n", br)
paragraphs[i] = HTML.p(para)
return "\n\n".join(paragraphs)
示例2: no_records
# 需要導入模塊: from webhelpers2.html import HTML [as 別名]
# 或者: from webhelpers2.html.HTML import p [as 別名]
def no_records(self):
return _HTML.p(_('No records to display'), class_='no-records')