helpers.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:dati-ckan-docker 作者: italia 项目源码 文件源码
def markdown_extract(text, extract_length=190):
    ''' return the plain text representation of markdown encoded text.  That
    is the texted without any html tags.  If extract_length is 0 then it
    will not be truncated.'''
    if not text:
        return ''
    plain = RE_MD_HTML_TAGS.sub('', markdown(text))
    if not extract_length or len(plain) < extract_length:
        return literal(plain)

    return literal(
        unicode(
            whtext.truncate(
                plain,
                length=extract_length,
                indicator='...',
                whole_word=True
            )
        )
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号