Beispiel #1
0
def test_renderer_block_code():
    test_code = 'this is a piece of code'
    test_markup = '<ac:structured-macro ac:name="code"><ac:parameter ac:name="linenumbers">true</ac:parameter>\n' \
                  '<ac:plain-text-body><![CDATA[this is a piece of code]]></ac:plain-text-body>\n' \
                  '</ac:structured-macro>\n'

    renderer = ConfluenceRenderer()

    assert renderer.block_code(test_code) == test_markup
Beispiel #2
0
def test_renderer_block_code_with_language():
    test_code = "this is a piece of code"
    test_language = "whitespace"
    test_markup = (
        '<ac:structured-macro ac:name="code"><ac:parameter ac:name="language">whitespace</ac:parameter>\n'
        '<ac:parameter ac:name="linenumbers">true</ac:parameter>\n'
        "<ac:plain-text-body><![CDATA[this is a piece of code]]></ac:plain-text-body>\n"
        "</ac:structured-macro>\n")

    renderer = ConfluenceRenderer()

    assert renderer.block_code(test_code, lang=test_language) == test_markup