@antora/assembler
Advanced tools
Comparing version 1.0.0-alpha.4 to 1.0.0-alpha.5
@@ -30,9 +30,11 @@ 'use strict' | ||
if (!config.asciidoc) { | ||
config.asciidoc = { attributes: (asciidocAttrs = { doctype: 'book' }) } | ||
config.asciidoc = { attributes: (asciidocAttrs = {}) } | ||
} else if (!(asciidocAttrs = config.asciidoc.attributes)) { | ||
config.asciidoc.attributes = asciidocAttrs = { doctype: 'book' } | ||
config.asciidoc.attributes = asciidocAttrs = {} | ||
} | ||
Object.assign(asciidocAttrs, { revdate: new Date().toISOString().split('T')[0], 'page-partial': null }) | ||
if (!('doctype' in asciidocAttrs)) asciidocAttrs.doctype = 'book' | ||
asciidocAttrs.revdate = new Date().toISOString().split('T')[0] | ||
asciidocAttrs['page-partial'] = null | ||
if (config.componentVersions == null) { | ||
config.componentVersions = ['**'] | ||
config.componentVersions = ['*'] | ||
} else if (typeof config.componentVersions === 'string') { | ||
@@ -39,0 +41,0 @@ config.componentVersions = config.componentVersions.split(', ') |
@@ -169,3 +169,6 @@ 'use strict' | ||
} | ||
const siteUrl = doc.getAttribute('site-url') | ||
const siteUrl = ((val) => { | ||
if (!val || val === '/') return '' | ||
return val.charAt(val.length - 1) === '/' ? val.substr(0, val.length - 1) : val | ||
})(doc.getAttribute('site-url')) | ||
const lines = doc.getSourceLines() | ||
@@ -175,5 +178,6 @@ const ignoreLines = [] | ||
if (doc.hasSections()) fixSectionLevels(doc.getSections(), level === 0) | ||
const allBlocks = doc.findBy( | ||
{ traverse_documents: true }, | ||
(it) => it.getContext() !== 'document' && !(it.getContext() === 'table_cell' && it.getStyle() === 'asciidoc') | ||
const allBlocks = doc.findBy({ traverse_documents: true }, (it) => | ||
it.getContext() === 'document' | ||
? it.getDocument().isNested() | ||
: !(it.getContext() === 'table_cell' && it.getStyle() === 'asciidoc') | ||
) | ||
@@ -303,4 +307,4 @@ allBlocks.forEach((block) => { | ||
const context = block.getContext() | ||
const idx = lineno - 1 | ||
if (context === 'section') { | ||
let idx = lineno - 1 | ||
if (context === 'section' && !block.getDocument().isNested()) { | ||
if (block.getSectionName() === 'header') { | ||
@@ -353,2 +357,5 @@ lines.splice(idx, 1) | ||
} | ||
} else if (context === 'document' && block.hasHeader()) { | ||
// nested document | ||
idx = (block.getHeader().getLineNumber() || idx + 1) - 1 | ||
} | ||
@@ -371,3 +378,3 @@ if (block.getId()) rewriteStyleAttribute(block, lines, idx, idprefix) | ||
} | ||
} else if (val != null && !doc.isAttributeLocked(name)) { | ||
} else if (val != null && !(doc.isAttributeLocked(name) || name === 'doctype')) { | ||
accum.push(`:!${name}:`) | ||
@@ -374,0 +381,0 @@ } |
@@ -10,3 +10,5 @@ 'use strict' | ||
const assemblerAsciiDocAttributes = Object.assign({}, assemblerAsciiDocConfig.attributes) | ||
delete assemblerAsciiDocAttributes['source-highlighter'] // only used at convert time | ||
const { doctype, 'source-highlighter': sourceHighlighter } = assemblerAsciiDocAttributes | ||
delete assemblerAsciiDocAttributes.doctype | ||
delete assemblerAsciiDocAttributes['source-highlighter'] | ||
return filterComponentVersions(contentCatalog.getComponents(), assemblerConfig.componentVersions).reduce( | ||
@@ -34,3 +36,4 @@ (accum, componentVersion) => { | ||
: {} | ||
return accum.concat( | ||
delete mutableAttributes.doctype | ||
accum = accum.concat( | ||
prepareOutlines(navigation, rootEntry, rootLevel).map((outline) => | ||
@@ -49,2 +52,7 @@ produceAggregateDocument( | ||
) | ||
mergedAsciiDocConfig.attributes.doctype = doctype | ||
sourceHighlighter | ||
? (mergedAsciiDocConfig.attributes['source-highlighter'] = sourceHighlighter) | ||
: delete mergedAsciiDocConfig.attributes['source-highlighter'] | ||
return accum | ||
}, | ||
@@ -51,0 +59,0 @@ [] |
{ | ||
"name": "@antora/assembler", | ||
"version": "1.0.0-alpha.4", | ||
"version": "1.0.0-alpha.5", | ||
"description": "An extension library for Antora that assembles content from multiple pages into a single AsciiDoc file to converted and publish.", | ||
@@ -28,2 +28,3 @@ "license": "MPL-2.0", | ||
"./produce-aggregate-document": "./lib/produce-aggregate-document.js", | ||
"./produce-aggregate-documents": "./lib/produce-aggregate-documents.js", | ||
"./select-mutable-attributes": "./lib/select-mutable-attributes.js" | ||
@@ -30,0 +31,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47979
1116