auto_glossary 0.1.0 → 0.1.1
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/CHANGELOG.md +25 -0
- data/README.md +127 -14
- data/app/controllers/auto_glossary/glossary_controller.rb +1 -0
- data/lib/auto_glossary/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 813e962b2d5958e1ee0c7cb5bd6413f26c02642af914e5fce89ec950e8954f57
|
|
4
|
+
data.tar.gz: 8121ec42733161e0487e0062db1e28f73e75b47abc17d9b0dd8e61197bc1408d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a0e445b98e5e3c7c1b6e1a544cbd4a5bfde53c79dba364033f1e12d5688860ff404ec635f26c3c3a0f8fa802f381be43aa194f9b03ad0045d7d2d218c7bd59c8
|
|
7
|
+
data.tar.gz: b01082634e8538b6cf02d425006119a5c16b55d158060507830fcf111187da0fc9f7dade38a2886bda104259ddb512f229bc72297243fbe89d0aeb4e61e05bed
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-02-19
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of Auto-Glossary gem
|
|
12
|
+
- Wikipedia glossary term fetching and caching
|
|
13
|
+
- Automatic term highlighting in Rails views
|
|
14
|
+
- Hover tooltips with term definitions
|
|
15
|
+
- Click-through modals for full definitions
|
|
16
|
+
- Rails Engine architecture for easy integration
|
|
17
|
+
- Install generator for quick setup
|
|
18
|
+
- Smart plural and variation handling
|
|
19
|
+
- Accessible keyboard navigation
|
|
20
|
+
- Responsive design for all devices
|
|
21
|
+
- API endpoint for term definitions
|
|
22
|
+
- Stimulus JavaScript controller
|
|
23
|
+
- Complete documentation and examples
|
|
24
|
+
|
|
25
|
+
[0.1.0]: https://github.com/mrdbidwill/auto-glossary/releases/tag/v0.1.0
|
data/README.md
CHANGED
|
@@ -1,35 +1,148 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Auto-Glossary
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Automatically highlight and define technical terms from Wikipedia glossaries in your Rails applications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## What It Does
|
|
6
|
+
|
|
7
|
+
Auto-Glossary identifies technical terms in your content and provides instant definitions from Wikipedia. Perfect for educational websites, scientific documentation, and technical blogs.
|
|
8
|
+
|
|
9
|
+
**Example:**
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
The basidiospores are produced by the basidium on the hymenium surface of the pileus.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
With Auto-Glossary, each technical term becomes interactive with:
|
|
16
|
+
- **Hover tooltips** - Quick definition preview
|
|
17
|
+
- **Click modals** - Full definition with Wikipedia attribution
|
|
18
|
+
- **Smart matching** - Handles plurals and variations automatically
|
|
19
|
+
|
|
20
|
+
## Demo
|
|
21
|
+
|
|
22
|
+
Visit [auto-glossary.com](https://auto-glossary.com/demo) to see it in action!
|
|
6
23
|
|
|
7
24
|
## Installation
|
|
8
25
|
|
|
9
|
-
|
|
26
|
+
Add this line to your Rails application's Gemfile:
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
gem 'auto_glossary'
|
|
30
|
+
```
|
|
10
31
|
|
|
11
|
-
|
|
32
|
+
Then execute:
|
|
12
33
|
|
|
13
34
|
```bash
|
|
14
|
-
bundle
|
|
35
|
+
bundle install
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or install it yourself:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
gem install auto_glossary
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
### 1. Run the installer
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
rails generate auto_glossary:install
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This will:
|
|
53
|
+
- Mount the engine routes
|
|
54
|
+
- Copy the Stimulus JavaScript controller
|
|
55
|
+
- Show you the next steps
|
|
56
|
+
|
|
57
|
+
### 2. Add stylesheet to your layout
|
|
58
|
+
|
|
59
|
+
In `app/views/layouts/application.html.erb`, add:
|
|
60
|
+
|
|
61
|
+
```erb
|
|
62
|
+
<%= stylesheet_link_tag 'glossary', 'data-turbo-track': 'reload' %>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 3. Add Stimulus controller to body tag
|
|
66
|
+
|
|
67
|
+
```erb
|
|
68
|
+
<body data-controller="glossary">
|
|
15
69
|
```
|
|
16
70
|
|
|
17
|
-
|
|
71
|
+
### 4. Use in your views
|
|
72
|
+
|
|
73
|
+
```erb
|
|
74
|
+
<%= mark_glossary_terms(@article.body) %>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 5. Restart your Rails server
|
|
18
78
|
|
|
19
79
|
```bash
|
|
20
|
-
|
|
80
|
+
rails server
|
|
21
81
|
```
|
|
22
82
|
|
|
23
|
-
|
|
83
|
+
Done! Technical terms will now be automatically highlighted with hover tooltips and click-through definitions.
|
|
84
|
+
|
|
85
|
+
## Usage Examples
|
|
24
86
|
|
|
25
|
-
|
|
87
|
+
### Basic Usage
|
|
26
88
|
|
|
27
|
-
|
|
89
|
+
```erb
|
|
90
|
+
<%= mark_glossary_terms(@text) %>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Mark Only First Occurrence
|
|
94
|
+
|
|
95
|
+
```erb
|
|
96
|
+
<%= mark_glossary_terms(@text, first_only: true) %>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Mark All Occurrences
|
|
100
|
+
|
|
101
|
+
```erb
|
|
102
|
+
<%= mark_glossary_terms(@text, first_only: false) %>
|
|
103
|
+
```
|
|
28
104
|
|
|
29
|
-
|
|
105
|
+
### Browse All Terms
|
|
30
106
|
|
|
31
|
-
|
|
107
|
+
Visit `/glossary` in your app to see all available glossary terms and definitions.
|
|
108
|
+
|
|
109
|
+
## Features
|
|
110
|
+
|
|
111
|
+
- ⚡ **Fast** - Aggressive caching (24 hours), minimal performance impact
|
|
112
|
+
- 🎯 **Smart** - Handles plurals, variations, and edge cases automatically
|
|
113
|
+
- 📱 **Responsive** - Beautiful tooltips and modals on all devices
|
|
114
|
+
- ♿ **Accessible** - Full keyboard navigation and screen reader support
|
|
115
|
+
- 🔌 **No Database Required** - Uses Rails.cache and Wikipedia API
|
|
116
|
+
- ⚖️ **Open Source** - MIT licensed
|
|
117
|
+
|
|
118
|
+
## How It Works
|
|
119
|
+
|
|
120
|
+
1. Fetches glossary terms from Wikipedia's "Glossary of Mycology"
|
|
121
|
+
2. Caches terms for 24 hours
|
|
122
|
+
3. Marks terms in your text with special HTML
|
|
123
|
+
4. JavaScript handles tooltips and modals
|
|
124
|
+
5. Definitions loaded on-demand from Wikipedia
|
|
125
|
+
|
|
126
|
+
## Configuration
|
|
127
|
+
|
|
128
|
+
The gem uses the [Glossary of Mycology](https://en.wikipedia.org/wiki/Glossary_of_mycology) by default. To use a different Wikipedia glossary, override the `GLOSSARY_PAGE` constant in `WikipediaGlossaryService`.
|
|
129
|
+
|
|
130
|
+
## Requirements
|
|
131
|
+
|
|
132
|
+
- Rails 7.0 or higher
|
|
133
|
+
- Ruby 3.2 or higher
|
|
134
|
+
- Stimulus JS (included in Rails 7+)
|
|
32
135
|
|
|
33
136
|
## Contributing
|
|
34
137
|
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
138
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mrdbidwill/auto-glossary
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
143
|
+
|
|
144
|
+
## Credits
|
|
145
|
+
|
|
146
|
+
- Built by [Will Johnston](https://github.com/mrdbidwill)
|
|
147
|
+
- Powered by [Wikipedia's Glossary of Mycology](https://en.wikipedia.org/wiki/Glossary_of_mycology) (CC BY-SA 4.0)
|
|
148
|
+
- Demo site: [auto-glossary.com](https://auto-glossary.com)
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
module AutoGlossary
|
|
4
4
|
class GlossaryController < ApplicationController
|
|
5
5
|
skip_before_action :verify_authenticity_token, only: [:definition]
|
|
6
|
+
skip_before_action :authenticate_user!, raise: false if respond_to?(:authenticate_user!)
|
|
6
7
|
|
|
7
8
|
# GET /glossary/definition?term=basidiospore
|
|
8
9
|
def definition
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: auto_glossary
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Will Johnston
|
|
@@ -46,6 +46,7 @@ executables: []
|
|
|
46
46
|
extensions: []
|
|
47
47
|
extra_rdoc_files: []
|
|
48
48
|
files:
|
|
49
|
+
- CHANGELOG.md
|
|
49
50
|
- MIT-LICENSE
|
|
50
51
|
- README.md
|
|
51
52
|
- Rakefile
|