jekyll-glossary_tooltip 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +51 -0
- data/.qlty/.gitignore +7 -0
- data/.qlty/configs/.shellcheckrc +1 -0
- data/.qlty/qlty.toml +85 -0
- data/.rubocop.yml +14 -13
- data/CHANGELOG.md +57 -13
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +1 -2
- data/README.md +44 -48
- data/Rakefile +8 -1
- data/gemfiles/jekyll_3.7.x.gemfile +0 -1
- data/gemfiles/jekyll_4.x.x.gemfile +0 -1
- data/lib/jekyll-glossary_tooltip/css_injector.rb +46 -0
- data/lib/jekyll-glossary_tooltip/options_parser.rb +1 -1
- data/lib/jekyll-glossary_tooltip/tag.rb +10 -5
- data/lib/jekyll-glossary_tooltip/version.rb +1 -1
- data/lib/jekyll-glossary_tooltip.rb +1 -0
- data/scripts/setup +4 -0
- metadata +11 -7
- data/.travis.yml +0 -31
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a1fd1d446beff3c06cbd32156d5c08bd2354a2a03653724c34eadc95a17af65a
|
|
4
|
+
data.tar.gz: f30ebd7d637f3138ba747fe08168fc829a9bf9f921a8027df04556977d1e53a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f6cb53f1ee8ce3d1138f6bf1b5cbe0cfe848152ed698bca7baca353b8f729410a139e2be945c6b9bf8aa6d1508323f768b8fe37c9b0042a16fb8edc25185ac6c
|
|
7
|
+
data.tar.gz: 7aba8038e95c111f6c05a379b74f7c06dd8ec19b877fe6b7f943f8c2cc9d3f3d88723d86488281352278a68e0395fc930b327b271780a10f9bd91f7dc4ced656
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Continuous Integration
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
branches: main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: main
|
|
9
|
+
|
|
10
|
+
# OIDC permissions for qlty
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
id-token: write
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
test:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
|
|
19
|
+
strategy:
|
|
20
|
+
matrix:
|
|
21
|
+
ruby: [2.7.0, 3.0.1]
|
|
22
|
+
gemfile:
|
|
23
|
+
- gemfiles/jekyll_3.7.x.gemfile
|
|
24
|
+
- gemfiles/jekyll_4.x.x.gemfile
|
|
25
|
+
|
|
26
|
+
env:
|
|
27
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
|
28
|
+
|
|
29
|
+
steps:
|
|
30
|
+
- name: Checkout code
|
|
31
|
+
uses: actions/checkout@v4
|
|
32
|
+
|
|
33
|
+
- name: Set up Ruby
|
|
34
|
+
uses: ruby/setup-ruby@v1
|
|
35
|
+
with:
|
|
36
|
+
ruby-version: ${{ matrix.ruby }}
|
|
37
|
+
bundler-cache: true
|
|
38
|
+
bundler: 2.2.18
|
|
39
|
+
|
|
40
|
+
- name: Run tests
|
|
41
|
+
run: bundle exec rake spec
|
|
42
|
+
|
|
43
|
+
- name: Run linting
|
|
44
|
+
run: bundle exec rake rubocop
|
|
45
|
+
|
|
46
|
+
- name: Publish code coverage to qlty
|
|
47
|
+
uses: qltysh/qlty-action/coverage@v2
|
|
48
|
+
with:
|
|
49
|
+
oidc: true
|
|
50
|
+
format: simplecov
|
|
51
|
+
files: coverage/.resultset.json
|
data/.qlty/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
source-path=SCRIPTDIR
|
data/.qlty/qlty.toml
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# This file was automatically generated by `qlty init`.
|
|
2
|
+
# You can modify it to suit your needs.
|
|
3
|
+
# We recommend you to commit this file to your repository.
|
|
4
|
+
#
|
|
5
|
+
# This configuration is used by both Qlty CLI and Qlty Cloud.
|
|
6
|
+
#
|
|
7
|
+
# Qlty CLI -- Code quality toolkit for developers
|
|
8
|
+
# Qlty Cloud -- Fully automated Code Health Platform
|
|
9
|
+
#
|
|
10
|
+
# Try Qlty Cloud: https://qlty.sh
|
|
11
|
+
#
|
|
12
|
+
# For a guide to configuration, visit https://qlty.sh/d/config
|
|
13
|
+
# Or for a full reference, visit https://qlty.sh/d/qlty-toml
|
|
14
|
+
config_version = "0"
|
|
15
|
+
|
|
16
|
+
exclude_patterns = [
|
|
17
|
+
"*_min.*",
|
|
18
|
+
"*-min.*",
|
|
19
|
+
"*.min.*",
|
|
20
|
+
"**/.yarn/**",
|
|
21
|
+
"**/*.d.ts",
|
|
22
|
+
"**/assets/**",
|
|
23
|
+
"**/bower_components/**",
|
|
24
|
+
"**/build/**",
|
|
25
|
+
"**/cache/**",
|
|
26
|
+
"**/config/**",
|
|
27
|
+
"**/db/**",
|
|
28
|
+
"**/deps/**",
|
|
29
|
+
"**/dist/**",
|
|
30
|
+
"**/extern/**",
|
|
31
|
+
"**/external/**",
|
|
32
|
+
"**/generated/**",
|
|
33
|
+
"**/Godeps/**",
|
|
34
|
+
"**/gradlew/**",
|
|
35
|
+
"**/mvnw/**",
|
|
36
|
+
"**/node_modules/**",
|
|
37
|
+
"**/protos/**",
|
|
38
|
+
"**/seed/**",
|
|
39
|
+
"**/target/**",
|
|
40
|
+
"**/templates/**",
|
|
41
|
+
"**/testdata/**",
|
|
42
|
+
"**/vendor/**",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
test_patterns = [
|
|
46
|
+
"**/test/**",
|
|
47
|
+
"**/spec/**",
|
|
48
|
+
"**/*.test.*",
|
|
49
|
+
"**/*.spec.*",
|
|
50
|
+
"**/*_test.*",
|
|
51
|
+
"**/*_spec.*",
|
|
52
|
+
"**/test_*.*",
|
|
53
|
+
"**/spec_*.*",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[smells]
|
|
57
|
+
mode = "comment"
|
|
58
|
+
|
|
59
|
+
[smells.boolean_logic]
|
|
60
|
+
threshold = 4
|
|
61
|
+
|
|
62
|
+
[smells.file_complexity]
|
|
63
|
+
threshold = 55
|
|
64
|
+
|
|
65
|
+
[smells.return_statements]
|
|
66
|
+
threshold = 4
|
|
67
|
+
|
|
68
|
+
[smells.nested_control_flow]
|
|
69
|
+
threshold = 4
|
|
70
|
+
|
|
71
|
+
[smells.function_parameters]
|
|
72
|
+
threshold = 4
|
|
73
|
+
|
|
74
|
+
[smells.function_complexity]
|
|
75
|
+
threshold = 5
|
|
76
|
+
|
|
77
|
+
[[source]]
|
|
78
|
+
name = "default"
|
|
79
|
+
default = true
|
|
80
|
+
|
|
81
|
+
[[plugin]]
|
|
82
|
+
name = "rubocop"
|
|
83
|
+
version = "1.80.2"
|
|
84
|
+
package_file = "Gemfile"
|
|
85
|
+
package_filters = ["rubocop"]
|
data/.rubocop.yml
CHANGED
|
@@ -7,17 +7,17 @@ plugins:
|
|
|
7
7
|
|
|
8
8
|
inherit_mode:
|
|
9
9
|
merge:
|
|
10
|
-
- Exclude
|
|
10
|
+
- Exclude # Merge my AllCops.Exclude with default excludes from https://github.com/rubocop/rubocop/blob/master/config/default.yml
|
|
11
11
|
|
|
12
12
|
AllCops:
|
|
13
13
|
TargetRubyVersion: 3.0
|
|
14
14
|
Include:
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
- lib/**/*.rb
|
|
16
|
+
- spec/**/*.rb
|
|
17
17
|
Exclude:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
# Travis: during build there will be a lot of rubocop config files in this path which will cause build failure as the refer to gems which are not installed by this project.
|
|
19
|
+
# See https://github.com/rubocop/rubocop/issues/9832
|
|
20
|
+
- gemfiles/vendor/bundle/**/*
|
|
21
21
|
NewCops: disable
|
|
22
22
|
|
|
23
23
|
Gemspec/DeprecatedAttributeAssignment:
|
|
@@ -30,7 +30,7 @@ Layout/LineEndStringConcatenationIndentation:
|
|
|
30
30
|
Layout/EmptyLineBetweenDefs:
|
|
31
31
|
Enabled: true
|
|
32
32
|
Exclude:
|
|
33
|
-
|
|
33
|
+
- lib/jekyll-glossary_tooltip/errors.rb
|
|
34
34
|
Layout/SpaceBeforeBrackets:
|
|
35
35
|
Enabled: true
|
|
36
36
|
|
|
@@ -93,11 +93,13 @@ Metrics/BlockLength:
|
|
|
93
93
|
Metrics/MethodLength:
|
|
94
94
|
Enabled: true
|
|
95
95
|
Max: 25
|
|
96
|
+
Metrics/ParameterLists:
|
|
97
|
+
Max: 6
|
|
96
98
|
|
|
97
99
|
Naming/FileName:
|
|
98
100
|
Enabled: false
|
|
99
101
|
Exclude:
|
|
100
|
-
|
|
102
|
+
- lib/jekyll-glossary_tooltip.rb
|
|
101
103
|
Naming/InclusiveLanguage:
|
|
102
104
|
Enabled: true
|
|
103
105
|
Naming/BlockForwarding:
|
|
@@ -113,7 +115,7 @@ Style/CollectionCompact:
|
|
|
113
115
|
Style/Documentation:
|
|
114
116
|
Enabled: true
|
|
115
117
|
Exclude:
|
|
116
|
-
|
|
118
|
+
- lib/jekyll-glossary_tooltip/errors.rb
|
|
117
119
|
Style/DocumentDynamicEvalDefinition:
|
|
118
120
|
Enabled: true
|
|
119
121
|
Style/EndlessMethod:
|
|
@@ -141,7 +143,7 @@ Style/RegexpLiteral:
|
|
|
141
143
|
Style/SingleLineMethods:
|
|
142
144
|
Enabled: true
|
|
143
145
|
Exclude:
|
|
144
|
-
|
|
146
|
+
- lib/jekyll-glossary_tooltip/errors.rb
|
|
145
147
|
Style/StringChars:
|
|
146
148
|
Enabled: true
|
|
147
149
|
Style/StringLiterals:
|
|
@@ -169,7 +171,6 @@ Style/RedundantSelfAssignmentBranch:
|
|
|
169
171
|
Style/SelectByRegexp:
|
|
170
172
|
Enabled: true
|
|
171
173
|
|
|
172
|
-
|
|
173
174
|
# Reference: https://github.com/rubocop/rubocop-rake/blob/master/config/default.yml
|
|
174
175
|
Rake:
|
|
175
176
|
Enabled: true
|
|
@@ -191,10 +192,10 @@ RSpec/MultipleMemoizedHelpers:
|
|
|
191
192
|
Enabled: true
|
|
192
193
|
Max: 10
|
|
193
194
|
RSpec/SpecFilePathFormat:
|
|
194
|
-
|
|
195
|
+
# Disable to match structure of lib/. For jekyll plugin inclusion convention features, not having lib/jekyll/sth.rb but lib/jekyll-sth.rb
|
|
195
196
|
Enabled: false
|
|
196
197
|
RSpec/SpecFilePathSuffix:
|
|
197
|
-
|
|
198
|
+
# Disable to match structure of lib/. For jekyll plugin inclusion convention features, not having lib/jekyll/sth.rb but lib/jekyll-sth.rb
|
|
198
199
|
Enabled: false
|
|
199
200
|
RSpec/IndexedLet:
|
|
200
201
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
|
|
2
3
|
All notable changes to this project will be documented in this file.
|
|
3
4
|
|
|
4
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
@@ -6,49 +7,92 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
7
|
|
|
7
8
|
## [Unreleased]
|
|
8
9
|
|
|
10
|
+
## [3.1.0] - 2026-05-29
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
* The plugin now automatically injects its bundled tooltip CSS as a `<style>` block into every rendered HTML page — no manual CSS setup required. [#1](https://github.com/erikw/jekyll-glossary_tooltip/issues/1)
|
|
15
|
+
* To disable automatic injection and provide your own stylesheet, set `glossary_tooltip: { include_default_style: false }` in `_config.yml`.
|
|
16
|
+
* **Upgrading from a previous version?** If you were already manually copying and including the CSS, you can remove that manual step after upgrading. If you leave it in place, both styles will load — the injected one and your linked one. To avoid this, either remove your manual `<link>` tag or set `include_default_style: false` and keep your own stylesheet.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
* When using `display:`, the tooltip now prepends the original glossary term before the definition to preserve the original term context. [#19](https://github.com/erikw/jekyll-glossary_tooltip/issues/19)
|
|
21
|
+
|
|
22
|
+
## [2.1.0] - 2025-10-30
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
* Unicode support [#20](https://github.com/erikw/jekyll-glossary_tooltip/pull/20)
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
* Migrated CI from Travis to GitHub Actions.
|
|
31
|
+
|
|
9
32
|
## [2.0.0] - 2025-03-31
|
|
33
|
+
|
|
10
34
|
### Added
|
|
11
|
-
|
|
12
|
-
|
|
35
|
+
|
|
36
|
+
* [BREAKING] Hidden with CSS parenthesis around term definition. These parenthesis will be revealed when jekyll produces a post.except as typically HTML and CSS stripped => the plain text rendering of the glossary tag will be "<term-name> (term-description> <term-url>)". [#7](https://github.com/erikw/jekyll-glossary_tooltip/issues/7)
|
|
37
|
+
* To **upgrade** to new version, you need to update the CSS by re-copy the full contexts of [jekyll-glossary_tooltip.css](lib/jekyll-glossary_tooltip/jekyll-glossary_tooltip.css) to your side. The new CSS class `.jekyll-glossary-tooltip-hidden` is added and needed to hide parenthesis in the tooltip.
|
|
13
38
|
|
|
14
39
|
## [1.5.1] - 2025-03-10
|
|
40
|
+
|
|
15
41
|
### Fixed
|
|
16
|
-
|
|
42
|
+
|
|
43
|
+
* Strip newlines from generated HTML to prevent unnecessary spaces to be added. [#9](https://github.com/erikw/jekyll-glossary_tooltip/issues/9)
|
|
17
44
|
|
|
18
45
|
## [1.5.0] - 2022-09-08
|
|
46
|
+
|
|
19
47
|
### Added
|
|
20
|
-
|
|
48
|
+
|
|
49
|
+
* Support for embedded liquid tags in the url field. ([#3](https://github.com/erikw/jekyll-glossary_tooltip/issues/3])
|
|
21
50
|
|
|
22
51
|
## [1.4.0] - 2021-08-18
|
|
52
|
+
|
|
23
53
|
### Changed
|
|
54
|
+
|
|
24
55
|
* Bump local ruby to 3.1.0
|
|
25
56
|
|
|
26
57
|
## [1.3.1] - 2021-08-18
|
|
58
|
+
|
|
27
59
|
### Added
|
|
28
|
-
|
|
60
|
+
|
|
61
|
+
* GitHub workflow to publish to GitHub Packages.
|
|
29
62
|
|
|
30
63
|
## [1.3.1] - 2021-08-18
|
|
64
|
+
|
|
31
65
|
### Fixed
|
|
32
|
-
|
|
66
|
+
|
|
67
|
+
* gemspec dependency range stynax.
|
|
33
68
|
|
|
34
69
|
## [1.3.0] - 2021-08-07
|
|
70
|
+
|
|
35
71
|
### Changed
|
|
36
|
-
|
|
72
|
+
|
|
73
|
+
* Open the souce link from a tooltip in a new tab.
|
|
37
74
|
|
|
38
75
|
## [1.2.0] - 2021-08-06
|
|
76
|
+
|
|
39
77
|
### Added
|
|
40
|
-
|
|
41
|
-
|
|
78
|
+
|
|
79
|
+
* Bottom arrow to the tooltip.
|
|
80
|
+
* Tooltip hover animation from invisible to visible.
|
|
42
81
|
|
|
43
82
|
### Changed
|
|
44
|
-
|
|
83
|
+
|
|
84
|
+
* Restyle the glossary term bottom border style and color.
|
|
45
85
|
|
|
46
86
|
## [1.1.0] - 2021-08-06
|
|
87
|
+
|
|
47
88
|
### Added
|
|
48
|
-
|
|
89
|
+
|
|
90
|
+
* Optional `display:` argument to set a different term display name, rather than using the term name as defined in the glossary file. Usage: `{% glossary term_name, display: Different Name To Display %}`.
|
|
49
91
|
|
|
50
92
|
## [1.0.0] - 2021-08-05
|
|
51
|
-
|
|
93
|
+
|
|
94
|
+
* No changes from `v0.1.0` but just bumping to final first major release version!
|
|
52
95
|
|
|
53
96
|
## [0.1.0] - 2021-08-05
|
|
54
|
-
|
|
97
|
+
|
|
98
|
+
* First release version. The plugin is fully working but I suspect that there might be a few point releases just to nail the release process. Once this is working, there will soon be an 1.0.0 release!
|
data/CONTRIBUTING.md
CHANGED
data/Gemfile
CHANGED
|
@@ -16,14 +16,13 @@ group :development, :test do
|
|
|
16
16
|
gem "gem-release", "~> 2.0", require: false
|
|
17
17
|
gem "rake", "~> 13.0", require: false
|
|
18
18
|
gem "solargraph", require: false
|
|
19
|
-
gem "travis", "~> 1.0", require: false
|
|
20
19
|
end
|
|
21
20
|
|
|
22
21
|
group :test do
|
|
22
|
+
gem "json_pure", "~> 2.8", require: false # Solargraph pulls in v2.6.3 which fails build with " uninitialized constant JSON::Fragment"
|
|
23
23
|
gem "rspec", "~> 3.0"
|
|
24
24
|
gem "rubocop", "~> 1.18", require: false
|
|
25
25
|
gem "rubocop-rake", "~> 0.6", require: false
|
|
26
26
|
gem "rubocop-rspec", "~> 3.5", require: false
|
|
27
27
|
gem "simplecov", "~> 0.22"
|
|
28
|
-
gem "json_pure", "~> 2.8", require: false # Solargraph pulls in v2.6.3 which fails build with " uninitialized constant JSON::Fragment"
|
|
29
28
|
end
|
data/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
# Jekyll Glossary Tooltip Tag Plugin [](https://x.com/intent/tweet?text=Get%20a%20nifty%20tooltip%20for%20term%20definitions%20in%20your%20Jekyll%20blog%20with%20this%20plugin&url=https://github.com/erikw/jekyll-glossary_tooltip&via=erik_westrup&hashtags=jekyll,plugin)
|
|
2
2
|
[](https://badge.fury.io/rb/jekyll-glossary_tooltip)
|
|
3
3
|
[](https://rubygems.org/gems/jekyll-glossary_tooltip)
|
|
4
|
-
[](https://codeclimate.com/github/erikw/jekyll-glossary_tooltip/maintainability)
|
|
7
|
-
[](https://codeclimate.com/github/erikw/jekyll-glossary_tooltip/test_coverage)
|
|
4
|
+
[](https://github.com/erikw/jekyll-glossary_tooltip/actions/workflows/ci.yml)
|
|
5
|
+
[](https://github.com/erikw/jekyll-glossary_tooltip/actions/workflows/cd.yml)
|
|
8
6
|
[](https://github.com/erikw/jekyll-glossary_tooltip/actions/workflows/codeql-analysis.yml)
|
|
7
|
+
[](https://github.com/erikw/jekyll-glossary_tooltip/actions/workflows/pages/pages-build-deployment)
|
|
8
|
+
[](https://qlty.sh/gh/erikw/projects/jekyll-glossary_tooltip)
|
|
9
|
+
[](https://qlty.sh/gh/erikw/projects/jekyll-glossary_tooltip)
|
|
9
10
|
[](#)
|
|
10
11
|
[](#)
|
|
11
12
|
[](#)
|
|
@@ -23,9 +24,9 @@
|
|
|
23
24
|
|
|
24
25
|
<img src="/img/tooltip_screenshot.png" width="256" align="right" alt="Screenshot of the glossary tooltip term definition" title="Example of tooltip definition of the term 'Jekyll'.">
|
|
25
26
|
|
|
26
|
-
This plugin simplifies for your
|
|
27
|
+
This plugin simplifies things for your website visitors and you by making it easy to define terms or abbreviations that need an explanation. Define a common dictionary of terms and their definition in a YAML file. Then, inside the markdown file, you can use the provided glossary liquid tag to insert a tooltip for a defined word from the dictionary. The tooltip will show the term definition on mouse hover.
|
|
27
28
|
|
|
28
|
-
It's also possible to provide an optional URL
|
|
29
|
+
It's also possible to provide an optional URL for, for example, a term definition source reference. To also support mobile devices, this URL link is placed inside the tooltip pop-up itself, rather than making the term itself clickable. This is so that on a mobile device, you will first tap the word to get the hover tooltip, then click the link in the tooltip if desired.
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
# Installation
|
|
@@ -49,8 +50,7 @@ It's also possible to provide an optional URL to for example a term definition s
|
|
|
49
50
|
```
|
|
50
51
|
1. Create a `_data/glossary.yml` file, according to the 'Glossary Term Definition File' section below, with your terms.
|
|
51
52
|
1. Use the liquid tag in a page like `{% glossary term_name %}`
|
|
52
|
-
1.
|
|
53
|
-
1. Now just build your site and you will get nice nice term definition tooltips on mouse hover (or mobile, tap) for you terms!
|
|
53
|
+
1. Now just build your site, and you will get nice, nice term definition tooltips on mouse hover (or mobile, tap) for your terms!
|
|
54
54
|
```shell
|
|
55
55
|
bundle exec jekyll build
|
|
56
56
|
```
|
|
@@ -70,15 +70,15 @@ Create a file `_data/glossary.yml` to host your shared term definition entries.
|
|
|
70
70
|
This could look something like:
|
|
71
71
|
```markdown
|
|
72
72
|
- term: Jekyll
|
|
73
|
-
definition: A Static Site Generator (SSG) built with
|
|
73
|
+
definition: A Static Site Generator (SSG) built with Ruby. Widely adopted as of GitHub Pages inclusion.
|
|
74
74
|
url: https://jekyllrb.com/
|
|
75
75
|
- term: SSG
|
|
76
|
-
definition: A Static Site Generator compiles the website before deployment. Then the generated web content is simply retrieved as-is by the client without any code running at
|
|
76
|
+
definition: A Static Site Generator compiles the website before deployment. Then the generated web content is simply retrieved as-is by the client without any code running at retrieval time.
|
|
77
77
|
- term: Jamstack
|
|
78
|
-
definition: JavaScript + API + Markup - a way of
|
|
78
|
+
definition: JavaScript + API + Markup - a way of building and hosting websites.
|
|
79
79
|
url: https://jamstack.org/
|
|
80
80
|
- term: EmbeddedLiquidURL
|
|
81
|
-
definition: This definition has
|
|
81
|
+
definition: This definition has a URL with embedded liquid tags to make it dynamic at build time. Note special YAML syntax for being able to use liquid (1.)
|
|
82
82
|
url: >
|
|
83
83
|
{{ site.baseurl }}{% link page2.md %}
|
|
84
84
|
```
|
|
@@ -87,21 +87,28 @@ This could look something like:
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
## Tag Usage
|
|
90
|
-
On any page where you've made sure include the needed CSS styling, you can use the glossary tag simply like
|
|
90
|
+
On any page where you've made sure to include the needed CSS styling, you can use the glossary tag simply like
|
|
91
91
|
|
|
92
92
|
```markdown
|
|
93
93
|
Here I'm talking about {% glossary term_name %} in a blog post.
|
|
94
94
|
|
|
95
95
|
The term name can contain spaces like {% glossary operating system %}.
|
|
96
96
|
|
|
97
|
-
Even if the term is defined in _data/glossary.yml as 'term_name', the matching is case-insensitive
|
|
97
|
+
Even if the term is defined in _data/glossary.yml as 'term_name', the matching is case-insensitive
|
|
98
|
+
meaning that I can look it up using {% glossary TeRM_NaME %}. Note that the term is displayed as
|
|
99
|
+
defined in the tag rather than the definition, here meaning 'TeRM_NaME'.
|
|
98
100
|
|
|
99
|
-
The case-styling above works as there's still a case-insensitive match. But what about when you
|
|
101
|
+
The case-styling above works as there's still a case-insensitive match. But what about when you
|
|
102
|
+
actually want to display the term differently? Maybe the term is defined as "cat," but you want to
|
|
103
|
+
use the plural "cats"? Then you can supply an optional `display` argument. The syntax is:
|
|
100
104
|
{% glossary <term>, display: <diplay name> %}
|
|
101
105
|
|
|
102
|
-
This could be e.g.
|
|
106
|
+
This could be, e.g.
|
|
103
107
|
{% glossary cat, display: cats %}
|
|
104
108
|
{% glossary some term, display: some other display text %}
|
|
109
|
+
|
|
110
|
+
When `display:` is used, the tooltip prepends the original glossary term before the definition so
|
|
111
|
+
readers still get the term's original context.
|
|
105
112
|
```
|
|
106
113
|
|
|
107
114
|
> [!WARNING]
|
|
@@ -109,11 +116,22 @@ This could be e.g.
|
|
|
109
116
|
|
|
110
117
|
|
|
111
118
|
## CSS Style Override
|
|
112
|
-
|
|
119
|
+
The plugin automatically injects its bundled tooltip CSS as a `<style>` block into every rendered HTML page, so no manual CSS setup is required.
|
|
120
|
+
|
|
121
|
+
The injected styles are placed at the start of `<head>`, which means any CSS your site loads afterward will naturally take precedence. To override specific rules, simply add your own declarations in your site's stylesheet — they will win without any extra configuration.
|
|
122
|
+
|
|
123
|
+
If you want full control (e.g., to replace the styles entirely with your own stylesheet), you can disable the built-in injection in `_config.yml`:
|
|
124
|
+
|
|
125
|
+
```yml
|
|
126
|
+
glossary_tooltip:
|
|
127
|
+
include_default_style: false
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Then add your own CSS based on [jekyll-glossary_tooltip.css](lib/jekyll-glossary_tooltip/jekyll-glossary_tooltip.css). View the generated HTML output to see the HTML tags that are styled, or check the [tag.rb](lib/jekyll-glossary_tooltip/tag.rb) implementation in the method `render()`.
|
|
113
131
|
|
|
114
132
|
|
|
115
133
|
## Page listing all terms
|
|
116
|
-
Thanks to this user
|
|
134
|
+
Thanks to this user-submitted [idea](https://github.com/erikw/jekyll-glossary_tooltip/issues/6) we have a way to create a page listing all terms with definitions and URLs.
|
|
117
135
|
|
|
118
136
|
:point_right: **Live demo**: https://erikw.github.io/jekyll-glossary_tooltip/glossary.html
|
|
119
137
|
|
|
@@ -126,7 +144,7 @@ Steps:
|
|
|
126
144
|
The structure of this plugin was inspired by [https://ayastreb.me/writing-a-jekyll-plugin/](https://ayastreb.me/writing-a-jekyll-plugin/), the plugin jekyll-sitemap and the [Bundler Gem tutorial](https://bundler.io/guides/creating_gem.html).
|
|
127
145
|
|
|
128
146
|
After checking out the repo;
|
|
129
|
-
1. Install [RVM](https://rvm.io/rvm/install) and install a supported
|
|
147
|
+
1. Install [RVM](https://rvm.io/rvm/install) and install a supported Ruby version (see .gemspec)
|
|
130
148
|
1. run `scripts/setup` to install dependencies
|
|
131
149
|
1. run `scripts/test` to run the tests
|
|
132
150
|
* Run a specific test with `bundle exec rspec -e "name of test example"`
|
|
@@ -145,13 +163,13 @@ Following the setup at [how-to-specify-local-ruby-gems-in-your-gemfile](https://
|
|
|
145
163
|
1. Configure bundler to use a local path for this gem in this project:
|
|
146
164
|
- `$ bundle config --local local.jekyll-glossary_tooltip ~/src/jekyll-glossary_tooltip`
|
|
147
165
|
1. Update the project: `$ bundle install`
|
|
148
|
-
1. Now the project will build with the local clone of this plugin when issuing e.g
|
|
166
|
+
1. Now the project will build with the local clone of this plugin when issuing e.g., `bundle exec jekyll build`
|
|
149
167
|
1. When you're done:
|
|
150
168
|
- Remove the local override with: `$ bundle config --delete local.jekyll-glossary_tooltip`
|
|
151
|
-
- Optionally restore the original gem
|
|
169
|
+
- Optionally restore the original gem included in `Gemfile` or keep building from a branch in the GitHub repo.
|
|
152
170
|
|
|
153
171
|
## Releasing
|
|
154
|
-
Instructions for releasing on rubygems.org below. Optionally make a GitHub [release](https://github.com/erikw/jekyll-glossary_tooltip/releases) after this for the pushed git tag.
|
|
172
|
+
Instructions for releasing on rubygems.org are below. Optionally make a GitHub [release](https://github.com/erikw/jekyll-glossary_tooltip/releases) after this for the pushed git tag.
|
|
155
173
|
|
|
156
174
|
## Using bundler/gem_tasks rake tasks
|
|
157
175
|
Following instructions from [bundler.io](https://bundler.io/guides/creating_gem.html#releasing-the-gem):
|
|
@@ -166,16 +184,17 @@ gem install pkg/jekyll-glossary_tooltip-$ver.gem
|
|
|
166
184
|
bundle exec rake release
|
|
167
185
|
```
|
|
168
186
|
|
|
169
|
-
## Using gem-release gem extension
|
|
187
|
+
## [recommended] Using gem-release gem extension
|
|
170
188
|
Using [gem-release](https://github.com/svenfuchs/gem-release):
|
|
171
189
|
```shell
|
|
172
190
|
vi CHANGELOG.md && git add CHANGELOG.md && git commit -m "Update CHANGELOG.md" && git push
|
|
191
|
+
gem signin
|
|
173
192
|
gem bump --version minor --tag --push --release --sign
|
|
174
193
|
```
|
|
175
194
|
For `--version`, use `major|minor|patch` as needed.
|
|
176
195
|
|
|
177
196
|
## Multi-versions
|
|
178
|
-
* For
|
|
197
|
+
* For Ruby, just use RVM to switch between supported Ruby versions specified in `.gemspec`.
|
|
179
198
|
* To run with different jekyll versions, [Appraisal](https://github.com/thoughtbot/appraisal) is used with [`Appraisals`](Appraisals) to generate different [`gemfiles/`](gemfiles/)
|
|
180
199
|
- To use a specific Gemfile, run like
|
|
181
200
|
```shell
|
|
@@ -192,29 +211,6 @@ For `--version`, use `major|minor|patch` as needed.
|
|
|
192
211
|
bundle exec appraisal generate
|
|
193
212
|
```
|
|
194
213
|
|
|
195
|
-
## Travis
|
|
196
|
-
To use the [travis cli client](https://github.com/travis-ci/travis.rb) (installed from `Gemfile`):
|
|
197
|
-
1. Get a GitHub OAuth token by
|
|
198
|
-
- going to [github.com/settings/tokens](https://github.com/settings/tokens)
|
|
199
|
-
- create a new token named `travis-cli`
|
|
200
|
-
- Set the scopes `repo`, `read:org`, `user:email` according to the [docs](https://docs.travis-ci.com/user/github-oauth-scopes).
|
|
201
|
-
1. Set travis.com as the default so we don't need to add `--pro` to most commands
|
|
202
|
-
```shell
|
|
203
|
-
bundle exec travis endpoint --set-default --api-endpoint https://api.travis-ci.com/
|
|
204
|
-
```
|
|
205
|
-
1. Login with the cli client
|
|
206
|
-
```shell
|
|
207
|
-
bundle exec travis login --github-token $GITHUB_TOKEN
|
|
208
|
-
```
|
|
209
|
-
1. Now the cli client can be used (might need `--pro` to use travis.com)
|
|
210
|
-
```shell
|
|
211
|
-
bundle exec travis lint
|
|
212
|
-
bundle exec travis accounts
|
|
213
|
-
bundle exec travis status
|
|
214
|
-
bundle exec travis branches
|
|
215
|
-
bundle exec travis monitor
|
|
216
|
-
```
|
|
217
|
-
|
|
218
214
|
## Live Demo GitHub Pages
|
|
219
215
|
The live demo source is in the branch [`gh-pages-source`](https://github.com/erikw/jekyll-glossary_tooltip/tree/gh-pages-source). Check its `README.md`!
|
|
220
216
|
|
data/Rakefile
CHANGED
|
@@ -13,7 +13,14 @@ RSpec::Core::RakeTask.new(:spec)
|
|
|
13
13
|
require "rubocop/rake_task"
|
|
14
14
|
RuboCop::RakeTask.new(:rubocop) do |t|
|
|
15
15
|
# See https://docs.rubocop.org/rubocop/usage/basic_usage.html
|
|
16
|
-
t.options = [
|
|
16
|
+
t.options = ["--display-cop-names", "--parallel"]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
desc "Run Qlty code analysis"
|
|
20
|
+
task :qlty do
|
|
21
|
+
sh "qlty smells --all"
|
|
22
|
+
sh "qlty metrics --all --max-depth=2 --sort complexity --limit 10"
|
|
23
|
+
# sh "qlty lint" # Just runs rubocop, not necessary as we have a task for this already
|
|
17
24
|
end
|
|
18
25
|
|
|
19
26
|
# default task: Add spec and rubocop to default tasks.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jekyll
|
|
4
|
+
module GlossaryTooltip
|
|
5
|
+
# Automatically injects the plugin's bundled tooltip CSS into rendered HTML pages and
|
|
6
|
+
# documents. Injection can be disabled via site configuration:
|
|
7
|
+
#
|
|
8
|
+
# glossary_tooltip:
|
|
9
|
+
# include_default_style: false
|
|
10
|
+
#
|
|
11
|
+
module CssInjector
|
|
12
|
+
CSS_FILE = File.join(__dir__, "jekyll-glossary_tooltip.css")
|
|
13
|
+
CSS_CONTENT = File.read(CSS_FILE).freeze
|
|
14
|
+
STYLE_ID = "jekyll-glossary-tooltip-style"
|
|
15
|
+
STYLE_BLOCK = "<style id=\"#{STYLE_ID}\">\n#{CSS_CONTENT}</style>".freeze
|
|
16
|
+
|
|
17
|
+
# Matches an opening <head> tag, including any attributes (e.g. <head lang="en">).
|
|
18
|
+
HEAD_TAG_REGEX = /<head\b[^>]*>/i.freeze
|
|
19
|
+
|
|
20
|
+
class << self
|
|
21
|
+
def register_hooks
|
|
22
|
+
Jekyll::Hooks.register(%i[pages documents], :post_render) do |doc|
|
|
23
|
+
inject_style(doc)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def inject_style(doc)
|
|
28
|
+
return unless enabled?(doc.site)
|
|
29
|
+
return unless doc.output.to_s.match?(HEAD_TAG_REGEX)
|
|
30
|
+
return if doc.output.include?(STYLE_ID)
|
|
31
|
+
|
|
32
|
+
doc.output = doc.output.sub(HEAD_TAG_REGEX) { |match| "#{match}\n#{STYLE_BLOCK}" }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
def enabled?(site)
|
|
38
|
+
config = site.config["glossary_tooltip"] || {}
|
|
39
|
+
config.fetch("include_default_style", true)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
Jekyll::GlossaryTooltip::CssInjector.register_hooks
|
|
@@ -7,7 +7,7 @@ module Jekyll
|
|
|
7
7
|
# Stripped down & modified version of
|
|
8
8
|
# https://github.com/ayastreb/jekyll-maps/blob/master/lib/jekyll-maps/options_parser.rb
|
|
9
9
|
class OptionsParser
|
|
10
|
-
ARGS_PATTERN = %r{\s*(\
|
|
10
|
+
ARGS_PATTERN = %r{\s*([\p{L}_][-\p{L}_]*):\s*([\p{L}_][^,\n\r]*)}
|
|
11
11
|
ARGS_ALLOWED = %w[
|
|
12
12
|
display
|
|
13
13
|
].freeze
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "jekyll"
|
|
4
4
|
require "jekyll-glossary_tooltip/errors"
|
|
5
|
+
require "jekyll-glossary_tooltip/options_parser"
|
|
5
6
|
|
|
6
7
|
module Jekyll
|
|
7
8
|
module GlossaryTooltip
|
|
@@ -14,13 +15,11 @@ module Jekyll
|
|
|
14
15
|
|
|
15
16
|
def render(context)
|
|
16
17
|
entry = lookup_entry(context.registers[:site], @opts[:term_query])
|
|
17
|
-
@opts[:display]
|
|
18
|
+
display = @opts[:display] || @opts[:term_query]
|
|
18
19
|
html = <<~HTML
|
|
19
20
|
<span class="jekyll-glossary">
|
|
20
|
-
#{
|
|
21
|
-
<span class="jekyll-glossary-tooltip">
|
|
22
|
-
<span class="jekyll-glossary-tooltip-hidden">(</span>#{entry["definition"]}#{render_tooltip_url(entry, context)}<span class="jekyll-glossary-tooltip-hidden">)</span>
|
|
23
|
-
</span>
|
|
21
|
+
#{display}
|
|
22
|
+
<span class="jekyll-glossary-tooltip"><span class="jekyll-glossary-tooltip-hidden">(</span>#{render_tooltip_definition(entry)}#{render_tooltip_url(entry, context)}<span class="jekyll-glossary-tooltip-hidden">)</span></span>
|
|
24
23
|
</span>
|
|
25
24
|
HTML
|
|
26
25
|
html.gsub("\n", "")
|
|
@@ -30,6 +29,12 @@ module Jekyll
|
|
|
30
29
|
|
|
31
30
|
LOG_TAG = "Glossary Tag:"
|
|
32
31
|
|
|
32
|
+
def render_tooltip_definition(entry)
|
|
33
|
+
return entry["definition"] unless @opts[:display]
|
|
34
|
+
|
|
35
|
+
"#{entry["term"]}: #{entry["definition"]}"
|
|
36
|
+
end
|
|
37
|
+
|
|
33
38
|
def render_tooltip_url(entry, context)
|
|
34
39
|
# The content of the anchor is set from the CSS class jekyll-glossary-source-link,
|
|
35
40
|
# so that the plugin user can customize the text without touching ruby source.
|
data/scripts/setup
CHANGED
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:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Erik Westrup
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-05-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|
|
@@ -47,13 +47,16 @@ files:
|
|
|
47
47
|
- ".editorconfig"
|
|
48
48
|
- ".github/dependabot.yml"
|
|
49
49
|
- ".github/workflows/cd.yml"
|
|
50
|
+
- ".github/workflows/ci.yml"
|
|
50
51
|
- ".github/workflows/codeql-analysis.yml"
|
|
51
52
|
- ".gitignore"
|
|
53
|
+
- ".qlty/.gitignore"
|
|
54
|
+
- ".qlty/configs/.shellcheckrc"
|
|
55
|
+
- ".qlty/qlty.toml"
|
|
52
56
|
- ".rspec"
|
|
53
57
|
- ".rubocop.yml"
|
|
54
58
|
- ".ruby-version"
|
|
55
59
|
- ".simplecov"
|
|
56
|
-
- ".travis.yml"
|
|
57
60
|
- Appraisals
|
|
58
61
|
- CHANGELOG.md
|
|
59
62
|
- CONTRIBUTING.md
|
|
@@ -70,6 +73,7 @@ files:
|
|
|
70
73
|
- img/tooltip_screenshot.xcf
|
|
71
74
|
- jekyll-glossary_tooltip.gemspec
|
|
72
75
|
- lib/jekyll-glossary_tooltip.rb
|
|
76
|
+
- lib/jekyll-glossary_tooltip/css_injector.rb
|
|
73
77
|
- lib/jekyll-glossary_tooltip/errors.rb
|
|
74
78
|
- lib/jekyll-glossary_tooltip/jekyll-glossary_tooltip.css
|
|
75
79
|
- lib/jekyll-glossary_tooltip/options_parser.rb
|
|
@@ -88,7 +92,7 @@ metadata:
|
|
|
88
92
|
homepage_uri: https://github.com/erikw/jekyll-glossary_tooltip/
|
|
89
93
|
source_code_uri: https://github.com/erikw/jekyll-glossary_tooltip/
|
|
90
94
|
changelog_uri: https://github.com/erikw/jekyll-glossary_tooltip/blob/main/CHANGELOG.md
|
|
91
|
-
post_install_message:
|
|
95
|
+
post_install_message:
|
|
92
96
|
rdoc_options: []
|
|
93
97
|
require_paths:
|
|
94
98
|
- lib
|
|
@@ -106,8 +110,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
106
110
|
- !ruby/object:Gem::Version
|
|
107
111
|
version: '0'
|
|
108
112
|
requirements: []
|
|
109
|
-
rubygems_version: 3.
|
|
110
|
-
signing_key:
|
|
113
|
+
rubygems_version: 3.3.3
|
|
114
|
+
signing_key:
|
|
111
115
|
specification_version: 4
|
|
112
116
|
summary: Jekyll plugin providing a glossary liquid tag that will show a tooltip of
|
|
113
117
|
a term definition in your site.
|
data/.travis.yml
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# NOTE run $(travis lint) after modyifing this file.
|
|
2
|
-
|
|
3
|
-
# Travis
|
|
4
|
-
# - build lifecycle: https://docs.travis-ci.com/user/job-lifecycle
|
|
5
|
-
# - config doc: https://config.travis-ci.com/
|
|
6
|
-
# - ruby defaults: https://docs.travis-ci.com/user/languages/ruby/
|
|
7
|
-
# Codeclimate setup: https://docs.codeclimate.com/docs/travis-ci-test-coverage
|
|
8
|
-
|
|
9
|
-
version: ~> 1.0
|
|
10
|
-
env:
|
|
11
|
-
global:
|
|
12
|
-
- CC_TEST_REPORTER_ID=8b8822cdaba8bb6c0a9d3f05bea9bc94dbf866ccdd1204913f5673b61caa61b1
|
|
13
|
-
language: ruby
|
|
14
|
-
dist: focal # TODO Remove this when solved: https://github.com/rvm/rvm/issues/5133
|
|
15
|
-
# Buid matrix (rvm x gemfile = 2x2) with one version from each supported major version in range defined in .gemspec for
|
|
16
|
-
rvm:
|
|
17
|
-
- 2.7.0
|
|
18
|
-
- 3.0.1
|
|
19
|
-
gemfile:
|
|
20
|
-
- gemfiles/jekyll_3.7.x.gemfile
|
|
21
|
-
- gemfiles/jekyll_4.x.x.gemfile
|
|
22
|
-
cache: bundler
|
|
23
|
-
before_install: gem install bundler -v 2.2.18
|
|
24
|
-
#install: bundle install # Default
|
|
25
|
-
before_script:
|
|
26
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
|
27
|
-
- chmod +x ./cc-test-reporter
|
|
28
|
-
- ./cc-test-reporter before-build
|
|
29
|
-
#script: bundle exec rake # Default
|
|
30
|
-
after_script:
|
|
31
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|