Skip to content

Commit

Permalink
Check whether filename is set when rendering asciidoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawa Ometto committed Sep 4, 2019
1 parent f3531a5 commit 2710ab9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions lib/github/markups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

This comment has been minimized.

attributes['outfilesuffix'] = '.adoc'
end
Asciidoctor::Compliance.unique_id_start_index = 1
Asciidoctor.convert(content, :safe => :secure, :attributes => attributes)
end
Expand Down
5 changes: 4 additions & 1 deletion test/markup_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ def test_each_render_has_a_name
end

def test_rendering_by_symbol
assert_equal '<p><code>test</code></p>', GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, '`test`').strip
markup = '`test`'
result = /<p><code>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
Expand Down

1 comment on commit 2710ab9

@sara2085788
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 prueba / markup_test.rb

@@ -94,7 +94,10 @@ def test_each_render_has_a_name
final

def test_rendering_by_symbol
afirmar_equal '

prueba

' , GitHub :: Markup . render_s ( GitHub :: Markups :: MARKUP_MARKDOWN , '' prueba` ' ) . tira
marcado = '' prueba ''
resultado = /

prueba < \ / code> < \ / p> /
Aserción del resultado de coincidencia , GitHub :: Markup . render_s ( GitHub :: Markups :: MARKUP_MARKDOWN , marcado ) . tira
Aserción del resultado de coincidencia , GitHub :: Markup . render_s ( GitHub :: Markups :: MARKUP_ASCIIDOC , marcado ) . dividir . unirse
final

def test_raises_error_if_command_exits_non_zero

Please sign in to comment.