• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python text.cleaned_markdown_conversion函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mediagoblin.tools.text.cleaned_markdown_conversion函数的典型用法代码示例。如果您正苦于以下问题:Python cleaned_markdown_conversion函数的具体用法?Python cleaned_markdown_conversion怎么用?Python cleaned_markdown_conversion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: media_preview_comment

def media_preview_comment(request):
    """Runs a comment through markdown so it can be previewed."""
    # If this isn't an ajax request, render_404
    if not request.is_xhr:
        return render_404(request)

    comment = unicode(request.form["comment_content"])
    cleancomment = {"content": cleaned_markdown_conversion(comment)}

    return Response(json.dumps(cleancomment))
开发者ID:aurelienmaury,项目名称:JoshuaGoblin,代码行数:10,代码来源:views.py


示例2: blogpost_edit

def blogpost_edit(request):

    blog_slug = request.matchdict.get('blog_slug', None)
    blog_post_slug = request.matchdict.get('blog_post_slug', None)

    blogpost = request.db.MediaEntry.query.filter_by(slug=blog_post_slug, actor=request.user.id).first()
    blog = get_blog_by_slug(request, blog_slug, author=request.user.id)

    if not blogpost or not blog:
        return render_404(request)

    defaults = dict(
                title = blogpost.title,
                description = cleaned_markdown_conversion(blogpost.description),
                tags=media_tags_as_string(blogpost.tags),
                license=blogpost.license)

    form = blog_forms.BlogPostEditForm(request.form, **defaults)
    if request.method == 'POST' and form.validate():
        blogpost.title = six.text_type(form.title.data)
        blogpost.description = six.text_type(cleaned_markdown_conversion((form.description.data)))
        blogpost.tags =  convert_to_tag_list_of_dicts(form.tags.data)
        blogpost.license = six.text_type(form.license.data)
        set_blogpost_state(request, blogpost)
        blogpost.generate_slug()
        blogpost.save()

        messages.add_message(
            request,
            messages.SUCCESS,
            _('Woohoo! edited blogpost is submitted'))
        return redirect(request, "mediagoblin.media_types.blog.blog-dashboard",
                        user=request.user.username,
                        blog_slug=blog.slug)

    return render_to_response(
        request,
        'mediagoblin/blog/blog_post_edit_create.html',
        {'form': form,
        'app_config': mg_globals.app_config,
        'user': request.user.username,
        'blog_post_slug': blog_post_slug
        })
开发者ID:ausbin,项目名称:mediagoblin,代码行数:43,代码来源:views.py


示例3: user_add_bio_html

def user_add_bio_html(database):
    """
    Users now have richtext bios via Markdown, reflect appropriately.
    """
    collection = database["users"]

    target = collection.find({"bio_html": {"$exists": False}})

    for document in target:
        document["bio_html"] = cleaned_markdown_conversion(document["bio"])
        collection.save(document)
开发者ID:3rdwiki,项目名称:mediagoblin,代码行数:11,代码来源:migrations.py


示例4: blogpost_create

def blogpost_create(request):

    form = blog_forms.BlogPostEditForm(request.form, license=request.user.license_preference)

    if request.method == 'POST' and form.validate():
        blog_slug = request.matchdict.get('blog_slug')
        blog = get_blog_by_slug(request, blog_slug, author=request.user.id)
        if not blog:
            return render_404(request)

        blogpost = request.db.MediaEntry()
        blogpost.media_type = 'mediagoblin.media_types.blogpost'
        blogpost.title = six.text_type(form.title.data)
        blogpost.description = six.text_type(cleaned_markdown_conversion((form.description.data)))
        blogpost.tags =  convert_to_tag_list_of_dicts(form.tags.data)
        blogpost.license = six.text_type(form.license.data) or None
        blogpost.actor = request.user.id
        blogpost.generate_slug()

        set_blogpost_state(request, blogpost)
        blogpost.save()

        # connect this blogpost to its blog
        blog_post_data = request.db.BlogPostData()
        blog_post_data.blog = blog.id
        blog_post_data.media_entry = blogpost.id
        blog_post_data.save()

        messages.add_message(
            request,
            messages.SUCCESS,
            _('Woohoo! Submitted!'))
        add_comment_subscription(request.user, blogpost)
        return redirect(request, "mediagoblin.media_types.blog.blog-dashboard",
                        user=request.user.username,
                        blog_slug=blog.slug)

    return render_to_response(
        request,
        'mediagoblin/blog/blog_post_edit_create.html',
        {'form': form,
        'app_config': mg_globals.app_config,
        'user': request.user.username})
开发者ID:ausbin,项目名称:mediagoblin,代码行数:43,代码来源:views.py


示例5: blog_edit

