1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00
joplin/Assets/PluginDocTheme/helpers/index.js
2020-11-05 16:58:23 +00:00

37 lines
841 B
JavaScript

function camelCaseToDots(s) {
const output = [];
for (let i = 0; i < s.length; i++) {
const c = s[i];
if (c === c.toLowerCase() || i === 0) {
output.push(c.toLowerCase());
} else {
output.push('.');
output.push(c.toLowerCase());
}
}
return output.join('');
}
module.exports = {
jpFormatClassName: function(className) {
if (className.indexOf('Joplin') !== 0 || className.indexOf(' ') >= 0) return className;
const p = className.substr(6);
if (p === '') return 'joplin';
return `joplin.${camelCaseToDots(p)
.replace(/menu\.items/, 'menuItems')
.replace(/toolbar\.buttons/, 'toolbarButtons')}`;
},
jpIsAllowedGroup: function(name) {
return name !== 'Constructors';
},
jsIsNotKindVariable: function(classes) {
if (!classes) return true;
return classes.indexOf('tsd-kind-variable') < 0;
},
};