Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antora/asciidoc-loader

Package Overview
Dependencies
Maintainers
2
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antora/asciidoc-loader - npm Package Compare versions

Comparing version 2.3.4 to 3.0.0-alpha.1

6

lib/converter/html5.js

@@ -72,3 +72,3 @@ 'use strict'

node.setAttribute('link', refSpec)
} else if (~refSpec.indexOf('.adoc')) {
} else if (refSpec.endsWith('.adoc') || ~refSpec.indexOf('.adoc#')) {
const pageRefCallback = converter[$pageRefCallback]

@@ -89,7 +89,5 @@ if (pageRefCallback) {

function matchesResourceSpec (target) {
return ~target.indexOf(':')
? !(~target.indexOf('://') || (target.startsWith('data:') && ~target.indexOf(',')))
: target.indexOf('@') > 0
return !(~target.indexOf(':') && (~target.indexOf('://') || (target.startsWith('data:') && ~target.indexOf(','))))
}
module.exports = Html5Converter

@@ -47,4 +47,8 @@ 'use strict'

} else {
log('error', `include target not found: ${target}`, reader)
reader.$unshift(`Unresolved include directive in ${reader.$cursor_at_prev_line().file} - include::${target}[]`)
if (attrs['$key?']('optional-option')) {
log('info', `optional include dropped because include file not found: ${target}`, reader)
} else {
log('error', `include target not found: ${target}`, reader)
reader.$unshift(`Unresolved include directive in ${reader.$cursor_at_prev_line().file} - include::${target}[]`)
}
}

@@ -73,3 +77,3 @@ })

if ((from = parseInt(from) || -1) > 0) {
linenums.push(...Array.from({ length: to - from + 1 }, (_, i) => i + from))
for (let i = from; i <= to; i++) linenums.push(i)
}

@@ -145,3 +149,10 @@ } else if (to === -1 && (from = parseInt(from) || -1) > 0) {

} else {
selectingDefault = selecting = !Array.from(tags.values()).includes(true)
selecting = true
for (const v of tags.values()) {
if (v === selecting) {
selecting = false
break
}
}
selectingDefault = selecting
if (tags.has('*')) {

@@ -212,6 +223,5 @@ wildcard = tags.get('*')

if (tags.size) {
const missingTagNames = Array.from(tags.keys())
log(
'warn',
`tag${tags.size > 1 ? 's' : ''} '${missingTagNames.join(', ')}' not found in include file: ${file.file}`,
`tag${tags.size > 1 ? 's' : ''} '${[...tags.keys()].join(', ')}' not found in include file: ${file.file}`,
reader

@@ -218,0 +228,0 @@ )

@@ -26,2 +26,3 @@ 'use strict'

let relative
// @deprecated interpret non-URL target as resource ID starting in Antora 4
if (RESOURCE_ID_DETECTOR_RX.test(target)) {

@@ -28,0 +29,0 @@ // NOTE support legacy {partialsdir} and {examplesdir} prefixes (same as resource ID w/ only family and relative)

@@ -53,4 +53,2 @@ 'use strict'

docfilesuffix: extname,
// NOTE relfilesuffix must be set for page-to-page xrefs to work correctly
relfilesuffix: '.adoc',
imagesdir: path.join(file.pub.moduleRootPath, '_images'),

@@ -61,6 +59,12 @@ attachmentsdir: path.join(file.pub.moduleRootPath, '_attachments'),

}
const attributes = family === 'page' ? { 'page-partial': '@' } : {}
Object.assign(attributes, config.attributes, intrinsicAttrs, computePageAttrs(file.src, contentCatalog))
const attributes = Object.assign(
family === 'page' ? { 'page-partial': '@' } : {},
config.attributes,
intrinsicAttrs,
computePageAttrs(file.src, contentCatalog)
)
const extensionRegistry = createExtensionRegistry(asciidoctor, {
onInclude: (doc, target, cursor) => resolveIncludeFile(target, file, cursor, contentCatalog),
onInclude: contentCatalog
? (doc, target, cursor) => resolveIncludeFile(target, file, cursor, contentCatalog)
: () => undefined,
})

@@ -80,3 +84,5 @@ const extensions = config.extensions || []

}
} else {
} else if (contentCatalog) {
// NOTE relfilesuffix must be set for page-to-page xrefs to work correctly
attributes.relfilesuffix = '.adoc'
const relativizePageRefs = config.relativizePageRefs !== false

@@ -156,3 +162,3 @@ opts.converter = createConverter({

*/
function resolveConfig (playbook = {}) {
function resolveAsciiDocConfig (playbook = {}) {
const attributes = {

@@ -174,8 +180,9 @@ env: 'site',

}
const config = { attributes }
if (!playbook.asciidoc) return config
if (!playbook.asciidoc) return { attributes }
// TODO process !name attributes
Object.assign(config, playbook.asciidoc, { attributes: Object.assign(attributes, playbook.asciidoc.attributes) })
if (config.extensions && config.extensions.length) {
const extensions = config.extensions.reduce((accum, extensionPath) => {
const { extensions, ...config } = Object.assign({ attributes }, playbook.asciidoc, {
attributes: Object.assign(attributes, playbook.asciidoc.attributes),
})
if (extensions && extensions.length) {
const scopedExtensions = extensions.reduce((accum, extensionPath) => {
if (extensionPath.charAt() === '.' && DOT_RELATIVE_RX.test(extensionPath)) {

@@ -198,9 +205,3 @@ // NOTE require resolves a dot-relative path relative to current file; resolve relative to playbook dir instead

}, [])
if (extensions.length) {
config.extensions = extensions
} else {
delete config.extensions
}
} else {
delete config.extensions
if (scopedExtensions.length) config.extensions = scopedExtensions
}

@@ -221,2 +222,8 @@ return config

module.exports = Object.assign(loadAsciiDoc, { loadAsciiDoc, extractAsciiDocMetadata, resolveConfig })
module.exports = Object.assign(loadAsciiDoc, {
loadAsciiDoc,
extractAsciiDocMetadata,
resolveAsciiDocConfig,
// @deprecated scheduled to be removed in Antora 4
resolveConfig: resolveAsciiDocConfig,
})
{
"name": "@antora/asciidoc-loader",
"version": "2.3.4",
"version": "3.0.0-alpha.1",
"description": "Loads AsciiDoc content into an Asciidoctor Document object (AST) for use in an Antora documentation pipeline.",

@@ -10,3 +10,4 @@ "license": "MPL-2.0",

"Sarah White <sarah@opendevise.com>",
"Guillaume Grossetie <g.grossetie@gmail.com>"
"Guillaume Grossetie <g.grossetie@gmail.com>",
"David Jencks <djencks@apache.org>"
],

@@ -24,3 +25,3 @@ "homepage": "https://antora.org",

"engines": {
"node": ">=8.11.0"
"node": ">=10.17.0"
},

@@ -39,3 +40,3 @@ "files": [

],
"gitHead": "5a40191c970ece6baecbd1a3a7a599d7161351a9"
"gitHead": "337ff6d2ed11e1f4d0a8ef993ddc8eaac7a73e9f"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc