Commit aa96f1fe authored by David Jencks's avatar David Jencks
Browse files

issue-699 Introduce context holding all stage implementations, playbook, and event emitter

parent 12ea2a23
Pipeline #258493168 passed with stages
in 4 minutes and 18 seconds
......@@ -127,7 +127,7 @@ function computePageAttrs ({ component: componentName, version, module: module_,
return attrs
}
function extractAsciiDocMetadata (doc) {
function extractAsciiDocMetadata (doc, context) {
const metadata = { attributes: doc.getAttributes() }
if (doc.hasHeader()) {
const doctitle = (metadata.doctitle = doc.getDocumentTitle())
......@@ -151,12 +151,14 @@ function extractAsciiDocMetadata (doc) {
*
* @memberof asciidoc-loader
*
* @param {Object} context - The pipeline context, containing the playbook.
* @param {Object} playbook - The configuration object for Antora (default: {}).
* @param {Object} playbook.asciidoc - The AsciiDoc configuration data in the playbook.
*
* @returns {Object} A resolved configuration object to be used by the loadAsciiDoc function.
*/
function resolveAsciiDocConfig (playbook = {}) {
function resolveAsciiDocConfig (context = { playbook: {} }) {
const playbook = context.playbook
const attributes = {
env: 'site',
'env-site': '',
......
......@@ -421,7 +421,7 @@ describe('loadAsciiDoc()', () => {
},
},
}
const doc = loadAsciiDoc(inputFile, undefined, resolveAsciiDocConfig(playbook))
const doc = loadAsciiDoc(inputFile, undefined, resolveAsciiDocConfig({ playbook }))
const expectedAttributes = { ...playbook.asciidoc.attributes, 'site-url': 'https://docs.example.org' }
expect(doc.getAttributes()).to.include(expectedAttributes)
})
......@@ -441,7 +441,7 @@ describe('loadAsciiDoc()', () => {
},
},
}
const doc = loadAsciiDoc(inputFile, undefined, resolveAsciiDocConfig(playbook))
const doc = loadAsciiDoc(inputFile, undefined, resolveAsciiDocConfig({ playbook }))
const expectedAttributes = { ...playbook.asciidoc.attributes, 'site-title': 'Docs' }
expect(doc.getAttributes()).to.include(expectedAttributes)
})
......@@ -3704,7 +3704,7 @@ describe('loadAsciiDoc()', () => {
it('should return config with attributes for site title and url if set in playbook', () => {
const playbook = { site: { url: 'https://docs.example.org', title: 'Docs' }, ui: {} }
const config = resolveAsciiDocConfig(playbook)
const config = resolveAsciiDocConfig({ playbook })
expect(config.attributes).to.exist()
expect(config.attributes).to.include({
'site-title': 'Docs',
......@@ -3721,7 +3721,7 @@ describe('loadAsciiDoc()', () => {
},
},
}
const config = resolveAsciiDocConfig(playbook)
const config = resolveAsciiDocConfig({ playbook })
expect(config).to.not.equal(playbook.asciidoc)
expect(config.attributes).to.not.equal(playbook.asciidoc.attributes)
expect(config.attributes).to.include(playbook.asciidoc.attributes)
......@@ -3729,19 +3729,19 @@ describe('loadAsciiDoc()', () => {
it('should not load extensions if extensions are not defined', () => {
const playbook = { asciidoc: {} }
const config = resolveAsciiDocConfig(playbook)
const config = resolveAsciiDocConfig({ playbook })
expect(config.extensions).to.not.exist()
})
it('should not load extensions if extensions are empty', () => {
const playbook = { asciidoc: { extensions: [] } }
const config = resolveAsciiDocConfig(playbook)
const config = resolveAsciiDocConfig({ playbook })
expect(config.extensions).to.not.exist()
})
it('should load scoped extension into config but not register it globally', () => {
const playbook = { asciidoc: { extensions: [ospath.resolve(FIXTURES_DIR, 'ext/scoped-shout-block.js')] } }
const config = resolveAsciiDocConfig(playbook)
const config = resolveAsciiDocConfig({ playbook })
expect(config.extensions).to.exist()
expect(config.extensions).to.have.lengthOf(1)
expect(config.extensions[0]).to.be.instanceOf(Function)
......@@ -3752,7 +3752,7 @@ describe('loadAsciiDoc()', () => {
it('should load global extension and register it globally', () => {
const playbook = { asciidoc: { extensions: [ospath.resolve(FIXTURES_DIR, 'ext/global-shout-block.js')] } }
const config = resolveAsciiDocConfig(playbook)
const config = resolveAsciiDocConfig({ playbook })
expect(config.extensions).to.not.exist()
const Extensions = Asciidoctor.Extensions
const extensionGroupNames = Object.keys(Extensions.getGroups())
......@@ -3762,8 +3762,8 @@ describe('loadAsciiDoc()', () => {
it('should only register a global extension once', () => {
const playbook = { asciidoc: { extensions: [ospath.resolve(FIXTURES_DIR, 'ext/global-shout-block.js')] } }
resolveAsciiDocConfig(playbook)
resolveAsciiDocConfig(playbook)
resolveAsciiDocConfig({ playbook })
resolveAsciiDocConfig({ playbook })
const Extensions = Asciidoctor.Extensions
const extensionGroupNames = Object.keys(Extensions.getGroups())
expect(extensionGroupNames).to.have.lengthOf(1)
......@@ -3777,7 +3777,7 @@ describe('loadAsciiDoc()', () => {
extensions: ['./ext/scoped-shout-block.js'],
},
}
const config = resolveAsciiDocConfig(playbook)
const config = resolveAsciiDocConfig({ playbook })
expect(config.extensions).to.exist()
expect(config.extensions).to.have.lengthOf(1)
expect(config.extensions[0]).to.be.instanceOf(Function)
......@@ -3790,7 +3790,7 @@ describe('loadAsciiDoc()', () => {
extensions: ['lorem-block-macro'],
},
}
const config = resolveAsciiDocConfig(playbook)
const config = resolveAsciiDocConfig({ playbook })
expect(config.extensions).to.exist()
expect(config.extensions).to.have.lengthOf(1)
expect(config.extensions[0]).to.be.instanceOf(Function)
......@@ -3807,7 +3807,7 @@ describe('loadAsciiDoc()', () => {
],
},
}
const config = resolveAsciiDocConfig(playbook)
const config = resolveAsciiDocConfig({ playbook })
expect(config.extensions).to.exist()
expect(config.extensions).to.have.lengthOf(2)
expect(config.extensions[0]).to.be.instanceOf(Function)
......
......@@ -6,7 +6,7 @@ const publishSite = require('@antora/site-publisher')
async function generateSite (args, env) {
const playbook = await buildPlaybook(args, env)
const siteCatalog = { getFiles: () => [create418Page()] }
return publishSite(playbook, [siteCatalog])
return publishSite([siteCatalog], { playbook })
}
function create418Page () {
......
......@@ -60,6 +60,7 @@ const URL_AUTH_EXTRACTOR_RX = /^(https?:\/\/)(?:([^/:@]+)?(?::([^/@]+)?)?@)?(.*)
*
* @memberof content-aggregator
*
* @param {Object} context - The pipeline context, containing the playbook.
* @param {Object} playbook - The configuration object for Antora.
* @param {Object} playbook.dir - The working directory of the playbook.
* @param {Object} playbook.runtime - The runtime configuration object for Antora.
......@@ -78,7 +79,8 @@ const URL_AUTH_EXTRACTOR_RX = /^(https?:\/\/)(?:([^/:@]+)?(?::([^/@]+)?)?@)?(.*)
*
* @returns {Promise<Object>} A map of files organized by component version.
*/
function aggregateContent (playbook, eventEmitter) {
function aggregateContent (context = {}) {
let eventEmitter = context.eventEmitter
if (!eventEmitter) {
const baseEmitter = new EventEmitter()
......@@ -95,6 +97,7 @@ function aggregateContent (playbook, eventEmitter) {
listenerCount: (name) => baseEmitter.listenerCount(name),
}
}
const playbook = context.playbook
const startDir = playbook.dir || '.'
const { branches, editUrl, tags, sources } = playbook.content
const sourcesByUrl = sources.reduce(
......
......@@ -7,17 +7,18 @@ const ContentCatalog = require('./content-catalog')
*
* @memberof content-classifier
*
* @param {Object} aggregate - The raw aggregate of virtual file objects to be classified.
* @param {Object} [siteAsciiDocConfig={}] - Site-wide AsciiDoc processor configuration options.
* @param {Object} context - the context object for the pipeline, containing the playbook.
* @param {Object} playbook - The configuration object for Antora.
* @param {Object} playbook.site - Site-related configuration data.
* @param {String} playbook.site.startPage - The start page for the site; redirects from base URL.
* @param {Object} playbook.urls - URL settings for the site.
* @param {String} playbook.urls.htmlExtensionStyle - The style to use when computing page URLs.
* @param {Object} aggregate - The raw aggregate of virtual file objects to be classified.
* @param {Object} [siteAsciiDocConfig={}] - Site-wide AsciiDoc processor configuration options.
* @returns {ContentCatalog} A structured catalog of content components and virtual content files.
*/
function classifyContent (playbook, aggregate, siteAsciiDocConfig = {}) {
const contentCatalog = new ContentCatalog(playbook)
function classifyContent (aggregate, siteAsciiDocConfig = {}, context) {
const contentCatalog = new ContentCatalog(context.playbook)
aggregate
.reduce((accum, componentVersionData) => {
const { name, version } = componentVersionData
......@@ -38,7 +39,7 @@ function classifyContent (playbook, aggregate, siteAsciiDocConfig = {}) {
files.forEach((file) => allocateSrc(file, name, version, nav) && contentCatalog.addFile(file))
contentCatalog.registerComponentVersionStartPage(name, componentVersion, startPage)
})
contentCatalog.registerSiteStartPage(playbook.site.startPage)
contentCatalog.registerSiteStartPage(context.playbook.site.startPage)
return contentCatalog
}
......
......@@ -832,7 +832,7 @@ describe('ContentCatalog', () => {
})
it('should return all files in catalog', () => {
const contentCatalog = classifyContent(playbook, aggregate)
const contentCatalog = classifyContent(aggregate, {}, { playbook })
const files = contentCatalog.getFiles()
expect(files).to.have.lengthOf(5)
const pages = files.filter((it) => it.src.family === 'page')
......@@ -842,7 +842,7 @@ describe('ContentCatalog', () => {
})
it('should map getAll as alias for getFiles', () => {
const contentCatalog = classifyContent(playbook, aggregate)
const contentCatalog = classifyContent(aggregate, {}, { playbook })
expect(contentCatalog.getAll).to.equal(contentCatalog.getFiles)
const files = contentCatalog.getAll()
expect(files).to.have.lengthOf(5)
......@@ -875,7 +875,7 @@ describe('ContentCatalog', () => {
})
it('should find all pages', () => {
const contentCatalog = classifyContent(playbook, aggregate)
const contentCatalog = classifyContent(aggregate, {}, { playbook })
const pages = contentCatalog.getPages()
expect(pages.length).to.equal(2)
pages.sort((a, b) => a.src.version.localeCompare(b.src.version) || a.path.localeCompare(b.path))
......@@ -886,7 +886,7 @@ describe('ContentCatalog', () => {
})
it('should find pages that match filter', () => {
const contentCatalog = classifyContent(playbook, aggregate)
const contentCatalog = classifyContent(aggregate, {}, { playbook })
const pages = contentCatalog.getPages((page) => page.src.version === 'v1.0.0')
expect(pages.length).to.equal(1)
expect(pages[0].path).to.equal('modules/ROOT/pages/page-two.adoc')
......@@ -928,7 +928,7 @@ describe('ContentCatalog', () => {
})
it('should find files by family', () => {
const contentCatalog = classifyContent(playbook, aggregate)
const contentCatalog = classifyContent(aggregate, {}, { playbook })
const numPages = contentCatalog.getPages().length
const pages = contentCatalog.findBy({ family: 'page' })
expect(pages).to.have.lengthOf(numPages)
......@@ -942,7 +942,7 @@ describe('ContentCatalog', () => {
})
it('should find files by component', () => {
const pages = classifyContent(playbook, aggregate).findBy({ component: 'the-component' })
const pages = classifyContent(aggregate, {}, { playbook }).findBy({ component: 'the-component' })
expect(pages).to.have.lengthOf(7)
pages.sort((a, b) => a.src.version.localeCompare(b.src.version) || a.path.localeCompare(b.path))
expect(pages[0].path).to.equal('modules/ROOT/assets/images/foo.png')
......@@ -962,7 +962,7 @@ describe('ContentCatalog', () => {
})
it('should find files by relative path', () => {
const pages = classifyContent(playbook, aggregate).findBy({ relative: 'page-one.adoc' })
const pages = classifyContent(aggregate, {}, { playbook }).findBy({ relative: 'page-one.adoc' })
expect(pages).to.have.lengthOf(2)
pages.sort((a, b) => a.src.version.localeCompare(b.src.version))
expect(pages[0].path).to.equal('modules/ROOT/pages/page-one.adoc')
......@@ -972,7 +972,7 @@ describe('ContentCatalog', () => {
})
it('should find files by extname', () => {
const pages = classifyContent(playbook, aggregate).findBy({ extname: '.svg' })
const pages = classifyContent(aggregate, {}, { playbook }).findBy({ extname: '.svg' })
expect(pages).to.have.lengthOf(1)
const page = pages[0]
expect(page.path).to.equal('modules/ROOT/assets/images/directory-structure.svg')
......@@ -980,7 +980,7 @@ describe('ContentCatalog', () => {
})
it('should find all versions of a page', () => {
const pages = classifyContent(playbook, aggregate).findBy({
const pages = classifyContent(aggregate, {}, { playbook }).findBy({
component: 'the-component',
module: 'ROOT',
family: 'page',
......@@ -1693,32 +1693,32 @@ describe('ContentCatalog', () => {
it('should find file by qualified page spec', () => {
const pageSpec = 'v1.2.3@the-component:ROOT:page-one.adoc'
const page = classifyContent(playbook, aggregate).resolvePage(pageSpec)
const page = classifyContent(aggregate, {}, { playbook }).resolvePage(pageSpec)
expect(page.path).to.equal('modules/ROOT/pages/page-one.adoc')
})
it('should return undefined if file not resolved from qualified page spec', () => {
const pageSpec = 'v1.2.3@the-component:ROOT:no-such-page.adoc'
const page = classifyContent(playbook, aggregate).resolvePage(pageSpec)
const page = classifyContent(aggregate, {}, { playbook }).resolvePage(pageSpec)
expect(page).to.not.exist()
})
it('should find file by contextual page spec', () => {
const pageSpec = 'ROOT:page-one.adoc'
const context = { component: 'the-component', version: 'v1.2.3' }
const page = classifyContent(playbook, aggregate).resolvePage(pageSpec, context)
const page = classifyContent(aggregate, {}, { playbook }).resolvePage(pageSpec, context)
expect(page.path).to.equal('modules/ROOT/pages/page-one.adoc')
})
it('should return undefined if file not resolved from contextual page spec', () => {
const pageSpec = 'ROOT:page-one.adoc'
const context = {}
const page = classifyContent(playbook, aggregate).resolvePage(pageSpec, context)
const page = classifyContent(aggregate, {}, { playbook }).resolvePage(pageSpec, context)
expect(page).to.not.exist()
})
it('should dereference alias in order to resolve page', () => {
const contentCatalog = classifyContent(playbook, aggregate)
const contentCatalog = classifyContent(aggregate, {}, { playbook })
const targetPage = contentCatalog.resolvePage('v1.2.3@the-component::page-one.adoc')
contentCatalog.registerPageAlias('alias.adoc', targetPage)
const pageResolvedFromAlias = contentCatalog.resolvePage('v1.2.3@the-component::alias.adoc')
......@@ -1741,7 +1741,7 @@ describe('ContentCatalog', () => {
it('should find file by qualified resource spec', () => {
const pageSpec = 'v1.2.3@the-component:ROOT:image$foo.png'
const page = classifyContent(playbook, aggregate).resolveResource(pageSpec)
const page = classifyContent(aggregate, {}, { playbook }).resolveResource(pageSpec)
expect(page.path).to.equal('modules/ROOT/assets/images/foo.png')
})
})
......@@ -1759,7 +1759,7 @@ describe('ContentCatalog', () => {
})
it('should find file by ID', () => {
const page = classifyContent(playbook, aggregate).getById({
const page = classifyContent(aggregate, {}, { playbook }).getById({
component: 'the-component',
version: 'v1.2.3',
module: 'ROOT',
......@@ -1770,7 +1770,7 @@ describe('ContentCatalog', () => {
})
it('should return undefined if ID is not found', () => {
const page = classifyContent(playbook, aggregate).getById({
const page = classifyContent(aggregate, {}, { playbook }).getById({
component: 'the-component',
version: 'v1.2.3',
module: 'ROOT',
......@@ -1794,7 +1794,7 @@ describe('ContentCatalog', () => {
})
it('should find file by path', () => {
const page = classifyContent(playbook, aggregate).getByPath({
const page = classifyContent(aggregate, {}, { playbook }).getByPath({
component: 'the-component',
version: 'v1.2.3',
path: 'modules/ROOT/pages/_partials/tables/options.adoc',
......@@ -1809,7 +1809,7 @@ describe('ContentCatalog', () => {
})
it('should return undefined if path is not found', () => {
const page = classifyContent(playbook, aggregate).getByPath({
const page = classifyContent(aggregate, {}, { playbook }).getByPath({
component: 'the-component',
version: 'v1.2.3',
path: 'modules/ROOT/pages/_partials/does-not-exist.adoc',
......
'use strict'
const { loadAsciiDoc, extractAsciiDocMetadata } = require('@antora/asciidoc-loader')
/**
* Converts the contents on the specified file from AsciiDoc to embedded HTML.
*
......@@ -20,13 +18,15 @@ const { loadAsciiDoc, extractAsciiDocMetadata } = require('@antora/asciidoc-load
* @param {File} file - The virtual file whose contents is an AsciiDoc source document.
* @param {ContentCatalog} [contentCatalog=undefined] - The catalog of all virtual content files in the site.
* @param {Object} [asciidocConfig={}] - AsciiDoc processor configuration options specific to this file.
* @param {Object} context - The pipeline context.
*
* @returns {File} The virtual file that was converted.
*/
function convertDocument (file, contentCatalog = undefined, asciidocConfig = {}) {
const doc = loadAsciiDoc(file, contentCatalog, asciidocConfig)
function convertDocument (file, contentCatalog = undefined, asciidocConfig = {}, context) {
const { loadAsciiDoc, extractAsciiDocMetadata } = context.asciidocLoader
const doc = loadAsciiDoc(file, contentCatalog, asciidocConfig, context)
if (!file.asciidoc) {
file.asciidoc = extractAsciiDocMetadata(doc)
file.asciidoc = extractAsciiDocMetadata(doc, context)
if (doc.hasAttribute('page-partial')) file.src.contents = file.contents
}
file.contents = Buffer.from(doc.convert())
......
'use strict'
const convertDocument = require('./convert-document')
const { loadAsciiDoc, extractAsciiDocMetadata } = require('@antora/asciidoc-loader')
const ON_DOCUMENT_HEADERS_PARSED = 'onDocumentHeadersParsed'
/**
......@@ -23,10 +22,12 @@ const ON_DOCUMENT_HEADERS_PARSED = 'onDocumentHeadersParsed'
*
* @param {ContentCatalog} contentCatalog - The catalog of all virtual content files in the site.
* @param {Object} [siteAsciiDocConfig={}] - Site-wide AsciiDoc processor configuration options.
* @param {Object} context - The pipeline context.
*
* @returns {Array<File>} The publishable virtual files in the page family taken from the content catalog.
*/
async function convertDocuments (contentCatalog, siteAsciiDocConfig = {}, eventEmitter) {
async function convertDocuments (contentCatalog, siteAsciiDocConfig = {}, context = {}) {
const { loadAsciiDoc, extractAsciiDocMetadata } = context.asciidocLoader
const mainAsciiDocConfigs = new Map()
contentCatalog.getComponents().forEach(({ name: component, versions }) => {
versions.forEach(({ version, asciidoc }) => {
......@@ -44,7 +45,9 @@ async function convertDocuments (contentCatalog, siteAsciiDocConfig = {}, eventE
if (page.mediaType === 'text/asciidoc') {
const asciidocConfig = headerAsciiDocConfigs.get(buildCacheKey(page.src))
const { attributes } = (page.asciidoc = extractAsciiDocMetadata(
loadAsciiDoc(page, contentCatalog, asciidocConfig || Object.assign({}, siteAsciiDocConfig, headerOverrides))
loadAsciiDoc(page, contentCatalog,
asciidocConfig || Object.assign({}, siteAsciiDocConfig, headerOverrides), context),
context
))
Object.defineProperty(page, 'title', {
get () {
......@@ -56,13 +59,14 @@ async function convertDocuments (contentCatalog, siteAsciiDocConfig = {}, eventE
}
return page
})
if (eventEmitter) {
await eventEmitter.emit(ON_DOCUMENT_HEADERS_PARSED, { pagesWithHeaders, contentCatalog })
if (context.eventEmitter) {
await context.eventEmitter.emit(ON_DOCUMENT_HEADERS_PARSED, { pagesWithHeaders, contentCatalog })
}
return pagesWithHeaders
.map((page) =>
page.mediaType === 'text/asciidoc'
? convertDocument(page, contentCatalog, mainAsciiDocConfigs.get(buildCacheKey(page.src)) || siteAsciiDocConfig)
? convertDocument(page, contentCatalog,
mainAsciiDocConfigs.get(buildCacheKey(page.src)) || siteAsciiDocConfig, context)
: page
)
.map((page) => delete page.src.contents && page)
......
......@@ -16,9 +16,6 @@
"url": "https://gitlab.com/antora/antora/issues"
},
"main": "lib/index.js",
"dependencies": {
"@antora/asciidoc-loader": "3.0.0-alpha.1"
},
"engines": {
"node": ">=10.17.0"
},
......
......@@ -4,7 +4,8 @@
const { expect, heredoc, spy } = require('../../../test/test-utils')
const { convertDocument } = require('@antora/document-converter')
const { resolveAsciiDocConfig } = require('@antora/asciidoc-loader')
const context = { asciidocLoader: require('@antora/asciidoc-loader') }
const { resolveAsciiDocConfig } = context.asciidocLoader
describe('convertDocument()', () => {
let inputFile
......@@ -21,7 +22,7 @@ describe('convertDocument()', () => {
url: 'https://docs.example.org',
},
}
asciidocConfig = resolveAsciiDocConfig(playbook)
asciidocConfig = resolveAsciiDocConfig({ playbook })
inputFile = {
path: 'modules/module-a/pages/page-a.adoc',
dirname: 'modules/module-a/pages',
......@@ -90,7 +91,7 @@ describe('convertDocument()', () => {
image::module-b:screenshot.png[]
`)
convertDocument(inputFile, contentCatalog, asciidocConfig)
convertDocument(inputFile, contentCatalog, asciidocConfig, context)
expect(contentCatalog.resolveResource)
.nth(1)
.called.with('module-b:screenshot.png', inputFile.src)
......@@ -134,14 +135,14 @@ describe('convertDocument()', () => {
++++
++++
`)
expect(() => convertDocument(inputFile, undefined, asciidocConfig)).to.throw("undefined method `include?' for nil")
expect(() => convertDocument(inputFile, undefined, asciidocConfig, context)).to.throw("undefined method `include?' for nil")
})
it('should resolve attachment relative to module root', () => {
inputFileInTopicFolder.contents = Buffer.from(heredoc`
Grab the link:{attachmentsdir}/quickstart-project.zip[quickstart project].
`)
convertDocument(inputFileInTopicFolder, undefined, asciidocConfig)
convertDocument(inputFileInTopicFolder, undefined, asciidocConfig, context)
const contents = inputFileInTopicFolder.contents.toString()
expect(contents).to.include('href="../_attachments/quickstart-project.zip"')
})
......@@ -152,7 +153,7 @@ describe('convertDocument()', () => {
NOTE: Icons not enabled.
`)
convertDocument(inputFile)
convertDocument(inputFile, undefined, {}, context)
expect(inputFile.asciidoc).to.exist()
const contents = inputFile.contents.toString()
expect(contents).to.include('<h2 id="_heading">Heading</h2>')
......@@ -165,7 +166,7 @@ describe('convertDocument()', () => {
article contents
`)
convertDocument(inputFile, undefined, asciidocConfig)
convertDocument(inputFile, undefined, asciidocConfig, context)
expect(inputFile.asciidoc).to.exist()
expect(inputFile.asciidoc.doctitle).to.equal('<em>Awesome</em> Document Title')
})
......@@ -174,7 +175,7 @@ describe('convertDocument()', () => {
inputFile.contents = Buffer.from(heredoc`
article contents only
`)
convertDocument(inputFile, undefined, asciidocConfig)
convertDocument(inputFile, undefined, asciidocConfig, context)
expect(inputFile.asciidoc).to.exist()
expect(inputFile.asciidoc.doctitle).to.not.exist()
expect(inputFile.asciidoc.xreftext).to.not.exist()
......@@ -188,7 +189,7 @@ describe('convertDocument()', () => {
article contents
`)
convertDocument(inputFile, undefined, asciidocConfig)
convertDocument(inputFile, undefined, asciidocConfig, context)
expect(inputFile.asciidoc).to.exist()
expect(inputFile.asciidoc.xreftext).to.equal('<em>Awesome</em> Document Title')
})
......@@ -199,7 +200,7 @@ describe('convertDocument()', () => {
article contents
`)
convertDocument(inputFile, undefined, asciidocConfig)
convertDocument(inputFile, undefined, asciidocConfig, context)
expect(inputFile.asciidoc).to.exist()
expect(inputFile.asciidoc.doctitle).to.equal(inputFile.asciidoc.xreftext)
expect(inputFile.asciidoc.xreftext).to.equal('<em>Awesome</em> Document Title')
......@@ -212,7 +213,7 @@ describe('convertDocument()', () => {
article contents
`)
convertDocument(inputFile, undefined, asciidocConfig)
convertDocument(inputFile, undefined, asciidocConfig, context)
expect(inputFile.asciidoc).to.exist()
expect(inputFile.asciidoc.navtitle).to.equal('Start <em>Here</em>')
})
......@@ -224,7 +225,7 @@ describe('convertDocument()', () => {
article contents
`)
convertDocument(inputFile, undefined, asciidocConfig)
convertDocument(inputFile, undefined, asciidocConfig, context)
expect(inputFile.asciidoc).to.exist()
expect(inputFile.asciidoc.navtitle).to.exist()
expect(inputFile.asciidoc.navtitle).to.equal('Start <em>Here</em>')
......@@ -237,7 +238,7 @@ describe('convertDocument()', () => {
article contents
`)
convertDocument(inputFile, undefined, asciidocConfig)
convertDocument(inputFile, undefined, asciidocConfig, context)
<