from asciidoc import asciidoc import io import pytest @pytest.mark.parametrize( "input,expected", ( ( '{attach}file.txt', '

\r\n' ), ( '\\{attach}file.txt', '

{attach}file.txt

\r\n' ), ( 'link:{attach}file.txt[file]', '

\r\n' ), ( 'link:\\{attach}file.txt[file]', '

' + 'file

\r\n' ), ( 'image:\\{attach}file.jpg[]', '

\r\n' + '{attach}file.jpg\r\n' + '

\r\n' ), ( 'image:\\{attach}file.jpg[foo]', '

\r\n' + 'foo\r\n

\r\n' ), ) ) def test_ignore_attribute(input, expected): infile = io.StringIO(input) outfile = io.StringIO() options = [ ('--out-file', outfile), ('--no-header-footer', '') ] asciidoc.execute('asciidoc', options, [infile]) assert outfile.getvalue() == expected