Skip to content

Commit a05be2c

Browse files
committed
#173 Tags support sprites, technology and custom text (resolve conflicts, fix PR findings)
2 parents 6f645d3 + 990010f commit a05be2c

11 files changed

+348
-142
lines changed

C4.puml

Lines changed: 140 additions & 82 deletions
Large diffs are not rendered by default.

C4_Context.puml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ endlegend
196196
' ##################################
197197

198198
!function $getPerson($label, $descr, $sprite)
199-
!if ($sprite == "") && ($defaultPersonSprite!="")
199+
!if ($sprite == "") && ($defaultPersonSprite != "")
200200
!$sprite = $defaultPersonSprite
201201
!endif
202202
!if ($descr == "") && ($sprite == "")

C4_Deployment.puml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy
4040
' If a $type contains \n then these are used (and no automatic space based line breaks are done)
4141
' $NODE_TYPE_MAX_CHAR_WIDTH defines the automatic line break position
4242
!global $NODE_TYPE_MAX_CHAR_WIDTH = 35
43-
!global $NODE_DESCR_MAX_CHAR_WIDTH=32
43+
!global $NODE_DESCR_MAX_CHAR_WIDTH = 32
4444

4545
!unquoted function $breakNode($type, $widthStr)
4646
!$width = %intval($widthStr)
@@ -52,9 +52,9 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy
5252
!$type = %substr($type, $brPos+2)
5353
!endwhile
5454
!else
55-
!while (%strlen($type)>$width)
55+
!while (%strlen($type) > $width)
5656
!$brPos = $width
57-
!while ($brPos>0 && %substr($type, $brPos, 1)!= ' ')
57+
!while ($brPos > 0 && %substr($type, $brPos, 1) != ' ')
5858
!$brPos = $brPos - 1
5959
!endwhile
6060

@@ -72,7 +72,7 @@ SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_sy
7272
!endif
7373
!endwhile
7474
!endif
75-
!if (%strlen($type)>0)
75+
!if (%strlen($type) > 0)
7676
!$multiLine = $multiLine + $type
7777
!endif
7878
!return $multiLine

C4_Dynamic.puml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
!procedure setIndex($new_index)
3535
!$lastIndex = $index
36-
!$index= $new_index
36+
!$index = $new_index
3737
!endprocedure
3838

