jekyll-glossary_tooltip 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0d2a7c9c71b7870e1d4fe0afa64d23aed4e6511cada60c8c4cc86be19b32dfd
4
- data.tar.gz: 1a20ab00bfd6d4f4c7ebeb7644c6ac49f04d4380bffea4fd5a831879ed37c7d2
3
+ metadata.gz: 02fc27dec8d3491d154f94d40a371caec17b2da3b189d157f708a7ce522a7076
4
+ data.tar.gz: 49e9d0b6e4f6312c7712df864f51345382e8562a3e124b471415824718ae13d2
5
5
  SHA512:
6
- metadata.gz: 7b2fcc69854a22adeb846fd8278bc92bdb4ce4c74ac7c487aec2020d7dc971615a0122b75cafe56b3c5f9626ff3f3140229a5a705b43cea889f16dd93fb8843f
7
- data.tar.gz: 1961474e8828979d106fb521ceac878d4511808dca15754853bb542d50e8f38a566f7d32a57dff07f61b2131fa82f316c4118bc3593f2895fb867a6c01374cb2
6
+ metadata.gz: 64c423fc44f600f08a8acbe45e94a86d91300efbe69941177529275f9ec8c1d55bb46d728aeba0a4c2b8c43af24e53d1393baf06e431530f05fc6024a0404daa
7
+ data.tar.gz: 3d07bf135cee11a831071eee2c535eef932563eb7277a14e65db02a435d8e5ae85cd5b764d5afd0e4464e79d2367a829a9807b5755618d7c2048ccda4747e3ff
data/.rubocop.yml CHANGED
@@ -18,8 +18,9 @@ AllCops:
18
18
  # Travis: during build there will be a lot of rubocop config files in this pat which will cause build failure as the refer to gems which are not installed by this project.
19
19
  # See https://github.com/rubocop/rubocop/issues/9832
20
20
  - gemfiles/vendor/bundle/**/*
21
+ NewCops: enable
21
22
 
22
- Gemspec/DateAssignment:
23
+ Gemspec/DeprecatedAttributeAssignment:
23
24
  Enabled: true
24
25
  Gemspec/RequireMFA:
25
26
  Enabled: true
@@ -193,3 +194,6 @@ RSpec/SubjectDeclaration:
193
194
  Enabled: true
194
195
  RSpec/FactoryBot/SyntaxMethods:
195
196
  Enabled: true
