@antora/asciidoc-loader
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -29,3 +29,3 @@ 'use strict' | ||
} | ||
const resolvedFile = this[$callback](doc, target, reader.getCursor()) | ||
const resolvedFile = this[$callback](doc, target, reader.$cursor_at_prev_line()) | ||
if (resolvedFile) { | ||
@@ -41,3 +41,3 @@ let includeContents | ||
} | ||
Opal.hash_put(attrs, 'partial-option', true) | ||
Opal.hash_put(attrs, 'partial-option', '') | ||
reader.pushInclude(includeContents, resolvedFile.file, resolvedFile.path, startLineNum, attrs) | ||
@@ -47,3 +47,3 @@ ;(reader.file = new String(reader.file)).context = resolvedFile.context // eslint-disable-line no-new-wrappers | ||
log('error', `include target not found: ${target}`, reader) | ||
reader.$unshift(`Unresolved include directive in ${reader.getCursor().file} - include::${target}[]`) | ||
reader.$unshift(`Unresolved include directive in ${reader.$cursor_at_prev_line().file} - include::${target}[]`) | ||
} | ||
@@ -64,3 +64,3 @@ }) | ||
if (tags) { | ||
let result = new Map() | ||
const result = new Map() | ||
let any = false | ||
@@ -106,4 +106,3 @@ tags.split(~tags.indexOf(',') ? ',' : ';').forEach((tag) => { | ||
let m | ||
let l = line | ||
if (~l.indexOf(DBL_COLON) && ~l.indexOf(DBL_SQUARE) && (m = l.match(TAG_DIRECTIVE_RX))) { | ||
if (~line.indexOf(DBL_COLON) && ~line.indexOf(DBL_SQUARE) && (m = line.match(TAG_DIRECTIVE_RX))) { | ||
const thisTag = m[2] | ||
@@ -170,4 +169,4 @@ if (m[1]) { | ||
const opts = includeCursor | ||
? { source_location: reader.getCursor(), include_location: includeCursor } | ||
: { source_location: reader.getCursor() } | ||
? { source_location: reader.$cursor_at_prev_line(), include_location: includeCursor } | ||
: { source_location: reader.$cursor_at_prev_line() } | ||
reader.$logger()['$' + severity](reader.$message_with_context(message, Opal.hash(opts))) | ||
@@ -174,0 +173,0 @@ } |
@@ -44,6 +44,6 @@ 'use strict' | ||
const fileSrc = file.src | ||
const relative = fileSrc.relative | ||
const { family, relative } = fileSrc | ||
const extname = fileSrc.extname || relative.replace(/.*(?=\.)/g, '') | ||
const intrinsicAttrs = { | ||
docname: relative.substr(0, relative.length - extname.length), | ||
docname: (family === 'nav' ? 'nav$' : '') + relative.substr(0, relative.length - extname.length), | ||
docfile: file.path, | ||
@@ -58,3 +58,3 @@ // NOTE docdir implicitly sets base_dir on document; Opal only expands value to absolute path if it starts with ./ | ||
} | ||
const pageAttrs = fileSrc.family === 'page' ? computePageAttrs(fileSrc, contentCatalog) : undefined | ||
const pageAttrs = family === 'page' ? computePageAttrs(fileSrc, contentCatalog) : undefined | ||
const attributes = Object.assign({}, config.attributes, intrinsicAttrs, pageAttrs) | ||
@@ -61,0 +61,0 @@ const relativizePageRefs = config.relativizePageRefs !== false |
@@ -21,7 +21,5 @@ 'use strict' | ||
function computeRelativeUrlPath (from, to, hash = '') { | ||
if (from === to) { | ||
return hash || (isDir(to) ? './' : path.basename(to)) | ||
} else { | ||
return path.relative(path.dirname(from + '.'), to) + (isDir(to) ? '/' + hash : hash) | ||
} | ||
return from === to | ||
? hash || (isDir(to) ? './' : path.basename(to)) | ||
: (path.relative(path.dirname(from + '.'), to) || '.') + (isDir(to) ? '/' + hash : hash) | ||
} | ||
@@ -28,0 +26,0 @@ |
@@ -27,3 +27,3 @@ 'use strict' | ||
try { | ||
if (!(targetPage = contentCatalog.resolvePage(pageIdSpec, currentPage.src))) { | ||
if (!((targetPage = contentCatalog.resolvePage(pageIdSpec, currentPage.src)) && targetPage.pub)) { | ||
// TODO log "Unresolved page ID" | ||
@@ -30,0 +30,0 @@ return { content: `${pageIdSpec}.adoc${fragment ? '#' + fragment : ''}`, target: '#' } |
{ | ||
"name": "@antora/asciidoc-loader", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Loads AsciiDoc content into an Asciidoctor Document object (AST) for use in an Antora documentation pipeline.", | ||
@@ -22,3 +22,3 @@ "license": "MPL-2.0", | ||
"engines": { | ||
"node": ">= 8.0.0" | ||
"node": ">=8.11.0" | ||
}, | ||
@@ -25,0 +25,0 @@ "files": [ |
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
26536
578