def blog_edit(request):
    """
    View for editing an existing blog or creating a new blog
    if user have not exceeded maximum allowed acount of blogs.
    """
    url_user = request.matchdict.get('user', None)
    blog_slug = request.matchdict.get('blog_slug', None)

    config = pluginapi.get_config('mediagoblin.media_types.blog')
    max_blog_count = config['max_blog_count']
    form = blog_forms.BlogEditForm(request.form)
    # creating a blog
    if not blog_slug:
        if Blog.query.filter_by(author=request.user.id).count()<max_blog_count:
            if request.method=='GET':
                return render_to_response(
                    request,
                    'mediagoblin/blog/blog_edit_create.html',
                    {'form': form,
                    'user' : request.user,
                    'app_config': mg_globals.app_config})

            if request.method=='POST' and form.validate():
                _log.info("Here")
                blog = request.db.Blog()
                blog.title = six.text_type(form.title.data)
                blog.description = six.text_type(cleaned_markdown_conversion((form.description.data)))
                blog.author = request.user.id
                blog.generate_slug()

                blog.save()
                return redirect(request, "mediagoblin.media_types.blog.blog_admin_dashboard",
                        user=request.user.username
                       )
        else:
            add_message(request, ERROR, "Welcome! You already have created \
                                                        maximum number of blogs.")
            return redirect(request, "mediagoblin.media_types.blog.blog_admin_dashboard",
                        user=request.user.username)


    #Blog already exists.
    else:
        blog = get_blog_by_slug(request, blog_slug)
        if not blog:
            return render_404(request)
        if request.method == 'GET':
            defaults = dict(
                title = blog.title,
                description = cleaned_markdown_conversion(blog.description),
                author = request.user.id)

            form = blog_forms.BlogEditForm(**defaults)

            return render_to_response(
                    request,
                    'mediagoblin/blog/blog_edit_create.html',
                    {'form': form,
                     'user': request.user,
                     'app_config': mg_globals.app_config})
        else:
            if request.method == 'POST' and form.validate():
                blog.title = six.text_type(form.title.data)
                blog.description = six.text_type(cleaned_markdown_conversion((form.description.data)))
                blog.author = request.user.id
                blog.generate_slug()

                blog.save()
                add_message(request, SUCCESS, "Your blog is updated.")
                return redirect(request, "mediagoblin.media_types.blog.blog-dashboard",
                        user=request.user.username,
                        blog_slug=blog.slug)
开发者ID:tofay,项目名称:mediagoblin,代码行数:72,代码来源:views.py


示例6: blog_edit

def blog_edit(request):
    """
    View for editing the existing blog or automatically
    creating a new blog if user does not have any yet.
    """
    url_user = request.matchdict.get('user', None)
    blog_slug = request.matchdict.get('blog_slug', None)
    
    max_blog_count = 1
    form = blog_forms.BlogEditForm(request.form)
    # the blog doesn't exists yet
    if not blog_slug:
        if Blog.query.filter_by(author=request.user.id).count()<max_blog_count:
            if request.method=='GET':
                return render_to_response(
                    request,
                    'mediagoblin/blog/blog_edit_create.html',
                    {'form': form,
                    'user' : request.user,
                    'app_config': mg_globals.app_config})

            if request.method=='POST' and form.validate():
                _log.info("Here")
                blog = request.db.Blog()
                blog.title = unicode(form.title.data)
                blog.description = unicode(cleaned_markdown_conversion((form.description.data))) 
                blog.author = request.user.id
                blog.generate_slug()
               
                blog.save()
                return redirect(request, "mediagoblin.media_types.blog.blog-dashboard",
                        user=request.user.username,
                        blog_slug=blog.slug)
        else:
            #the case when max blog count is one.
            blog = request.db.Blog.query.filter_by(author=request.user.id).first()
            add_message(request, ERROR, "Welcome! You already have created a blog.")
            return redirect(request, "mediagoblin.media_types.blog.blog-dashboard",
                        user=request.user.username,
                        blog_slug=blog.slug)


    #Blog already exists.
    else:
        blog = request.db.Blog.query.filter_by(slug=blog_slug).first()
        if request.method == 'GET':
            defaults = dict(
                title = blog.title,
                description = cleaned_markdown_conversion(blog.description),
                author = request.user.id) 
            
            form = blog_forms.BlogEditForm(**defaults)

            return render_to_response(
                    request,
                    'mediagoblin/blog/blog_edit_create.html',
                    {'form': form,
                     'user': request.user,
                     'app_config': mg_globals.app_config})
        else:
            if request.method == 'POST' and form.validate():
                blog.title = unicode(form.title.data)
                blog.description = unicode(cleaned_markdown_conversion((form.description.data)))
                blog.author = request.user.id
                blog.generate_slug()
                
                blog.save()
                add_message(request, SUCCESS, "Your blog is updated.")
                return redirect(request, "mediagoblin.media_types.blog.blog-dashboard",
                        user=request.user.username,
                        blog_slug=blog.slug)            
开发者ID:spaetz,项目名称:mediagoblin_blog,代码行数:71,代码来源:views.py


示例7: description_html

 def description_html(self):
     """
     Rendered version of the description, run through
     Markdown and cleaned with our cleaning tool.
     """
     return cleaned_markdown_conversion(self.description)
开发者ID:imclab,项目名称:mediagoblin,代码行数:6,代码来源:mixin.py


示例8: bio_html

 def bio_html(self):
     return cleaned_markdown_conversion(self.bio)
开发者ID:imclab,项目名称:mediagoblin,代码行数:2,代码来源:mixin.py


示例9: note_html

 def note_html(self):
     """
     the actual html-rendered version of the note displayed.
     Run through Markdown and the HTML cleaner.
     """
     return cleaned_markdown_conversion(self.note)
开发者ID:imclab,项目名称:mediagoblin,代码行数:6,代码来源:mixin.py


示例10: content_html

 def content_html(self):
     """
     the actual html-rendered version of the comment displayed.
     Run through Markdown and the HTML cleaner.
     """
     return cleaned_markdown_conversion(self.content)
开发者ID:imclab,项目名称:mediagoblin,代码行数:6,代码来源:mixin.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python translate._函数代码示例发布时间:2022-05-27
下一篇:
Python template.clear_test_template_context函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap