fix(議題解析): CRLF 的 body 不再讓清單靜靜變成空的

瀏覽器送出 textarea 一律用 CRLF,議題只要在 Gitea 網頁上被編輯過,body 逐行切開後
每一行行尾就掛著 \r。JS 的 . 不吃 \r,`(.*)$` 因此整行比不中——listSection 會把
目標、非目標、驗收標準這些段落一律回成空陣列,而且不報錯,下游拿到的是「這一段沒寫」
而不是「解析失敗」。

改用 [\s\S] 比對行尾,text 本來就有 trim 會把 \r 修掉。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-17 06:30:21 +00:00
co-authored by Claude Opus 5
parent a58d766009
commit 3977523eb3
+3 -1
View File
@@ -90,7 +90,9 @@ export function listSection(sections, name) {
for (const { line, inFence } of eachLine(sections.get(name))) { for (const { line, inFence } of eachLine(sections.get(name))) {
if (inFence) continue; if (inFence) continue;
const item = line.match(/^\s*(?:[-*+]|\d+\.)\s+(.*)$/); // [\s\S] 而非 . :CRLF 的 body 逐行切開後行尾有 \r,而 . 不吃 \r,
// 用 . 會讓整行比不中,清單靜靜變成空的。後面的 trim 再把 \r 修掉。
const item = line.match(/^\s*(?:[-*+]|\d+\.)\s+([\s\S]*)$/);
if (!item) continue; if (!item) continue;
const text = item[1].replace(/^\[[ xX]\]\s*/, '').trim(); const text = item[1].replace(/^\[[ xX]\]\s*/, '').trim();