def safe_developer(content, style="macos"):
    """
    Renders content without cleaning the original.
    Replaces the terminal divs for a more complext html layout.
    """
    new_content = refactor_html(content, style)
    return mark_safe(new_content)
def safe_developer(content, style="macos"):
    """
    Renders content without cleaning the original.
    Replaces the terminal divs for a more complext html layout.
    """
    new_content = refactor_html(content, style)
    return mark_safe(new_content)
def get_preview(request):
    """ View called to generate a preview of a blog post.

    Attributes:
       request (HttpRequest): User request.

    Returns JsonResponse:
       'html_code_preview' (str): Final HTML generated from the original blog
         post.
    """
    if request.method != "POST":
        return HttpResponse(status=404)
    # Obtaining original blog content.
    post_code = request.POST.get('data')
    terminal_style = settings.TERMINAL_STYLE.split(".")[-1]
    # Generating final html from original content.
    preview_code = refactor_html(post_code, terminal_style)
    # Returing to user
    return JsonResponse({'html_code_preview': preview_code})
Exemple #4
0
def get_preview(request):
    """ View called to generate a preview of a blog post.

    Attributes:
       request (HttpRequest): User request.

    Returns JsonResponse:
       'html_code_preview' (str): Final HTML generated from the original blog
         post.
    """
    if request.method != "POST":
        return HttpResponse(status=404)
    # Obtaining original blog content.
    post_code = request.POST.get('data')
    terminal_style = settings.TERMINAL_STYLE.split(".")[-1]
    # Generating final html from original content.
    preview_code = refactor_html(post_code, terminal_style)
    # Returing to user
    return JsonResponse({'html_code_preview': preview_code})