Grammalecte  Check-in [f9a034e6ce]

Overview
Comment:[core][js] test if variable <exports> exists
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | core
Files: files | file ages | folders
SHA3-256: f9a034e6ce78cb1b6fb64b7b7cbb125c0bc5208e8a9c08d2bd1d197e7e453887
User & Date: olr on 2017-07-27 10:10:40
Other Links: manifest | tags
Context
2017-07-29
08:06
[core][js] test if <exports> exists check-in: c55ae247e7 user: olr tags: core, webext
2017-07-28
10:48
[fr] ocr: casse des mots avec traits d’union check-in: d250734599 user: olr tags: trunk, fr
2017-07-27
10:10
[core][js] test if variable <exports> exists check-in: f9a034e6ce user: olr tags: trunk, core
08:26
[fr] phonet_simil: rai/raie/raient check-in: a58719dcf9 user: olr tags: trunk, fr
Changes

Modified gc_core/js/helpers.js from [262e2563f7] to [726b7e9abe].

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91


92
93
94
95
96
97
98

    }
    catch (e) {
        logerror(e);
        return null
    }
}


    


// conversions
function objectToMap (obj) {
    let m = new Map();
    for (let param in obj) {
        //console.log(param + " " + obj[param]);
        m.set(param, obj[param]);
    }
    return m;
}

function mapToObject (m) {
    let obj = {};
    for (let [k, v] of m) {
        obj[k] = v;
    }
    return obj;
}



exports.setLogOutput = setLogOutput;
exports.echo = echo;
exports.logerror = logerror;
exports.inspect = inspect;
exports.objectToMap = objectToMap;
exports.mapToObject = mapToObject;
exports.loadFile = loadFile;








<
<
<



















>
>
|
|
|
|
|
|
|
>
63
64
65
66
67
68
69



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
    }
    catch (e) {
        logerror(e);
        return null
    }
}





// conversions
function objectToMap (obj) {
    let m = new Map();
    for (let param in obj) {
        //console.log(param + " " + obj[param]);
        m.set(param, obj[param]);
    }
    return m;
}

function mapToObject (m) {
    let obj = {};
    for (let [k, v] of m) {
        obj[k] = v;
    }
    return obj;
}


if (typeof(exports) !== 'undefined') {
    exports.setLogOutput = setLogOutput;
    exports.echo = echo;
    exports.logerror = logerror;
    exports.inspect = inspect;
    exports.objectToMap = objectToMap;
    exports.mapToObject = mapToObject;
    exports.loadFile = loadFile;
}

Modified gc_core/js/ibdawg.js from [fca88c3e7c] to [e748c8288e].

284
285
286
287
288
289
290

291


    _lookupArcNode3 (nVal, iAddr) {
        // to do
    };
}



exports.IBDAWG = IBDAWG;








>
|
>
284
285
286
287
288
289
290
291
292
293

    _lookupArcNode3 (nVal, iAddr) {
        // to do
    };
}


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

Modified gc_core/js/lang_core/gc_engine.js from [fb021578af] to [ce3013cd59].

602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623

${pluginsJS}


${callablesJS}




exports.load = load;
exports.parse = parse;
exports.lang = lang;
exports.version = version;
exports.getDictionary = getDictionary;
exports.setOption = setOption;
exports.setOptions = setOptions;
exports.getOptions = getOptions;
exports.getDefaultOptions = getDefaultOptions;
exports.resetOptions = resetOptions;
exports.ignoreRule = ignoreRule;
exports.reactivateRule = reactivateRule;
exports.resetIgnoreRules = resetIgnoreRules;
exports.listRules = listRules;








|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
${pluginsJS}


${callablesJS}



if (typeof(exports) !== 'undefined') {
    exports.load = load;
    exports.parse = parse;
    exports.lang = lang;
    exports.version = version;
    exports.getDictionary = getDictionary;
    exports.setOption = setOption;
    exports.setOptions = setOptions;
    exports.getOptions = getOptions;
    exports.getDefaultOptions = getDefaultOptions;
    exports.resetOptions = resetOptions;
    exports.ignoreRule = ignoreRule;
    exports.reactivateRule = reactivateRule;
    exports.resetIgnoreRules = resetIgnoreRules;
    exports.listRules = listRules;
}

