25 lines
636 B
JavaScript
25 lines
636 B
JavaScript
|
|
module.exports = (function () {
|
|
|
|
var filterCode = function(ctx,value) {
|
|
return ctx.filterValue(value,[' ','_','-','.',','],'',function (part) {
|
|
return part.toLowerCase();
|
|
});
|
|
}
|
|
|
|
return function AutoTEntityTCodePlugin() {
|
|
|
|
this.configPlugin = function (ctx) {
|
|
ctx.key='autoTEntityTCode';
|
|
ctx.description='Fills and filters tcode to be code-safe for generating variables/functions.';
|
|
};
|
|
|
|
this.fillTEntity = function(ctx) {
|
|
if (ctx.tentity.tcode === null || ctx.tentity.tcode === null) {
|
|
ctx.tentity.tcode = ctx.tentity.tid;
|
|
}
|
|
ctx.tentity.tcode = filterCode(ctx,ctx.tentity.tcode);
|
|
};
|
|
};
|
|
})();
|