添加期刊引用分析
This commit is contained in:
49
scripts/test-ref-revision.mjs
Normal file
49
scripts/test-ref-revision.mjs
Normal file
@@ -0,0 +1,49 @@
|
||||
import {
|
||||
Document,
|
||||
Paragraph,
|
||||
TextRun,
|
||||
DeletedTextRun,
|
||||
InsertedTextRun,
|
||||
LevelFormat,
|
||||
LevelSuffix,
|
||||
AlignmentType,
|
||||
Packer
|
||||
} from 'docx';
|
||||
import JSZip from 'jszip';
|
||||
import fs from 'fs';
|
||||
|
||||
const doc = new Document({
|
||||
features: { trackRevisions: true },
|
||||
sections: [{
|
||||
children: [new Paragraph({
|
||||
children: [
|
||||
new DeletedTextRun({
|
||||
id: 1,
|
||||
author: 'Editor',
|
||||
date: new Date().toISOString(),
|
||||
text: 'David Harvey ',
|
||||
font: 'Charis SIL',
|
||||
size: 15
|
||||
}),
|
||||
new InsertedTextRun({
|
||||
id: 2,
|
||||
author: 'Editor',
|
||||
date: new Date().toISOString(),
|
||||
text: 'Harvey D ',
|
||||
font: 'Charis SIL',
|
||||
size: 15
|
||||
}),
|
||||
new TextRun('Contemporary Nursing Knowledge.')
|
||||
]
|
||||
})]
|
||||
}]
|
||||
});
|
||||
|
||||
const buf = await Packer.toBuffer(doc);
|
||||
fs.writeFileSync('test-ref-revision.docx', buf);
|
||||
const zip = await JSZip.loadAsync(buf);
|
||||
const docXml = await zip.file('word/document.xml').async('string');
|
||||
const settingsXml = await zip.file('word/settings.xml').async('string');
|
||||
console.log('has w:ins:', docXml.includes('<w:ins'));
|
||||
console.log('has w:del:', docXml.includes('<w:del'));
|
||||
console.log('trackRevisions:', settingsXml.includes('trackRevisions'));
|
||||
Reference in New Issue
Block a user