update
This commit is contained in:
@@ -70,3 +70,7 @@ export function deleteBook(id: string): Promise<{ ok: true }> {
|
||||
export function generateLesson(topic: string): Promise<GenerateResult> {
|
||||
return request('/api/generate', { method: 'POST', body: JSON.stringify({ topic }) })
|
||||
}
|
||||
|
||||
export function generateOutline(theme: string): Promise<{ titles: string[] }> {
|
||||
return request('/api/generate/outline', { method: 'POST', body: JSON.stringify({ theme }) })
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ export function parseTeachingDesign(filename: string, markdown: string): Teachin
|
||||
if (!reflectionTable) {
|
||||
warnings.push({ code: 'missing-reflection', message: '教学成效与反思表格格式不正确。' })
|
||||
} else {
|
||||
for (const row of reflectionTable.rows) {
|
||||
for (const row of [reflectionTable.header, ...reflectionTable.rows]) {
|
||||
const label = cleanLabel(row[0] ?? '')
|
||||
const value = normalizeMultiline(row[1] ?? '')
|
||||
if (label === '教学成效') design.effectiveness = value
|
||||
|
||||
@@ -166,6 +166,24 @@ export function extractMarkdownTable(
|
||||
const header = splitMarkdownRow(headerLine)
|
||||
const divider = splitMarkdownRow(dividerLine)
|
||||
|
||||
// Handle separator-first tables (no header row: starts with |:---|:---|)
|
||||
if (header.length > 0 && header.every((cell) => dividerCellPattern.test(cell))) {
|
||||
const rows: string[][] = []
|
||||
let end = start
|
||||
|
||||
while (end + 1 < lines.length && !insideFence[end + 1] && isTableRow(lines[end + 1]!)) {
|
||||
end++
|
||||
const row = splitMarkdownRow(lines[end]!)
|
||||
if (!row.every((cell) => dividerCellPattern.test(cell))) {
|
||||
rows.push(row)
|
||||
}
|
||||
}
|
||||
|
||||
if (rows.length > 0) {
|
||||
return { start, end, header: [], rows }
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
header.length === 0 ||
|
||||
divider.length !== header.length ||
|
||||
|
||||
Reference in New Issue
Block a user