Skip to content

Commit

Permalink
Merge pull request #395 from Mogztter/issue-393-fontawesome-set
Browse files Browse the repository at this point in the history
resolves #393 support set attribute on icon
  • Loading branch information
ggrossetie authored Dec 11, 2020
2 parents 0e4281d + 0a0b1c0 commit 3992f24
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 10 deletions.
3 changes: 1 addition & 2 deletions examples/font-awesome-specific-version.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@

== Updated in Version 5.14.0

// FIXME: won't work as this is a brand icon and the converter needs to use the "fab" class and not the (default) "fa" class
icon:rust[2x]
icon:rust[2x,set=fab]
14 changes: 12 additions & 2 deletions examples/font-awesome.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ icon:heart[size=5x]

== !

// FIXME: won't work as this is a brand icon and the converter needs to use the "fab" class and not the (default) "fa" class
icon:stackpath[size=5x]
icon:stackpath[size=5x,set=fab]

== !

Expand All @@ -31,3 +30,14 @@ icon:twitter[size=5x]
== Added in 5.15.0

icon:vest[size=2x]

== Sets

.Brand
icon:creative-commons[size=2x,set=fab]

.Regular
icon:address-book[size=2x,set=far]

.Solid
icon:address-book[size=2x,set=fas]
5 changes: 1 addition & 4 deletions templates/inline_image.html.slim
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
= html_tag('span', { :class => [@type, role], :style => ("float: #{attr :float}" if attr? :float) }.merge(data_attrs(@attributes)))
- if @type == 'icon' && (@document.attr? :icons, 'font')
- style_class = ["fa fa-#{@target}"]
- style_class << "fa-#{attr :size}" if attr? :size
- style_class << "fa-rotate-#{attr :rotate}" if attr? :rotate
- style_class << "fa-flip-#{attr :flip}" if attr? :flip
- style_class = [(attr :set, 'fa'), "fa-#{@target}", ("fa-#{attr :size}" if attr? :size), ("fa-rotate-#{attr :rotate}" if attr? :rotate), ("fa-flip-#{attr :flip}" if attr? :flip)]
- if attr? :link
a.image href=(attr :link) target=(attr :window) data-preview-link=(bool_data_attr :link_preview)
i class=style_class title=(attr :title)
Expand Down
2 changes: 1 addition & 1 deletion test/doctest/font-awesome-specific-version.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1>Font Awesome Tests</h1>
<h2>Updated in Version 5.14.0</h2>
<div class="slide-content">
<div class="paragraph">
<p><span class="icon"><i class="fa fa-rust fa-2x"></i></span></p>
<p><span class="icon"><i class="fab fa-rust fa-2x"></i></span></p>
</div>
</div>
</section>
Expand Down
19 changes: 18 additions & 1 deletion test/doctest/font-awesome.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h1>Font Awesome Tests</h1>
<section>
<div class="slide-content">
<div class="paragraph">
<p><span class="icon"><i class="fa fa-stackpath fa-5x"></i></span></p>
<p><span class="icon"><i class="fab fa-stackpath fa-5x"></i></span></p>
</div>
</div>
</section>
Expand All @@ -52,4 +52,21 @@ <h2>Added in 5.15.0</h2>
</div>
</div>
</section>
<section id="_sets">
<h2>Sets</h2>
<div class="slide-content">
<div class="paragraph">
<div class="title">Brand</div>
<p><span class="icon"><i class="fab fa-creative-commons fa-2x"></i></span></p>
</div>
<div class="paragraph">
<div class="title">Regular</div>
<p><span class="icon"><i class="far fa-address-book fa-2x"></i></span></p>
</div>
<div class="paragraph">
<div class="title">Solid</div>
<p><span class="icon"><i class="fas fa-address-book fa-2x"></i></span></p>
</div>
</div>
</section>
</div>

0 comments on commit 3992f24

Please sign in to comment.