Index: gc_core/js/text.js
==================================================================
--- gc_core/js/text.js
+++ gc_core/js/text.js
@@ -2,178 +2,179 @@
 
 "use strict";
 
 const helpers = require("resource://grammalecte/helpers.js");
 
-
-function* getParagraph (sText) {
-    // generator: returns paragraphs of text
-    let iStart = 0;
-    let iEnd = 0;
-    sText = sText.replace("\r", "");
-    while ((iEnd = sText.indexOf("\n", iStart)) !== -1) {
-        yield sText.slice(iStart, iEnd);
-        iStart = iEnd + 1;
-    }
-    yield sText.slice(iStart);
-}
-
-function* wrap (sText, nWidth=80) {
-    // generator: returns text line by line
-    while (sText) {
-        if (sText.length >= nWidth) {
-            let nEnd = sText.lastIndexOf(" ", nWidth) + 1;
-            if (nEnd > 0) {
-                yield sText.slice(0, nEnd);
-                sText = sText.slice(nEnd);
-            } else {
-                yield sText.slice(0, nWidth);
-                sText = sText.slice(nWidth);
-            }
-        } else {
-            break;
-        }
-    }
-    yield sText;
-}
-
-function getReadableError (oErr) {
-    // Returns an error oErr as a readable error
-    try {
-        let s = "\n* " + oErr['nStart'] + ":" + oErr['nEnd'] + "  # " + oErr['sRuleId']+":\n";
-        s += "  " + oErr["sMessage"];
-        if (oErr["aSuggestions"].length > 0) {
-            s += "\n  > Suggestions : " + oErr["aSuggestions"].join(" | ");
-        }
-        if (oErr["URL"] !== "") {
-            s += "\n  > URL: " + oErr["URL"];
-        }
-        return s;
-    }
-    catch (e) {
-        helpers.logerror(e);
-        return "\n# Error. Data: " + oErr.toString();
-    }
-}
-
-function addHtmlEntities (sParagraph) {
-    if (sParagraph.includes("&")) {
-        sParagraph = sParagraph.replace(/&/g, "&");
-    }
-    if (sParagraph.includes("<")) {
-        sParagraph = sParagraph.replace(//g, ">");
-    }
-    return sParagraph;
-}
-
-function createHTMLBlock (sParagraph, iParagraph) {
-    let sClassName = (sParagraph.includes('' + sParagraph + '
\n'
-           + '×
'
-           + '
Éditer
'
-           + '
Réanalyser
 
Suggestions :
';
-            let iSugg = 0;
-            for (let sSugg of oErr["aSuggestions"]) {
-                sErr += '' + sSugg + ' ';
-                iSugg += 1;
-            }
-        }
-        return sErr;
-    }
-    catch (e) {
-        helpers.logerror(e);
-        return '# Error. Data: ' + oErr.toString();
-    }
-}
-
-function getSpellingErrorHTML (oErr) {
-    // Returns an error oErr as a readable error in HTML
-    try {
-        let sErr = 'Mot inconnu du dictionnaire.';
-        sErr += ' IGNORER';
-        sErr += '
Suggestions :
';
-        return sErr;
-    }
-    catch (e) {
-        helpers.logerror(e);
-        return '# Error. Data: ' + oErr.toString();
+const text = {
+    getParagraph: function* (sText) {
+        // generator: returns paragraphs of text
+        let iStart = 0;
+        let iEnd = 0;
+        sText = sText.replace("\r", "");
+        while ((iEnd = sText.indexOf("\n", iStart)) !== -1) {
+            yield sText.slice(iStart, iEnd);
+            iStart = iEnd + 1;
+        }
+        yield sText.slice(iStart);
+    },
+
+    wrap: function* (sText, nWidth=80) {
+        // generator: returns text line by line
+        while (sText) {
+            if (sText.length >= nWidth) {
+                let nEnd = sText.lastIndexOf(" ", nWidth) + 1;
+                if (nEnd > 0) {
+                    yield sText.slice(0, nEnd);
+                    sText = sText.slice(nEnd);
+                } else {
+                    yield sText.slice(0, nWidth);
+                    sText = sText.slice(nWidth);
+                }
+            } else {
+                break;
+            }
+        }
+        yield sText;
+    },
+
+    getReadableError: function (oErr) {
+        // Returns an error oErr as a readable error
+        try {
+            let s = "\n* " + oErr['nStart'] + ":" + oErr['nEnd'] + "  # " + oErr['sRuleId']+":\n";
+            s += "  " + oErr["sMessage"];
+            if (oErr["aSuggestions"].length > 0) {
+                s += "\n  > Suggestions : " + oErr["aSuggestions"].join(" | ");
+            }
+            if (oErr["URL"] !== "") {
+                s += "\n  > URL: " + oErr["URL"];
+            }
+            return s;
+        }
+        catch (e) {
+            helpers.logerror(e);
+            return "\n# Error. Data: " + oErr.toString();
+        }
+    },
+
+    addHtmlEntities: function (sParagraph) {
+        if (sParagraph.includes("&")) {
+            sParagraph = sParagraph.replace(/&/g, "&");
+        }
+        if (sParagraph.includes("<")) {
+            sParagraph = sParagraph.replace(//g, ">");
+        }
+        return sParagraph;
+    },
+
+    createHTMLBlock: function (sParagraph, iParagraph) {
+        let sClassName = (sParagraph.includes('' + sParagraph + '\n'
+               + '×
'
+               + '
Éditer
'
+               + '
Réanalyser
 
Suggestions :
';
+                let iSugg = 0;
+                for (let sSugg of oErr["aSuggestions"]) {
+                    sErr += '' + sSugg + ' ';
+                    iSugg += 1;
+                }
+            }
+            return sErr;
+        }
+        catch (e) {
+            helpers.logerror(e);
+            return '# Error. Data: ' + oErr.toString();
+        }
+    },
+
+    _getSpellingErrorHTML: function (oErr) {
+        // Returns an error oErr as a readable error in HTML
+        try {
+            let sErr = 'Mot inconnu du dictionnaire.';
+            sErr += ' IGNORER';
+            sErr += '
Suggestions :
';
+            return sErr;
+        }
+        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;
+    exports.getParagraph = text.getParagraph;
+    exports.addHtmlEntities = text.addHtmlEntities;
+    exports.createHTMLBlock = text.createHTMLBlock;
+    exports.tagParagraph = text.tagParagraph;
+    exports.getReadableError = text.getReadableError;
 }