Modified gc_core/js/lang_core/gc_options.js from [a6bfab9180] to [6e45d077d4].

15
16
17
18
19
20
21


22
23
24

    "JavaScript": new Map (${dOptJavaScript}),
    "Firefox": new Map (${dOptFirefox}),
    "Thunderbird": new Map (${dOptThunderbird}),
}

const dOptLabel = ${dOptLabel};



exports.getOptions = getOptions;
exports.lStructOpt = lStructOpt;
exports.dOptLabel = dOptLabel;








>
>
|
|
|
>
15
16
17
18
19
20
21
22
23
24
25
26
27
    "JavaScript": new Map (${dOptJavaScript}),
    "Firefox": new Map (${dOptFirefox}),
    "Thunderbird": new Map (${dOptThunderbird}),
}

const dOptLabel = ${dOptLabel};


if (typeof(exports) !== 'undefined') {
	exports.getOptions = getOptions;
	exports.lStructOpt = lStructOpt;
	exports.dOptLabel = dOptLabel;
}

Modified gc_core/js/lang_core/gc_rules.js from [c85bd666a1] to [03bc540fb7].

1
2
3
4
5
6
7
8
9
10
11

12
13

// Grammar checker rules
"use strict";

${string}
${regex}

const lParagraphRules = ${paragraph_rules_JS};

const lSentenceRules = ${sentence_rules_JS};



exports.lParagraphRules = lParagraphRules;
exports.lSentenceRules = lSentenceRules;












>
|
|
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Grammar checker rules
"use strict";

${string}
${regex}

const lParagraphRules = ${paragraph_rules_JS};

const lSentenceRules = ${sentence_rules_JS};


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

Modified gc_core/js/str_transform.js from [572c35f46a] to [0fafeda9a5].

50
51
52
53
54
55
56

57
58

    }
    var [sPfxCode, sSfxCode] = sAffCode.split('/');
    sFlex = sPfxCode.slice(1) + sFlex.slice(sPfxCode.charCodeAt(0)-48);
    return sSfxCode[0] == '0' ? sFlex + sSfxCode.slice(1) : sFlex.slice(0, -(sSfxCode.charCodeAt(0)-48)) + sSfxCode.slice(1);
}



exports.getStemFromSuffixCode = getStemFromSuffixCode;
exports.getStemFromAffixCode = getStemFromAffixCode;








>
|
|
>
50
51
52
53
54
55
56
57
58
59
60
    }
    var [sPfxCode, sSfxCode] = sAffCode.split('/');
    sFlex = sPfxCode.slice(1) + sFlex.slice(sPfxCode.charCodeAt(0)-48);
    return sSfxCode[0] == '0' ? sFlex + sSfxCode.slice(1) : sFlex.slice(0, -(sSfxCode.charCodeAt(0)-48)) + sSfxCode.slice(1);
}


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

Modified gc_core/js/tests.js from [24427fff6b] to [f2f737b523].

143
144
145
146
147
148
149


150

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

}



exports.TestGrammarChecking = TestGrammarChecking;








>
>
|
>
143
144
145
146
147
148
149
150
151
152
153
            helpers.logerror(e);
        }
        return [" ".repeat(sLine.length), ""];
    };

}


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

Modified gc_core/js/text.js from [62ec1ec953] to [647037b16a].

167
168
169
170
171
172
173

174
175
176
177
178

    catch (e) {
        helpers.logerror(e);
        return '# Error. Data: ' + oErr.toString();
    }
}



exports.getParagraph = getParagraph;
exports.addHtmlEntities = addHtmlEntities;
exports.createHTMLBlock = createHTMLBlock;
exports.tagParagraph = tagParagraph;
exports.getReadableError = getReadableError;








>
|
|
|
|
|
>
167
168
169
170
171
172
173
174
175
176
177
178
179
180
    catch (e) {
        helpers.logerror(e);
        return '# Error. Data: ' + oErr.toString();
    }
}


