diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2018-03-27 21:17:47 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2018-03-27 21:34:51 -0400 |
commit | bc5aba49ae9da731c54d6a4fa84fbea0d18f38ea (patch) | |
tree | b48cc528cc685360f2513a1a6b2da410e28c8232 | |
parent | 6c592ff23dab48a728e50301a6b19d69a90d67d9 (diff) |
libremessages: whitespace_collapse: Don't insert trailing whitespacev20180327
-rw-r--r-- | src/lib/messages.sh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/messages.sh b/src/lib/messages.sh index a6f1460..10c0400 100644 --- a/src/lib/messages.sh +++ b/src/lib/messages.sh @@ -3,7 +3,7 @@ # Copyright (C) 2011 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com> # Copyright (C) 2012 Nicolás Reynolds <fauno@parabola.nu> -# Copyright (C) 2012-2014, 2016-2017 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2012-2014, 2016-2018 Luke Shumaker <lukeshu@parabola.nu> # # For just the setup_traps() function: # Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org> @@ -80,7 +80,8 @@ whitespace_collapse() { tr '\n' '\r' | sed -r \ -e 's/\r/ /g' -e 's/\t/ /g' \ - -e 's/(^|[^.!? ]) +/\1 /g' -e 's/([.!?]) +/\1 /g' + -e 's/(^|[^.!? ]) +/\1 /g' -e 's/([.!?]) +/\1 /g' \ + -e 's/\s+$//' } |