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
439 stars 107 forks source link

Add support for graphviz-py #379

Closed Alwinator closed 2 years ago

Alwinator commented 2 years ago

graphviz-py makes it possible to run Python code inside of Graphviz diagrams, as well as using variables. I extended asciidoctor-diagram to support it.

Alwinator commented 2 years ago

@pepijnve You are welcome! Thanks for approving my code!

pepijnve commented 2 years ago

I had a look at your graphviz-py project in detail this morning. I'm wondering if an extra integration is actually necessary here. Since you support the same CLI interface as dot you could also just point the existing graphviz integration to graphviz-py. You can do that by setting the dot document attribute (e.g. pass -a dot=/usr/bin/graphviz-py to the Asciidoctor CLI).

Alwinator commented 2 years ago

@pepijnve Thank you so much for the reminder! I forgot to add an argument for variables. This makes it possible to calculate the same diagram with different values. I think that is very convenient.


[graphviz_py, "graphviz_py_example", "SVG", argument="foo=5;bar=7"]
----
include::my_diagram.py.dot[]
----

[graphviz_py, "graphviz_py_example", "SVG", argument="foo=24;bar=32"]
----
include::my_diagram.py.dot[]
----
Alwinator commented 2 years ago

From my side, it is ready for merging now!

Alwinator commented 2 years ago

@pepijnve Thank you for merging! I am looking forward to the new version :)

pepijnve commented 2 years ago

I'm picking up maintenance work again after a bit of a hiatus. A new release should be ready later today.

Alwinator commented 2 years ago

@pepijnve Thank you! That is great!