docs(i18n): address ds-review-bot on the v4 restoration
解析器:三段闭合标签改为行首锚定(正文提及 </translation> 不再截 断)、重复段全文扫描并校验段序(补两条回归测试)。切换行:v4 模板 保持字面占位不变,资产文档写明全新配对由流水线在解析后按目标文件 名机械插入、配对门禁兜底。加粗后空格限定于字母/数字/汉字、标点前 一律不加;RFC 2119 关键词改为保留源侧强调标记(斜体归斜体、加粗 归加粗)。i18n README 双侧同步 v4 契约描述(不再承诺 CDATA 协议与 规则注入)并重录配对。
This commit is contained in:
@@ -42,9 +42,19 @@ describe('translation response sections', () => {
|
||||
expect(parseTranslationResponse(fenced).final).toBe('A')
|
||||
})
|
||||
|
||||
it('keeps an inline close tag inside prose from terminating the section', () => {
|
||||
const doc = { translation: 'the wire format uses </translation> as its close tag', review: '- 无修正', final: 'F' }
|
||||
expect(parseTranslationResponse(renderTranslationResponse(doc))).toEqual(doc)
|
||||
})
|
||||
|
||||
it('rejects a duplicate section appearing before final', () => {
|
||||
const early = '<translation>\nA\n</translation>\n<translation>\nB\n</translation>\n<review>\nR\n</review>\n<final>\nF\n</final>'
|
||||
expect(() => parseTranslationResponse(early)).toThrow(/duplicate <translation>/)
|
||||
})
|
||||
|
||||
it('rejects missing, unterminated, or duplicated sections', () => {
|
||||
expect(() => parseTranslationResponse('<translation>\nA\n</translation>')).toThrow(/missing <review>/)
|
||||
expect(() => parseTranslationResponse('<translation>\nA')).toThrow(/unterminated <translation>/)
|
||||
expect(() => parseTranslationResponse('<translation>\nA\n</translation>')).toThrow(/missing or unterminated <review>/)
|
||||
expect(() => parseTranslationResponse('<translation>\nA')).toThrow(/missing or unterminated <translation>/)
|
||||
const dup = '<translation>\nA\n</translation>\n<review>\nR\n</review>\n<final>\nF\n</final>\n<final>\nG\n</final>'
|
||||
expect(() => parseTranslationResponse(dup)).toThrow(/duplicate <final>/)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user