3939
!function Index($offset=1)
@@ -94,53 +94,53 @@ $getRel("<<-", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $t
9494
!endprocedure
9595

9696
!unquoted procedure Rel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
97-
$getRel("-DOWN->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
97+
$getRel($down("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
9898
!endprocedure
9999
!unquoted procedure Rel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
100-
$getRel("-DOWN->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
100+
$getRel($down("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
101101
!endprocedure
102102
!unquoted procedure RelIndex_D($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
103-
$getRel("-DOWN->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
103+
$getRel($down("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
104104
!endprocedure
105105
!unquoted procedure RelIndex_Down($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
106-
$getRel("-DOWN->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
106+
$getRel($down("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
107107
!endprocedure
108108

109109
!unquoted procedure Rel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
110-
$getRel("-UP->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
110+
$getRel($up("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
111111
!endprocedure
112112
!unquoted procedure Rel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
113-
$getRel("-UP->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
113+
$getRel($up("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
114114
!endprocedure
115115
!unquoted procedure RelIndex_U($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
116-
$getRel("-UP->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
116+
$getRel($up("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
117117
!endprocedure
118118
!unquoted procedure RelIndex_Up($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
119-
$getRel("-UP->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
119+
$getRel($up("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
120120
!endprocedure
121121

122122
!unquoted procedure Rel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
123-
$getRel("-LEFT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
123+
$getRel($left("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
124124
!endprocedure
125125
!unquoted procedure Rel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
126-
$getRel("-LEFT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
126+
$getRel($left("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
127127
!endprocedure
128128
!unquoted procedure RelIndex_L($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
129-
$getRel("-LEFT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
129+
$getRel($left("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
130130
!endprocedure
131131
!unquoted procedure RelIndex_Left($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
132-
$getRel("-LEFT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
132+
$getRel($left("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
133133
!endprocedure
134134

135135
!unquoted procedure Rel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
136-
$getRel("-RIGHT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
136+
$getRel($right("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
137137
!endprocedure
138138
!unquoted procedure Rel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
139-
$getRel("-RIGHT->>", $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
139+
$getRel($right("-","->>"), $from, $to, Index() + ": " + $label, $techn, $descr, $sprite, $tags, $link)
140140
!endprocedure
141141
!unquoted procedure RelIndex_R($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
142-
$getRel("-RIGHT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
142+
$getRel($right("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
143143
!endprocedure
144144
!unquoted procedure RelIndex_Right($e_index, $from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
145-
$getRel("-RIGHT->>", $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
145+
$getRel($right("-","->>"), $from, $to, $e_index + ": " + $label, $techn, $descr, $sprite, $tags, $link)
146146
!endprocedure

LayoutOptions.md

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ PlantUML uses [Graphviz](https://www.graphviz.org/) for its graph visualization.
66

77
For this reason, C4-PlantUML also comes with some layout options.
88

9-
## LAYOUT_TOP_DOWN() or LAYOUT_LEFT_RIGHT()
9+
## LAYOUT_TOP_DOWN() or LAYOUT_LEFT_RIGHT() or LAYOUT_LANDSCAPE()
1010

1111
With the two macros `LAYOUT_TOP_DOWN()` and `LAYOUT_LEFT_RIGHT()` it is possible to easily change the flow visualization of the diagram. `LAYOUT_TOP_DOWN()` is the default.
1212

13-
```csharp
13+
```plantuml
1414
@startuml LAYOUT_TOP_DOWN Sample
1515
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
1616
@@ -30,10 +30,9 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS")
3030

3131
![LAYOUT_TOP_DOWN Sample](https://www.plantuml.com/plantuml/png/NP1DJyCm38Rl-HLc7DP9ezKG9quh0y5X7nNhc3XLQUknI6aI9IxLXFZlkDhO454aI_Rhruyz3IGzjOs6UVg-skH5ligAnzLs2MlPE8tYIfbAjpN2diY5-oJniei_5EtRiWteAsi83SMLRH9PUoNDfsvTcypkRZ8j3MqMyqHBma2SAcQibigWZnsF528Pmj8I6CGQQoYnakm9j5S1-DCUeSQTR3N1C17_0AEH41dwO4qawqQPCGpIFgf0NfBrWv5O7m9XKppOrjJI7w9gCeRXSQ_X2Bu4y3iZHHsMXNIEVRPOGkgSLfKaPSs0KxFhCQJhB5u-vTpY4MxZ2IpUPdqjrTfs0VfpCBG5leMJB6aONF4io3j5X1v8DQXvLc2sxnDTHCSY-vnaN1Ilg7-tkc1j0dToVCdpRCsgNdIkNcoUaHYZmpxil6t-japHr7pv7m00 "LAYOUT_TOP_DOWN Sample")
3232

33+
`LAYOUT_LEFT_RIGHT()` rotates the flow visualization to *from Left to Right* and directed relations like `Rel_Left()`, `Rel_Right()`, `Rel_Up()` and `Rel_Down()` are rotated too.
3334

34-
Using `LAYOUT_LEFT_RIGHT()`
35-
36-
```csharp
35+
```plantuml
3736
@startuml LAYOUT_LEFT_RIGHT Sample
3837
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
3938
@@ -52,6 +51,40 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS")
5251

5352
![LAYOUT_LEFT_RIGHT Sample](https://www.plantuml.com/plantuml/png/PL1DIyD05BplhrZheIdKX8edJusXjaAhfKaLJs6RFEt2Vh7xrb34_-uBhLPmBmDlvhsPsMb0uJ5gnPVvwzEsgfUp-whUFCmN5I-5TWhOXJIDYYtmFQ8BjrdcHPU-Izp7NGpW6siG3AQDrPbelHJcGqKNi-BcQgs4mUrgcIc14916TK5g8Gtur94fO_zSan5ZQ_31caIqMfen7-Gzoe1UeFM34IiF0K7NTpQQLlX3qap6V7WCEnpnJyRf_Vea7UnguHpTUO4TpvrJiX4ehHdGgBWSyxnSfu-pYbOyyEjqmbVFHS_bIjakyBvZu6Wv5NI293egbEJ5gquYWkSeDIZo2fJjwvGkmID9Tquo8ja6r4-hSwnje4t2HLMjIrBreb_sV6OEI34wwE7DM_rtPGgcfU_y1W00 "LAYOUT_LEFT_RIGHT Sample")
5453

54+
`LAYOUT_LANDSCAPE()` rotates the default flow visualization to *from Left to Right* like `LAYOUT_LEFT_RIGHT()` additional **directed relations** like Rel_Left(), Rel_Right(), Rel_Up() and Rel_Down() **are not rotated** anymore.
55+
56+
```plantuml
57+
@startuml LAYOUT_LANDSCAPE Sample
58+
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
59+
60+
LAYOUT_LANDSCAPE()
61+
62+
Person(admin, "Administrator")
63+
System_Boundary(c1, 'Sample') {
64+
Container(web_app, "Web Application", "C#, ASP.NET Core 2.1 MVC", "Allows users to compare multiple Twitter timelines")
65+
}
66+
System(twitter, "Twitter")
67+
68+
Rel(admin, web_app, "Uses", "HTTPS")
69+
Rel(web_app, twitter, "Gets tweets from", "HTTPS")
70+
71+
System(S,"S")
72+
System(SU,"S Up")
73+
System(SD,"S Down")
74+
System(SL,"S Left")
75+
System(SR,"S Right")
76+
77+
Rel_Up(S, SU, "Up")
78+
Rel_Down(S, SD, "Down")
79+
Rel_Left(S, SL, "Left")
80+
Rel_Right(S, SR, "Right")
81+
82+
SHOW_LEGEND()
83+
84+
@enduml
85+
```
86+
87+
![LAYOUT_LANDSCAPE Sample](https://www.plantuml.com/plantuml/png/NOzFRvj04CNlV8gjUmYM75kfUkef5ApaG1nae55FQ0sJUANzizeTXAAgtxqpCNQiSa7lDxFllRcFA0EEHeio-_tSDbsPxOewpwgjgANn6f8lolPw740S4NtyiTa4EQtV51x7mnWXzCuYM5ptpcoybfQzRYCEMXqs-VVRYb7xL6wCZ0Y1K9VJ2waiXBMdtIJvFpXT9aa58JgRoi4eknABZFygOf3emcAPrEzaPhgVRhI33EzfVxSIDwU-Dqln9n7qNMBI2GwTz9vyNk0WCk-rwYKgPnU4ygyhaTNLUhTjw4a0yMrz9vv-vJpBj7PJ57nc5EW4tUWbhPXHew8iqKmA4O90PK1JLgHkV-TsAPw6v3ElqJ3PWpvVzLchZH0vxx5fgfgsUEao_RHv08maWN-lmPdh9-VGUhLWULOjIT7wAr8mATnahrZ9h8HNl69xPdlrTiIvTjTwSXTrouNPaHaRVT22A8kPiza7Bucpc3aRdWPx6bpiwyVdbwxSFcntHKho7kmm6lqF "LAYOUT_LANDSCAPE Sample")
5588

5689
## LAYOUT_WITH_LEGEND() or SHOW_LEGEND(?hideStereotype)
5790

@@ -61,7 +94,7 @@ It can also help to save some space.
6194
All of that is the reason, C4-PlantUML uses colors and prefer also to enable a layout without `<<stereotypes>>` and with a legend.
6295
This can be enabled with `LAYOUT_WITH_LEGEND()`.
6396

64-
```csharp
97+
```plantuml
6598
@startuml LAYOUT_WITH_LEGEND Sample
6699
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
67100
@@ -88,7 +121,7 @@ The calculated legend has following differences:
88121
* stereotypes can remain visible (with `SHOW_LEGEND(false)`)
89122
* **`SHOW_LEGEND()` has to be last call in the diagram**
90123

91-
```csharp
124+
```plantuml
92125
@startuml SHOW_LEGEND Sample
93126
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
94127
@@ -111,7 +144,7 @@ SHOW_LEGEND()
111144

112145
`LAYOUT_WITH_LEGEND()` and SHOW_LEGEND(?hideStereotype)` adds the legend at the bottom right of the picture like below and additional whitespace is created.
113146

114-
```csharp
147+
```plantuml
115148
@startuml Layout With Whitespace Sample
116149
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
117150
@@ -137,7 +170,7 @@ Therefore a floating legend can be added via SHOW_FLOATING_LEGEND(), positioned
137170
- `SHOW_FLOATING_LEGEND(?alias, ?hideStereotype): shows the legend in the drawing area
138171
- `LEGEND()`: is the default alias of the created floating legend and can be used in Lay_Distance() call
139172

140-
```csharp
173+
```plantuml
141174
@startuml Compact Legend Layout Sample
142175
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
143176
@@ -173,7 +206,7 @@ Without any proof
173206
More often these sketches are used by many people as facts and are manifested into their documentations.
174207
With `LAYOUT_AS_SKETCH()` you can make a difference.
175208

176-
```csharp
209+
```plantuml
177210
@startuml LAYOUT_AS_SKETCH Sample
178211
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
179212
@@ -198,7 +231,7 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS")
198231
To enable a layout without `<<stereotypes>>` and legend.
199232
This can be enabled with `HIDE_STEREOTYPE()`.
200233

201-
```csharp
234+
```plantuml
202235
@startuml HIDE_STEREOTYPE Sample
203236
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
204237
@@ -230,7 +263,7 @@ With the macros `HIDE_PERSON_SPRITE()`, `SHOW_PERSON_SPRITE()` and `SHOW_PERSON_
230263

231264
"person" and "person2" are predefined sprites which can be used as default sprite too.
232265

233-
```csharp
266+
```plantuml
234267
@startuml predefined sprites Sample
235268
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
236269
@@ -244,7 +277,7 @@ Person(userB, "User B", "with predefined sprite person2", "person2")
244277

245278
**Using HIDE_PERSON_SPRITE()**
246279

247-
```csharp
280+
```plantuml
248281
@startuml HIDE_PERSON_SPRITE Sample
249282
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
250283
@@ -265,7 +298,7 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS")
265298

266299
**Using SHOW_PERSON_SPRITE()**
267300

268-
```csharp
301+
```plantuml
269302
@startuml SHOW_PERSON_SPRITE Sample
270303
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
271304
@@ -287,7 +320,7 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS")
287320

288321
**Using SHOW_PERSON_SPRITE(sprite)**
289322

290-
```csharp
323+
```plantuml
291324
@startuml SHOW_PERSON_SPRITE(sprite) Sample
292325
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
293326
!define osaPuml https://raw.githubusercontent.com/Crashedmind/PlantUML-opensecurityarchitecture2-icons/master
@@ -311,7 +344,7 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS")
311344

312345
**Using SHOW_PERSON_PORTRAIT()**
313346

314-
```csharp
347+
```plantuml
315348
@startuml SHOW_PERSON_PORTRAIT() Sample
316349
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
317350
@@ -337,7 +370,7 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS")
337370

338371
> This call requires PlantUML version >= v1.2021.4!
339372
340-
```csharp
373+
```plantuml
341374
@startuml SHOW_PERSON_OUTLINE() Sample
342375
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
343376

0 commit comments

Comments
 (0)