Skip to content

Commit ccb17de

Browse files
Add built-in plurals for es, fr, de.
1 parent 285ad3d commit ccb17de

File tree

5 files changed

+174
-147
lines changed

5 files changed

+174
-147
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
- Unicode support
1313
- PDF export support
1414
- Custom templates via Jinja2
15-
- Plural forms support (English)
15+
- Plural forms support (English, Spanish, French, German)
1616

1717
## Documentation
1818

@@ -83,7 +83,7 @@ plugins:
8383
inline_refs: short # none, short, list
8484

8585
# Enable plural forms (English)
86-
plurals: en # none, en
86+
plurals: en # en, es, it, fr, de
8787

8888
# Custom templates directory
8989
templates: docs/templates

docs/releases.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Release Notes
22

3+
## v2.1.0a1
4+
| ~2025-02-10~
5+
6+
- Add translation rules for spanish, french, german
7+
38
## v2.0.0
49
| ~2025-02-10~
510

docs/usage/linking.md

Lines changed: 106 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -1,225 +1,187 @@
1-
# Linking to a glossary entry
1+
# Linking to Glossary Terms
22

3-
## Basic
3+
## Basic Usage
44

5-
Link to this glossary definition using the following
6-
syntax. This will produce a link to the definition in your documentation:
5+
To link to a glossary term, use the following syntax:
76

8-
``` markdown
9-
- See the <section:term> for details
7+
```markdown
8+
See the <section:term> for more details
109
```
1110

12-
!!! Example
11+
This creates a link to the term's definition in your documentation.
1312

14-
Link to the previously defined `glossary` term in the `term` section:
13+
!!! Example
1514

16-
``` markdown
17-
- See the <demo:my_term1> for definition of term 1
18-
- See the <demo:my term 2> for definition of term 2
15+
```markdown
16+
See the <demo:my_term1> for definition of term 1
17+
See the <demo:my term 2> for definition of term 2
1918
```
2019

21-
- See the <demo:my_term1> for definition of term 1
22-
- See the <demo:my term 2> for definition of term 1
20+
Output:
21+
- See the <demo:my_term1> for definition of term 1
22+
- See the <demo:my term 2> for definition of term 2
2323

24-
## Case sensitivity
25-
> starting from version `1.7.0` [beta]
24+
## Case Sensitivity
25+
> Available since version 1.7.0
2626
27-
By default, this term definitions and references are case-sensitive, i.e. you need to use
28-
the exact spelling in your links as used in your term definition.
27+
By default, term definitions and references are case-sensitive. You must use
28+
the exact spelling in your links as used in the term definition.
2929

30-
By setting <configuration:ignore_case> to `true`, the plugin will ignore the case in order
31-
to find definitions for your links.
30+
To enable case-insensitive matching, set `ignore_case` to `true`:
3231

33-
!!! Example
32+
```yaml
33+
plugins:
34+
ezglossary:
35+
ignore_case: true
36+
```
3437
35-
``` yaml
36-
plugins:
37-
search
38-
ezglossary:
39-
ignore_case: true
38+
!!! Example
39+
With `ignore_case: true`, all these links point to the same term:
40+
```markdown
41+
- <demo:my_term>
42+
- <demo:My_Term>
43+
- <demo:MY_TERM>
4044
```
4145

42-
- See the <demo:MY_term1> for definition of term 1
46+
## Custom Link Text
4347

44-
## Individual reference texts
48+
By default, the term itself is used as the link text. You can override this
49+
using the `|` modifier:
4550

46-
By default the <term:term> is used as text for the link, however,
47-
you can override the term using the `|` modifier:
51+
```markdown
52+
See our <term:section|glossary sections> documentation
53+
```
4854

4955
!!! Example
50-
51-
``` markdown
52-
- You can define multiple <term:section|glossary sections>
56+
```markdown
57+
Learn about <demo:my_term1|our first concept>
5358
```
5459

55-
- You can define multiple <term:section|glossary sections>
60+
Output:
61+
- Learn about <demo:my_term1|our first concept>
5662

5763
!!! Note
58-
59-
When using a link with individual reference texts in a table,
60-
you need to quote the `|`.
61-
62-
``` markdown
63-
| row1 | row2 |
64-
|-----------------------------------|------|
65-
| <term:section\|glossary sections> | ... |
64+
When using custom link text in tables, escape the `|` character:
65+
```markdown
66+
| Description | Reference |
67+
|------------|-----------|
68+
| First term | <demo:first_term\|see details> |
6669
```
6770

68-
## Handling plurals
69-
> starting from version `1.7.0a2` (not stable released yet)
71+
## Handling Plurals
72+
> Available since version 1.7.0
7073

71-
A most common problem when linking to glossary terms is that you want to use
72-
the plural form of the word in the link text while linking to the term in singular.
74+
The plugin can automatically match plural forms to their singular definitions.
75+
This is useful when you want to use the plural form in your text while linking
76+
to the singular definition.
7377

7478
!!! Example
75-
7679
Definition:
77-
78-
``` markdown
80+
```markdown
7981
GPU
80-
: A GPU is a ....
82+
: A Graphics Processing Unit is...
8183
```
8284

