-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: limiting the number of glossary links to once per paragraph (#118)
* feat: Limiting the number of glossary links to first in paragraph (#117, #118, #127) * test: New baseline.
- Loading branch information
1 parent
04894ce
commit 0310e93
Showing
11 changed files
with
210 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
test/input/config-linking/terms-first-in-paragraph/document.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Test Case 'option linking.terms' | ||
|
||
## Section 1 | ||
|
||
GIVEN option `linking: { terms: "first-in-paragraph" }` | ||
AND a glossary term 'Lorem' | ||
AND a document with term 'Lorem' in this *first* paragraph *of section 1* | ||
AND and the term 'Lorem' being mentioned *three times* in this paragraph | ||
THEN only the first occurrence of the term MUST be linkified. | ||
|
||
GIVEN option `linking: { terms: "first-in-paragraph" }` | ||
AND a glossary term 'Lorem' | ||
AND a document with term 'Lorem' in this *second* paragraph *of section 1* | ||
AND and the term 'Lorem' being mentioned *three times* in this paragraph | ||
THEN only the first occurrence of the term MUST be linkified. | ||
|
||
GIVEN option `linking: { terms: "first-in-paragraph" }` | ||
AND a glossary term 'Lorem' | ||
AND a glossary term 'Ipsum' | ||
AND a document with term 'Lorem' in this *third* paragraph *of section 1* | ||
AND a document with term 'Ipsum' in this *third* paragraph *of section 1* | ||
AND and the term 'Lorem' being mentioned *three times* in this paragraph | ||
AND and the term 'Ipsum' being mentioned *three times* in this paragraph | ||
THEN only the first occurrence of *each* term MUST be linkified. | ||
|
||
## Section 2 | ||
|
||
GIVEN option `linking: { terms: "first-in-paragraph" }` | ||
AND a glossary term 'Lorem' | ||
AND a document with term 'Lorem' in this *first* paragraph *of section 2* | ||
AND and the term 'Lorem' being mentioned *three times* in this paragraph | ||
THEN only the first occurrence of the term MUST be linkified. |
19 changes: 19 additions & 0 deletions
19
test/input/config-linking/terms-first-in-paragraph/glossarify-md.conf.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"$schema": "../../../../conf.schema.json", | ||
"baseDir": ".", | ||
"linking": { | ||
"paths": "relative", | ||
"terms": "first-in-paragraph" | ||
}, | ||
"glossaries": [ | ||
{ | ||
"file": "./glossary.md" | ||
} | ||
], | ||
"ignoreCase": false, | ||
"outDir": "../../../output-actual/config-linking/terms-first-in-paragraph", | ||
"dev": { | ||
"termsFile": "../../../output-actual/config-linking/terms-first-in-paragraph/terms.json", | ||
"reproducablePaths": true | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
test/input/config-linking/terms-first-in-paragraph/glossary.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Glossary | ||
|
||
## Lorem | ||
|
||
Test term | ||
|
||
## Ipsum | ||
|
||
Test term |
36 changes: 36 additions & 0 deletions
36
test/output-expected/config-linking/terms-first-in-paragraph/document.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# [Test Case 'option linking.terms'](#test-case-option-linkingterms) | ||
|
||
## [Section 1](#section-1) | ||
|
||
GIVEN option `linking: { terms: "first-in-paragraph" }` | ||
AND a glossary term '[Lorem][1]' | ||
AND a document with term 'Lorem' in this _first_ paragraph _of section 1_ | ||
AND and the term 'Lorem' being mentioned _three times_ in this paragraph | ||
THEN only the first occurrence of the term MUST be linkified. | ||
|
||
GIVEN option `linking: { terms: "first-in-paragraph" }` | ||
AND a glossary term '[Lorem][1]' | ||
AND a document with term 'Lorem' in this _second_ paragraph _of section 1_ | ||
AND and the term 'Lorem' being mentioned _three times_ in this paragraph | ||
THEN only the first occurrence of the term MUST be linkified. | ||
|
||
GIVEN option `linking: { terms: "first-in-paragraph" }` | ||
AND a glossary term '[Lorem][1]' | ||
AND a glossary term '[Ipsum][2]' | ||
AND a document with term 'Lorem' in this _third_ paragraph _of section 1_ | ||
AND a document with term 'Ipsum' in this _third_ paragraph _of section 1_ | ||
AND and the term 'Lorem' being mentioned _three times_ in this paragraph | ||
AND and the term 'Ipsum' being mentioned _three times_ in this paragraph | ||
THEN only the first occurrence of _each_ term MUST be linkified. | ||
|
||
## [Section 2](#section-2) | ||
|
||
GIVEN option `linking: { terms: "first-in-paragraph" }` | ||
AND a glossary term '[Lorem][1]' | ||
AND a document with term 'Lorem' in this _first_ paragraph _of section 2_ | ||
AND and the term 'Lorem' being mentioned _three times_ in this paragraph | ||
THEN only the first occurrence of the term MUST be linkified. | ||
|
||
[1]: ./glossary.md#lorem "Test term" | ||
|
||
[2]: ./glossary.md#ipsum "Test term" |
19 changes: 19 additions & 0 deletions
19
test/output-expected/config-linking/terms-first-in-paragraph/glossarify-md.conf.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"$schema": "../../../../conf.schema.json", | ||
"baseDir": ".", | ||
"linking": { | ||
"paths": "relative", | ||
"terms": "first-in-paragraph" | ||
}, | ||
"glossaries": [ | ||
{ | ||
"file": "./glossary.md" | ||
} | ||
], | ||
"ignoreCase": false, | ||
"outDir": "../../../output-actual/config-linking/terms-first-in-paragraph", | ||
"dev": { | ||
"termsFile": "../../../output-actual/config-linking/terms-first-in-paragraph/terms.json", | ||
"reproducablePaths": true | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
test/output-expected/config-linking/terms-first-in-paragraph/glossary.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# [Glossary](#glossary) | ||
|
||
## [Lorem](#lorem) | ||
|
||
Test term | ||
|
||
## [Ipsum](#ipsum) | ||
|
||
Test term |
36 changes: 36 additions & 0 deletions
36
test/output-expected/config-linking/terms-first-in-paragraph/terms.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[ | ||
{ | ||
"shortDesc": "Test term", | ||
"value": "Ipsum", | ||
"hint": "", | ||
"longDesc": "Test term", | ||
"anchor": "#ipsum", | ||
"glossary": { | ||
"file": "./glossary.md", | ||
"termHint": "", | ||
"basePath": "/{CWD}/output-actual/config-linking/terms-first-in-paragraph/glossary.md", | ||
"outPath": "/{CWD}/output-actual/config-linking/terms-first-in-paragraph/glossary.md" | ||
}, | ||
"regex": {}, | ||
"aliases": [], | ||
"ignoreCase": false, | ||
"countOccurrenceTotal": 1 | ||
}, | ||
{ | ||
"shortDesc": "Test term", | ||
"value": "Lorem", | ||
"hint": "", | ||
"longDesc": "Test term", | ||
"anchor": "#lorem", | ||
"glossary": { | ||
"file": "./glossary.md", | ||
"termHint": "", | ||
"basePath": "/{CWD}/output-actual/config-linking/terms-first-in-paragraph/glossary.md", | ||
"outPath": "/{CWD}/output-actual/config-linking/terms-first-in-paragraph/glossary.md" | ||
}, | ||
"regex": {}, | ||
"aliases": [], | ||
"ignoreCase": false, | ||
"countOccurrenceTotal": 4 | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters