diff --git a/lib/github/markups.rb b/lib/github/markups.rb index ea816c75..0ed55df0 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -33,13 +33,16 @@ 'idprefix' => '', 'idseparator' => '-', 'sectanchors' => nil, - 'docname' => File.basename(filename, (extname = File.extname(filename))), - 'docfilesuffix' => extname, - 'outfilesuffix' => extname, 'env' => 'github', 'env-github' => '', 'source-highlighter' => 'html-pipeline' } + if filename + attributes['docname'] = File.basename(filename, (extname = File.extname(filename))) + attributes['docfilesuffix'] = attributes['outfilesuffix'] = extname + else + attributes['outfilesuffix'] = '.adoc' + end Asciidoctor::Compliance.unique_id_start_index = 1 Asciidoctor.convert(content, :safe => :secure, :attributes => attributes) end diff --git a/test/markup_test.rb b/test/markup_test.rb index 4c3cc7af..24e78000 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -94,7 +94,10 @@ def test_each_render_has_a_name end def test_rendering_by_symbol - assert_equal '

test

', GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, '`test`').strip + markup = '`test`' + result = /

test<\/code><\/p>/ + assert_match result, GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, markup).strip + assert_match result, GitHub::Markup.render_s(GitHub::Markups::MARKUP_ASCIIDOC, markup).split.join end def test_raises_error_if_command_exits_non_zero