Skip to content

Commit

Permalink
Escape text with newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandresalome committed Apr 25, 2024
1 parent fbaa90d commit 65fa935
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

2.0.1 (2024-04-25)
------------------

* [bug] Escape text with newlines

2.0.0 (23/10/2022)
------------------

Expand Down
2 changes: 1 addition & 1 deletion src/Output/DotEscaper.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ private function needsEscaping(string $value): bool
return true;
}

return preg_match('/[{}<> "#\-:\\\\\\/.,]/', $value) || '' === $value;
return preg_match('/[\n{}<> "#\-:\\\\\\/.,]/', $value) || '' === $value;
}
}
1 change: 1 addition & 0 deletions tests/Output/DotEscaperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function provideEscape(): array
['edge', '"edge"'],
['', '""'],
['2', '2'],
["foo\nbar", "\"foo\nbar\""],
];
}

Expand Down

0 comments on commit 65fa935

Please sign in to comment.