asciidoctor-maven-plugin icon indicating copy to clipboard operation
asciidoctor-maven-plugin copied to clipboard

asciidoctor-diagram graphviz diagram block error with "shaape" requirements

Open tarilabs opened this issue 10 years ago • 7 comments

Ciao, Using the Maven Examples If I add a diagram block for graphviz, now laments error for a missing dot command in the "shaape" ⚠️ configuration, even if I setup correctly the graphviz dot as per the example.

In details, if I add in the adoc:

[graphviz, dot-example, svg]
----
digraph g {
    a -> b
    b -> c
    c -> d
    d -> a
}
----

The error I get in Maven, despite I setup correctly the graphvizdot runtime environment

[ERROR] (...)/example-manual.adoc: Failed to parse source, Could not find the 'dot' executable in PATH; add it to the PATH or specify its location using the 'shaape' document attribute -> [Help 1]

I would like to highlight that:

  • I am sure the graphvizdot runtime environment is setup correctly as mentioned in link above, because the original adoc contains some plantuml diagramblock, which DO work before I added the new graphviz diagram block, and because plantuml also requires dot, then is working correctly
  • the error message is complaining the dot executable is not found for a shaape library; even if I add the same configuration for "graphvizdot" into "shaape" as a document attribute, it still not work. Besides I still haven't understood why is complaining for dot missing in the shaape attribute, when it should be governed by the graphvizdot attribute.

I think is also helpful to mention that if I use the plantuml as the block diagram name, instead of graphviz, then strangely it do work; I say strangely because I think what happens is that plantuml understand this is actually a dot-syntax, and so it doesn't apply plantuml stylsheet/processor but just uses the underlying dot processor; however I would have expected as per the documentation that graphviz should be the correct keyword to use for the example above. In summary the workaround I found is to actually place in the adoc:

[plantuml, dot-example, svg]
----
digraph g {
    a -> b
    b -> c
    c -> d
    d -> a
}
----

Can you kindly advise, please? Thanks

tarilabs avatar Nov 16 '15 16:11 tarilabs

After some test I can confirm that the fact that you get the "shaape" message means that your settings are correct as you said and imho it seems a bug, because setting the shaape attribute did nothing. Only setting the dot in the system PATH worked.

Back to the question, however, I cannot confirm or deny the correctness of your workarround, maybe @pepijnve can help.

abelsromero avatar Nov 16 '15 18:11 abelsromero

The shaape in the error message is actually a bug which was fixed in 1.3.0. The error string had that value hardcoded where it should actually have had the name of the command it was looking for. So in your case setting the dot document attribute should do the trick. Not sure why PlantUML isn't complaining though. Looking up the location of graphviz is left to plantuml itself so perhaps it's using some other mechanism to find it. I would have to have a look at the plantuml code itself to figure that one out.

pepijnve avatar Nov 16 '15 19:11 pepijnve

I went back and had a look at the asciidoctor-diagram 1.2.0 code. In that version the graphvizdot attribute was being used to find the location of graphviz, but that was only used for plantuml. In 1.3.0 this attribute is no longer used and finding graphviz is left to plantuml. That was done as part of the fix for https://github.com/pepijnve/asciidoctor-diagram/commit/e09bd16c114a5fef09e1c810398f626e998a576c IIRC. I've made an issue in the diagram project to add back support for that attribute and to use it for graphviz diagrams as well.

pepijnve avatar Nov 16 '15 20:11 pepijnve

I've made an issue in the diagram project to add back support for that attribute and to use it for graphviz diagrams as well.

I don't have a problem with that, and I'd rather have a simple parameter with a clear meaning that many with repeated features. So, if you prefer to call it dot I'll document it.

abelsromero avatar Nov 17 '15 10:11 abelsromero

No strong preference for the name of the attribute or which one is documented. The convention I ended up using for the other diagram generation tools is to use the name of the executable as the attribute name. I'm going to restore support for the graphvizdot attribute anyway since this change may have broken other users workflows as well.

pepijnve avatar Nov 17 '15 10:11 pepijnve

The convention I ended up using for the other diagram generation tools is to use the name of the executable as the attribute name.

I like that :+1:

abelsromero avatar Nov 17 '15 16:11 abelsromero

:+1:

mojavelinux avatar Nov 21 '15 01:11 mojavelinux