asciidoctor / asciidoctor-diagram

:left_right_arrow: Asciidoctor diagram extension, with support for AsciiToSVG, BlockDiag (BlockDiag, SeqDiag, ActDiag, NwDiag), Ditaa, Erd, GraphViz, Mermaid, Msc, PlantUML, Shaape, SvgBob, Syntrax, UMLet, Vega, Vega-Lite and WaveDrom.
http://asciidoctor.org
MIT License
436 stars 106 forks source link

plantuml:: directive file specification not working according to documentation #283

Closed alwyn closed 8 months ago

alwyn commented 4 years ago

Hi,

I am using gradle with version 3.2.0 of org.asciidoctor.jvm.convert and org.asciidoctor.jvm.pdf plugins. I'm not sure which version of asciidoctor-diagram this pulls in.

Default sourceDir is src/docs/asciidoc.

The documentation for asciidoctor-diagram states for the diagram block macro: When the source file name is a relative path it is resolved with respect to the location of the document being processed.

My main document is under src/docs/asciidoc and it contains a plantuml:: directive uml/a.puml for a file located at src/docs/asciidoc/uml/a.puml

The intellij plugin for asciidoc correctly parses and displays the image inline. BUT, when I build using gradle it expects to find the file in the root folder of the project and not relative to the document being processed.

The workaround is to use plantuml::src/docs/asciidoc/uml/a.puml, BUT then the inline rendering of intellij doesn't find the file.

Ideal solution: It works as documented in all environments.

My build configuration:

plugins {
    id("org.asciidoctor.jvm.convert") version "3.2.0"
    id("org.asciidoctor.jvm.pdf") version "3.2.0"
}

asciidoctorj {
    modules {
        diagram.use()
    }
    options(mapOf(
            "doctype" to "book"
    ))
    attributes(mapOf("toclevel" to "2"))
}

tasks {
    asciidoctor {
        dependsOn(asciidoctorPdf)
    }
}
pepijnve commented 3 years ago

I think this is more an issue with the gradle plugin than with the diagram extension itself. I'm not too familiar with the java based derivatives I'm afraid. @robertpanzer Any tips on how to debug this kind of thing?

robertpanzer commented 3 years ago

I just tried a small sample build with a document that contains a plantuml macro and it worked fine for me:

I used this build.gradle with Gradle 6.7:

buildscript {
    repositories {
        jcenter()
        mavenLocal()
    }
}
plugins {
        id 'org.asciidoctor.jvm.convert' version '3.2.0'
        id 'org.asciidoctor.jvm.pdf' version '3.2.0'
}

asciidoctorj {
    modules {
       diagram.use() 
       diagram.version '2.1.1' 
       pdf { 
           version '1.5.4'
       }
    }
}

repositories {
    mavenLocal()
    jcenter ()
}

And this asciidoc file under src/docs/asciidoc/test.adoc:

= Test
:source-highlighter: rouge

== Test

[plantuml,test,png]
----
A --> B
----