@antora/asciidoc-loader
Advanced tools
Comparing version 1.1.1 to 2.0.0-beta.1
@@ -8,3 +8,3 @@ 'use strict' | ||
const scope = Opal.klass( | ||
Opal.module(null, 'Antora'), | ||
Opal.module(null, 'Antora', function $Antora () {}), | ||
Opal.module(null, 'Asciidoctor').Converter.Html5Converter, | ||
@@ -20,19 +20,19 @@ 'Html5Converter', | ||
if (node.getType() === 'xref') { | ||
let refSpec = node.getAttribute('refid') | ||
if ( | ||
node.getAttribute('path') || | ||
// NOTE refSpec is undefined if inter-document xref refers to current docname and fragment is empty | ||
// TODO remove check for file extension after upgrading to 1.5.7 | ||
(refSpec && refSpec.endsWith('.adoc') && (refSpec = refSpec.substr(0, refSpec.length - 5)) !== undefined) | ||
) { | ||
if (node.getAttribute('path')) { | ||
const callback = this[$pageRefCallback] | ||
if (callback) { | ||
const { content, target } = callback(refSpec, node.getText()) | ||
const attrs = node.getAttributes() | ||
if (attrs.fragment === Opal.nil) delete attrs.fragment | ||
const { content, target } = callback(attrs.refid, node.getText()) | ||
let options | ||
// NOTE if resolved target starts with #, it's an unresolved xref | ||
if (target.charAt() === '#') { | ||
options = Opal.hash2(['type', 'target'], { type: 'link', target }) | ||
} else { | ||
// TODO pass attributes (e.g., id, role) after upgrading to 1.5.7 | ||
const attributes = Opal.hash2(['role'], { role: 'page' }) | ||
options = Opal.hash2(['type', 'target', 'attributes'], { type: 'link', target, attributes }) | ||
attrs.role = attrs.role ? 'page ' + attrs.role : 'page' | ||
options = Opal.hash2(['type', 'target', 'attrs'], { | ||
type: 'link', | ||
target, | ||
attributes: Opal.hash2(Object.keys(attrs), attrs), | ||
}) | ||
} | ||
@@ -39,0 +39,0 @@ node = Opal.module(null, 'Asciidoctor').Inline.$new(node.getParent(), 'anchor', content, options) |
@@ -13,3 +13,8 @@ 'use strict' | ||
const superclass = Opal.module(null, 'Asciidoctor').Extensions.IncludeProcessor | ||
const scope = Opal.klass(Opal.module(null, 'Antora'), superclass, 'IncludeProcessor', function () {}) | ||
const scope = Opal.klass( | ||
Opal.module(null, 'Antora', function $Antora () {}), | ||
superclass, | ||
'IncludeProcessor', | ||
function () {} | ||
) | ||
@@ -28,3 +33,3 @@ Opal.defn(scope, '$initialize', function initialize (callback) { | ||
if (tags) [includeContents, startLineNum] = applyTagFiltering(includeContents, tags) | ||
const includes = doc.getCatalog().includes.$dup() | ||
Opal.hash_put(attrs, 'partial-option', true) | ||
reader.pushInclude(includeContents, resolvedFile.file, resolvedFile.path, startLineNum, attrs) | ||
@@ -34,4 +39,2 @@ if (resolvedFile.context) { | ||
} | ||
// TODO after upgrading to 1.5.7, pass partial-option attribute instead | ||
doc.getCatalog().includes.$replace(includes) | ||
} | ||
@@ -38,0 +41,0 @@ }) |
@@ -44,8 +44,10 @@ 'use strict' | ||
const fileSrc = file.src | ||
const relative = fileSrc.relative | ||
const extname = fileSrc.extname || relative.replace(/.*(?=\.)/g, '') | ||
const intrinsicAttrs = { | ||
docname: fileSrc.stem, | ||
docname: relative.substr(0, relative.length - extname.length), | ||
docfile: file.path, | ||
// NOTE docdir implicitly sets base_dir on document; Opal only expands value to absolute path if it starts with ./ | ||
docdir: file.dirname, | ||
docfilesuffix: fileSrc.extname, | ||
docfilesuffix: extname, | ||
imagesdir: path.join(file.pub.moduleRootPath, '_images'), | ||
@@ -182,3 +184,3 @@ attachmentsdir: path.join(file.pub.moduleRootPath, '_attachments'), | ||
function freeExtensions () { | ||
EXTENSION_DSL_TYPES.forEach((type) => (Opal.const_get_local(Extensions, type).$$included_in.length = 0)) | ||
EXTENSION_DSL_TYPES.forEach((type) => (Opal.const_get_local(Extensions, type).$$iclasses.length = 0)) | ||
} | ||
@@ -185,0 +187,0 @@ |
{ | ||
"name": "@antora/asciidoc-loader", | ||
"version": "1.1.1", | ||
"version": "2.0.0-beta.1", | ||
"description": "Loads AsciiDoc content into an Asciidoctor Document object (AST) for use in an Antora documentation pipeline.", | ||
@@ -19,3 +19,3 @@ "license": "MPL-2.0", | ||
"dependencies": { | ||
"asciidoctor.js": "1.5.6" | ||
"asciidoctor.js": "1.5.9" | ||
}, | ||
@@ -22,0 +22,0 @@ "engines": { |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
562
25370
1
+ Addedasciidoctor.js@1.5.9(transitive)
+ Addedopal-runtime@1.0.11(transitive)
- Removedasciidoctor.js@1.5.6(transitive)
- Removedopal-runtime@1.0.3(transitive)
Updatedasciidoctor.js@1.5.9