summaryrefslogtreecommitdiffstats
path: root/util/bin/jbo
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2013-11-06 20:44:44 +0100
committertv <tv@nomic.retiolum>2013-11-06 20:44:44 +0100
commitb27da03fed2042b0783d5c40501ed958eb674af8 (patch)
treee65ecda9e6e030d2436bc17083e228558d2c4d2e /util/bin/jbo
parentb50fa72fc286a2302d90e137b738911cae9aebf0 (diff)
util jbo: initial import
Diffstat (limited to 'util/bin/jbo')
-rwxr-xr-xutil/bin/jbo46
1 files changed, 46 insertions, 0 deletions
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@</?(HTML|HEAD|TITLE|BODY|FONT)[^>]*>@@g
+ s@Lojban translation@@
+
+ s|<SUB>1</SUB>|₁|g
+ s|<SUB>2</SUB>|₂|g
+ s|<SUB>3</SUB>|₃|g
+ s|<SUB>4</SUB>|₄|g
+ s|<SUB>5</SUB>|₅|g
+ s|<SUB>6</SUB>|₆|g
+ s|<SUB>7</SUB>|₇|g
+ s|<SUB>8</SUB>|₈|g
+ s|<SUB>9</SUB>|₉|g
+
+ 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/
+'