Skip to content

Commit d3b73e5

Browse files
Merge branch '5.4' into 6.2
* 5.4: fix style of label containing new lines in PUML dump [TwigBridge] Allow floats in html5 input type number field [Translation] Handle the translation of empty strings [VarDumper] Fix error when reflected class has default Enum parameter in constructor [FrameworkBundle] Fix denyAccessUnlessGranted for mixed attributes [Validator] Fix translation of AtLeastOneOf constraint message [Validator] Sync IBAN formats with Swift IBAN registry [String] Use same alphabet for ByteString::fromRandom tests Fix phpdocs in components
2 parents 7eabea5 + 96ec184 commit d3b73e5

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Dumper/PlantUmlDumper.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,17 @@ private function getState(string $place, Definition $definition, Marking $markin
217217
private function getTransitionEscapedWithStyle(MetadataStoreInterface $workflowMetadata, Transition $transition, string $to): string
218218
{
219219
$to = $workflowMetadata->getMetadata('label', $transition) ?? $to;
220-
$to = str_replace("\n", ' ', $to);
220+
// Change new lines symbols to actual '\n' string,
221+
// PUML will render them as new lines
222+
$to = str_replace("\n", '\n', $to);
221223

222224
$color = $workflowMetadata->getMetadata('color', $transition) ?? null;
223225

224226
if (null !== $color) {
227+
// Close and open <font> before and after every '\n' string,
228+
// so that the style is applied properly on every line
229+
$to = str_replace('\n', sprintf('</font>\n<font color=%1$s>', $color), $to);
230+
225231
$to = sprintf(
226232
'<font color=%1$s>%2$s</font>',
227233
$color,

Tests/fixtures/puml/arrow/complex-state-machine-marking.puml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ state "b"
1515
state "c" <<marked>>
1616
state "d"
1717
"a" --> "b": "t1"
18-
"d" -[#Red]-> "b": "<font color=Grey>My custom transition label 3</font>"
18+
"d" -[#Red]-> "b": "<font color=Grey>My custom transition</font>\n<font color=Grey>label 3</font>"
1919
"b" -[#Blue]-> "c": "t2"
2020
"b" --> "d": "t3"
2121
@enduml

Tests/fixtures/puml/arrow/complex-state-machine-nomarking.puml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ state "b"
1515
state "c"
1616
state "d"
1717
"a" --> "b": "t1"
18-
"d" -[#Red]-> "b": "<font color=Grey>My custom transition label 3</font>"
18+
"d" -[#Red]-> "b": "<font color=Grey>My custom transition</font>\n<font color=Grey>label 3</font>"
1919
"b" -[#Blue]-> "c": "t2"
2020
"b" --> "d": "t3"
2121
@enduml

0 commit comments

Comments
 (0)