site/node_modules/@citation-js/plugin-bibtex/lib-mjs/output/bibtxt.js

12 lines
437 B
JavaScript
Raw Normal View History

2024-10-14 06:09:33 +00:00
function formatEntry({
type,
label,
properties
}, dict) {
const fields = Object.entries(properties).concat([['type', type]]).map(([field, value]) => dict.listItem.join(`${field}: ${value}`));
return dict.entry.join(`[${label}]${dict.list.join(fields.join(''))}`);
}
export function format(src, dict) {
const entries = src.map(entry => formatEntry(entry, dict)).join('\n');
return dict.bibliographyContainer.join(entries);
}