more low-hanging fruits

This commit is contained in:
Henry Jameson 2026-08-04 17:12:46 +03:00
commit b2dca4a3f6
20 changed files with 45 additions and 45 deletions

View file

@ -181,7 +181,7 @@ export default {
}
// Processor to use with html_tree_converter
const processItem = (item, index, array, what) => {
const processItem = (item, index, array) => {
// Handle text nodes - just add emoji
if (typeof item === 'string') {
const emptyText = item.trim() === ''
@ -281,7 +281,7 @@ export default {
// Processor for back direction (for finding "last" stuff, just easier this way)
let encounteredTextReverse = false
const processItemReverse = (item, index, array, what) => {
const processItemReverse = (item, index, array) => {
// Handle text nodes - just add emoji
if (typeof item === 'string') {
const emptyText = item.trim() === ''
@ -479,7 +479,7 @@ export default {
>
{this.collapse
? pass2.map((x) => {
if (typeof x === 'string') return x.replace(/\n/g, ' ')
if (typeof x === 'string') return x.replaceAll('\n', ' ')
if (!Array.isArray(x)) return x
return x.map((y) => (y.type === 'br' ? ' ' : y))
})
@ -547,8 +547,8 @@ export const preProcessPerLine = (html, greentext) => {
(string.includes('>') || string.includes('<'))
) {
const cleanedString = string
.replace(/<[^>]+?>/gi, '') // remove all tags
.replace(/@\w+/gi, '') // remove mentions (even failed ones)
.replaceAll(/<[^>]+?>/gi, '') // remove all tags
.replaceAll(/@\w+/gi, '') // remove mentions (even failed ones)
.trim()
if (cleanedString.startsWith('&gt;')) {
return `<span class='greentext'>${string}</span>`