if (typeof(exports) !== 'undefined') {
    exports.getParagraph = getParagraph;
    exports.addHtmlEntities = addHtmlEntities;
    exports.createHTMLBlock = createHTMLBlock;
    exports.tagParagraph = tagParagraph;
    exports.getReadableError = getReadableError;
}

Modified gc_core/js/tokenizer.js from [8720e6c367] to [a6594366c3].

83
84
85
86
87
88
89


90

                aSpellErr.push(oToken);
            }
        }
        return aSpellErr;
    }
}



exports.Tokenizer = Tokenizer;








>
>
|
>
83
84
85
86
87
88
89
90
91
92
93
                aSpellErr.push(oToken);
            }
        }
        return aSpellErr;
    }
}


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

Modified gc_lang/fr/modules-js/conj.js from [0ac007e97e] to [4856ca7520].

483
484
485
486
487
488
489

490
491
492
493
494
495
496
        }
        if (!bPlur) {
            return (this.dConj.get(":PQ").get(":Q3")) ? this.dConj.get(":PQ").get(":Q3") : this.dConj.get(":PQ").get(":Q1");
        }
        return (this.dConj.get(":PQ").get(":Q4")) ? this.dConj.get(":PQ").get(":Q4") : this.dConj.get(":PQ").get(":Q1");
    }
}


if (typeof(exports) !== 'undefined') {
    // Used for Grammalecte library.
    // In content scripts, these variable are directly reachable
    exports.Verb = Verb;
    exports.isVerb = isVerb;
    exports.getConj = getConj;







>







483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
        }
        if (!bPlur) {
            return (this.dConj.get(":PQ").get(":Q3")) ? this.dConj.get(":PQ").get(":Q3") : this.dConj.get(":PQ").get(":Q1");
        }
        return (this.dConj.get(":PQ").get(":Q4")) ? this.dConj.get(":PQ").get(":Q4") : this.dConj.get(":PQ").get(":Q1");
    }
}


if (typeof(exports) !== 'undefined') {
    // Used for Grammalecte library.
    // In content scripts, these variable are directly reachable
    exports.Verb = Verb;
    exports.isVerb = isVerb;
    exports.getConj = getConj;

Modified gc_lang/fr/modules-js/cregex.js from [eb814cc494] to [266ea45a85].

260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300

    if (lMorph.some(s  =>  zNPf.test(s))) {
        return false;
    }
    return lMorph.some(s  =>  zNPm.test(s));
}



exports.getLemmaOfMorph = getLemmaOfMorph;
exports.checkAgreement = checkAgreement;
exports.checkConjVerb = checkConjVerb;
exports.getGender = getGender;
exports.getNumber = getNumber;
exports.isNom = isNom;
exports.isNomNotAdj = isNomNotAdj;
exports.isAdj = isAdj;
exports.isNomAdj = isNomAdj;
exports.isNomVconj = isNomVconj;
exports.isInv = isInv;
exports.isSg = isSg;
exports.isPl = isPl;
exports.isEpi = isEpi;
exports.isMas = isMas;
exports.isFem = isFem;
exports.mbNom = mbNom;
exports.mbAdj = mbAdj;
exports.mbAdjNb = mbAdjNb;
exports.mbNomAdj = mbNomAdj;
exports.mbNomNotAdj = mbNomNotAdj;
exports.mbPpasNomNotAdj = mbPpasNomNotAdj;
exports.mbVconj = mbVconj;
exports.mbVconj123 = mbVconj123;
exports.mbMG = mbMG;
exports.mbInv = mbInv;
exports.mbSg = mbSg;
exports.mbPl = mbPl;
exports.mbEpi = mbEpi;
exports.mbMas = mbMas;
exports.mbFem = mbFem;
exports.mbNpr = mbNpr;
exports.mbNprMasNotFem = mbNprMasNotFem;








|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
    if (lMorph.some(s  =>  zNPf.test(s))) {
        return false;
    }
    return lMorph.some(s  =>  zNPm.test(s));
}


