diff options
author | JoshyPHP <s9e.dev@gmail.com> | 2015-05-30 22:20:52 +0200 |
---|---|---|
committer | JoshyPHP <s9e.dev@gmail.com> | 2015-05-30 22:20:52 +0200 |
commit | b69e33c2b0dfaaf9274e783cd189a8d1d49bce07 (patch) | |
tree | c717cbbd60e21e0960e8f3d6c51761814bbf6f29 | |
parent | 2f0d11ba3c28f27e535988de2a8d08f7b17aef92 (diff) | |
download | forums-b69e33c2b0dfaaf9274e783cd189a8d1d49bce07.tar forums-b69e33c2b0dfaaf9274e783cd189a8d1d49bce07.tar.gz forums-b69e33c2b0dfaaf9274e783cd189a8d1d49bce07.tar.bz2 forums-b69e33c2b0dfaaf9274e783cd189a8d1d49bce07.tar.xz forums-b69e33c2b0dfaaf9274e783cd189a8d1d49bce07.zip |
[ticket/13901] Add whitespace to short, multiline quotes for readability
PHPBB3-13901
-rw-r--r-- | phpBB/phpbb/textformatter/s9e/utils.php | 2 | ||||
-rw-r--r-- | tests/text_formatter/s9e/utils_test.php | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/phpBB/phpbb/textformatter/s9e/utils.php b/phpBB/phpbb/textformatter/s9e/utils.php index 64fdb628ca..803c71a5a2 100644 --- a/phpBB/phpbb/textformatter/s9e/utils.php +++ b/phpBB/phpbb/textformatter/s9e/utils.php @@ -69,7 +69,7 @@ class utils implements \phpbb\textformatter\utils_interface $quote .= ' ' . $name . '=' . $this->enquote($value); } $quote .= ']'; - $newline = (strlen($quote . $text . '[/quote]') > 80) ? "\n" : ''; + $newline = (strlen($quote . $text . '[/quote]') > 80 || strpos($text, "\n") !== false) ? "\n" : ''; $quote .= $newline . $text . $newline . '[/quote]'; return $quote; diff --git a/tests/text_formatter/s9e/utils_test.php b/tests/text_formatter/s9e/utils_test.php index d40d450f5a..152c316b2e 100644 --- a/tests/text_formatter/s9e/utils_test.php +++ b/tests/text_formatter/s9e/utils_test.php @@ -181,6 +181,11 @@ class phpbb_textformatter_s9e_utils_test extends phpbb_test_case array(), '[quote]This is a short quote on its own line[/quote]', ), + array( + "This is a short quote\non two lines", + array(), + "[quote]\nThis is a short quote\non two lines\n[/quote]", + ), ); } |