专刊
This commit is contained in:
35
scripts/test-fig-match.mjs
Normal file
35
scripts/test-fig-match.mjs
Normal file
@@ -0,0 +1,35 @@
|
||||
import {
|
||||
extractFigureNumbersFromText,
|
||||
paragraphMentionsFigureNumber,
|
||||
parseFigureNumberFromTitle,
|
||||
findFirstAmIdForFigureNumber
|
||||
} from '../src/utils/manuscriptMediaReferences.js';
|
||||
|
||||
const samples = [
|
||||
'Figure 3A and Figure 3B.',
|
||||
'as shown in Figure 3A and Figure 3B.',
|
||||
'See Fig. 3 and Fig. 3A',
|
||||
'as shown in <blue>Figure 3A</blue> and <blue>Figure 3B</blue>.'
|
||||
];
|
||||
for (const s of samples) {
|
||||
console.log(JSON.stringify(s), '=>', extractFigureNumbersFromText(s), 'mentions3', paragraphMentionsFigureNumber(s, 3));
|
||||
}
|
||||
console.log(
|
||||
'title',
|
||||
parseFigureNumberFromTitle('<span style="color:#d25a5a">Figure 3 Co-occurrence map</span>')
|
||||
);
|
||||
console.log(
|
||||
'find',
|
||||
findFirstAmIdForFigureNumber(
|
||||
[
|
||||
{ am_id: 1, type: 0, content: 'hello' },
|
||||
{
|
||||
am_id: 146120,
|
||||
type: 0,
|
||||
content: 'as shown in <blue>Figure 3A</blue> and <blue>Figure 3B</blue>.'
|
||||
},
|
||||
{ am_id: 3, type: 1, content: '', ami_id: 99 }
|
||||
],
|
||||
3
|
||||
)
|
||||
);
|
||||
Reference in New Issue
Block a user