From e4b00117c311dd309fbe0e969a5053911264b8d7 Mon Sep 17 00:00:00 2001 From: "Alexandre G.-Raymond" Date: Sat, 11 Nov 2023 14:22:52 +0100 Subject: [PATCH] Parse the synonyms tag in source documentation --- jsdoc-synonyms.js | 17 +++++++++++++++++ jsdoc.config.json | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 jsdoc-synonyms.js diff --git a/jsdoc-synonyms.js b/jsdoc-synonyms.js new file mode 100644 index 00000000..29aed7b2 --- /dev/null +++ b/jsdoc-synonyms.js @@ -0,0 +1,17 @@ +/* +jsdoc-synonyms.js - Add support for @synonym tag +Copyright (C) 2023 Strudel contributors - see +This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . +*/ + +function defineTags(dictionary) { + dictionary.defineTag('synonyms', { + mustHaveValue: true, + onTagged: function(doclet, tag) { + doclet.synonyms_text = tag.value; + doclet.synonyms = doclet.synonyms_text.split(/[ ,]+/); + } +}); +}; + +module.exports = {defineTags: defineTags} \ No newline at end of file diff --git a/jsdoc.config.json b/jsdoc.config.json index ca9c3d81..4098a5c5 100644 --- a/jsdoc.config.json +++ b/jsdoc.config.json @@ -3,7 +3,7 @@ "includePattern": ".+\\.(js(doc|x)?|mjs)$", "excludePattern": "node_modules|shift-parser|shift-reducer|shift-traverser|dist" }, - "plugins": ["plugins/markdown"], + "plugins": ["plugins/markdown", "jsdoc-synonyms"], "opts": { "destination": "./out/", "recurse": true