Example #1
0
def test_create_toc():
    in1 = [['first headline', 'first-headline', 1],
           ['second headline', 'second-headline', 2]]

    out1 = ['# Table of Contents', '- [first headline](#first-headline)',
                '    - [second headline](#second-headline)', '\n']
    out2 = ['<a class="mk-toclify" id="table-of-contents"></a>\n', '# Table of Contents',
                '- [first headline](#first-headline)', '    - [second headline](#second-headline)', '\n']

    assert(mt.create_toc(in1, hyperlink=True, top_link=False) == out1)
    assert(mt.create_toc(in1, hyperlink=True, top_link=True) == out2)
Example #2
0
def test_create_toc():
    in1 = [['first headline', 'first-headline', 1],
           ['second headline', 'second-headline', 2]]

    out1 = [
        '# Table of Contents', '- [first headline](#first-headline)',
        '    - [second headline](#second-headline)', '\n'
    ]
    out2 = [
        '<a class="mk-toclify" id="table-of-contents"></a>\n',
        '# Table of Contents', '- [first headline](#first-headline)',
        '    - [second headline](#second-headline)', '\n'
    ]

    assert (mt.create_toc(in1, hyperlink=True, top_link=False) == out1)
    assert (mt.create_toc(in1, hyperlink=True, top_link=True) == out2)