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
435 stars 106 forks source link

!define does not seem to work as expected for plantuml #343

Closed sindre-nistad closed 3 years ago

sindre-nistad commented 3 years ago

Hi, I am trying to write a C4 Model, with icons, as shown here

Entities can also be decorated with icons using the last parameter, for example:

@startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml

!define DEVICONS https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/devicons
!define FONTAWESOME https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/font-awesome-5
!include DEVICONS/angular.puml
!include DEVICONS/java.puml
!include DEVICONS/msql_server.puml
!include FONTAWESOME/users.puml

LAYOUT_WITH_LEGEND()

Person(user, "Customer", "People that need products", "users")
Container(spa, "SPA", "angular", "The main interface that the customer interacts with", "angular")
Container(api, "API", "java", "Handles all business logic", "java")
ContainerDb(db, "Database", "Microsoft SQL", "Holds product, order and invoice information", "msql_server")

Rel(user, spa, "Uses", "https")
Rel(spa, api, "Uses", "https")
Rel_R(api, db, "Reads/Writes")
@enduml

image

However, when I try the same document, the AsciiDoc plugin to PyCharm shows the diagram without images, and trying to compile it with asciidoctor --failure-level ERROR -r asciidoctor-diagram --backend=html5 gives the error below

asciidoctor: ERROR: <file name>.adoc: line 6: Failed to generate image: PlantUML image generation failed: [From <input> (line 6) ]                                                                                                             

@startuml                                                                                                                            
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml                                      
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally                                             
!if %variable_exists("RELATIVE_INCLUDE")                                                                                             
  !include %get_variable_value("RELATIVE_INCLUDE")/C4_Context.puml                                                                   
...                                                                                                                                  
... ( skipping 1440 lines )                                                                                                          
...                                                                                                                                  
!endprocedure                                                                                                                        

!unquoted procedure ContainerDb_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="")                                         
database "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias               
!endprocedure                                                                                                                        

!unquoted procedure ContainerQueue_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="")                                      
queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias                  
!endprocedure                                                                                                                        

' Boundaries                                                                                                                         
' ##################################                                                                                                 

!unquoted procedure Container_Boundary($alias, $label, $tags="")                                                                     
Boundary($alias, $label, "Container", $tags)                                                                                         
!endprocedure                                                                                                                        

!define DEVICONS https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/devicons                                
!define FONTAWESOME https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/font-awesome-5                       
!include /home/pptruser/docs/DEVICONS/angular.puml                                                                                   
^^^^^                                                                                                                                
 cannot include /home/pptruser/docs/https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/devicons/angular.puml
sindre-nistad commented 3 years ago

However, when using !includeurl, it compiles

pepijnve commented 3 years ago

Release 2.1.1 should fix this problem.