diff options
-rwxr-xr-x | src/lib/librelib | 4 | ||||
-rwxr-xr-x | src/lib/libremessages | 10 | ||||
-rw-r--r-- | src/lib/libremessages.1.ronn | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/librelib b/src/lib/librelib index bc5c5ed..e9d184e 100755 --- a/src/lib/librelib +++ b/src/lib/librelib @@ -34,14 +34,14 @@ print() { printf -- "$mesg\n" "$@" } -whitespace-collapse() { +whitespace_collapse() { tr '\n' '\r' | sed -r \ -e 's/\r/ /g' -e 's/\t/ /g' \ -e 's/(^|[^.!? ]) +/\1 /g' -e 's/([.!?]) +/\1 /g' } prose() { - local mesg="$(_ "$(whitespace-collapse <<<"$1")")"; shift + local mesg="$(_ "$(whitespace_collapse <<<"$1")")"; shift printf -- "$mesg" "$@" | fmt -u } diff --git a/src/lib/libremessages b/src/lib/libremessages index 4bea486..151674b 100755 --- a/src/lib/libremessages +++ b/src/lib/libremessages @@ -58,12 +58,12 @@ print() { printf -- "$mesg\n" "$@" } -# Usage: whitespace-collapse <<<STRING +# Usage: whitespace_collapse <<<STRING # # Collapses whitespace on stadard I/O, similar to HTML whitespace # collapsing, with the exception that it puts two spaces between # sentences. It considers newline, tab, and space to be whitespace. -whitespace-collapse() { +whitespace_collapse() { [[ $# == 0 ]] || panic tr '\n' '\r' | sed -r \ @@ -79,7 +79,7 @@ whitespace-collapse() { # printing a paragraph of prose in --help text. prose() { [[ $# -ge 1 ]] || panic - local mesg="$(_ "$(whitespace-collapse <<<"$1")")"; shift + local mesg="$(_ "$(whitespace_collapse <<<"$1")")"; shift printf -- "$mesg" "$@" | fmt -u } @@ -88,7 +88,7 @@ prose() { # remaining lines. bullet() { [[ $# -ge 1 ]] || panic - local mesg="$(_ "$(whitespace-collapse <<<"$1")")"; shift + local mesg="$(_ "$(whitespace_collapse <<<"$1")")"; shift # Wrap the text to 71 columns; 75 (the default) minus a 4 column indent printf -- "$mesg" "$@" | fmt -u -w 71 | sed -e '1s/^/ - /' -e '2,$s/^/ /' } @@ -141,7 +141,7 @@ flag() { while [[ $# -gt 0 ]]; do local flag=$1 - local desc="$(_ "$(whitespace-collapse <<<"$2")")" + local desc="$(_ "$(whitespace_collapse <<<"$2")")" shift 2 local lines diff --git a/src/lib/libremessages.1.ronn b/src/lib/libremessages.1.ronn index 5afcbc8..3bce612 100644 --- a/src/lib/libremessages.1.ronn +++ b/src/lib/libremessages.1.ronn @@ -74,7 +74,7 @@ Unless otherwise noted, these do not implicitly call `gettext`. <MESSAGE> is a `printf`(1)-formatted string that is fed through `gettext`, and <MESSAGE_ARGS> are its arguments. - * `whitespace-collapse`: + * `whitespace_collapse`: Collapses whitespace on stadard I/O, similar to HTML whitespace collapsing, with the exception that it puts two spaces between sentences. It considers newline, tab, and space to be |