Skip to content
Snippets Groups Projects
PlainNormalizer.js 622 B
Newer Older
  • Learn to ignore specific revisions
  • Igor Markin's avatar
    Igor Markin committed
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.normalizePlainPart = void 0;
    const utils_1 = require("../utils");
    const normalizePlainPart = (text) => {
    
    Igor Markin's avatar
    Igor Markin committed
        text = removeListBullets(text);
    
    Igor Markin's avatar
    Igor Markin committed
        text = utils_1.removeSpacesAndLinebreaks(text);
        return removeQRCodes(text);
    };
    exports.normalizePlainPart = normalizePlainPart;
    const removeQRCodes = (s) => {
        return s
            .replace(/\[qrcode.png]\s*<https:\/\/[\w./?=\-&]+>/g, "")
            .replace(/<https:\/\/[\w./?=\-&]+>\s*\[qrcode.png]/g, "");
    };
    
    Igor Markin's avatar
    Igor Markin committed
    const removeListBullets = (s) => {
        return s.replace("\n[o§]\n+/g", "");
    };