def test_javascript_code_block(): """ Common Doctils extensions allow non-python language specification using ``code`` and `code-block`` directives. Refs: * http://www.sphinx-doc.org/en/stable/markup/code.html * http://docs.getpelican.com/en/stable/content.html#syntax-highlighting """ rst = """\ Some code: .. code:: javascript x=1; Good stuff! """ expected = """\ Some code: {language=javascript} ~~~~~~~~ x=1; ~~~~~~~~ Good stuff! """ md = rst_to_md(rst) assert md == expected
def test_python_code_block(): rst = """\ Some code:: def foo(): return 1 Good stuff! """ expected = """\ Some code: {language=python} ~~~~~~~~ def foo(): return 1 ~~~~~~~~ Good stuff! """ md = rst_to_md(rst) assert md == expected
def test_pycon_code_block(): rst = """\ Some code:: >>> x = 1 1 Good stuff! """ expected = """\ Some code: {language=pycon} ~~~~~~~~ >>> x = 1 1 ~~~~~~~~ Good stuff! """ md = rst_to_md(rst) assert md == expected
def test_nested_bullet_list(): rst = """\ - point - point - sub-point - sub-point **2** - sub-**sub**-point - and so forth """ expected = """\ - point - point - sub-point - sub-point **2** - sub-**sub**-point - and so forth """ md = rst_to_md(rst) assert md == expected
def test_multiparagraph_list_item(): rst = """\ - llamas. Foo bar baz. Fnord fnord fnord. - emus - yaks **are** fuzzy""" expected = """\ - llamas. Foo bar baz. Fnord fnord fnord. - emus - yaks **are** fuzzy """ md = rst_to_md(rst) assert md == expected
def test_math_inline(): rst = """ Here is inline math :math:`x^2`. """ expected = """\ Here is inline math $x^2$. """ md = rst_to_md(rst) assert md == expected
def test_inline_elements(): rst = """ This is **a** test. Only a test.""" expected = """\ > This is **a** test. > Only a test. """ md = rst_to_md(rst) assert md == expected
def test_basic_block_quote(): rst = """ This is a test. Only a test. """ expected = """> This is a test. > Only a test. """ md = rst_to_md(rst) assert md == expected
def test_basic_bullet_list(): rst = """- llamas - emus - yaks""" expected = """- llamas - emus - yaks """ md = rst_to_md(rst) assert md == expected
def test_list_item_with_bold(): rst = """\ - llamas - emus - yaks **are** fuzzy""" expected = """\ - llamas - emus - yaks **are** fuzzy """ md = rst_to_md(rst) assert md == expected
def test_multiline_list_item(): rst = """\ - llamas. Foo bar baz. - emus - yaks **are** fuzzy""" expected = """\ - llamas. Foo bar baz. - emus - yaks **are** fuzzy """ md = rst_to_md(rst) assert md == expected
def test_basic_math_block(): rst = """ Here is block math .. math:: x^2 """ expected = """Here is block math $$ x^2 $$ """ md = rst_to_md(rst) assert md == expected
def test_bare_uri(): rst = "http://example.com/llamas" expected = "[{0}]({0})\n\n".format(rst) md = rst_to_md(rst) assert md == expected
def test_named_reference(): rst = "`some name <http://someuri.io/path>`_" expected = "[some name](http://someuri.io/path)\n\n" md = rst_to_md(rst) assert md == expected