Skip to content

Commit f563b3c

Browse files
committed
Merge branch 'feat/355_prop' into extended
2 parents 01ab4e8 + 8cace5e commit f563b3c

File tree

3 files changed

+48
-6
lines changed

3 files changed

+48
-6
lines changed

C4.puml

+10-4
Original file line numberDiff line numberDiff line change
@@ -1151,9 +1151,12 @@ $elementSkin
11511151
!global $propTableCaption = ""
11521152
!global $propColCaption = "="
11531153

1154-
!unquoted function SetPropertyHeader($col1Name, $col2Name, $col3Name = "", $col4Name = "")
1154+
!unquoted function SetPropertyHeader($col1Name, $col2Name = "", $col3Name = "", $col4Name = "")
11551155
!$propColCaption = ""
1156-
!$propTableCaption = "|= " + $col1Name + " |= " + $col2Name + " |"
1156+
!$propTableCaption = "|= " + $col1Name + " |"
1157+
!if ($col2Name != "")
1158+
!$propTableCaption = $propTableCaption + "= " + $col2Name + " |"
1159+
!endif
11571160
!if ($col3Name != "")
11581161
!$propTableCaption = $propTableCaption + "= " + $col3Name + " |"
11591162
!endif
@@ -1169,15 +1172,18 @@ $elementSkin
11691172
!return ""
11701173
!endfunction
11711174

1172-
!unquoted function AddProperty($col1, $col2, $col3 = "", $col4 = "")
1175+
!unquoted function AddProperty($col1, $col2 = "", $col3 = "", $col4 = "")
11731176
!if ($propTable == "")
11741177
!if ($propTableCaption != "")
11751178
!$propTable = $propTableCaption + "\n"
11761179
!endif
11771180
!else
11781181
!$propTable = $propTable + "\n"
11791182
!endif
1180-
!$propTable = $propTable + "| " + $col1 + " |" + $propColCaption + " " + $col2 + " |"
1183+
!$propTable = $propTable + "| " + $col1 + " |"
1184+
!if ($col2 != "")
1185+
!$propTable = $propTable + $propColCaption + " " + $col2 + " |"
1186+
!endif
11811187
!if ($col3 != "")
11821188
!$propTable = $propTable + " " + $col3 + " |"
11831189
!endif

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -889,11 +889,11 @@ SHOW_LEGEND()
889889

890890
A model can be extended with (a table of) properties that concrete deployments or more detailed concepts can be documented:
891891

892-
- `SetPropertyHeader(col1Name, col2Name, ?col3Name, ?col4Name)`
892+
- `SetPropertyHeader(col1Name, ?col2Name, ?col3Name, ?col4Name)`
893893
The properties table can have up to 4 columns. The default header uses the column names "Name", "Description".
894894
- `WithoutPropertyHeader()`
895895
If no header is used, then the second column is bold.
896-
- `AddProperty(col1, col2, ?col3, ?col4)`
896+
- `AddProperty(col1, ?col2, ?col3, ?col4)`
897897
(All columns of) a property which will be added to the next element.
898898

899899
Following sample uses all 3 different property definitions (and the aligned deployment node).

percy/TestProperty.puml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@startuml
2+
' convert it with additional command line argument -DRELATIVE_INCLUDE="./.." to use locally
3+
!if %variable_exists("RELATIVE_INCLUDE")
4+
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Deployment.puml
5+
!else
6+
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Deployment.puml
7+
!endif
8+
9+
' default header Property, Value
10+
AddProperty("Name", "Flash")
11+
AddProperty("Organization", "Zootopia")
12+
AddProperty("Tool", "Internet Explorer 7.0")
13+
Person(personAlias, "Label", "Optional Description (with default property header)")
14+
15+
SetPropertyHeader("Property","Value", "Description")
16+
AddProperty("Prop1", "Value1", "Details1")
17+
AddProperty("Prop2", "Value2", "Details2")
18+
Deployment_Node_L(nodeAlias, "Label", "Optional Type", "Optional Description (with custom property header)") {
19+
20+
WithoutPropertyHeader()
21+
AddProperty("PropC1", "ValueC1")
22+
AddProperty("PropC2", "ValueC2")
23+
Container(containerAlias, "Label", "Technology", "Optional Description (without property header)")
24+
}
25+
26+
SetPropertyHeader("Property")
27+
AddProperty("Value1")
28+
AddProperty("Value2")
29+
System(systemAlias, "Label", "Optional Description\n(single column property)")
30+
31+
' starting with v.2.5.0 relationships support properties too
32+
WithoutPropertyHeader()
33+
AddProperty("PropC1", "ValueC1")
34+
AddProperty("PropC2", "ValueC2")
35+
Rel(personAlias, containerAlias, "Label", "Optional Technology", "Optional Description")
36+
@enduml

0 commit comments

Comments
 (0)