Keep clinical citations inline
All checks were successful
Forgejo Android APK / Build signed APK (push) Successful in 1m54s
All checks were successful
Forgejo Android APK / Build signed APK (push) Successful in 1m54s
This commit is contained in:
parent
c1ba6fa798
commit
e71a7e22e1
2 changed files with 7 additions and 1 deletions
|
|
@ -101,7 +101,6 @@ export function normalizeMarkdownText(text) {
|
|||
.replace(/(:)\s*[-–—]\s+(\*\*)?/g, '$1\n- $2')
|
||||
.replace(/(\[(?:\d+\s*,\s*)*\d+\]\.)\s+(\d+\.\s+[A-Z][A-Za-z][^\n]{0,80})/g, '$1\n$2')
|
||||
.replace(/([.!?])\s+(\d+\.\s+[A-Z][A-Za-z][^\n]{0,80})/g, '$1\n$2')
|
||||
.replace(/(\[(?:\d+\s*,\s*)*\d+\])(?=\s*(?:[A-Z][A-Za-z]+\s+){1,4}(?:deficits?|distress|apnoea|apnea|vomiting|seizures?|signs?|symptoms?|criteria|indications?|risk|oxygen|saturation|dehydration|lethargy|toxicity)\b)/g, '$1\n')
|
||||
.replace(/([^\n])\s+(#{1,4}\s+)/g, '$1\n\n$2')
|
||||
.replace(/(#{1,4}\s+[^\n]+?)\s+(-\s+)/g, '$1\n\n$2')
|
||||
.replace(/(#{1,4}\s+[^\n]+)\n(-\s+)/g, '$1\n\n$2')
|
||||
|
|
|
|||
|
|
@ -113,6 +113,13 @@ test('repairs smashed admission bullet list after citations', async () => {
|
|||
assert.doesNotMatch(html, /\]-/);
|
||||
});
|
||||
|
||||
test('keeps citations inline before clinical terms', async () => {
|
||||
const { renderAssistantMarkdown } = await loadCitationModule();
|
||||
const html = renderAssistantMarkdown('Assess for lethargy [1] and dehydration [2].', sources);
|
||||
assert.match(html, /lethargy <a class="assistant-cite"[^>]*>src<\/a> and dehydration <a class="assistant-cite"[^>]*>src<\/a>/);
|
||||
assert.doesNotMatch(html, /<\/a><br>\s*and dehydration/);
|
||||
});
|
||||
|
||||
test('repairs smashed head injury red flag bullets after citation clusters', async () => {
|
||||
const { renderAssistantMarkdown } = await loadCitationModule();
|
||||
const html = renderAssistantMarkdown('CT is indicated for: [1, 2, 3]- Focal neurologic deficits [1]- Signs of skull fracture [2]- Recurrent vomiting [3]', sources);
|
||||
|
|
|
|||
Loading…
Reference in a new issue