197
+ RSpec/MultipleMemoizedHelpers:
198
+ Enabled: true
199
+ Max: 10
data/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.5.0] - 2022-09-08
10
+ ### Added
11
+ - Support for embedded liqid tags in the url field. ([#3](https://github.com/erikw/jekyll-glossary_tooltip/issues/3])
12
+
13
+ ## [1.4.0] - 2021-08-18
14
+ ### Changed
15
+ * Bump local ruby to 3.1.0
16
+
9
17
  ## [1.3.1] - 2021-08-18
10
18
  ### Added
11
19
  - GitHub workflow to publish to GitHub Packages.
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/7ffb648ec4b77f3f9eb8/maintainability)](https://codeclimate.com/github/erikw/jekyll-glossary_tooltip/maintainability)
6
6
  [![Code Climate Test Coverage](https://api.codeclimate.com/v1/badges/7ffb648ec4b77f3f9eb8/test_coverage)](https://codeclimate.com/github/erikw/jekyll-glossary_tooltip/test_coverage)
7
7
  [![CodeQL](https://github.com/erikw/jekyll-glossary_tooltip/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/erikw/jekyll-glossary_tooltip/actions/workflows/codeql-analysis.yml)
8
- [![SLOC](https://img.shields.io/tokei/lines/github/erikw/jekyll-glossary_tooltip)](#)
8
+ [![SLOC](https://img.shields.io/tokei/lines/github/erikw/jekyll-glossary_tooltip?logo=codefactor&logoColor=lightgrey)](#)
9
9
  [![License](https://img.shields.io/github/license/erikw/jekyll-glossary_tooltip)](LICENSE.txt)
10
10
  [![OSS Lifecycle](https://img.shields.io/osslifecycle/erikw/jekyll-glossary_tooltip)](https://github.com/Netflix/osstracker)
11
11
 
@@ -20,13 +20,19 @@ It's also possible to provide an optional URL to for example a term definition s
20
20
 
21
21
 
22
22
  # Installation
23
- 1. Add this gem to your Jekyll site's Gemfile
24
- - Simply with `$ bundle add jekyll-glossary_tooltip` when standing in the Jekyll project
25
- - Or manually by adding to `Gemfile`
23
+ 1. Add this gem to your Jekyll site's Gemfile in the `:jekyll_plugins` group:
24
+ * On CLI (in project root directory):
25
+ ```shell
26
+ bundle add --group jekyll_plugins jekyll-glossary_tooltip
27
+ ```
28
+ * Or manually:
26
29
  ```ruby
30
+ group :jekyll_plugins do
31
+ [...]
27
32
  gem 'jekyll-glossary_tooltip'
33
+ end
28
34
  ```
29
- and then running `$ bundle install`.
35
+ 1. Run `$ bundle install`.
30
36
  1. In your site's `_config.yml`, enable the plugin:
31
37
  ```yml
32
38
  plugins:
@@ -36,8 +42,8 @@ It's also possible to provide an optional URL to for example a term definition s
36
42
  1. Use the liquid tag in a page like `{% glossary term_name %}`
37
43
  1. Add CSS styling for the tooltip from [jekyll-glossary_tooltip.css](lib/jekyll-glossary_tooltip/jekyll-glossary_tooltip.css). You need to make sure that the pages where you will use the glossary tag have this styling applied. Typically this would mean 1) copying this file to your `assets/css/` directory 2) editing your theme's template for blog posts (or what pages you desire) to include this CSS in the header like `<link rel="stylesheet" href="/assets/css/jekyll-glossary_tooltip.css">`. However you could also copy this file's content in to your `main.css` or `main.scss` or however you build your site's CSS.
38
44
  1. Now just build your site and you will get nice nice term definition tooltips on mouse hover (or mobile, tap) for you terms!
39
- ```console
40
- $ bundle exec jekyll build
45
+ ```shell
46
+ bundle exec jekyll build
41
47
  ```
42
48
 
43
49
  # Usage
@@ -62,8 +68,14 @@ This could look something like:
62
68
  - term: Jamstack
63
69
  definition: JavaScript + API + Markup - a way of buildin and hosting websites.
64
70
  url: https://jamstack.org/
71
+ - term: EmbeddedLiquidURL
72
+ definition: This definition has an URL with embedded liquid tags to make it dynamic at build time. Note special YAML syntax for being able to use liquid (1.)
73
+ url: >
74
+ {{ site.baseurl }}{% link page2.md %}
65
75
  ```
66
76
 
77
+ 1. See [here](https://documentation.platformos.com/use-cases/using-liquid-markup-yaml) for notes on using Liquid in YAML.
78
+
67
79
 
68
80
  ## Tag Usage
69
81
  On any page where you've made sure include the needed CSS styling, you can use the glossary tag simply like
@@ -122,22 +134,22 @@ Instructions for releasing on rubygems.org below. Optionally make a GitHub [rele
122
134
 
123
135
  ## Using bundler/gem_tasks rake tasks
124
136
  Following instructions from [bundler.io](https://bundler.io/guides/creating_gem.html#releasing-the-gem):
125
- ```console
126
- $ vi -p lib/jekyll-glossary_tooltip/version.rb CHANGELOG.md
127
- $ bundle exec rake build
128
- $ ver=$(ruby -r ./lib/jekyll-glossary_tooltip/version.rb -e 'puts Jekyll::GlossaryTooltip::VERSION')
137
+ ```shell
138
+ vi -p lib/jekyll-glossary_tooltip/version.rb CHANGELOG.md
139
+ bundle exec rake build
140
+ ver=$(ruby -r ./lib/jekyll-glossary_tooltip/version.rb -e 'puts Jekyll::GlossaryTooltip::VERSION')
129
141
 
130
142
  # Optional: test locally by including in another project
131
- $ gem install pkg/jekyll-glossary_tooltip-$ver.gem
143
+ gem install pkg/jekyll-glossary_tooltip-$ver.gem
132
144
 
133
- $ bundle exec rake release
145
+ bundle exec rake release
134
146
  ```
135
147
 
136
148
  ## Using gem-release gem extension
137
149
  Using [gem-release](https://github.com/svenfuchs/gem-release):
138
- ```console
139
- $ vi CHANGELOG.md && git add CHANGELOG.md && git commit -m "Update CHANGELOG.md" && git push
140
- $ gem bump --version minor --tag --sign --push --release
150
+ ```shell
151
+ vi CHANGELOG.md && git add CHANGELOG.md && git commit -m "Update CHANGELOG.md" && git push
152
+ gem bump --version minor --tag --push --release --sign
141
153
  ```
142
154
  For `--version`, use `major|minor|patch` as needed.
143
155
 
@@ -145,18 +157,18 @@ For `--version`, use `major|minor|patch` as needed.
145
157
  * For ruby, just use RVM to switch between supported ruby version specified in `.gemspec`.
146
158
  * To run with different jekyll versions, [Appraisal](https://github.com/thoughtbot/appraisal) is used with [`Appraisals`](Appraisals) to generate different [`gemfiles/`](gemfiles/)
147
159
  - To use a specific Gemfile, run like
148
- ```console
149
- $ BUNDLE_GEMFILE=gemfiles/jekyll_4.x.x.gemfile bundle exec rake spec
150
- $ bundle exec appraisal jekyll-4.x.x rake spec
160
+ ```shell
161
+ BUNDLE_GEMFILE=gemfiles/jekyll_4.x.x.gemfile bundle exec rake spec
162
+ bundle exec appraisal jekyll-4.x.x rake spec
151
163
  ```
152
164
  - To run `rake spec` for all gemfiles:
153
- ```console
154
- $ bundle exec appraisal rake spec
165
+ ```shell
166
+ bundle exec appraisal rake spec
155
167
  ```
156
168
  - To generate new/updated gemfiles from `Appraisals`
157
- ```console
158
- $ bundle exec appraisal install
159
- $ bundle exec appraisal generate --travis
169
+ ```shell
170
+ bundle exec appraisal install
171
+ bundle exec appraisal generate --travis
160
172
  ```
161
173
 
162
174
  ## Travis
@@ -166,20 +178,20 @@ To use the [travis cli client](https://github.com/travis-ci/travis.rb) (installe
166
178
  - create a new token named `travis-cli`
167
179
  - Set the scopes `repo`, `read:org`, `user:email` according to the [docs](https://docs.travis-ci.com/user/github-oauth-scopes).
168
180
  1. Set travis.com as the default so we don't need to add `--pro` to most commands
169
- ```console
170
- $ bundle exec travis endpoint --set-default --api-endpoint https://api.travis-ci.com/
181
+ ```shell
182
+ bundle exec travis endpoint --set-default --api-endpoint https://api.travis-ci.com/
171
183
  ```
172
184
  1. Login with the cli client
173
- ```console
174
- $ bundle exec travis login --github-token $GITHUB_TOKEN
185
+ ```shell
186
+ bundle exec travis login --github-token $GITHUB_TOKEN
175
187
  ```
176
188
  1. Now the cli client can be used (might need `--pro` to use travis.com)
177
- ```console
178
- $ bundle exec travis lint
179
- $ bundle exec travis accounts
180
- $ bundle exec travis status
181
- $ bundle exec travis branches
182
- $ bundle exec travis monitor
189
+ ```shell
190
+ bundle exec travis lint
191
+ bundle exec travis accounts
192
+ bundle exec travis status
193
+ bundle exec travis branches
194
+ bundle exec travis monitor
183
195
  ```
184
196
 
185
197
  ## Live Demo GitHub Pages
@@ -18,7 +18,7 @@ module Jekyll
18
18
  <<~HTML
19
19
  <span class="jekyll-glossary">
20
20
  #{@opts[:display]}
21
- <span class="jekyll-glossary-tooltip">#{entry["definition"]}#{render_tooltip_url(entry)}</span>
21
+ <span class="jekyll-glossary-tooltip">#{entry["definition"]}#{render_tooltip_url(entry, context)}</span>
22
22
  </span>
23
23
  HTML
24
24
  end
@@ -27,11 +27,13 @@ module Jekyll
27
27
 
28
28
  LOG_TAG = "Glossary Tag:"
29
29
 
30
- def render_tooltip_url(entry)
30
+ def render_tooltip_url(entry, context)
31
31
  # The content of the anchor is set from the CSS class jekyll-glossary-source-link,
32
32
  # so that the plugin user can customize the text without touching ruby source.
33
- anchor = "<br><a class=\"jekyll-glossary-source-link\" href=\"#{entry["url"]}\" target=\"_blank\"></a>"
34
- entry["url"] ? anchor : ""
33
+ return "" if entry["url"].nil?
34
+
35
+ url = Liquid::Template.parse(entry["url"]).render(context).strip
36
+ "<br><a class=\"jekyll-glossary-source-link\" href=\"#{url}\" target=\"_blank\"></a>"
35
37
  end
36
38
 
37
39
  def lookup_entry(site, term_name)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module GlossaryTooltip
5
- VERSION = "1.4.0"
5
+ VERSION = "1.5.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-glossary_tooltip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Westrup
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-24 00:00:00.000000000 Z
11
+ date: 2022-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll