diff --git a/src/asciidoctorWebViewConverter.ts b/src/asciidoctorWebViewConverter.ts
index 1b2101b7..bc374a06 100644
--- a/src/asciidoctorWebViewConverter.ts
+++ b/src/asciidoctorWebViewConverter.ts
@@ -193,6 +193,7 @@ export class AsciidoctorWebViewConverter {
const resolvedPath = resolveAntoraImageIds(target, this.contentCatalog, this.src)
if (resolvedPath !== undefined) {
// fixme: update the image_uri on the Node
+ return ``
}
return this.baseConverter.convert(node, transform)
}
diff --git a/src/features/antora/antoraSupport.ts b/src/features/antora/antoraSupport.ts
index 8de79083..66a6fa7f 100644
--- a/src/features/antora/antoraSupport.ts
+++ b/src/features/antora/antoraSupport.ts
@@ -115,41 +115,54 @@ export async function getAttributes (textDocumentUri: Uri): Promise<{ [key: stri
export async function getContentCatalog (textDocumentUri: Uri, extensionContext: ExtensionContext): Promise {
try {
- const activeAntoraConfig = await getActiveAntoraConfig(textDocumentUri, extensionContext)
- if (activeAntoraConfig === undefined) {
- return undefined
- }
- const contentSourceRootPath = path.dirname(activeAntoraConfig.fsPath)
- const contentSourceRepositoryRootPath = workspace.getWorkspaceFolder(activeAntoraConfig).uri.fsPath
- // https://docs.antora.org/antora/latest/playbook/content-source-start-path/#start-path-key
- const startPath = path.relative(contentSourceRepositoryRootPath, contentSourceRootPath)
- const playbook = {
- content: {
- sources: [{
- url: contentSourceRepositoryRootPath,
- branches: 'HEAD',
- startPath,
- }],
- },
- runtime: {},
- site: {},
- }
- try {
+ const playbook = await createPlaybook(textDocumentUri, extensionContext)
+ if (playbook !== undefined) {
const contentAggregate = await aggregateContent(playbook)
return classifyContent(playbook, contentAggregate)
- } catch (e) {
- console.log(`Unable to create contentCatalog : ${e}`)
- return undefined
}
+ return undefined
} catch (e) {
if (e instanceof AntoraDisabledError) {
return undefined
} else {
+ console.log(`Unable to create contentCatalog : ${e}`)
throw e
}
}
}
+async function createPlaybook (textDocumentUri: Uri, extensionContext: ExtensionContext): Promise<{
+ site: {};
+ runtime: {};
+ content: {
+ sources: {
+ startPath: string;
+ branches: string;
+ url: string
+ }[]
+ }
+} | undefined> {
+ const activeAntoraConfig = await getActiveAntoraConfig(textDocumentUri, extensionContext)
+ if (activeAntoraConfig === undefined) {
+ return undefined
+ }
+ const contentSourceRootPath = path.dirname(activeAntoraConfig.fsPath)
+ const contentSourceRepositoryRootPath = workspace.getWorkspaceFolder(activeAntoraConfig).uri.fsPath
+ // https://docs.antora.org/antora/latest/playbook/content-source-start-path/#start-path-key
+ const startPath = path.relative(contentSourceRepositoryRootPath, contentSourceRootPath)
+ return {
+ content: {
+ sources: [{
+ url: contentSourceRepositoryRootPath,
+ branches: 'HEAD',
+ startPath,
+ }],
+ },
+ runtime: {},
+ site: {},
+ }
+}
+
export async function getSrc (textDocumentUri: Uri, contentCatalog: ContentCatalog | undefined) {
const antoraConfig = await getAntoraConfig(textDocumentUri)
const doc = await parseAntoraConfig(textDocumentUri)
@@ -157,10 +170,10 @@ export async function getSrc (textDocumentUri: Uri, contentCatalog: ContentCatal
if (doc !== {} && contentCatalog !== undefined) {
try {
const file = contentCatalog.getByPath({
- component: doc.name,
- version: doc.version,
- path: path.relative(contentSourceRootPath, textDocumentUri.path),
- }
+ component: doc.name,
+ version: doc.version,
+ path: path.relative(contentSourceRootPath, textDocumentUri.path),
+ }
)
return {
component: file.src.component,