Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#355 Single column property #356

Merged
merged 1 commit into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions C4.puml
Original file line number Diff line number Diff line change
Expand Up @@ -1151,9 +1151,12 @@ $elementSkin
!global $propTableCaption = ""
!global $propColCaption = "="

!unquoted function SetPropertyHeader($col1Name, $col2Name, $col3Name = "", $col4Name = "")
!unquoted function SetPropertyHeader($col1Name, $col2Name = "", $col3Name = "", $col4Name = "")
!$propColCaption = ""
!$propTableCaption = "|= " + $col1Name + " |= " + $col2Name + " |"
!$propTableCaption = "|= " + $col1Name + " |"
!if ($col2Name != "")
!$propTableCaption = $propTableCaption + "= " + $col2Name + " |"
!endif
!if ($col3Name != "")
!$propTableCaption = $propTableCaption + "= " + $col3Name + " |"
!endif
Expand All @@ -1169,15 +1172,18 @@ $elementSkin
!return ""
!endfunction

!unquoted function AddProperty($col1, $col2, $col3 = "", $col4 = "")
!unquoted function AddProperty($col1, $col2 = "", $col3 = "", $col4 = "")
!if ($propTable == "")
!if ($propTableCaption != "")
!$propTable = $propTableCaption + "\n"
!endif
!else
!$propTable = $propTable + "\n"
!endif
!$propTable = $propTable + "| " + $col1 + " |" + $propColCaption + " " + $col2 + " |"
!$propTable = $propTable + "| " + $col1 + " |"
!if ($col2 != "")
!$propTable = $propTable + $propColCaption + " " + $col2 + " |"
!endif
!if ($col3 != "")
!$propTable = $propTable + " " + $col3 + " |"
!endif
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -875,11 +875,11 @@ SHOW_LEGEND()

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

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

Following sample uses all 3 different property definitions (and the aligned deployment node).
Expand Down
36 changes: 36 additions & 0 deletions percy/TestProperty.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@startuml
' convert it with additional command line argument -DRELATIVE_INCLUDE="./.." to use locally
!if %variable_exists("RELATIVE_INCLUDE")
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Deployment.puml
!else
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Deployment.puml
!endif

' default header Property, Value
AddProperty("Name", "Flash")
AddProperty("Organization", "Zootopia")
AddProperty("Tool", "Internet Explorer 7.0")
Person(personAlias, "Label", "Optional Description (with default property header)")

SetPropertyHeader("Property","Value", "Description")
AddProperty("Prop1", "Value1", "Details1")
AddProperty("Prop2", "Value2", "Details2")
Deployment_Node_L(nodeAlias, "Label", "Optional Type", "Optional Description (with custom property header)") {

WithoutPropertyHeader()
AddProperty("PropC1", "ValueC1")
AddProperty("PropC2", "ValueC2")
Container(containerAlias, "Label", "Technology", "Optional Description (without property header)")
}

SetPropertyHeader("Property")
AddProperty("Value1")
AddProperty("Value2")
System(systemAlias, "Label", "Optional Description\n(single column property)")

' starting with v.2.5.0 relationships support properties too
WithoutPropertyHeader()
AddProperty("PropC1", "ValueC1")
AddProperty("PropC2", "ValueC2")
Rel(personAlias, containerAlias, "Label", "Optional Technology", "Optional Description")
@enduml