asciidoctor / asciidoctor-tabs

An extension for Asciidoctor that adds a tabs block to the AsciiDoc syntax.
MIT License
40 stars 7 forks source link

"skipping reference to missing attribute" in tabs #64

Closed AndreasPetersen closed 1 year ago

AndreasPetersen commented 1 year ago

Using Antora 3.1.4 and @asciidoctor/tabs 1.0.0-beta.5 I've followed the Antora setup as described Using a Dedicated UI Project.

Tabs render fine, but attributes used in the tabs will produce compile warnings. For example:

:group-id: dk.ape
:artifact-id: ape

[tabs]
======
Gradle::
+
[source,groovy,subs=attributes+]
----
implemenation("{group-id}:{artifact-id}:{page-component-version}")
----

Maven::
+
[source,xml,subs=attributes+]
----
<dependency>
    <groupId>{group-id}</groupId>
    <artifactId>{artifact-id}</artifactId>
    <version>{page-component-version}</version>
</dependency>
----
======

will give the following compile warnings:

npx antora --fetch antora-playbook.yml

[17:50:22.027] WARN (asciidoctor): skipping reference to missing attribute: group-id
    file: /mnt/c/repos/community-documentation/modules/guides/pages/libs.adoc
    source: /mnt/c/repos/community-documentation (branch: lib-partials <worktree>)
[17:50:22.033] WARN (asciidoctor): skipping reference to missing attribute: artifact-id
    file: /mnt/c/repos/community-documentation/modules/guides/pages/libs.adoc
    source: /mnt/c/repos/community-documentation (branch: lib-partials <worktree>)
[17:50:22.035] WARN (asciidoctor): skipping reference to missing attribute: group-id
    file: /mnt/c/repos/community-documentation/modules/guides/pages/libs.adoc
    source: /mnt/c/repos/community-documentation (branch: lib-partials <worktree>)
[17:50:22.036] WARN (asciidoctor): skipping reference to missing attribute: artifact-id
    file: /mnt/c/repos/community-documentation/modules/guides/pages/libs.adoc
    source: /mnt/c/repos/community-documentation (branch: lib-partials <worktree>)
Site generation complete!
Open file:///mnt/c/repos/community-documentation/build/site/index.html in a browser to view your site.

producing: image image

Interestingly, the {page-component-version} attribute works just fine. If I add the same code blocks in the tabs just above, everything works fine (except now I have too many code blocks):

[source,groovy,subs=attributes+]
----
implemenation("{group-id}:{artifact-id}:{page-component-version}")
----

[source,xml,subs=attributes+]
----
<dependency>
    <groupId>{group-id}</groupId>
    <artifactId>{artifact-id}</artifactId>
    <version>{page-component-version}</version>
</dependency>
----

[tabs]
======
Gradle::
+
[source,groovy,subs=attributes+]
----
implemenation("{group-id}:{artifact-id}:{page-component-version}")
----

Maven::
+
[source,xml,subs=attributes+]
----
<dependency>
    <groupId>{group-id}</groupId>
    <artifactId>{artifact-id}</artifactId>
    <version>{page-component-version}</version>
</dependency>
----
======

produces:

image

mojavelinux commented 1 year ago

I see what's happening. This happens whenever there are attribute entries that immediately proceed the tabs block. To be clear, this has nothing to do with Antora. The problem is that the extension is not passing on the attribute entries to the newly created tabs block. So this is definitely a bug and would happen even when using the extension with standalone Asciidoctor.

mojavelinux commented 1 year ago

I should be able to fix and release this soon.

AndreasPetersen commented 1 year ago

Amazing, thanks!