jekyll_bootstrap5_tabs 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 63ce06f23eb1d77f84b9d67685742a46d0eabc7adf6debb4eef596ba73681300
4
+ data.tar.gz: e11c0c59467faa3d38f96006f7b5bb88ef980baac765f602414274f9bbfa760e
5
+ SHA512:
6
+ metadata.gz: 83fdc5c10c81e75a6e97303888b2e09ea54f644722363c81d77b2b068310315377c770a81f95c526f1a32fbdbc93192f59f2c0cbff64706dc8ad0b38cad1d912
7
+ data.tar.gz: c8f51ac97da8afee5d108b2d8b8d9bd27c3a801cc83db6b36d4d2b1213db04f3c52a9172b067cde867ad2c7947c54df3d43de2b909f27996c2e132f910b800ee
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # The gem's dependencies are specified in jekyll_bootstrap5_tabs.gemspec
8
+ gemspec
9
+
10
+ gem "rake", "~> 13.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,81 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jekyll_bootstrap5_tabs (1.0.0)
5
+ jekyll (>= 3.0)
6
+ slim (~> 3.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.8.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
+ colorator (1.1.0)
14
+ concurrent-ruby (1.1.9)
15
+ em-websocket (0.5.3)
16
+ eventmachine (>= 0.12.9)
17
+ http_parser.rb (~> 0)
18
+ eventmachine (1.2.7)
19
+ ffi (1.15.5)
20
+ forwardable-extended (2.6.0)
21
+ http_parser.rb (0.8.0)
22
+ i18n (1.9.1)
23
+ concurrent-ruby (~> 1.0)
24
+ jekyll (4.2.1)
25
+ addressable (~> 2.4)
26
+ colorator (~> 1.0)
27
+ em-websocket (~> 0.5)
28
+ i18n (~> 1.0)
29
+ jekyll-sass-converter (~> 2.0)
30
+ jekyll-watch (~> 2.0)
31
+ kramdown (~> 2.3)
32
+ kramdown-parser-gfm (~> 1.0)
33
+ liquid (~> 4.0)
34
+ mercenary (~> 0.4.0)
35
+ pathutil (~> 0.9)
36
+ rouge (~> 3.0)
37
+ safe_yaml (~> 1.0)
38
+ terminal-table (~> 2.0)
39
+ jekyll-sass-converter (2.1.0)
40
+ sassc (> 2.0.1, < 3.0)
41
+ jekyll-watch (2.2.1)
42
+ listen (~> 3.0)
43
+ kramdown (2.3.1)
44
+ rexml
45
+ kramdown-parser-gfm (1.1.0)
46
+ kramdown (~> 2.0)
47
+ liquid (4.0.3)
48
+ listen (3.7.1)
49
+ rb-fsevent (~> 0.10, >= 0.10.3)
50
+ rb-inotify (~> 0.9, >= 0.9.10)
51
+ mercenary (0.4.0)
52
+ pathutil (0.16.2)
53
+ forwardable-extended (~> 2.6)
54
+ public_suffix (4.0.6)
55
+ rake (13.0.6)
56
+ rb-fsevent (0.11.1)
57
+ rb-inotify (0.10.1)
58
+ ffi (~> 1.0)
59
+ rexml (3.2.5)
60
+ rouge (3.28.0)
61
+ safe_yaml (1.0.5)
62
+ sassc (2.4.0)
63
+ ffi (~> 1.9)
64
+ slim (3.0.9)
65
+ temple (>= 0.7.6, < 0.9)
66
+ tilt (>= 1.3.3, < 2.1)
67
+ temple (0.8.2)
68
+ terminal-table (2.0.0)
69
+ unicode-display_width (~> 1.1, >= 1.1.1)
70
+ tilt (2.0.10)
71
+ unicode-display_width (1.8.0)
72
+
73
+ PLATFORMS
74
+ x86_64-linux
75
+
76
+ DEPENDENCIES
77
+ jekyll_bootstrap5_tabs!
78
+ rake (~> 13.0)
79
+
80
+ BUNDLED WITH
81
+ 2.3.5
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Artur Gabitov
4
+ Portions Copyright (c) 2022 Mike Slinn
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,132 @@
1
+ Jekyll Bootstrap 5 Tabs
2
+ [![Gem Version](https://badge.fury.io/rb/jekyll_bootstrap5_tabs.svg)](https://badge.fury.io/rb/jekyll_bootstrap5_tabs)
3
+ ===========
4
+
5
+ The original version, written by Artur Gabitov, expected Markdown and Bootstrap 4.
6
+ This version requires Bootstrap 5 and HTML, not Markdown.
7
+
8
+
9
+ ## Installation
10
+
11
+ Add this to your project's `Gemfile`:
12
+ ```ruby
13
+ gem "jekyll_bootstrap5_tabs"
14
+ ```
15
+
16
+ Add this to your project's `_config.yml`:
17
+
18
+ ```yaml
19
+ plugins:
20
+ - jekyll_bootstrap5_tabs
21
+ ```
22
+
23
+ And then execute:
24
+
25
+ $ bundle install
26
+
27
+ Or install it yourself as:
28
+
29
+ $ gem install jekyll-simple-tab5
30
+
31
+
32
+ ## Usage
33
+
34
+ Bootstrap 5 is required. One way to include Bootstrap 5 in your project is to add the following HTML into the &lt;head> tag:
35
+ ```html
36
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
37
+ integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
38
+ ```
39
+ ...and add this to the bottom of the HTML file:
40
+ ```html
41
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
42
+ ```
43
+
44
+ See this [working minimal Bootstrap 5 tab example](https://codepen.io/mslinn/pen/OJOjVPR)
45
+
46
+ For example, given the following content in a Jekyll page:
47
+ ```
48
+ ---
49
+ ---
50
+ {% tabs test %}
51
+ {% tab test#home %}
52
+ Home at last!
53
+ {% endtab %}
54
+ {% tab test#profile %}
55
+ Profile meeee...
56
+ {% endtab %}
57
+ {% tab test#messages %}
58
+ Messages - I have none
59
+ {% endtab %}
60
+ {% endtabs %}
61
+ ```
62
+ The jekyll_bootstrap5_tabs plugin will generate code similar to this:
63
+ ```html
64
+ <ul class="nav nav-tabs">
65
+ <li class="nav-item">
66
+ <a class="nav-link active" data-bs-toggle="tab" aria-current="page" href="#home">Home</a>
67
+ </li>
68
+ <li class="nav-item">
69
+ <a class="nav-link" data-bs-toggle="tab" aria-current="page" href="#profile">Profile</a>
70
+ </li>
71
+ <li class="nav-item">
72
+ <a class="nav-link" data-bs-toggle="tab" aria-current="page" href="#messages">Messages</a>
73
+ </li>
74
+ </ul>
75
+
76
+ <div class="tab-content">
77
+ <div class="tab-pane active" id="home" aria-labelledby="home-tab">Home at last!</div>
78
+ <div class="tab-pane" id="profile" aria-labelledby="profile-tab">Profile meeee...</div>
79
+ <div class="tab-pane" id="messages" aria-labelledby="messages-tab">Messages - I have none</div>
80
+ </div>
81
+ ```
82
+
83
+ ![Image](docs/tab-screen.gif)
84
+
85
+
86
+ ## Building
87
+
88
+ ```shell
89
+ $ rake build jekyll_bootstrap5_tabs.gemspec
90
+ jekyll_bootstrap5_tabs 1.0.0 built to pkg/jekyll_bootstrap5_tabs-1.0.0.gem.
91
+ ```
92
+
93
+ The most recently built gem is provided in `pkg/`.
94
+
95
+
96
+ ## Installing
97
+
98
+ ```shell
99
+ $ gem install pkg/jekyll_bootstrap5_tabs-1.0.0.gem
100
+ Fetching slim-4.1.0.gem
101
+ Fetching temple-0.8.2.gem
102
+ Successfully installed temple-0.8.2
103
+ Successfully installed slim-4.1.0
104
+ Successfully installed jekyll_bootstrap5_tabs-1.0.0
105
+ Parsing documentation for temple-0.8.2
106
+ Installing ri documentation for temple-0.8.2
107
+ Parsing documentation for slim-4.1.0
108
+ Installing ri documentation for slim-4.1.0
109
+ Parsing documentation for jekyll_bootstrap5_tabs-1.0.0
110
+ Installing ri documentation for jekyll_bootstrap5_tabs-1.0.0
111
+ Done installing documentation for temple, slim, jekyll_bootstrap5_tabs after 0 seconds
112
+ 3 gems installed
113
+ ```
114
+
115
+ Now go use the gem in a Jekyll project!
116
+
117
+
118
+ ## Development
119
+
120
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
121
+
122
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
123
+
124
+
125
+ ## Contributing
126
+
127
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mslinn/jekyll-simple-tab5.
128
+
129
+
130
+ ## License
131
+
132
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ task default: %i[]
Binary file
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module JekyllBootstrap5Tabs
4
+ VERSION = "1.0.0"
5
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'slim'
4
+ require_relative "jekyll_bootstrap5_tabs/version"
5
+
6
+ DEFAULT_TEMPLATE = 'template.slim'
7
+
8
+ module JekyllBootstrap5Tabs
9
+ # Handles the outer {% tabs %}{% endtabs %} Liquid block for Bootstrap 5
10
+ class TabsBlock < Liquid::Block
11
+ def initialize(tag, args, _)
12
+ super
13
+
14
+ raise SyntaxError.new("#{tag} requires name") if args.empty?
15
+
16
+ @tab_name = args.strip
17
+ end
18
+
19
+ def template_path(template_name)
20
+ dir = File.dirname(__FILE__)
21
+ File.join(dir, template_name.to_s)
22
+ end
23
+
24
+ def render(context)
25
+ @environment = context.environments.first
26
+ super
27
+
28
+ template_file_path = template_path(DEFAULT_TEMPLATE)
29
+ template = Slim::Template.new(template_file_path)
30
+ template.render(self)
31
+ end
32
+ end
33
+
34
+ # Handles the inner {% tab %}{% endtab %} Liquid block for Bootstrap 5
35
+ class TabBlock < Liquid::Block
36
+ def initialize(tag, args, _)
37
+ super
38
+
39
+ @tabs_group, @tab = split_params(args.strip)
40
+ raise SyntaxError.new("Block #{tag} requires tabs name") if @tabs_group.empty? || @tab.empty?
41
+ end
42
+
43
+ def render(context)
44
+ content = super
45
+
46
+ environment = context.environments.first
47
+ environment["tabs-#{@tabs_group}"] ||= {}
48
+ environment["tabs-#{@tabs_group}"][@tab] = content
49
+ end
50
+
51
+ private
52
+
53
+ def split_params(params)
54
+ params.split('#')
55
+ end
56
+ end
57
+ end
58
+
59
+ Liquid::Template.register_tag('tabs', JekyllBootstrap5Tabs::TabsBlock)
60
+ Liquid::Template.register_tag('tab', JekyllBootstrap5Tabs::TabBlock)
data/lib/template.slim ADDED
@@ -0,0 +1,15 @@
1
+ ul.nav.nav-tabs
2
+ - @environment["tabs-#{@tab_name}"].each_with_index do |(key, _), index|
3
+ li.nav-item
4
+ - if index == 0
5
+ a.nav-link.active id="#{key}-tab" data-bs-toggle="tab" href="##{key}" aria-current="page" aria-selected="true"= key
6
+ - else
7
+ a.nav-link id="#{key}-tab" data-bs-toggle="tab" href="##{key}" aria-current="page" aria-selected="false"= key
8
+ .tab-content id="#{@tab_name}-content"
9
+ - @environment["tabs-#{@tab_name}"].each_with_index do |(key, value), index|
10
+ - if index == 0
11
+ .tab-pane.active id="#{key}" aria-labelledby="#{key}-tab"
12
+ == value
13
+ - else
14
+ .tab-pane id="#{key}" aria-labelledby="#{key}-tab"
15
+ == value
@@ -0,0 +1,4 @@
1
+ module JekyllBootstrap5Tabs
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll_bootstrap5_tabs
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Artur Gabitov
8
+ - Mike Slinn
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2022-02-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: jekyll
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '3.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '3.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: slim
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '3.0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '3.0'
42
+ description: Enables Bootstrap 5 tabs in Jekyll 4 websites.
43
+ email:
44
+ - applifort@gmail.com
45
+ - mslinn@mslinn.com
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - Gemfile
51
+ - Gemfile.lock
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - docs/tab-screen.gif
56
+ - lib/jekyll_bootstrap5_tabs.rb
57
+ - lib/jekyll_bootstrap5_tabs/version.rb
58
+ - lib/template.slim
59
+ - pkg/jekyll_bootstrap5_tabs-1.0.0.gem
60
+ - sig/jekyll_bootstrap5_tabs.rbs
61
+ homepage: https://mslinn.com/blog/2022/02/13/jekyll-gem.html
62
+ licenses:
63
+ - MIT
64
+ metadata:
65
+ homepage_uri: https://mslinn.com/blog/2022/02/13/jekyll-gem.html
66
+ source_code_uri: https://github.com/mslinn/jekyll_bootstrap5_tabs
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 2.6.0
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubygems_version: 3.2.5
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: Jekyll plugin for Bootstrap 5 tabs
86
+ test_files: []