Index: gc_lang/fr/modules-js/textformatter.js ================================================================== --- gc_lang/fr/modules-js/textformatter.js +++ gc_lang/fr/modules-js/textformatter.js @@ -265,18 +265,18 @@ constructor (bDebug=false) { this.sLang = "fr"; this.bDebug = bDebug; //don't change this in external ;) - this._optionsUsed = dTFDefaultOptions.gl_shallowCopy(); + this.dOptions = dTFDefaultOptions.gl_shallowCopy(); } formatText (sText, dOpt=null) { if (dOpt !== null) { - this._optionsUsed.gl_updateOnlyExistingKeys(dOpt); + this.dOptions.gl_updateOnlyExistingKeys(dOpt); } - for (let [sOptName, bVal] of this._optionsUsed) { + for (let [sOptName, bVal] of this.dOptions) { //console.log(oReplTable); if (bVal && oReplTable[sOptName]) { for (let [zRgx, sRep] of oReplTable[sOptName]) { sText = sText.replace(zRgx, sRep); } @@ -286,13 +286,13 @@ } formatTextCount (sText, dOpt=null) { let nCount = 0; if (dOpt !== null) { - this._optionsUsed.gl_updateOnlyExistingKeys(dOpt); + this.dOptions.gl_updateOnlyExistingKeys(dOpt); } - for (let [sOptName, bVal] of this._optionsUsed) { + for (let [sOptName, bVal] of this.dOptions) { if (bVal && oReplTable[sOptName]) { for (let [zRgx, sRep] of oReplTable[sOptName]) { nCount += (sText.match(zRgx) || []).length; sText = sText.replace(zRgx, sRep); } @@ -380,27 +380,23 @@ getDefaultOptions () { //we return a copy to make sure they are no modification in external return dTFDefaultOptions.gl_shallowCopy(); } - getUsedOptions () { + getOptions () { //we return a copy to make sure they are no modification in external - return this._optionsUsed.gl_shallowCopy(); + return this.dOptions.gl_shallowCopy(); } - setUsedOptions (dOpt=null) { + setOptions (dOpt=null) { if (dOpt !== null) { - this._optionsUsed.gl_updateOnlyExistingKeys(dOpt); + this.dOptions.gl_updateOnlyExistingKeys(dOpt); } else if (this.bDebug){ console.log("# Error. TF: no option to change."); } } - - getReplTable(){ - return oReplTable; - } } if (typeof(exports) !== 'undefined') { exports.TextFormatter = TextFormatter; } Index: gc_lang/fr/nodejs/core/api.js ================================================================== --- gc_lang/fr/nodejs/core/api.js +++ gc_lang/fr/nodejs/core/api.js @@ -238,33 +238,33 @@ setTfOptions(dOptions) { if (!this.isInit.TextFormatter) { this.load(["TextFormatter"]); } - this.oTextFormatter.setUsedOptions(dOptions); - return this._helpers.mapToObject(this.oTextFormatter.getUsedOptions()); + this.oTextFormatter.setOptions(dOptions); + return this._helpers.mapToObject(this.oTextFormatter.getOptions()); } setTfOption(sOptName, bValue) { if (!this.isInit.TextFormatter) { this.load(["TextFormatter"]); } if (sOptName) { - let optionsTF = this.oTextFormatter.getUsedOptions(); + let optionsTF = this.oTextFormatter.getOptions(); optionsTF.set(sOptName, bValue); - return this._helpers.mapToObject(this.oTextFormatter.getUsedOptions()); + return this._helpers.mapToObject(this.oTextFormatter.getOptions()); } return false; } resetTfOptions() { if (!this.isInit.TextFormatter) { this.load(["TextFormatter"]); } let optionsTF = this.oTextFormatter.getDefaultOptions(); - this.oTextFormatter.setUsedOptions(optionsTF); - return this._helpers.mapToObject(this.oTextFormatter.getUsedOptions()); + this.oTextFormatter.setOptions(optionsTF); + return this._helpers.mapToObject(this.oTextFormatter.getOptions()); } //fonctions concernant plussieurs parties verifParagraph(sText, bSuggest = true){ if (!this.isInit.Grammalecte || !this.isInit.Graphspell) {