Пример #1
0
def test_blockquote_two_paragraphs():
    resp = rydown.to_mediawiki("""> This is a blockquote with two paragraphs.
> Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
>
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
> id sem consectetuer libero luctus adipiscing.\n\n""")
    assert resp == """<blockquote><p> This is a blockquote with two paragraphs.
Пример #2
0
def test_not_numberedlist():
    resp = rydown.to_mediawiki("1986\. What a great season.\n")
    assert resp == "<p>1986. What a great season.</p>\n"
Пример #3
0
def test_numberedlist():
    resp = rydown.to_mediawiki("1. apples\n2. oranges\n3. pears\n\n")
    assert resp == """<ol>
Пример #4
0
def test_bulletlist_plus():
    resp = rydown.to_mediawiki("+ apples\n+ oranges\n+ pears\n\n")
    assert resp == "*apples\n*oranges\n*pears\n"
Пример #5
0
def test_textattributes():
    resp = rydown.to_mediawiki(
        "Text attributes _italic_, **bold**, `monospace`.\n")
    assert resp == "<p>Text attributes _italic_, '''bold''',"\
        " <code>monospace</code>.</p>\n"
Пример #6
0
def test_textitalicbold_asterisc():
    resp = rydown.to_mediawiki("***italic bold***\n")
    assert resp == "<p>'''''italic bold'''''</p>\n" or resp == "<p>''''' italic bold '''''</p>\n"
Пример #7
0
def test_paragraph():
    resp = rydown.to_mediawiki("Paragraphs are separated\nby a blank line.\n")
    assert resp == "<p>Paragraphs are separated\nby a blank line.</p>\n"
Пример #8
0
def test_heading_h2():
    """Header level 2"""
    resp = rydown.to_mediawiki("## Heading 2\n")
    assert resp == "== Heading 2 ==\n"
Пример #9
0
def test_link_ref():
    resp = rydown.to_mediawiki(
        """[an example][id]\n\n[id]: http://example.com/\n""")
    assert resp == "<p>[http://example.com/#id an example]</p>\n"
Пример #10
0
def test_heading_h1_underline():
    """Underline header level 1"""
    resp = rydown.to_mediawiki("Heading 1\n=========\n")
    assert resp == "= Heading 1 =\n"
Пример #11
0
def test_link():
    resp = rydown.to_mediawiki("A [link](https://www.example.com).\n")
    assert resp == "<p>A [https://www.example.com link].</p>\n"
Пример #12
0
def test_comment_startline():
    resp = rydown.to_mediawiki(
        "<-- Comment -->Comment in the beginning of line\n")
    assert resp == "<p>Comment in the beginning of line</p>\n"
Пример #13
0
def test_comment_simple():
    resp = rydown.to_mediawiki("<-- Comment -->")
    assert resp == ""
Пример #14
0
def test_numberedlist_mixnumering():
    resp = rydown.to_mediawiki("2. apples\n3. oranges\n1. pears\n\n")
    assert resp == """<ol>
Пример #15
0
def test_heading_h2_underline():
    """Underline header level 2"""
    resp = rydown.to_mediawiki("Heading 2\n---------\n")
    assert resp == "== Heading 2 ==\n"
Пример #16
0
def test_heading_h1():
    """Header level 1"""
    resp = rydown.to_mediawiki("# Heading 1\n")
    assert resp == "= Heading 1 =\n"
Пример #17
0
def test_image():
    resp = rydown.to_mediawiki("![Image](https://www.example.com/img.png)\n")
    assert resp == """<span class="plainlinks">[{{fullurl:Image}} https://www.example.com/img.png]</span>"""
Пример #18
0
def test_heading_h3_b():
    """Header level 3"""
    resp = rydown.to_mediawiki("### Heading 3 ###\n\n")
    assert resp == "=== Heading 3 ===\n"
Пример #19
0
def test_blockquote():
    resp = rydown.to_mediawiki(
        "> Markdown uses email-style > characters for blockquoting.\n\n")
    assert resp == "<blockquote><p> Markdown uses email-style &gt;" \
        " characters for blockquoting.</p></blockquote>\n"
Пример #20
0
def test_textitalic_asterisc():
    resp = rydown.to_mediawiki("*italic*\n")
    assert resp == "<p>'' italic ''</p>\n" or resp == "<p>''italic''</p>\n"
Пример #21
0
def test_inlinecode():
    resp = rydown.to_mediawiki("`This is a code block.`\n")
    assert resp == "<p><code>This is a code block.</code></p>\n"
Пример #22
0
def test_table():
    resp = rydown.to_mediawiki("a|b|c\n-|-|-\nd|e|f\n\n")
    assert resp == "\n{|\n!a\n!b\n!c\n|-\n|d\n|e\n|f\n|}\n"
Пример #23
0
def test_heading_h1_underline_singleline():
    resp = rydown.to_mediawiki("Heading 1\n=========\nOnly one newline\n")
    assert resp == "= Heading 1 =\n<p>Only one newline</p>\n"
Пример #24
0
def test_bulletlist_asterisc():
    resp = rydown.to_mediawiki("* apples\n* oranges\n* pears\n\n")
    assert resp == "*apples\n*oranges\n*pears\n"
Пример #25
0
def test_codeblock_lang():
    resp = rydown.to_mediawiki("""```bash
This is a code block.```\n""")
    assert resp == "<syntaxhighlight lang='bash'>This is a" \
        " code block.</syntaxhighlight>\n"
Пример #26
0
def test_bulletlist_minus():
    resp = rydown.to_mediawiki("- apples\n- oranges\n- pears\n\n")
    assert resp == "*apples\n*oranges\n*pears\n"
Пример #27
0
def test_bulletlist_asterisc_sublists_tabs():
    resp = rydown.to_mediawiki(
        "* apples\n\t* oranges\n\t\t* pears\n\t\t\t* bananas\n\t\t\t\t* tomatos\n\n"
    )
    assert resp == "*apples\n**oranges\n***pears\n****bananas\n*****tomatos\n"