Skip to content

Instantly share code, notes, and snippets.

@wfouche
Last active June 28, 2025 11:27
Show Gist options
  • Select an option

  • Save wfouche/70738de122128bbc19ea888799151699 to your computer and use it in GitHub Desktop.

Select an option

Save wfouche/70738de122128bbc19ea888799151699 to your computer and use it in GitHub Desktop.
asciidoc
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.asciidoctor:asciidoctorj:3.0.0
//DEPS org.asciidoctor:asciidoctorj-diagram:3.0.1
//DEPS org.asciidoctor:asciidoctorj-diagram-plantuml:1.2025.3
import org.asciidoctor.Asciidoctor;
import org.asciidoctor.Options;
import org.asciidoctor.SafeMode;
import java.io.File;
public class asciidoc {
public static void main(String[] args) {
Asciidoctor asciidoctor = Asciidoctor.Factory.create();
asciidoctor.requireLibrary("asciidoctor-diagram");
asciidoctor.convertFile(
new File(args[0]),
Options.builder()
.toFile(true)
.safe(SafeMode.UNSAFE)
.build());
}
}
@wfouche
Copy link
Author

wfouche commented Jan 8, 2025

This is the test.adoc document that was used to test asciidoc.java

= Title
:diagram-server-url: https://kroki.io/
:diagram-server-type: kroki_io

== Workflows 

=== Example1

[%header,cols="1a,1a"]
|===
| Workflow Diagram | Specification
|[plantuml,wfd1,svg]
----
@startuml
state "-" as A0
state "Action 1" as A1
A1: <DELAY-6ms>

state "Action 2" as A2
A2: <DELAY-14ms>

A0 --> A1: 0.250
A0 --> A2: 0.750
A1 --> A0: 1.000
A2 --> A0: 1.000
@enduml
----
| 
[source,json]
----
{
    "-": {
        "1": 0.25, 
        "2": 0.75
    }, 
    "1": {
        "-": 1.0
    }, 
    "2": {
        "-": 1.0
    }
}
----
|===

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment