From b27da03fed2042b0783d5c40501ed958eb674af8 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 6 Nov 2013 20:44:44 +0100 Subject: util jbo: initial import --- util/bin/jbo | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 util/bin/jbo (limited to 'util/bin') diff --git a/util/bin/jbo b/util/bin/jbo new file mode 100755 index 00000000..f1e349dc --- /dev/null +++ b/util/bin/jbo @@ -0,0 +1,46 @@ +#! /bin/sh +set -euf + +if test $# = 0; then + while read line; do + if test "${clear-}" = true; then + echo -n 'c' + fi + "$0" "$line" + done + exit +fi + +echo "$*" | +tr 'h' "'" | +jbofihe -H | +tr '\n' ' ' | +sed -r ' + + s@]*>@@g + s@Lojban translation@@ + + s|1|₁|g + s|2|₂|g + s|3|₃|g + s|4|₄|g + s|5|₅|g + s|6|₆|g + s|7|₇|g + s|8|₈|g + s|9|₉|g + + s|||g; s|||g + + s| |_|g + s|||g; s|||g + + #s|||g; s|||g + s|||g; s|||g + + s|<|<|g + s|>|>|g + + s@^ *@@ + $s/$/\n/ +' -- cgit v1.2.3 From 01cac2ee2e6f6394e6bd33cb63bec1103a727d11 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 6 Nov 2013 20:45:15 +0100 Subject: util jbo: talk about usage --- util/bin/jbo | 1 + 1 file changed, 1 insertion(+) (limited to 'util/bin') diff --git a/util/bin/jbo b/util/bin/jbo index f1e349dc..78408d4f 100755 --- a/util/bin/jbo +++ b/util/bin/jbo @@ -1,4 +1,5 @@ #! /bin/sh +# usage: jbo WORDS... set -euf if test $# = 0; then -- cgit v1.2.3 From a0507027720aee72f1f10cbc2f7504a9960ed465 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 6 Nov 2013 21:57:10 +0100 Subject: util jbo: properly apply subscripts --- util/bin/jbo | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'util/bin') diff --git a/util/bin/jbo b/util/bin/jbo index 78408d4f..76f86680 100755 --- a/util/bin/jbo +++ b/util/bin/jbo @@ -17,20 +17,15 @@ tr 'h' "'" | jbofihe -H | tr '\n' ' ' | sed -r ' - s@]*>@@g s@Lojban translation@@ - - s|1|₁|g - s|2|₂|g - s|3|₃|g - s|4|₄|g - s|5|₅|g - s|6|₆|g - s|7|₇|g - s|8|₈|g - s|9|₉|g - +' | { + sed 's:[^>]*:\n&\n:g' | + sed '/^/y/0123456789/₀₁₂₃₄₅₆₇₈₉/' | + tr -d '\n' | + sed 's:::g' +} | +sed -r ' s|||g; s|||g s| |_|g -- cgit v1.2.3