mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 18:46:01 +01:00
fix: add pre-processing step to title generation logic so sbd doesn't fall over so badly
This commit is contained in:
@@ -165,7 +165,11 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
||||
|
||||
// mainPid ok to leave as-is
|
||||
if (!title) {
|
||||
const sentences = tokenizer.sentences(content || sourceContent, { sanitize: true });
|
||||
// Naive pre-processing prior to sbd tokenization
|
||||
let sbdInput = content || sourceContent;
|
||||
sbdInput = sbdInput.replace('</p><p>', '</p>\n<p>');
|
||||
|
||||
const sentences = tokenizer.sentences(sbdInput, { sanitize: true, newline_boundaries: true });
|
||||
title = sentences.shift();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user