how to make multiple @startuml@enduml blocks (in 1 file) generate into one diagram

+1 vote
asked Apr 23, 2021 in Closed feature request by anonymous
for an example:

@startuml

.......AAA

@enduml

@startuml

.......BBB

@enduml

@startuml

.......CCC

@enduml

(all of these content above are in one file), and I want to all of these blocks form one diagram by plantuml tool in linux. Currently, I just use cmd: "java -jar plantuml.jar <filename>". But it generated multiple diagrams, one block to one diagram. I want all of them into one diagram.

How could I do that?

2 Answers

0 votes
answered Apr 23, 2021 by The-Lu (49,760 points)

Hello A.,

For that, you can use sub-diagram, with {{ and }}, and all in one label as:

@startuml
label l [

{{
title AAA
a -> b
}}

{{
title BBB
[c]
}}

{{mindmap
title CCC
* r
** 1
** 2
}}

]
@enduml

If that can help,
Regards,
Th.

commented Apr 28, 2021 by anonymous

thanks for reply, however, I want to make multiple 

@startuml

.......

@enduml  blocks into one single diagram. Not into multiple sub-diagrams of one picture.

0 votes
answered Jun 21, 2021 by The-Lu (49,760 points)

Hello A.,

If you have only several @startuml/@enduml (no other diagram type), you could add on the beginning of the file, for a first diagram, this definition:

@startuml
'Change only this value depending of the number of @startuml/@enduml on the full file
!$max=3
!$i=1
label l [
!while $i < $max+1
  {{
  !include %filename()!$i
  }}
  !$i = $i +1
!endwhile
]
@enduml

Here is a full example, for a file named "filename.pu":

@startuml
'Change only this value depending of the number of @startuml/@enduml
!$max=3
!$i=1
label l [
!while $i < $max+1
  {{
  !include %filename()!$i
  }}
  !$i = $i +1
!endwhile
]
@enduml

@startuml
title AAA
a -> b
@enduml

@startuml
title BBB
[c]
@enduml

@startuml
title CCC
[A] lasts 4 days
then [B] lasts 2 days
@enduml

Then you observe the expected result: all diagrams of the file on the first output image (on the first image named 'finame.png' wink).

If that can help,
Regards,
Th.

...