counter Problems with images and plantuml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

counter Problems with images and plantuml

Hendrik Timmermann
This post was updated on .
Hello , i work with maven

                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>2.0.0-RC.1</version>
                <dependencies>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj-pdf</artifactId>
                        <version>1.5.0-beta.4</version>
                    </dependency>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj-diagram</artifactId>
                        <version>1.5.18</version>
...
                       <require>asciidoctor-diagram</require>
                    </requires>

related?

Assign image captions in extension #165  or #164 #169   (issue in asciidoctor diagramm) seem to be similar?


the following situation:

: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}"]
.{figure-caption} {figures}: {desc-plantuml}
plantuml::images/plantuml.puml[align="center"]

:desc-image2: description image 2
[id="image2",reftext="{figure-caption} {counter:figures}"]
.{desc-image2}
image::image2.png[align="center"]

----
please observe, I added {figure-caption} {figures}:  
---
with this a have two problems (The images are correct!):

1) a wrong numbering of the image2 in the text  (html and pdf)

Figure 2: description image 2   expected    Figure 3: description image 2

2) The Caption and the number is not generated automatically at plantuml . Why?

Figure 1: description image 1
description plantuml                 expected    Figure 2: description plantuml
Figure 2: description image 2   expected    Figure 3: description image 2

is the problem located in line 609 of parser.rb the reason in 2.0.0.RC1?

Is the increment of the counter in plantuml not considered in images?
Reply | Threaded
Open this post in threaded view
|

Re: table of figures problems with images and plantuml

Hendrik Timmermann
counter and extensions... How is the stuff worked?

a) counter before extension
b) counter afer extension   (means: first create picture with plantuml and then afterwards update the counter in the caption


Reply | Threaded
Open this post in threaded view
|

Re: table of figures problems with images and plantuml

Hendrik Timmermann
is there no one with a hint or an idea how to debug?
Reply | Threaded
Open this post in threaded view
|

Re: counter Problems with images and plantuml / table of figures problems with images and plantuml

Alexander Schwartz
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.
Alexander Schwartz (alexander.schwartz@gmx.net)
https://www.ahus1.de
Reply | Threaded
Open this post in threaded view
|

Re: counter Problems with images and plantuml / table of figures problems with images and plantuml

Hendrik Timmermann
Hello,

yes, that solved the counting problem

thank you very much!