Grammalecte  Check-in [ec3136d1bc]

Overview
Comment:[njs] Add *ignoreRule(s)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | nodejs
Files: files | file ages | folders
SHA3-256: ec3136d1bc7730852cb2d7fc66e81b268a6cf6e86ea69240727296429c6676c8
User & Date: IllusionPerdu on 2018-10-21 15:04:00
Other Links: branch diff | manifest | tags
Context
2018-10-21
15:16
[njs] Export noew function getIgnoreRules check-in: ba941ad2d4 user: IllusionPerdu tags: nodejs
15:04
[njs] Add *ignoreRule(s) check-in: ec3136d1bc user: IllusionPerdu tags: nodejs
14:58
[js] Add getIgnoreRules check-in: fc3446bfc2 user: IllusionPerdu tags: nodejs
Changes

Modified gc_lang/fr/nodejs/cli/bin/gramma-cli.js from [d5a9326889] to [e6be35662d].

293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
                    repText += "\nErreur(s) grammaticale(s)";
                    for (let gramma of toAff.reponse.lGrammarErrors) {
                        numRep1++;
                        if (numRep1 == replength) {
                            ascii1 = "└";
                            ascii1a = " ";
                        }
                        repText += "\n " + ascii1 + " " + gramma.nStart + "->" + gramma.nEnd + " " + gramma.sMessage;
                        ascii2 = "├";
                        numRep2 = 0;
                        for (let suggestion of gramma.aSuggestions) {
                            numRep2++;
                            if (numRep2 == gramma.aSuggestions.length) {
                                ascii2 = "└";
                            }







|







293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
                    repText += "\nErreur(s) grammaticale(s)";
                    for (let gramma of toAff.reponse.lGrammarErrors) {
                        numRep1++;
                        if (numRep1 == replength) {
                            ascii1 = "└";
                            ascii1a = " ";
                        }
                        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) {
                                ascii2 = "└";
                            }
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
    for (const action of ["json", "perf"]) {
        if (getArg(aArg, [action])) {
            repPreference[action] = getArgVal(aArg, [action]);
            repAction[action] = repPreference[action] ? "ON" : "OFF";
        }
    }

    for (const action of ["gceoption", "tfoption"]) {
        if (getArg(aArg, [action])) {
            let sFonction = action == "gceoption" ? "GceOption" : "TfOption";
            let sOpt = sText.split(" ");
            if (sOpt[0] == "reset") {
                oGrammarChecker["reset" + sFonction + "s"]();
                repAction[action] = "reset";
            } else {
                for (const optAction of sOpt) {
                    let bOptVal = optAction[0] == "+" ? true : false;







|

|







406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
    for (const action of ["json", "perf"]) {
        if (getArg(aArg, [action])) {
            repPreference[action] = getArgVal(aArg, [action]);
            repAction[action] = repPreference[action] ? "ON" : "OFF";
        }
    }

    for (const action of ["gceoption", "tfoption", "gcerule"]) {
        if (getArg(aArg, [action])) {
            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 {
                for (const optAction of sOpt) {
                    let bOptVal = optAction[0] == "+" ? true : false;

Modified gc_lang/fr/nodejs/core/api.js from [a782304429] to [83bcbb9eeb].

138
139
140
141
142
143
144













































145
146
147
148
149
150
151
    resetGceOptions () {
        if (!this.isInit.Grammalecte) {
            this.load(["Grammalecte"]);
        }
        this._oGce.resetOptions();
        return this._helpers.mapToObject(this._oGce.getOptions());
    }














































    //Fonctions concernant: Graphspell
    getGraphspell(){
        if (!this.isInit.Graphspell) {
            this.load(["Graphspell"]);
        }
        return this.oSpellChecker;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
    resetGceOptions () {
        if (!this.isInit.Grammalecte) {
            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"]);
        }
        return this.oSpellChecker;