'use strict'; const Posts = require(__dirname+'/../db/posts.js') , greentextRegex = /^>([^>].+)/gm , pinktextRegex = /^<([^<].+)/gm , boldRegex = /""(.+)""/gm , titleRegex = /==(.+)==/gm , italicRegex = /__(.+)__/gm , linkRegex = /https?\:\/\/[^\s]+/g , spoilerRegex = /\|\|(.+)\|\|/gm , detectedRegex = /(\(\(\(.+\)\)\))/gm , codeRegex = /^```\s([\s\S]+)\s```/gm; module.exports = (board, thread, text) => { //pinktext text = text.replace(pinktextRegex, (match, pinktext) => { return `<${pinktext}`; }); //greentext text = text.replace(greentextRegex, (match, greentext) => { return `>${greentext}`; }); //links text = text.replace(linkRegex, (match) => { return `${match}`; }); //bold text = text.replace(boldRegex, (match, bold) => { return `${bold}`; }); //titles text = text.replace(titleRegex, (match, title) => { return `${title}`; }); //italic text = text.replace(italicRegex, (match, italic) => { return `${italic}`; }); //spoilers text = text.replace(spoilerRegex, (match, spoiler) => { return `${spoiler}`; }); //code text = text.replace(codeRegex, (match, code) => { return `${code.trim()}`; }); //detected text = text.replace(detectedRegex, (match, detected) => { return `${detected}`; }); return text; }