From 8b857eed26279ec4cc0f0edd4281568c9ba29412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Sun, 9 Feb 2020 17:19:11 +0100 Subject: [PATCH] Change prettyname of classes Now also includes the class name if it is different than its module name. `ol/source/Vector` -> `ol/source/Vector~VectorSource`. --- config/jsdoc/api/template/publish.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/config/jsdoc/api/template/publish.js b/config/jsdoc/api/template/publish.js index ecda2d2fb1..d8222784dc 100644 --- a/config/jsdoc/api/template/publish.js +++ b/config/jsdoc/api/template/publish.js @@ -189,9 +189,15 @@ function attachModuleSymbols(doclets, modules) { } function getPrettyName(longname) { - return longname - .split('~')[0] - .replace('module:', ''); + const fullname = longname.replace('module:', ''); + const parts = fullname.split(/[~\.]/); + if (parts.length > 1) { + const pathParts = parts[0].split('/'); + if (parts[parts.length - 1] === pathParts[pathParts.length - 1]) { + return parts[0]; + } + } + return fullname; } /**