summaryrefslogtreecommitdiffstats
path: root/util/bin/jbo
diff options
context:
space:
mode:
Diffstat (limited to 'util/bin/jbo')
-rwxr-xr-xutil/bin/jbo42
1 files changed, 42 insertions, 0 deletions
diff --git a/util/bin/jbo b/util/bin/jbo
new file mode 100755
index 00000000..76f86680
--- /dev/null
+++ b/util/bin/jbo
@@ -0,0 +1,42 @@
+#! /bin/sh
+# usage: jbo WORDS...
+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@</?(HTML|HEAD|TITLE|BODY|FONT)[^>]*>@@g
+ s@Lojban translation@@
+' | {
+ sed 's:<SUB>[^>]*</SUB>:\n&\n:g' |
+ sed '/^<SUB>/y/0123456789/₀₁₂₃₄₅₆₇₈₉/' |
+ tr -d '\n' |
+ sed 's:</\?SUB>::g'
+} |
+sed -r '
+ s|<B>||g; s|</B>||g
+
+ s|<I> </I>|<I>_</I>|g
+ s|<I>||g; s|</I>||g
+
+ #s|<U>||g; s|</U>||g
+ s|<U>||g; s|</U>||g
+
+ s|&lt;|<|g
+ s|&gt;|>|g
+
+ s@^ *@@
+ $s/$/\n/
+'