Grammalecte  Check-in [977fd9b488]

Overview
Comment:[js] Revert syntax change (oubli)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | njs | nodejs
Files: files | file ages | folders
SHA3-256: 977fd9b488a9ae72864b15298a2f47635dd0267f1e9230c76f25a9a74e57de31
User & Date: IllusionPerdu on 2018-10-11 15:39:24
Other Links: branch diff | manifest | tags
Context
2018-10-12
10:33
[build] Apply change in build check-in: 9cd97ae91f user: IllusionPerdu tags: build, nodejs
2018-10-11
15:39
[js] Revert syntax change (oubli) check-in: 977fd9b488 user: IllusionPerdu tags: njs, nodejs
15:13
[js] Revert syntax change check-in: 9ae8f0a042 user: IllusionPerdu tags: njs, nodejs
Changes

Modified gc_core/js/lang_core/gc_engine.js from [47ef94b478] to [5c503d2a3c].

1
2
3
4
5
6
7
8
9
10
11



12
13
14
15
16
17
18
19






20
21
22
23
24
25





26
27
28
29
30
31
32
1
2
3
4
5
6
7
8



9
10
11
12
13






14
15
16
17
18
19
20





21
22
23
24
25
26
27
28
29
30
31
32








-
-
-
+
+
+


-
-
-
-
-
-
+
+
+
+
+
+

-
-
-
-
-
+
+
+
+
+







// Grammar checker engine

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, exports, console */

"use strict";

//${string}
//${regex}
//${map}
${string}
${regex}
${map}