83-
Linking:
84-
85-
``` markdown
86-
Many <term:GPUs> support ...
85+
Usage:
86+
```markdown
87+
Many <term:GPUs> support parallel processing
8788
```
8889

89-
!!! Note
90-
91-
At this point of time, plural lookup is only available for the english language.
90+
### Supported Languages
9291

93-
However, future versions may support additional langugaes (with your help). Furthermore
94-
a feature is planned to allow you to define your own rules for the lookup.
92+
Plural handling is available for:
93+
- English (en)
94+
- Spanish (es)
95+
- French (fr)
96+
- German (de)
9597

96-
### Lookup using the inflect library
98+
Enable plural handling in your configuration:
9799

98-
The [inflect library](https://github.com/jaraco/inflect) supports converting plurals to singulars,
99-
it has some advantages and drawbacks. If you want to use this library to convert plurals to singulars,
100-
you can add the following entry to the configuration:
101-
102-
``` yaml
100+
```yaml
103101
plugins:
104-
search
105102
ezglossary:
106-
plurals: inflect
103+
plurals: en # Use 'en', 'es', 'fr', or 'de'
107104
```
108105

109-
### Looking up using the plugin's logic
106+
### Plural Lookup Methods
110107

111-
This plugin has an own implementation logic to lookup singulars, which might not be perfect as well,
112-
but might catch some edge cases which the inflect library does not catch.
108+
#### Using the inflect Library
113109

114-
Try the own implementation by adding this configuration entry:
110+
The [inflect library](https://github.com/jaraco/inflect) provides robust plural-to-singular
111+
conversion for English terms:
115112

116-
``` yaml
113+
```yaml
117114
plugins:
118-
search
119115
ezglossary:
120-
plurals: en
116+
plurals: inflect
121117
```
122118

123-
## Using markdown links
124-
> starting from version `1.6.0`
125-
126-
When setting the <configuration:markdown_links> to `true`,
127-
ezglossary will also search for markdown links. If it identifies that
128-
a link points to a glossary entry, it will link it as well:
129-
130-
!!! Note
131-
132-
When using unicode characters in term definitions, linking them
133-
using the `<section:term>` syntax might not work. In this case
134-
you have to use markdown links in order to link to those terms.
135-
136-
!!! Note
119+
#### Using Built-in Rules
137120

138-
In case your definition contains emojis, linking them using
139-
the `<section:term>` syntax will not work as well. In this case
140-
you have to use markdown links.
121+
The plugin includes basic plural rules for supported languages:
141122

142-
!!! Example
123+
```yaml
124+
plugins:
125+
ezglossary:
126+
plurals: en # or 'es', 'fr', 'de'
127+
```
143128

144-
``` markdown
145-
my happy term :smile:
146-
: I am so happy
129+
## Using Markdown Links
130+
> Available since version 1.6.0
147131

148-
- See [](my happy term)
149-
```
132+
When <configuration:markdown_links> is enabled, the plugin also processes standard Markdown links:
150133

151-
``` yaml
134+
```yaml
152135
plugins:
153-
search
154136
ezglossary:
155-
markdown_links: true
137+
markdown_links: true
156138
```
157139

158-
!!! Example
140+
This is especially useful for:
141+
- Terms containing Unicode characters
142+
- Terms with emojis
143+
- Integration with other Markdown tools
159144

160-
``` markdown
161-
- See [](configuration:tooltip) for details
162-
- See [tooltips](configuration:tooltip) for details
145+
!!! Example
146+
```markdown
147+
- See [](configuration:tooltip) for details
148+
- See [tooltips](configuration:tooltip) for details
163149
```
164150

165-
!!! Output
166-
167-
- See [](configuration:tooltip) for details
168-
- See [tooltips](configuration:tooltip) for details
169-
170-
171-
configuration:markdown_links
172-
: Defines wether ezglossary should also link markdown links to
173-
glossary entries.
174-
151+
Output:
152+
- See [](configuration:tooltip) for details
153+
- See [tooltips](configuration:tooltip) for details
175154

176155
## Tooltips
177156

178-
The <configuration:tooltip> configuration allows you to control wether
179-
tooltips should be displayed with a preview on the definition:
157+
Control whether hovering over links shows definition previews using the <configuration:tooltip> option:
180158

181-
``` yaml
159+
```yaml
182160
plugins:
183-
search
184161
ezglossary:
185-
tooltip: [none, short, full]
162+
tooltip: short # Options: none, short, full
186163
```
187164

188165
Options:
189-
190-
none
191-
: Tooltips are disabled
192-
193-
short
194-
: The <term:reference> link shows the first line of the definition as a tooltip
195-
(link title)
196-
197-
full
198-
: The reference link shows the full definition as a tooltip.
166+
- `none`: No tooltips (default)
167+
- `short`: Show first line of definition
168+
- `full`: Show complete definition
199169

200170
!!! Example
201-
202-
```markdown
203-
plugins:
204-
search
205-
ezglossary:
206-
tooltip: full
207-
```
208-
209-
!!! Quote "Active tooltips"
210-
211-
![](../static/tooltip-full.png)
212-
171+
With `tooltip: full`:
172+
173+
![Tooltip Example](../static/tooltip-full.png)
213174

214175
## Configuration
215176

216177
configuration:tooltip
217-
: Configure [tooltips](#tooltips) for reference links. Default is `none`.
178+
: Configure [tooltips](#tooltips) for reference links. Default: `none`
218179

219180
configuration:plurals
220-
: Configure if and how the plugin shall lookup the term in singular if a plural
221-
is provided in the link text. See [handling plurals](#handling-plurals) for more details.
181+
: Configure plural handling. Options: `none` (default), `en`, `es`, `fr`, `de`, `inflect`
222182

223183
configuration:ignore_case
224-
: Set to `true` to ignore the case for terms in the definition lookup.
184+
: Enable case-insensitive term matching. Default: `false`
225185

186+
configuration:markdown_links
187+
: Enable processing of standard Markdown links. Default: `false`

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = mkdocs-ezglossary-plugin
3-
version = 2.0.0
3+
version = 2.1.0a1
44
description = manage multiple glossaries in mkdocs
55
keywords = mkdocs, glossary, plugin, references, links
66
long_description = file: README.md

0 commit comments

Comments
 (0)