UNPKG

@antora/assembler

Version:

A JavaScript library that merges AsciiDoc content from multiple pages in an Antora site into assembly files and delegates to an exporter to convert those files to another format, such as PDF.

18 lines (14 loc) 596 B
'use strict' const computeOut = require('./compute-out') function createAsciiDocFile (contentCatalog, file) { file.mediaType = 'text/asciidoc' const src = file.src const out = computeOut.call(contentCatalog, src) if (src.family === 'export') { contentCatalog.removeFile((file = contentCatalog.addFile(Object.assign(file, { path: out.path, out: null })))) return file } const pub = { url: '/' + out.path, moduleRootPath: out.moduleRootPath, rootPath: out.rootPath } return { contents: src.contents ?? Buffer.alloc(0), src, out, pub } } module.exports = createAsciiDocFile