8000 [Workflow] Support multiline descriptions in PlantUML · symfony/symfony@ed62914 · GitHub
[go: up one dir, main page]

Skip to content

Commit ed62914

Browse files
valtzufabpot
authored andcommitted
[Workflow] Support multiline descriptions in PlantUML
1 parent b2a17ea commit ed62914

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

src/Symfony/Component/Workflow/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CHANGELOG
88
transitions and workflow's metadata into dumped graph
99
* Add support for storing marking in a property
1010
* Add a profiler
11+
* Add support for multiline descriptions in PlantUML diagrams
1112

1213
6.2
1314
---

src/Symfony/Component/Workflow/Dumper/PlantUmlDumper.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ private function getState(string $place, Definition $definition, Marking $markin
208208

209209
$description = $workflowMetadata->getMetadata('description', $place);
210210
if (null !== $description) {
211-
$output .= \PHP_EOL.$placeEscaped.' : '.str_replace("\n", ' ', $description);
211+
foreach (array_filter(explode("\n", $description)) as $line) {
212+
$output .= "\n".$placeEscaped.' : '.$line;
213+
}
212214
}
213215

214216
return $output;

src/Symfony/Component/Workflow/Tests/Dumper/PlantUmlDumperTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function testDumpWorkflowWithSpacesInTheStateNamesAndDescription()
8383

8484
$placesMetadata = [];
8585
$placesMetadata['place a'] = [
86-
'description' => 'My custom place description',
86+
'description' => "My custom\nplace description",
8787
];
8888
$inMemoryMetadataStore = new InMemoryMetadataStore([], $placesMetadata);
8989
$definition = new Definition($places, $transitions, null, $inMemoryMetadataStore);

src/Symfony/Component/Workflow/Tests/fixtures/puml/square/simple-workflow-with-spaces.puml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ skinparam agent {
1515
BorderColor #3887C6
1616
}
1717
state "place a" <<initial>>
18-
"place a" : My custom place description
18+
"place a" : My custom
19+
"place a" : place description
1920
state "place b"
2021
agent "t 1"
2122
"place a" --> "t 1"

0 commit comments

Comments
 (0)
0