Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove UIKit classes #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jekyll-code-tabs.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
spec.licenses = ["MIT"]
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
spec.require_paths = ["lib"]
spec.add_dependency "jekyll", "~> 3.0"
spec.add_dependency "jekyll", "~> 4.0"
spec.add_development_dependency "rake", "~> 11.0"
spec.add_development_dependency "rspec", "~> 3.5"
spec.add_development_dependency "rubocop", "~> 0.52"
Expand Down
20 changes: 11 additions & 9 deletions lib/jekyll-code-tabs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ def render(context)

uuid = SecureRandom.uuid
template = ERB.new <<-EOF
<ul class="uk-tab" data-uk-switcher="{connect:'#<%= uuid %>'}">
<% environment['codetabs'].each_with_index do |(key, _), index| %>
<li<%= index == 0 ? ' class="uk-active"' : ''%>><a href="#"><%= key %></a></li>
<% end %>
</ul>
<!-- Tab links -->
<div class="tab">
<% environment['codetabs'].each_with_index do |(key, _), index| %>
<button class="tablinks" id="<%= index == 0 ? 'default' : '' %>" onclick="showTab(event, '<%= key %>')"><%= key %></button>
<% end %>
</div>

<ul id="<%= uuid %>" class="uk-switcher uk-margin">
<% environment['codetabs'].each do |_, value| %>
<li><%= value %></li>
<!-- Tab content -->
<% environment['codetabs'].each do |key, value| %>
<div id="<%= key %>" class="tabcontent">
<%= value %>
</div>
<% end %>
</ul>
EOF
template.result(binding)
end
Expand Down