diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2012-09-03 17:57:46 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2012-09-03 17:57:46 +0200 |
commit | ddb59757f5e4a6c30ede99a2d4f039e881132ab9 (patch) | |
tree | 2dbccf700970bdfaa13eaa260a08cb2b26696912 /man/example-filter.sh | |
parent | 8769aa6370cd6b4ebd7393c32519a04772f5bd29 (diff) | |
download | pass-ddb59757f5e4a6c30ede99a2d4f039e881132ab9.tar.gz pass-ddb59757f5e4a6c30ede99a2d4f039e881132ab9.tar.bz2 pass-ddb59757f5e4a6c30ede99a2d4f039e881132ab9.zip |
Move examples into manpage.
Diffstat (limited to 'man/example-filter.sh')
-rwxr-xr-x | man/example-filter.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/man/example-filter.sh b/man/example-filter.sh new file mode 100755 index 0000000..2a71d40 --- /dev/null +++ b/man/example-filter.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# This is a super bootleg script for converting plaintext examples into groff. + +while read line; do + echo "$line" | while read -n 1 char; do + if [[ $char == "%" ]]; then + echo -n '%' + continue + fi + ord=$(printf '%d' "'$char") + if [[ $ord -eq 0 ]]; then + printf ' ' + elif [[ $ord -gt 127 ]]; then + printf '\[u%X]' "'$char" + else + printf "$char" + fi + done + echo + echo ".br" +done |