Nested !ifdef bug

0 votes
asked Nov 24, 2017 in Bug by Serge Wenger Work (9,810 points)

Hello,

The following sample is not working correctly:

@startuml
'No define: OK
'FILE_FORMAT_SVG: error
'FILE_FORMAT_PNG: OK
!define FILE_FORMAT_SVG 1
'!define FILE_FORMAT_PNG 1

!ifdef FILE_FORMAT_SVG
title Test SVG
!else
!ifdef FILE_FORMAT_PNG 
title Test PNG
!else 
title Test with unknown type
!endif
Bob -> Alice : hello
@enduml

http://www.plantuml.com/plantuml/png/RP2n3e9044Jx_OgbehAmfJ1W8iIWO9JO4fKbN3plpB64-FSkqWYXt7blfjYmvPlZxgN1ponML2j30UOf-F7-i2lZ_7oCYl9oJG8avwoRvgSi-SdUMCHP1zVWBo6f2G9FrGBd9M35ch2Wbd4uFT8jBRd3ohyizoXFqbvnWvrv6jiRvCzRfiXKgeQjlUDgWv5M3y806zBQGYXCdl45

1 Answer

0 votes
answered Nov 24, 2017 by plantuml (184,600 points)

There is a missing !endif in your example.

@startuml

!define FILE_FORMAT_SVG 1

!ifdef FILE_FORMAT_SVG
title Test SVG
!else
!ifdef FILE_FORMAT_PNG
title Test PNG
!else
title Test with unknown type
!endif
!endif
Bob -> Alice : hello
@enduml

http://www.plantuml.com/plantuml/uml/ut8eBaaiAYdDpU7YKan9JSlCIrLmy_HnZNVp3_9r38aF3dDNC0HAPQO19T5bk4eoIt9I5K9IYqiKG5p5r9pYL6ng0_nGr8Au4BL8WkMP9HaAfNdPUVdbUGebbGL0WrBpKZBJO9HJVfA2hfs2OqvcSgg2bK96QavEFfS3K0xeTW00

But I agree that this is a bug and that the server should not return an error 500 in that case. We're going to investigate this one...

commented Nov 27, 2017 by Serge Wenger Work (9,810 points)
You are right
...