24 lines
818 B
JavaScript
24 lines
818 B
JavaScript
const { Document, Packer } = require('docx');
|
|
const JSZip = require('jszip');
|
|
const { buildManuscriptPageFooter, patchManuscriptPageFootersToXml } = require('../src/utils/exportManuscriptWordFooter.js');
|
|
|
|
(async function () {
|
|
const footer = buildManuscriptPageFooter({
|
|
journal: { website: 'https://www.tmrjournals.com/bmec' }
|
|
});
|
|
const doc = new Document({
|
|
sections: [
|
|
{
|
|
properties: {},
|
|
footers: { default: footer },
|
|
children: []
|
|
}
|
|
]
|
|
});
|
|
const buf = await Packer.toBuffer(doc);
|
|
let xml = await (await JSZip.loadAsync(buf)).file('word/footer1.xml').async('string');
|
|
console.log('BEFORE PATCH\n', xml);
|
|
xml = patchManuscriptPageFootersToXml(xml);
|
|
console.log('AFTER PATCH\n', xml);
|
|
})();
|