Beispiel #1
0
def render_markdown_doc(meta, text, doc, request):
    html, toc = markdown_and_toc(text)
    return render_to_response(
        meta.get('template', 'doc.html'),
        {
            'title': doc.title,
            'doc': doc,
            'html': html,
            'toc': toc,
        },
        context_instance=RequestContext(request),
    )
Beispiel #2
0
def render_markdown_doc(path, meta, text, doc, request):

    # Reload markdown docs if in development
    if settings.DEBUG:
        with path.open() as f:
            text, meta = text_and_meta(f)

    html, toc = markdown_and_toc(text)

    return render(
        request,
        meta.get('template', 'docs/doc.html'),
        {
            'title': meta['title'],
            'doc': doc,
            'html': html,
            'toc': toc,
        },
    )
Beispiel #3
0
def render_markdown_doc(path, meta, text, doc, request):

    # Reload markdown docs if in development
    if settings.DEBUG:
        with path.open() as f:
            text, meta = text_and_meta(f)

    html, toc = markdown_and_toc(text)

    return render(
        request,
        meta.get('template', 'docs/doc.html'),
        {
            'title': meta['title'],
            'doc': doc,
            'html': html,
            'toc': toc,
        },
    )
Beispiel #4
0
def render_markdown_doc(path: Path, meta: Dict[str, Any], text: str,
                        doc: Document, request: Any) -> HttpResponse:

    # Reload markdown docs if in development
    if settings.DEBUG:
        with path.open() as f:
            text, meta = text_and_meta(f)

    html, toc = markdown_and_toc(text)

    return render(
        request,
        meta.get('template', 'docs/doc.html'),
        {
            'title': meta['title'],
            'doc': doc,
            'html': html,
            'toc': toc,
        },
    )
Beispiel #5
0
def assert_markdown(content, expected_html, expected_toc=None):
    html, toc = markdown_and_toc(dedent(content))
    assert html.strip() == dedent(expected_html).strip()

    if expected_toc is not None:
        assert toc == expected_toc
Beispiel #6
0
def assert_markdown(content, expected_html, expected_toc=None):
    html, toc = markdown_and_toc(dedent(content))
    assert html.strip() == dedent(expected_html).strip()

    if expected_toc is not None:
        assert toc == expected_toc