if (typeof(exports) !== 'undefined') {
    exports.getLemmaOfMorph = getLemmaOfMorph;
    exports.checkAgreement = checkAgreement;
    exports.checkConjVerb = checkConjVerb;
    exports.getGender = getGender;
    exports.getNumber = getNumber;
    exports.isNom = isNom;
    exports.isNomNotAdj = isNomNotAdj;
    exports.isAdj = isAdj;
    exports.isNomAdj = isNomAdj;
    exports.isNomVconj = isNomVconj;
    exports.isInv = isInv;
    exports.isSg = isSg;
    exports.isPl = isPl;
    exports.isEpi = isEpi;
    exports.isMas = isMas;
    exports.isFem = isFem;
    exports.mbNom = mbNom;
    exports.mbAdj = mbAdj;
    exports.mbAdjNb = mbAdjNb;
    exports.mbNomAdj = mbNomAdj;
    exports.mbNomNotAdj = mbNomNotAdj;
    exports.mbPpasNomNotAdj = mbPpasNomNotAdj;
    exports.mbVconj = mbVconj;
    exports.mbVconj123 = mbVconj123;
    exports.mbMG = mbMG;
    exports.mbInv = mbInv;
    exports.mbSg = mbSg;
    exports.mbPl = mbPl;
    exports.mbEpi = mbEpi;
    exports.mbMas = mbMas;
    exports.mbFem = mbFem;
    exports.mbNpr = mbNpr;
    exports.mbNprMasNotFem = mbNprMasNotFem;
}

Modified gc_lang/fr/modules-js/lexicographe.js from [2702fb7f6b] to [5e8c9037a7].

281
282
283
284
285
286
287

288

        }
        let nPos = s.indexOf("-");
        return _dAD.get(s.slice(0, nPos)) + " +" + _dAD.get(s.slice(nPos+1));
    };
}



exports.Lexicographe = Lexicographe;








>
|
>
281
282
283
284
285
286
287
288
289
290
        }
        let nPos = s.indexOf("-");
        return _dAD.get(s.slice(0, nPos)) + " +" + _dAD.get(s.slice(nPos+1));
    };
}


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

Modified gc_lang/fr/modules-js/mfsp.js from [eacc870aa5] to [404b1b695d].

75
76
77
78
79
80
81

82
83
84
85

    catch (e) {
        console.log(e);
        return "## erreur, code : " + sSfx + " ##";
    }
}



exports.isFemForm = isFemForm;
exports.getMasForm = getMasForm;
exports.hasMiscPlural = hasMiscPlural;
exports.getMiscPlural = getMiscPlural;








>
|
|
|
|
>
75
76
77
78
79
80
81
82
83
84
85
86
87
    catch (e) {
        console.log(e);
        return "## erreur, code : " + sSfx + " ##";
    }
}


if (typeof(exports) !== 'undefined') {
    exports.isFemForm = isFemForm;
    exports.getMasForm = getMasForm;
    exports.hasMiscPlural = hasMiscPlural;
    exports.getMiscPlural = getMiscPlural;
}

Modified gc_lang/fr/modules-js/phonet.js from [9c713cdc05] to [1d899a6d9f].

64
65
66
67
68
69
70

71
72
73

            }
        }
    }
    return aSelect;
}



exports.hasSimil = hasSimil;
exports.getSimil = getSimil;
exports.selectSimil = selectSimil;








>
|
|
|
>
64
65
66
67
68
69
70
71
72
73
74
75
            }
        }
    }
    return aSelect;
}


if (typeof(exports) !== 'undefined') {
    exports.hasSimil = hasSimil;
    exports.getSimil = getSimil;
    exports.selectSimil = selectSimil;
}

Modified gc_lang/fr/modules-js/textformatter.js from [82caf6845e] to [7314bcd9a1].

274
275
276
277
278
279
280

281
282
283
284
285
        return sText;
    };

    getDefaultOptions () {
        return dDefaultOptions;
    }
}


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







>





274
275
276
277
278
279
280
281
282
283
284
285
286
        return sText;
    };

    getDefaultOptions () {
        return dDefaultOptions;
    }
}


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