!include_once loads multiple times

0 votes
asked Oct 19, 2024 in Bug by kirchsth (7,760 points)

In the current online version (v1.2024.0beta3) the `!include_once` command includes the same file a second time.
Eg. in following sample the ".../C4_Container.puml" file defines a `C4Version()` procedure.
And if the file would be loaded only once, then the second `!include_once` should not reset the procedure like below

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

[C4Version()-UNCHANGED ORIGINAL]

!function C4Version()
  !$c4Version  =  "MyC4DiagramVersion"
  !return $c4Version
!end function

[C4Version()-CHANGED]

' if this is commented out (=simulates the working !include_once) then it remain changed
!include_once https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml

[C4Version()-REMAINCHANGEDAFTERINCLUDEONCE]
@enduml



but if !include_once would work (like in the simulation below, with commented !include_once line) then there should be 2 components "MyC4DiagramVersion-...." and not only one.

BR 
Helmut

PS.: orig found in C4-PlantUML issue #368 comment - Solution2 !include_once not working

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...