Grammalecte  Check-in [050f94978a]

Overview
Comment:[core] fix unnoticed bug: getCleanText
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | core
Files: files | file ages | folders
SHA3-256: 050f94978a2f15c237ef482d3be05caa4526bf28261352f36ca311a9ebcd7d20
User & Date: olr on 2020-08-28 09:36:11
Other Links: manifest | tags
Context
2020-08-31
10:48
[graphspell] ibdawg: fix lexicographer import (cherrypick from safxg) check-in: a9ed4298f2 user: olr tags: trunk, graphspell
2020-08-28
09:36
[core] fix unnoticed bug: getCleanText check-in: 050f94978a user: olr tags: trunk, core
09:00
[core] remove useless code: don’t delete token position check-in: 2a8cbe13be user: olr tags: trunk, core
Changes

Modified gc_core/js/lang_core/gc_engine.js from [f27b4f4d8a] to [2bae51d547].

261
262
263
264
265
266
267
268

269
270
271
272
273
274
275
        if (sText.includes("‐")) {
            sText = sText.replace(/‐/g, "-"); // Hyphen (U+2010)
        }
        if (sText.includes("‑")) {
            sText = sText.replace(/‑/g, "-"); // Non-Breaking Hyphen (U+2011)
        }
        if (sText.includes("@@")) {
            sText = sText.replace(/@@+/g, "");

        }
        return sText;
    }

    parseText (sText, sText0, bParagraph, nOffset, sCountry, dOptions, bShowRuleId, bDebug, bContext) {
        let bChange = false;
        let m;







|
>







261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
        if (sText.includes("‐")) {
            sText = sText.replace(/‐/g, "-"); // Hyphen (U+2010)
        }
        if (sText.includes("‑")) {
            sText = sText.replace(/‑/g, "-"); // Non-Breaking Hyphen (U+2011)
        }
        if (sText.includes("@@")) {
            sText = sText.replace(/@@+/g, (sMatch, nOffest, sSource) => { return " ".repeat(sMatch.length) });
            // function as replacement: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
        }
        return sText;
    }

    parseText (sText, sText0, bParagraph, nOffset, sCountry, dOptions, bShowRuleId, bDebug, bContext) {
        let bChange = false;
        let m;

Modified gc_core/py/lang_core/gc_engine.py from [781f6b8833] to [31a9f5bc44].

310
311
312
313
314
315
316
317

318
319
320
321
322
323
324
        if "'" in sText:
            sText = sText.replace("'", "’")
        if "‐" in sText:
            sText = sText.replace("‐", "-") # Hyphen (U+2010)
        if "‑" in sText:
            sText = sText.replace("‑", "-") # Non-Breaking Hyphen (U+2011)
        if "@@" in sText:
            sText = re.sub("@@+", "", sText)

        return sText

    def parseText (self, sText, sText0, bParagraph, nOffset, sCountry, dOptions, bShowRuleId, bDebug, bContext):
        "parse the text with rules"
        bChange = False
        for sOption, lRuleGroup in _getRules(bParagraph):
            if sOption == "@@@@":







|
>







310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
        if "'" in sText:
            sText = sText.replace("'", "’")
        if "‐" in sText:
            sText = sText.replace("‐", "-") # Hyphen (U+2010)
        if "‑" in sText:
            sText = sText.replace("‑", "-") # Non-Breaking Hyphen (U+2011)
        if "@@" in sText:
            sText = re.sub("@@+", lambda m: " " * len(m.group(0)), sText)
            # function as replacement: https://docs.python.org/3.7/library/re.html#re.sub
        return sText

    def parseText (self, sText, sText0, bParagraph, nOffset, sCountry, dOptions, bShowRuleId, bDebug, bContext):
        "parse the text with rules"
        bChange = False
        for sOption, lRuleGroup in _getRules(bParagraph):
            if sOption == "@@@@":