I was trying to include a simplified view of a complex component in a higher-level component diagram. To achieve this, I attempted to use startsub / includesub as described in the documentation (https://plantuml.com/en/preprocessing):
You can also use !startsub NAME and !endsub to indicate sections of text to include from other files using !includesub. For example:
file1.puml:
@startuml
A -> A : stuff1
!startsub BASIC
B -> B : stuff2
!endsub
C -> C : stuff3
!startsub BASIC
D -> D : stuff4
!endsub
@enduml
file1.puml would be rendered exactly as if it were:
@startuml
A -> A : stuff1
B -> B : stuff2
C -> C : stuff3
D -> D : stuff4
@enduml
However, this would also allow you to have another file2.puml like this:
file2.puml
@startuml
title this contains only B and D
!includesub file1.puml!BASIC
@enduml
This file would be rendered exactly as if:
@startuml
title this contains only B and D
B -> B : stuff2
D -> D : stuff4
@enduml
Now my main problem is that I don't see D->D: stuff4. The resulting diagram only contains the first part "B->B: stuff2". I have updated to the most recent version (plantuml.1.2020.1.jar) but have not seen a change.
Since my diagram has multiple interfaces in multiple components that I want to include in some views but not others, the documented behavior would be ideal for me. Using multiple different subs (BASIC, BASIC2, ...) would be to cumbersome. The only real workaround I have found is to define a variabel and then use if statements to switch the unwanted interfaces off. But this doesn't work very well, since the diagram does not render unless you define the variable.