Skip to content

Commit

Permalink
Fix some issues introduced with #269
Browse files Browse the repository at this point in the history
* Fix perSectionDepth value range
* Fix perSectionDepth not being initialize with documented default.
  • Loading branch information
about-code authored Aug 23, 2023
1 parent 24839df commit 5e37def
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion conf/v5/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@
,"perSectionDepth": {
"type": "number"
,"description": "When there are ambiguous terms in a book one glossary term definition might be more appropriate in a section A while another definition for the same term may be more appropriate in a section B. glossary-ref-count' can prioritize term definitions separately per section by counting term usage individually per sections at level `perSectionDepth` but not for their subsections deeper than `perSectionDepth`."
,"min": 1
,"min": 0
,"max": 6
,"default": 2
,"more": "https://github.com/about-code/glossarify-md/blob/master/doc/ambiguities.md"
Expand Down
5 changes: 5 additions & 0 deletions lib/model/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ class Context {
if (Math.abs(altLinks) > 95) {
conf_.linking.limitByAlternatives = Math.sign(altLinks) * 95;
}
const sortAlternatives = conf_.linking.sortAlternatives;
if (sortAlternatives.by === "glossary-ref-count") {
conf_.linking.sortAlternatives = { perSectionDepth: 2, ...sortAlternatives };
}
if (conf.generateFiles.listOfFigures) {
conf_.generateFiles.listOfFigures = { class: "figure", title: "Figures", ...conf.generateFiles.listOfFigures };
conf_.generateFiles.listOf.push(conf.generateFiles.listOfFigures);
Expand All @@ -68,6 +72,7 @@ class Context {
if (conf_.unified.rcPath) {
conf_.unified.rcPath = toForwardSlash(path.resolve(conf.baseDir, conf.unified.rcPath));
}

}

resolvePath(relativePath) {
Expand Down

0 comments on commit 5e37def

Please sign in to comment.