Overview
Comment: | [fx] handle soft hyphens |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | fx |
Files: | files | file ages | folders |
SHA3-256: |
482b521d67c5135d37c8cc5f867f3637 |
User & Date: | olr on 2017-11-10 11:30:41 |
Other Links: | manifest | tags |
Context
2017-11-10
| ||
13:37 | [fr] pt: mettre à bas check-in: 23d875b138 user: olr tags: trunk, fr | |
11:30 | [fx] handle soft hyphens check-in: 482b521d67 user: olr tags: trunk, fx | |
2017-11-08
| ||
19:06 | [core] merge spellsugg: faster suggestion engine check-in: ec1136c73d user: olr tags: trunk, core | |
Changes
Modified gc_lang/fr/webext/background.js from [61c0259fd3] to [01b8a8402c].
︙ | ︙ | |||
213 214 215 216 217 218 219 | sendCommandToTab(xInfo.menuItemId, xTab.id); break; // selected text case "rightClickGCSelectedText": sendCommandToTab("rightClickGCSelectedText", xTab.id); xGCEWorker.postMessage({ sCommand: "parseAndSpellcheck", | | | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | sendCommandToTab(xInfo.menuItemId, xTab.id); break; // selected text case "rightClickGCSelectedText": sendCommandToTab("rightClickGCSelectedText", xTab.id); xGCEWorker.postMessage({ sCommand: "parseAndSpellcheck", dParam: {sText: xInfo.selectionText, sCountry: "FR", bDebug: false, bContext: false}, dInfo: {iReturnPort: xTab.id} }); break; case "rightClickLxgSelectedText": sendCommandToTab("rightClickLxgSelectedText", xTab.id); xGCEWorker.postMessage({ sCommand: "getListOfTokens", dParam: {sText: xInfo.selectionText}, dInfo: {iReturnPort: xTab.id} }); break; // conjugueur case "conjugueur_window": openConjugueurWindow(); break; |
︙ | ︙ |
Modified gc_lang/fr/webext/content_scripts/init.js from [8fdfb151d0] to [8dd0bc574d].
︙ | ︙ | |||
190 191 192 193 194 195 196 | getPageText: function () { let sPageText = document.body.innerText; let nPos = sPageText.indexOf("__grammalecte_panel__"); if (nPos >= 0) { sPageText = sPageText.slice(0, nPos); } | | | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | getPageText: function () { let sPageText = document.body.innerText; let nPos = sPageText.indexOf("__grammalecte_panel__"); if (nPos >= 0) { sPageText = sPageText.slice(0, nPos); } return sPageText; }, createNode: function (sType, oAttr, oDataset=null) { try { let xNode = document.createElement(sType); Object.assign(xNode, oAttr); if (oDataset) { |
︙ | ︙ | |||
249 250 251 252 253 254 255 | // Grammar checker commands case "rightClickGCEditableNode": if (oGrammalecte.xRightClickedNode !== null) { oGrammalecte.startGCPanel(oGrammalecte.xRightClickedNode); sText = (oGrammalecte.xRightClickedNode.tagName == "TEXTAREA") ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText; xGrammalectePort.postMessage({ sCommand: "parseAndSpellcheck", | | | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | // Grammar checker commands case "rightClickGCEditableNode": if (oGrammalecte.xRightClickedNode !== null) { oGrammalecte.startGCPanel(oGrammalecte.xRightClickedNode); sText = (oGrammalecte.xRightClickedNode.tagName == "TEXTAREA") ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText; xGrammalectePort.postMessage({ sCommand: "parseAndSpellcheck", dParam: {sText: sText, sCountry: "FR", bDebug: false, bContext: false}, dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id} }); } else { oGrammalecte.showMessage("Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à corriger et relancez le correcteur via le menu contextuel."); } break; case "rightClickGCPage": |
︙ | ︙ | |||
275 276 277 278 279 280 281 | // Lexicographer commands case "rightClickLxgEditableNode": if (oGrammalecte.xRightClickedNode !== null) { oGrammalecte.startLxgPanel(); sText = (oGrammalecte.xRightClickedNode.tagName == "TEXTAREA") ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText; xGrammalectePort.postMessage({ sCommand: "getListOfTokens", | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | // Lexicographer commands case "rightClickLxgEditableNode": if (oGrammalecte.xRightClickedNode !== null) { oGrammalecte.startLxgPanel(); sText = (oGrammalecte.xRightClickedNode.tagName == "TEXTAREA") ? oGrammalecte.xRightClickedNode.value : oGrammalecte.xRightClickedNode.innerText; xGrammalectePort.postMessage({ sCommand: "getListOfTokens", dParam: {sText: sText}, dInfo: {sTextAreaId: oGrammalecte.xRightClickedNode.id} }); } else { oGrammalecte.showMessage("Erreur. Le node sur lequel vous avez cliqué n’a pas pu être identifié. Sélectionnez le texte à analyser et relancez le lexicographe via le menu contextuel."); } break; case "rightClickLxgPage": |
︙ | ︙ |
Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [6f118056e4] to [a6cbda9c1f].
︙ | ︙ | |||
451 452 453 454 455 456 457 | } _loadText () { let sText = (this.bTextArea) ? this.xNode.value : this.xNode.innerText; let i = 0; let iStart = 0; let iEnd = 0; | | | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | } _loadText () { let sText = (this.bTextArea) ? this.xNode.value : this.xNode.innerText; let i = 0; let iStart = 0; let iEnd = 0; sText = sText.replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(//g, "").normalize("NFC"); while ((iEnd = sText.indexOf("\n", iStart)) !== -1) { this.dParagraph.set(i, sText.slice(iStart, iEnd)); i++; iStart = iEnd+1; } this.dParagraph.set(i, sText.slice(iStart)); //console.log("Paragraphs number: " + (i+1)); |
︙ | ︙ |
Modified gc_lang/fr/webext/gce_worker.js from [ad4b1695da] to [af8e931393].
︙ | ︙ | |||
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | helpers.logerror(e); postMessage(createResponse("init", createErrorResult(e, "init failed"), dInfo, true, true)); } } function parse (sText, sCountry, bDebug, bContext, dInfo={}) { for (let sParagraph of text.getParagraph(sText)) { let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, bContext); postMessage(createResponse("parse", aGrammErr, dInfo, false)); } postMessage(createResponse("parse", null, dInfo, true)); } function parseAndSpellcheck (sText, sCountry, bDebug, bContext, dInfo={}) { let i = 0; for (let sParagraph of text.getParagraph(sText)) { let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, bContext); let aSpellErr = oTokenizer.getSpellingErrors(sParagraph, oDict); postMessage(createResponse("parseAndSpellcheck", {sParagraph: sParagraph, iParaNum: i, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, dInfo, false)); i += 1; } postMessage(createResponse("parseAndSpellcheck", null, dInfo, true)); } function parseAndSpellcheck1 (sParagraph, sCountry, bDebug, bContext, dInfo={}) { let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, bContext); let aSpellErr = oTokenizer.getSpellingErrors(sParagraph, oDict); postMessage(createResponse("parseAndSpellcheck1", {sParagraph: sParagraph, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, dInfo, true)); } function getOptions (dInfo={}) { postMessage(createResponse("getOptions", gc_engine.getOptions(), dInfo, true)); | > > > | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | helpers.logerror(e); postMessage(createResponse("init", createErrorResult(e, "init failed"), dInfo, true, true)); } } function parse (sText, sCountry, bDebug, bContext, dInfo={}) { sText = sText.replace(//g, "").normalize("NFC"); for (let sParagraph of text.getParagraph(sText)) { let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, bContext); postMessage(createResponse("parse", aGrammErr, dInfo, false)); } postMessage(createResponse("parse", null, dInfo, true)); } function parseAndSpellcheck (sText, sCountry, bDebug, bContext, dInfo={}) { let i = 0; sText = sText.replace(//g, "").normalize("NFC"); for (let sParagraph of text.getParagraph(sText)) { let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, bContext); let aSpellErr = oTokenizer.getSpellingErrors(sParagraph, oDict); postMessage(createResponse("parseAndSpellcheck", {sParagraph: sParagraph, iParaNum: i, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, dInfo, false)); i += 1; } postMessage(createResponse("parseAndSpellcheck", null, dInfo, true)); } function parseAndSpellcheck1 (sParagraph, sCountry, bDebug, bContext, dInfo={}) { sParagraph = sParagraph.replace(//g, "").normalize("NFC"); let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, bContext); let aSpellErr = oTokenizer.getSpellingErrors(sParagraph, oDict); postMessage(createResponse("parseAndSpellcheck1", {sParagraph: sParagraph, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, dInfo, true)); } function getOptions (dInfo={}) { postMessage(createResponse("getOptions", gc_engine.getOptions(), dInfo, true)); |
︙ | ︙ | |||
243 244 245 246 247 248 249 250 251 252 253 254 255 256 | } function textToTest (sText, sCountry, bDebug, bContext, dInfo={}) { if (!gc_engine) { postMessage(createResponse("textToTest", "# Grammar checker not loaded.", dInfo, true)); return; } let aGrammErr = gc_engine.parse(sText, sCountry, bDebug, bContext); let sMsg = ""; for (let oErr of aGrammErr) { sMsg += text.getReadableError(oErr) + "\n"; } if (sMsg == "") { sMsg = "Aucune erreur détectée."; | > | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | } function textToTest (sText, sCountry, bDebug, bContext, dInfo={}) { if (!gc_engine) { postMessage(createResponse("textToTest", "# Grammar checker not loaded.", dInfo, true)); return; } sText = sText.replace(//g, "").normalize("NFC"); let aGrammErr = gc_engine.parse(sText, sCountry, bDebug, bContext); let sMsg = ""; for (let oErr of aGrammErr) { sMsg += text.getReadableError(oErr) + "\n"; } if (sMsg == "") { sMsg = "Aucune erreur détectée."; |
︙ | ︙ | |||
292 293 294 295 296 297 298 299 300 301 302 303 304 305 | } // Lexicographer function getListOfTokens (sText, dInfo={}) { try { for (let sParagraph of text.getParagraph(sText)) { if (sParagraph.trim() !== "") { let aElem = []; let aRes = null; for (let oToken of oTokenizer.genTokens(sParagraph)) { aRes = oLxg.getInfoForToken(oToken); if (aRes) { | > | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | } // Lexicographer function getListOfTokens (sText, dInfo={}) { try { sText = sText.replace(//g, "").normalize("NFC"); for (let sParagraph of text.getParagraph(sText)) { if (sParagraph.trim() !== "") { let aElem = []; let aRes = null; for (let oToken of oTokenizer.genTokens(sParagraph)) { aRes = oLxg.getInfoForToken(oToken); if (aRes) { |
︙ | ︙ |