From 8ee9f87f7f9eadcbe21e9e72cd4176b2f06cd5b5 Mon Sep 17 00:00:00 2001 From: Jess Archer Date: Thu, 14 Mar 2024 02:05:43 +1000 Subject: [PATCH] Fix box spacing with Symfony named style tags (#125) --- src/Themes/Default/Concerns/DrawsBoxes.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Themes/Default/Concerns/DrawsBoxes.php b/src/Themes/Default/Concerns/DrawsBoxes.php index df270e64..2b4567ac 100644 --- a/src/Themes/Default/Concerns/DrawsBoxes.php +++ b/src/Themes/Default/Concerns/DrawsBoxes.php @@ -86,8 +86,13 @@ protected function pad(string $text, int $length): string */ protected function stripEscapeSequences(string $text): string { + // Strip ANSI escape sequences. $text = preg_replace("/\e[^m]*m/", '', $text); + // Strip Symfony named style tags. + $text = preg_replace("/<(info|comment|question|error)>(.*?)<\/\\1>/", '$2', $text); + + // Strip Symfony inline style tags. return preg_replace("/<(?:(?:[fb]g|options)=[a-z,;]+)+>(.*?)<\/>/i", '$1', $text); } }