|
|
@ -5,13 +5,15 @@ const Posts = require(__dirname+'/../../db/posts.js') |
|
|
|
, pinktextRegex = /^<([^<].+)/gm |
|
|
|
, pinktextRegex = /^<([^<].+)/gm |
|
|
|
, boldRegex = /""(.+)""/gm |
|
|
|
, boldRegex = /""(.+)""/gm |
|
|
|
, titleRegex = /==(.+)==/gm |
|
|
|
, titleRegex = /==(.+)==/gm |
|
|
|
, italicRegex = /__(.+)__/gm |
|
|
|
, underlineRegex = /__(.+)__/gm |
|
|
|
|
|
|
|
, strikethroughRegex = /~~(.+)~~/gm |
|
|
|
|
|
|
|
, italicRegex = /\*\*(.+)\*\*/gm |
|
|
|
, linkRegex = /https?\:\/\/[^\s<>\[\]{}|\\^]+/g |
|
|
|
, linkRegex = /https?\:\/\/[^\s<>\[\]{}|\\^]+/g |
|
|
|
, spoilerRegex = /\|\|(.+)\|\|/gm |
|
|
|
, spoilerRegex = /\|\|(.+)\|\|/gm |
|
|
|
, detectedRegex = /(\(\(\(.+\)\)\))/gm |
|
|
|
, detectedRegex = /(\(\(\(.+\)\)\))/gm |
|
|
|
, codeRegex = /^```\s([\s\S]+)\s```/gm; |
|
|
|
, codeRegex = /^```\s([\s\S]+)\s```/gm; |
|
|
|
|
|
|
|
|
|
|
|
module.exports = (board, thread, text) => { |
|
|
|
module.exports = (text) => { |
|
|
|
|
|
|
|
|
|
|
|
//pinktext
|
|
|
|
//pinktext
|
|
|
|
text = text.replace(pinktextRegex, (match, pinktext) => { |
|
|
|
text = text.replace(pinktextRegex, (match, pinktext) => { |
|
|
@ -33,6 +35,21 @@ module.exports = (board, thread, text) => { |
|
|
|
return `<strong>${bold}</strong>`; |
|
|
|
return `<strong>${bold}</strong>`; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//bold
|
|
|
|
|
|
|
|
text = text.replace(boldRegex, (match, bold) => { |
|
|
|
|
|
|
|
return `<strong>${bold}</strong>`; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//underline
|
|
|
|
|
|
|
|
text = text.replace(underlineRegex, (match, underline) => { |
|
|
|
|
|
|
|
return `<span class='underline'>${underline}</span>`; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//strikethrough
|
|
|
|
|
|
|
|
text = text.replace(strikethroughRegex, (match, strike) => { |
|
|
|
|
|
|
|
return `<span class='strikethrough'>${strike}</span>`; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//titles
|
|
|
|
//titles
|
|
|
|
text = text.replace(titleRegex, (match, title) => { |
|
|
|
text = text.replace(titleRegex, (match, title) => { |
|
|
|
return `<span class='title'>${title}</span>`; |
|
|
|
return `<span class='title'>${title}</span>`; |
|
|
|