Skip to content

Commit 3ee3027

Browse files
committed
Fix for "Use !option handwritten true" warning
C4-PlantUML is compatible up to v1.2023.5 (because of the `?=` operator being used). We can't use JSON notation (i.e. `$versionPart[1]`) as that triggers a ClassCastException in versions older than v1.2024.5. The function `%splitstr()` is safe, as it was added in v1.2022.2 Fixes #396
1 parent 61f08fd commit 3ee3027

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

C4.puml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,25 @@ hide stereotype
13921392
!endprocedure
13931393

13941394
!procedure LAYOUT_AS_SKETCH()
1395+
!$counter=0
1396+
!foreach $versionPart in %splitstr(%version(), ".")
1397+
!$counter=$counter+1
1398+
1399+
!if ($counter == 2)
1400+
!$year=$versionPart
1401+
!endif
1402+
1403+
!if ($counter == 3)
1404+
!$minor=$versionPart
1405+
!endif
1406+
!endfor
1407+
1408+
!if ($year < 2025) || ($year == 2025 && $minor == 0)
13951409
skinparam handwritten true
1410+
!else
1411+
!option handwritten true
1412+
!endif
1413+
13961414
!if $SKETCH_BG_COLOR > ""
13971415
skinparam backgroundColor $SKETCH_BG_COLOR
13981416
!endif

0 commit comments

Comments
 (0)