if(typeof process !== 'undefined') {
    var gc_options = require('./gc_options.js');
    var gc_rules = require('./gc_rules.js');
    var gc_rules_graph = require('./gc_rules_graph.js');
    var cregex = require('./cregex.js');
    var text = require('../text.js');
if(typeof(process) !== 'undefined') {
    var gc_options = require("./gc_options.js");
    var gc_rules = require("./gc_rules.js");
    var gc_rules_graph = require("./gc_rules_graph.js");
    var cregex = require("./cregex.js");
    var text = require("../text.js");
} else if (typeof(require) !== 'undefined') {
    var gc_options = require('resource://grammalecte/${lang}/gc_options.js');
    var gc_rules = require('resource://grammalecte/${lang}/gc_rules.js');
    var gc_rules_graph = require('resource://grammalecte/${lang}/gc_rules_graph.js');
    var cregex = require('resource://grammalecte/${lang}/cregex.js');
    var text = require('resource://grammalecte/text.js');
    var gc_options = require("resource://grammalecte/${lang}/gc_options.js");
    var gc_rules = require("resource://grammalecte/${lang}/gc_rules.js");
    var gc_rules_graph = require("resource://grammalecte/${lang}/gc_rules_graph.js");
    var cregex = require("resource://grammalecte/${lang}/cregex.js");
    var text = require("resource://grammalecte/text.js");
}


function capitalizeArray (aArray) {
    // can’t map on user defined function??
    let aNew = [];
    for (let i = 0; i < aArray.length; i = i + 1) {
57
58
59
60
61
62
63
64
65


66
67
68


69
70
71
72
73
74
75
57
58
59
60
61
62
63


64
65
66


67
68
69
70
71
72
73
74
75







-
-
+
+

-
-
+
+







    version: "${version}",
    author: "${author}",

    //// Initialization

    load: function (sContext="JavaScript", sColorType="aRGB", sPath="") {
        try {
            if(typeof process !== 'undefined') {
                var spellchecker = require('../graphspell/spellchecker.js');
            if(typeof(process) !== 'undefined') {
                var spellchecker = require("../graphspell/spellchecker.js");
                _oSpellChecker = new spellchecker.SpellChecker("${lang}", "", "${dic_main_filename_js}", "${dic_extended_filename_js}", "${dic_community_filename_js}", "${dic_personal_filename_js}");
            } else if (typeof require !== 'undefined') {
                var spellchecker = require('resource://grammalecte/graphspell/spellchecker.js');
            } else if (typeof(require) !== 'undefined') {
                var spellchecker = require("resource://grammalecte/graphspell/spellchecker.js");
                _oSpellChecker = new spellchecker.SpellChecker("${lang}", "", "${dic_main_filename_js}", "${dic_extended_filename_js}", "${dic_community_filename_js}", "${dic_personal_filename_js}");
            } else {
                _oSpellChecker = new SpellChecker("${lang}", sPath, "${dic_main_filename_js}", "${dic_extended_filename_js}", "${dic_community_filename_js}", "${dic_personal_filename_js}");
            }
            _sAppContext = sContext;
            _dOptions = gc_options.getOptions(sContext).gl_shallowCopy();     // duplication necessary, to be able to reset to default
            _dOptionsColors = gc_options.getOptionsColors(sContext, sColorType);
1396
1397
1398
1399
1400
1401
1402
1403

1404
1405
1406
1407
1408
1409
1410
1396
1397
1398
1399
1400
1401
1402

1403
1404
1405
1406
1407
1408
1409
1410







-
+







${callablesJS}

    // callables for graph rules
${graph_callablesJS}
}


if (typeof exports !== 'undefined') {
if (typeof(exports) !== 'undefined') {
    exports.lang = gc_engine.lang;
    exports.locales = gc_engine.locales;
    exports.pkg = gc_engine.pkg;
    exports.name = gc_engine.name;
    exports.version = gc_engine.version;
    exports.author = gc_engine.author;
    // init

Modified gc_core/js/lang_core/gc_rules_graph.js from [6e7c6b0d6d] to [3efb8afd5c].

1
2
3
4
5

6
7
8
9
10
11
12
1
2
3
4

5
6
7
8
9
10
11
12




-
+







// Grammar checker graph rules

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/*global exports*/
/* global exports */

"use strict";

${string}


var gc_rules_graph = {

Modified gc_core/js/tests.js from [2455a96fb4] to [147f1c4e7b].

1
2
3
4
5
6
7
8
9
10
11
12
13




14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

29
30
31
32
33
34
35
1
2
3
4
5
6
7
8
9




10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35









-
-
-
-
+
+
+
+














-
+







// JavaScript

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, exports, console */

"use strict";


if(typeof process !== 'undefined') {
    var helpers = require('./graphspell/helpers.js');
} else if (typeof require !== 'undefined') {
    var helpers = require('resource://grammalecte/graphspell/helpers.js');
if(typeof(process) !== 'undefined') {
    var helpers = require("./graphspell/helpers.js");
} else if (typeof(require) !== 'undefined') {
    var helpers = require("resource://grammalecte/graphspell/helpers.js");
}


class TestGrammarChecking {

    constructor (gce, spfTests="") {
        this.gce = gce;
        this.spfTests = spfTests;
        this._aRuleTested = new Set();
    }

    * testParse (bDebug=false) {
        const t0 = Date.now();
        let sURL;
        if(typeof process !== 'undefined') {
        if(typeof(process) !== 'undefined') {
            sURL = (this.spfTests !== "") ? this.spfTests : "./"+this.gce.lang+"/tests_data.json";
        } else {
            sURL = (this.spfTests !== "") ? this.spfTests : "resource://grammalecte/"+this.gce.lang+"/tests_data.json";
        }
        const aData = JSON.parse(helpers.loadFile(sURL)).aData;
        let nInvalid = 0;
        let nTotal = 0;
158
159
160
161
162
163
164
165

166
167
158
159
160
161
162
163
164

165
166
167







-
+


        }
        return [" ".repeat(sLine.length), ""];
    }

}


if (typeof exports !== 'undefined') {
if (typeof(exports) !== 'undefined') {
    exports.TestGrammarChecking = TestGrammarChecking;
}

Modified gc_core/js/text.js from [2540b2b127] to [1251d5448b].

57
58
59
60
61
62
63
64

65
66
67
68
57
58
59
60
61
62
63

64
65
66
67
68







-
+




            console.error(e);
            return "\n# Error. Data: " + oErr.toString();
        }
    }
};


if (typeof exports !== 'undefined') {
if (typeof(exports) !== 'undefined') {
    exports.getParagraph = text.getParagraph;
    exports.wrap = text.wrap;
    exports.getReadableError = text.getReadableError;
}

Modified gc_lang/fr/modules-js/conj.js from [112ea76b9d] to [98b99c75fa].

1
2
3
4
5
6

7
8
9
10
11
12
13
1
2
3
4
5

6
7
8
9
10
11
12
13





-
+







// Grammalecte - Conjugueur
// License: GPL 3

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/*global require, exports, console, self, browser, chrome, __dirname */
/* global require, exports, console, self, browser, chrome, __dirname */

"use strict";

${map}


if(typeof(process) !== 'undefined') {
511
512
513
514
515
516
517
518

519
520
521
522

523
524
525
526
527
528
529
511
512
513
514
515
516
517

518
519
520
521

522
523
524
525
526
527
528
529







-
+



-
+







    conj.init(helpers.loadFile(chrome.extension.getURL("grammalecte/fr/conj_data.json")));
} else if (!conj.bInit && typeof(require) !== 'undefined') {
    // Add-on SDK and Thunderbird
    conj.init(helpers.loadFile("resource://grammalecte/fr/conj_data.json"));
} else if (!conj.bInit && typeof(self) !== 'undefined' && typeof(self.port) !== 'undefined' && typeof(self.port.on) !== 'undefined') {
    // used within Firefox content script (conjugation panel).
    // can’t load JSON from here, so we do it in ui.js and send it here.
    self.port.on('provideConjData', function (sJSONData) {
    self.port.on("provideConjData", function (sJSONData) {
        conj.init(sJSONData);
    });
} else if (conj.bInit){
    console.log('Module conj déjà initialisé');
    console.log("Module conj déjà initialisé");
} else {
    //console.log("Module conj non initialisé");
}


if (typeof(exports) !== 'undefined') {
    exports._lVtyp = conj._lVtyp;

Modified gc_lang/fr/modules-js/mfsp.js from [832f7c5e6f] to [7cfc8c21b3].

106
107
108
109
110
111
112
113

114
115
116

117
118
119

120
121

122
123

124
125
126
127
128
129
130
106
107
108
109
110
111
112

113
114
115

116
117
118

119
120

121
122

123
124
125
126
127
128
129
130







-
+


-
+


-
+

-
+

-
+







    }
};


// Initialization
if(!mfsp.bInit && typeof(process) !== 'undefined') {
    //Nodejs
    mfsp.init(helpers.loadFile(__dirname+'/mfsp_data.json'));
    mfsp.init(helpers.loadFile(__dirname+"/mfsp_data.json"));
} else if (!mfsp.bInit && typeof(browser) !== 'undefined') {
    // WebExtension
    mfsp.init(helpers.loadFile(browser.extension.getURL('grammalecte/fr/mfsp_data.json')));
    mfsp.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/mfsp_data.json")));
} else if (!mfsp.bInit && typeof(require) !== 'undefined') {
    // Add-on SDK and Thunderbird
    mfsp.init(helpers.loadFile('resource://grammalecte/fr/mfsp_data.json'));
    mfsp.init(helpers.loadFile("resource://grammalecte/fr/mfsp_data.json"));
} else if (mfsp.bInit){
    console.log('Module mfsp déjà initialisé');
    console.log("Module mfsp déjà initialisé");
} else {
    //console.log('Module mfsp non initialisé');
    //console.log("Module mfsp non initialisé");
}


if (typeof(exports) !== 'undefined') {
    exports._lTagMiscPlur = mfsp._lTagMiscPlur;
    exports._lTagMasForm = mfsp._lTagMasForm;
    exports._dMiscPlur = mfsp._dMiscPlur;

Modified gc_lang/fr/modules-js/phonet.js from [58acb58e4e] to [71750ecf21].

97
98
99
100
101
102
103
104

105
106
107
108
109
110
111
112
113
114
115
116
97
98
99
100
101
102
103

104
105
106
107
108
109
110
111
112
113
114
115
116







-
+












    phonet.init(helpers.loadFile(browser.extension.getURL("grammalecte/fr/phonet_data.json")));
} else if (!phonet.bInit && typeof(require) !== 'undefined') {
    // Add-on SDK and Thunderbird
    phonet.init(helpers.loadFile("resource://grammalecte/fr/phonet_data.json"));
} else if (phonet.bInit){
    console.log("Module phonet déjà initialisé");
} else {
    //console.log('Module phonet non initialisé');
    //console.log("Module phonet non initialisé");
}


if (typeof(exports) !== 'undefined') {
    exports._dWord = phonet._dWord;
    exports._lSet = phonet._lSet;
    exports._dMorph = phonet._dMorph;
    exports.init = phonet.init;
    exports.hasSimil = phonet.hasSimil;
    exports.getSimil = phonet.getSimil;
    exports.selectSimil = phonet.selectSimil;
}

Modified gc_lang/fr/modules-js/textformatter.js from [c9c7a0f69c] to [eee97306e0].

285
286
287
288
289
290
291
292

293
294
295
285
286
287
288
289
290
291

292
293
294
295







-
+




    getDefaultOptions () {
        return dTFDefaultOptions;
    }
}


if (typeof(exports) !== "undefined") {
if (typeof(exports) !== 'undefined') {
    exports.TextFormatter = TextFormatter;
    exports.oReplTable = oReplTable;
}

Modified graphspell-js/helpers.js from [8e7a91003c] to [3e56cf75fd].

24
25
26
27
28
29
30
31

32
33
34
35
36
37
38
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38







-
+







        // if not in workers, use sdk/data.load() instead
        try {
            if(typeof(process) !== 'undefined') {
                //console.log('loadFile(disque): ' + spf);
                let fs = require("fs");
                return fs.readFileSync(spf, "utf8");
            } else {
                //console.log('loadFile: ' + spf);
                console.log("loadFile: " + spf);
                let xRequest;
                xRequest = new XMLHttpRequest();
                xRequest.open('GET', spf, false); // 3rd arg is false for synchronous, sync is acceptable in workers
                xRequest.overrideMimeType('text/json');
                xRequest.send();
                return xRequest.responseText;
            }

Modified graphspell-js/ibdawg.js from [c0fccb61bf] to [4598bbd432].

98
99
100
101
102
103
104
105

106
107
108
109
110
111
112
98
99
100
101
102
103
104

105
106
107
108
109
110
111
112







-
+








    constructor (param1, sPath="") {
        // param1 can be a filename or a object with all the necessary data.
        try {
            let oData = null;
            if (typeof(param1) == "string") {
                let sURL;
                if(typeof process !== 'undefined') {
                if(typeof(process) !== 'undefined') {
                    sURL = (sPath !== "") ? sPath + "/" + param1 : __dirname + "/_dictionaries/"+param1;
                } else {
                    sURL = (sPath !== "") ? sPath + "/" + param1 : "resource://grammalecte/graphspell/_dictionaries/"+param1;
                }
                oData = JSON.parse(helpers.loadFile(sURL));
            } else {
                oData = param1;