fix(sonar): extract assignments from expressions (javascript:S1121)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
bab9b50643
commit
e81ebbc45b
@ -41,7 +41,11 @@ function sentenceRanges(text, a, b) {
|
||||
const re = /[^.!?…]*[.!?…]+[»«“”"’)\]]*\s*|[^.!?…]+$/g;
|
||||
const slice = text.slice(a, b);
|
||||
let m;
|
||||
while ((m = re.exec(slice)) && m[0].length) out.push([a + m.index, a + m.index + m[0].length]);
|
||||
while (true) {
|
||||
m = re.exec(slice);
|
||||
if (!m || !m[0].length) break;
|
||||
out.push([a + m.index, a + m.index + m[0].length]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@ -759,11 +759,14 @@ function audiobookGuessSpeaker(after, before) {
|
||||
// NOTE: no 'i' flag — names must be genuinely capitalized; German speech verbs
|
||||
// after a quote are lowercase, so this rejects pronouns like "sagte er".
|
||||
// after the quote: ", sagte Riskan" / "sagte Riskan" (verb → name)
|
||||
if ((m = new RegExp('^[\\s,;–-]*' + AB_SPEECH_VERBS + '\\s+(?:der|die|das|ein|eine)?\\s*' + _AB_NAME).exec(after || ''))) { const r = ok(m[1]); if (r) return r; }
|
||||
m = new RegExp('^[\\s,;–-]*' + AB_SPEECH_VERBS + '\\s+(?:der|die|das|ein|eine)?\\s*' + _AB_NAME).exec(after || '');
|
||||
if (m) { const r = ok(m[1]); if (r) return r; }
|
||||
// after the quote: ", Riskan sagte" (name → verb)
|
||||
if ((m = new RegExp('^[\\s,;–-]*' + _AB_NAME + '\\s+' + AB_SPEECH_VERBS).exec(after || ''))) { const r = ok(m[1]); if (r) return r; }
|
||||
m = new RegExp('^[\\s,;–-]*' + _AB_NAME + '\\s+' + AB_SPEECH_VERBS).exec(after || '');
|
||||
if (m) { const r = ok(m[1]); if (r) return r; }
|
||||
// before the quote: "Riskan sagte:" / "Riskan fragte"
|
||||
if ((m = new RegExp(_AB_NAME + '\\s+' + AB_SPEECH_VERBS + '[\\s:,–-]*$').exec(before || ''))) { const r = ok(m[1]); if (r) return r; }
|
||||
m = new RegExp(_AB_NAME + '\\s+' + AB_SPEECH_VERBS + '[\\s:,–-]*$').exec(before || '');
|
||||
if (m) { const r = ok(m[1]); if (r) return r; }
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -1635,7 +1635,8 @@ async function _charDetailPage(rec, allChars, opts) {
|
||||
sourcesList.forEach(function (s, idx) {
|
||||
const key = _libStr(s.line_hint || s.hint || '').trim().toLowerCase();
|
||||
if (!key) return;
|
||||
(sourcesByField[key] = sourcesByField[key] || []).push(idx);
|
||||
sourcesByField[key] = sourcesByField[key] || [];
|
||||
sourcesByField[key].push(idx);
|
||||
});
|
||||
const sourcesHtml = sourcesList.length ? (
|
||||
'<div class="lcd-sources">'
|
||||
|
||||
@ -55,7 +55,8 @@ async function refreshRehBackends() {
|
||||
_checkToneStyleSupport();
|
||||
}
|
||||
|
||||
(window._ttsRefreshHooks = window._ttsRefreshHooks || []).push(() => {
|
||||
window._ttsRefreshHooks = window._ttsRefreshHooks || [];
|
||||
window._ttsRefreshHooks.push(() => {
|
||||
const sel = $('reh-backend-select'); if (!sel) return;
|
||||
const backends = typeof availableTtsBackends === 'function' ? availableTtsBackends() : [];
|
||||
if (!backends.length) return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user