jekyll-glossary_tooltip 2.1.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 +2 -1
- data/.rubocop.yml +14 -13
- data/CHANGELOG.md +53 -15
- data/README.md +15 -2
- data/lib/jekyll-glossary_tooltip/css_injector.rb +46 -0
- data/lib/jekyll-glossary_tooltip/tag.rb +10 -3
- data/lib/jekyll-glossary_tooltip/version.rb +1 -1
- data/lib/jekyll-glossary_tooltip.rb +1 -0
- metadata +3 -2
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
|
data/.github/workflows/ci.yml
CHANGED
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,55 +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
|
+
|
|
9
22
|
## [2.1.0] - 2025-10-30
|
|
23
|
+
|
|
10
24
|
### Added
|
|
11
|
-
|
|
25
|
+
|
|
26
|
+
* Unicode support [#20](https://github.com/erikw/jekyll-glossary_tooltip/pull/20)
|
|
27
|
+
|
|
12
28
|
### Changed
|
|
13
|
-
|
|
29
|
+
|
|
30
|
+
* Migrated CI from Travis to GitHub Actions.
|
|
14
31
|
|
|
15
32
|
## [2.0.0] - 2025-03-31
|
|
33
|
+
|
|
16
34
|
### Added
|
|
17
|
-
|
|
18
|
-
|
|
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.
|
|
19
38
|
|
|
20
39
|
## [1.5.1] - 2025-03-10
|
|
40
|
+
|
|
21
41
|
### Fixed
|
|
22
|
-
|
|
42
|
+
|
|
43
|
+
* Strip newlines from generated HTML to prevent unnecessary spaces to be added. [#9](https://github.com/erikw/jekyll-glossary_tooltip/issues/9)
|
|
23
44
|
|
|
24
45
|
## [1.5.0] - 2022-09-08
|
|
46
|
+
|
|
25
47
|
### Added
|
|
26
|
-
|
|
48
|
+
|
|
49
|
+
* Support for embedded liquid tags in the url field. ([#3](https://github.com/erikw/jekyll-glossary_tooltip/issues/3])
|
|
27
50
|
|
|
28
51
|
## [1.4.0] - 2021-08-18
|
|
52
|
+
|
|
29
53
|
### Changed
|
|
54
|
+
|
|
30
55
|
* Bump local ruby to 3.1.0
|
|
31
56
|
|
|
32
57
|
## [1.3.1] - 2021-08-18
|
|
58
|
+
|
|
33
59
|
### Added
|
|
34
|
-
|
|
60
|
+
|
|
61
|
+
* GitHub workflow to publish to GitHub Packages.
|
|
35
62
|
|
|
36
63
|
## [1.3.1] - 2021-08-18
|
|
64
|
+
|
|
37
65
|
### Fixed
|
|
38
|
-
|
|
66
|
+
|
|
67
|
+
* gemspec dependency range stynax.
|
|
39
68
|
|
|
40
69
|
## [1.3.0] - 2021-08-07
|
|
70
|
+
|
|
41
71
|
### Changed
|
|
42
|
-
|
|
72
|
+
|
|
73
|
+
* Open the souce link from a tooltip in a new tab.
|
|
43
74
|
|
|
44
75
|
## [1.2.0] - 2021-08-06
|
|
76
|
+
|
|
45
77
|
### Added
|
|
46
|
-
|
|
47
|
-
|
|
78
|
+
|
|
79
|
+
* Bottom arrow to the tooltip.
|
|
80
|
+
* Tooltip hover animation from invisible to visible.
|
|
48
81
|
|
|
49
82
|
### Changed
|
|
50
|
-
|
|
83
|
+
|
|
84
|
+
* Restyle the glossary term bottom border style and color.
|
|
51
85
|
|
|
52
86
|
## [1.1.0] - 2021-08-06
|
|
87
|
+
|
|
53
88
|
### Added
|
|
54
|
-
|
|
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 %}`.
|
|
55
91
|
|
|
56
92
|
## [1.0.0] - 2021-08-05
|
|
57
|
-
|
|
93
|
+
|
|
94
|
+
* No changes from `v0.1.0` but just bumping to final first major release version!
|
|
58
95
|
|
|
59
96
|
## [0.1.0] - 2021-08-05
|
|
60
|
-
|
|
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/README.md
CHANGED
|
@@ -50,7 +50,6 @@ It's also possible to provide an optional URL for, for example, a term definitio
|
|
|
50
50
|
```
|
|
51
51
|
1. Create a `_data/glossary.yml` file, according to the 'Glossary Term Definition File' section below, with your terms.
|
|
52
52
|
1. Use the liquid tag in a page like `{% glossary term_name %}`
|
|
53
|
-
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 into your `main.css` or `main.scss` or however you build your site's CSS.
|
|
54
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!
|
|
55
54
|
```shell
|
|
56
55
|
bundle exec jekyll build
|
|
@@ -107,6 +106,9 @@ use the plural "cats"? Then you can supply an optional `display` argument. The s
|
|
|
107
106
|
This could be, e.g.
|
|
108
107
|
{% glossary cat, display: cats %}
|
|
109
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.
|
|
110
112
|
```
|
|
111
113
|
|
|
112
114
|
> [!WARNING]
|
|
@@ -114,7 +116,18 @@ This could be, e.g.
|
|
|
114
116
|
|
|
115
117
|
|
|
116
118
|
## CSS Style Override
|
|
117
|
-
|
|
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()`.
|
|
118
131
|
|
|
119
132
|
|
|
120
133
|
## Page listing all terms
|
|
@@ -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
|
|
@@ -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,11 +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"><span class="jekyll-glossary-tooltip-hidden">(</span>#{entry
|
|
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>
|
|
22
23
|
</span>
|
|
23
24
|
HTML
|
|
24
25
|
html.gsub("\n", "")
|
|
@@ -28,6 +29,12 @@ module Jekyll
|
|
|
28
29
|
|
|
29
30
|
LOG_TAG = "Glossary Tag:"
|
|
30
31
|
|
|
32
|
+
def render_tooltip_definition(entry)
|
|
33
|
+
return entry["definition"] unless @opts[:display]
|
|
34
|
+
|
|
35
|
+
"#{entry["term"]}: #{entry["definition"]}"
|
|
36
|
+
end
|
|
37
|
+
|
|
31
38
|
def render_tooltip_url(entry, context)
|
|
32
39
|
# The content of the anchor is set from the CSS class jekyll-glossary-source-link,
|
|
33
40
|
# so that the plugin user can customize the text without touching ruby source.
|
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
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
|
|
@@ -73,6 +73,7 @@ files:
|
|
|
73
73
|
- img/tooltip_screenshot.xcf
|
|
74
74
|
- jekyll-glossary_tooltip.gemspec
|
|
75
75
|
- lib/jekyll-glossary_tooltip.rb
|
|
76
|
+
- lib/jekyll-glossary_tooltip/css_injector.rb
|
|
76
77
|
- lib/jekyll-glossary_tooltip/errors.rb
|
|
77
78
|
- lib/jekyll-glossary_tooltip/jekyll-glossary_tooltip.css
|
|
78
79
|
- lib/jekyll-glossary_tooltip/options_parser.rb
|