Report line-collapsed formatting

This commit is contained in:
Jiang Yio 2024-12-09 23:07:54 -05:00
parent fa25bf3c5c
commit 32de0bdd56

View File

@ -205,7 +205,7 @@
id: 'OR_PN:' + time.getTime() + ':' + x[2], id: 'OR_PN:' + time.getTime() + ':' + x[2],
emblem: 'emblem-notes', emblem: 'emblem-notes',
title: [x[4], x[5], '#' + x[2]], title: [x[4], x[5], '#' + x[2]],
detail: escape_html(x[6]) detail: escape_html(collapse_lines(x[6]))
}; };
}), }),
loader: reportloader_chunk, loader: reportloader_chunk,
@ -412,6 +412,10 @@
return fn; return fn;
} }
function collapse_lines(s) {
return s.replace(/(\S)[^\S\r\n]+\r?\n([^\s\.,\/#!$%\^&\*;:=\-_`~])/g, '$1 $2').replace(/([\.,!;])\r?\n([^\s\.,\/#!$%\^&\*;:=\-_`~])/g, '$1 $2');
}
const escape_div = document.createElement('div'); const escape_div = document.createElement('div');
function escape_html(s) { function escape_html(s) {
escape_div.textContent = s; escape_div.textContent = s;