本文整理汇总了Python中rest_framework.compat.apply_markdown函数的典型用法代码示例。如果您正苦于以下问题:Python apply_markdown函数的具体用法?Python apply_markdown怎么用?Python apply_markdown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了apply_markdown函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_markdown
def test_markdown(self):
"""
Ensure markdown to HTML works as expected.
"""
if apply_markdown:
gte_21_match = apply_markdown(DESCRIPTION) == MARKED_DOWN_gte_21
lt_21_match = apply_markdown(DESCRIPTION) == MARKED_DOWN_lt_21
self.assertTrue(gte_21_match or lt_21_match)
开发者ID:MrNavorski,项目名称:django-rest-framework,代码行数:8,代码来源:test_description.py
示例2: get_notes
def get_notes(self):
"""
Returns the body of the docstring trimmed before any parameters are
listed. First, get the class docstring and then get the method's. The
methods will always inherit the class comments.
"""
docstring = ""
class_docs = self.callback.__doc__ or ''
class_docs = smart_text(class_docs)
class_docs = IntrospectorHelper.strip_yaml_from_docstring(class_docs)
class_docs = IntrospectorHelper.strip_params_from_docstring(class_docs)
method_docs = self.get_docs()
if class_docs is not None:
docstring += class_docs + " \n"
if method_docs is not None:
method_docs = formatting.dedent(smart_text(method_docs))
method_docs = IntrospectorHelper.strip_yaml_from_docstring(
method_docs
)
method_docs = IntrospectorHelper.strip_params_from_docstring(
method_docs
)
docstring += '\n' + method_docs
# Markdown is optional
if apply_markdown:
docstring = apply_markdown(docstring)
else:
docstring = docstring.replace("\n\n", "<br/>")
return docstring
开发者ID:basicsbeauty,项目名称:django-rest-swagger,代码行数:33,代码来源:introspectors.py
示例3: markup_description
def markup_description(description):
"""
Apply HTML markup to the given description.
"""
if apply_markdown:
description = apply_markdown(description)
else:
description = escape(description).replace('\n', '<br />')
return mark_safe(description)
开发者ID:etnperlong,项目名称:mese2014,代码行数:9,代码来源:formatting.py
示例4: markup_description
def markup_description(self, description):
"""
Apply HTML markup to the description of this view.
"""
# TODO: deprecate?
if apply_markdown:
description = apply_markdown(description)
else:
description = escape(description).replace('\n', '<br />')
return mark_safe(description)
开发者ID:juliomistral,项目名称:django-rest-framework,代码行数:10,代码来源:views.py
示例5: markup_description
def markup_description(description):
"""
Apply HTML markup to the given description.
"""
if apply_markdown:
description = apply_markdown(description)
else:
description = escape(description).replace("\n", "<br />")
description = "<p>" + description + "</p>"
return mark_safe(description)
开发者ID:flaki,项目名称:remo,代码行数:10,代码来源:formatting.py
示例6: test_markdown
def test_markdown(self):
"""
Ensure markdown to HTML works as expected.
"""
if apply_markdown:
md_applied = apply_markdown(DESCRIPTION)
gte_21_match = (
md_applied == (
MARKED_DOWN_gte_21 % MARKED_DOWN_HILITE) or
md_applied == (
MARKED_DOWN_gte_21 % MARKED_DOWN_NOT_HILITE))
lt_21_match = (
md_applied == (
MARKED_DOWN_lt_21 % MARKED_DOWN_HILITE) or
md_applied == (
MARKED_DOWN_lt_21 % MARKED_DOWN_NOT_HILITE))
assert gte_21_match or lt_21_match
开发者ID:YanyanZeng,项目名称:django-rest-framework,代码行数:17,代码来源:test_description.py
示例7: render_markdown
def render_markdown(markdown_text):
if apply_markdown is None:
return markdown_text
return mark_safe(apply_markdown(markdown_text))
开发者ID:jplaut,项目名称:django-rest-framework,代码行数:4,代码来源:rest_framework.py
示例8: do_markdown
def do_markdown(docstring):
# Markdown is optional
if apply_markdown:
return apply_markdown(docstring)
else:
return docstring.replace("\n\n", "<br/>")
开发者ID:Nnonexistent,项目名称:django-rest-swagger,代码行数:6,代码来源:introspectors.py
注:本文中的rest_framework.compat.apply_markdown函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论