Skip to content

Commit

Permalink
promote Font Awesome version to a constant (PR #2468)
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Nov 6, 2017
1 parent c5b2c7d commit 39f6c5e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/asciidoctor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ class << self; self; end.send :attr_accessor, key
:latexmath => ['\(', '\)'],
}

FONT_AWESOME_VERSION = '4.7.0'

# attributes which be changed within the content of the document (but not
# header) because it has semantic meaning; ex. sectnums
FLEXIBLE_ATTRIBUTES = ['sectnums']
Expand Down
2 changes: 1 addition & 1 deletion lib/asciidoctor/converter/html5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def document node

if node.attr? 'icons', 'font'
if node.attr? 'iconfont-remote'
result << %(<link rel="stylesheet" href="#{node.attr 'iconfont-cdn', %[#{cdn_base}/font-awesome/4.7.0/css/font-awesome.min.css]}"#{slash}>)
result << %(<link rel="stylesheet" href="#{node.attr 'iconfont-cdn', %[#{cdn_base}/font-awesome/#{FONT_AWESOME_VERSION}/css/font-awesome.min.css]}"#{slash}>)
else
iconfont_stylesheet = %(#{node.attr 'iconfont-name', 'font-awesome'}.css)
result << %(<link rel="stylesheet" href="#{node.normalize_web_path iconfont_stylesheet, (node.attr 'stylesdir', ''), false}"#{slash}>)
Expand Down
6 changes: 3 additions & 3 deletions test/blocks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2392,7 +2392,7 @@ def names
EOS

output = render_string input, :safe => Asciidoctor::SafeMode::SERVER
assert_css 'html > head > link[rel="stylesheet"][href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"]', output, 1
assert_css %(html > head > link[rel="stylesheet"][href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/#{Asciidoctor::FONT_AWESOME_VERSION}/css/font-awesome.min.css"]), output, 1
assert_xpath '//*[@class="admonitionblock tip"]//*[@class="icon"]/i[@class="fa icon-tip"]', output, 1
end

Expand Down Expand Up @@ -2423,7 +2423,7 @@ def names
EOS

output = render_string input, :safe => Asciidoctor::SafeMode::SAFE
assert_css 'html > head > link[rel="stylesheet"][href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"]', output, 1
assert_css %(html > head > link[rel="stylesheet"][href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/#{Asciidoctor::FONT_AWESOME_VERSION}/css/font-awesome.min.css"]), output, 1
assert_css 'html > body > script[src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"]', output, 1
end

Expand All @@ -2440,7 +2440,7 @@ def names
EOS

output = render_string input, :safe => Asciidoctor::SafeMode::SAFE
assert_css 'html > head > link[rel="stylesheet"][href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"]', output, 1
assert_css %(html > head > link[rel="stylesheet"][href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/#{Asciidoctor::FONT_AWESOME_VERSION}/css/font-awesome.min.css"]), output, 1
assert_css 'html > body > script[src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"]', output, 1
end
end
Expand Down

0 comments on commit 39f6c5e

Please sign in to comment.