Index: gc_lang/fr/nodejs/cli/bin/gramma-cli.js ================================================================== --- gc_lang/fr/nodejs/cli/bin/gramma-cli.js +++ gc_lang/fr/nodejs/cli/bin/gramma-cli.js @@ -295,11 +295,11 @@ numRep1++; if (numRep1 == replength) { ascii1 = "└"; ascii1a = " "; } - repText += "\n " + ascii1 + " " + gramma.nStart + "->" + gramma.nEnd + " " + gramma.sMessage; + repText += "\n " + ascii1 + " " + gramma.nStart + "->" + gramma.nEnd + " [" + gramma.sRuleId + "]\n " + ascii1a + " " + gramma.sMessage; ascii2 = "├"; numRep2 = 0; for (let suggestion of gramma.aSuggestions) { numRep2++; if (numRep2 == gramma.aSuggestions.length) { @@ -408,13 +408,13 @@ repPreference[action] = getArgVal(aArg, [action]); repAction[action] = repPreference[action] ? "ON" : "OFF"; } } - for (const action of ["gceoption", "tfoption"]) { + for (const action of ["gceoption", "tfoption", "gcerule"]) { if (getArg(aArg, [action])) { - let sFonction = action == "gceoption" ? "GceOption" : "TfOption"; + let sFonction = (action == "gceoption") ? "GceOption" : (action == "tfoption") ? "TfOption" : "GceIgnoreRule"; let sOpt = sText.split(" "); if (sOpt[0] == "reset") { oGrammarChecker["reset" + sFonction + "s"](); repAction[action] = "reset"; } else { Index: gc_lang/fr/nodejs/core/api.js ================================================================== --- gc_lang/fr/nodejs/core/api.js +++ gc_lang/fr/nodejs/core/api.js @@ -140,10 +140,55 @@ this.load(["Grammalecte"]); } this._oGce.resetOptions(); return this._helpers.mapToObject(this._oGce.getOptions()); } + + getGceRules (bParagraph) { + if (!this.isInit.Grammalecte) { + this.load(["Grammalecte"]); + } + return this._oGce.getRules(bParagraph); + } + + getGceIgnoreRules () { + if (!this.isInit.Grammalecte) { + this.load(["Grammalecte"]); + } + return Array.from(this._oGce.getIgnoreRules()); + } + + setGceIgnoreRules (dRules) { + if (!this.isInit.Grammalecte) { + this.load(["Grammalecte"]); + } + if (!(dRules instanceof Set)) { + dRules = new Set(dRules); + } + this._oGce._aIgnoredRules = dRules; + return Array.from(this._oGce.getIgnoreRules()); + } + + setGceIgnoreRule (sRuleId, bValue) { + if (!this.isInit.Grammalecte) { + this.load(["Grammalecte"]); + } + if (bValue){ //Add + this._oGce.ignoreRule(sRuleId); + } else { //Delete + this._oGce.reactivateRule(sRuleId); + } + return Array.from(this._oGce.getIgnoreRules()); + } + + resetGceIgnoreRules () { + if (!this.isInit.Grammalecte) { + this.load(["Grammalecte"]); + } + this._oGce.resetIgnoreRules(); + return Array.from(this._oGce.getIgnoreRules()); + } //Fonctions concernant: Graphspell getGraphspell(){ if (!this.isInit.Graphspell) { this.load(["Graphspell"]);