Beispiel #1
0
def test_htmlise():
    data = ['list_item', "A bullet"]
    expected = """
<li>A bullet</li>""".strip()
    result = md.htmlise(data)
    assert expected == result

    data = [
        'ordered_list',
        ['list_item', "A bullet"]]
    expected = """
<ol>
  <li>A bullet</li>
</ol>""".strip()
    result = md.htmlise(data).strip()
    assert expected == result

    data = [
        'list_item',
        ['plain',
         "A bullet with some ",
         ['emphasis',
          "bold"],
         " in it"]]
    expected = """
<li>A bullet with some <strong>bold</strong> in it</li>""".strip()
    result = md.htmlise(data).strip()
    assert expected == result
Beispiel #2
0
def test_htmlise():
    data = ['list_item', "A bullet"]
    expected = """
<li>A bullet</li>""".strip()
    result = md.htmlise(data)
    assert expected == result

    data = ['ordered_list', ['list_item', "A bullet"]]
    expected = """
<ol>
  <li>A bullet</li>
</ol>""".strip()
    result = md.htmlise(data).strip()
    assert expected == result

    data = [
        'list_item',
        ['plain', "A bullet with some ", ['emphasis', "bold"], " in it"]
    ]
    expected = """
<li>A bullet with some <strong>bold</strong> in it</li>""".strip()
    result = md.htmlise(data).strip()
    assert expected == result
Beispiel #3
0
def test_htmlise_link():
    data = [
        'link',
        ['link_text', "a link to Google"],
        ['link_url',
         "http://www.google.com"]]

    expected_html = ['''
    <a href="http://www.google.com">a link to Google</a>
    '''.strip()]
    result = md.make_anchor(data[0], data[1:])
    assert expected_html == result

    expected_html = '''
    <a href="http://www.google.com">a link to Google</a>
    '''.strip()
    result = md.htmlise(data)
    assert expected_html == result
Beispiel #4
0
def test_htmlise_link():
    data = [
        'link', ['link_text', "a link to Google"],
        ['link_url', "http://www.google.com"]
    ]

    expected_html = [
        '''
    <a href="http://www.google.com">a link to Google</a>
    '''.strip()
    ]
    result = md.make_anchor(data[0], data[1:])
    assert expected_html == result

    expected_html = '''
    <a href="http://www.google.com">a link to Google</a>
    '''.strip()
    result = md.htmlise(data)
    assert expected_html == result