Posted by
Alexander Schwartz on
Nov 20, 2019; 9:36pm
URL: https://discuss.asciidoctor.org/counter-Problems-with-images-and-plantuml-tp7320p7363.html
I've given it a try with the following versions and I got it working as far as I can see.
Please note that this updates several dependencies, including the asciidoctorj-Version
----
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<asciidoctor.maven.plugin.version>2.0.0-RC.1</asciidoctor.maven.plugin.version>
<asciidoctorj.pdf.version>1.5.0-beta.7</asciidoctorj.pdf.version>
<asciidoctorj.version>2.1.0</asciidoctorj.version>
<jruby.version>9.2.8.0</jruby.version>
<asciidoctor.diagram.version>1.5.18</asciidoctor.diagram.version>
</properties>
<build>
<defaultGoal>process-resources</defaultGoal>
<plugins>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>${asciidoctor.maven.plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-pdf</artifactId>
<version>${asciidoctorj.pdf.version}</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>${jruby.version}</version>
</dependency>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>${asciidoctorj.version}</version>
</dependency>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-diagram</artifactId>
<version>${asciidoctor.diagram.version}</version>
</dependency>
</dependencies>
<configuration>
<sourceDirectory>src/docs/asciidoc</sourceDirectory>
<attributes>
<sourcedir>${project.build.sourceDirectory}</sourcedir>
</attributes>
</configuration>
<executions>
<execution>
<id>generate-pdf-doc</id>
<phase>generate-resources</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>pdf</backend>
<requires>
<require>asciidoctor-diagram</require>
</requires>
<sourceHighlighter>coderay</sourceHighlighter>
<attributes>
<icons>font</icons>
<pagenums/>
<toc/>
<idprefix/>
<idseparator>-</idseparator>
</attributes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
----
For the input of
----
:desc-image1: description image 1
[id="image1",reftext="{figure-caption} {counter:figures}"]
.{desc-image1}
image::image1.png[align="center"]
:desc-plantuml: description plantuml
[id="plantuml",reftext="{figure-caption} {counter:figures}"]
.{desc-plantuml}
plantuml::plantuml.puml[align="center"]
:desc-image2: description image 2
[id="image2",reftext="{figure-caption} {counter:figures}"]
.{desc-image2}
image::image2.png[align="center"]
<<image1>> <<plantuml>> <<image2>>
----
It produces as expected:
----
Figure 1. description image 1
Figure 2. description plantuml
Figure 3. description image 2
Figure 1 Figure 2 Figure 3
----
Please note that you can define the :xrefstyle: short to get short references like you used without specifying the reftext manually. See
https://asciidoctor.org/docs/user-manual/#customizing-the-cross-reference-text for details.