summaryrefslogtreecommitdiff
path: root/bin/capitalise
diff options
context:
space:
mode:
authorDavid Wührer <def@gmx.at>2024-05-18 21:04:34 +0200
committerDavid Wührer <def@gmx.at>2024-05-18 21:04:34 +0200
commit77cfffee6177fb0421fa0fce15d6a1875bde4816 (patch)
tree251428cdd482ea50cfb019dbd3c3bafd79d2fd14 /bin/capitalise
parent75b23ce1ff0daab363725a2a5755ea80bbeaa68e (diff)
manuals, sum-down, radix
Diffstat (limited to 'bin/capitalise')
-rwxr-xr-xbin/capitalise137
1 files changed, 137 insertions, 0 deletions
diff --git a/bin/capitalise b/bin/capitalise
new file mode 100755
index 0000000..479c55d
--- /dev/null
+++ b/bin/capitalise
@@ -0,0 +1,137 @@
+#!/bin/bash
+
+
+# Latin letter small capital a: UTF-8: e1 b4 80 UTF-16BE: 1d00
+# .0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .A .B .C .D .E .F
+# 1D0. ᴀ ᴁ ᴂ ᴃ ᴄ ᴅ ᴆ ᴇ ᴈ ᴉ ᴊ ᴋ ᴌ ᴍ ᴎ ᴏ
+# 1D1. ᴐ ᴑ ᴒ ᴓ ᴔ ᴕ ᴖ ᴗ ᴘ ᴙ ᴚ ᴛ ᴜ ᴝ ᴞ ᴟ
+# 1D2. ᴠ ᴡ ᴢ ᴣ ᴤ ᴥ ᴦ ᴧ ᴨ ᴩ ᴪ ᴫ ᴬ ᴭ ᴮ ᴯ
+# 1D3. ᴰ ᴱ ᴲ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴻ ᴼ ᴽ ᴾ ᴿ
+# 1D4. ᵀ ᵁ ᵂ ᵃ ᵄ ᵅ ᵆ ᵇ ᵈ ᵉ ᵊ ᵋ ᵌ ᵍ ᵎ ᵏ
+# 1D5. ᵐ ᵑ ᵒ ᵓ ᵔ ᵕ ᵖ ᵗ ᵘ ᵙ ᵚ ᵛ ᵜ ᵝ ᵞ ᵟ
+# 1D6. ᵠ ᵡ ᵢ ᵣ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\xb4\xa1'
+ [x]=x # Missing
+ [y]=$'\xca\x8f'
+ [z]=$'\xe1\xb4\xa2'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+# []=$'\x1d\x'
+)
+
+while IFS= read -r line
+do
+ replacement=""
+ for i in $(seq 0 "$((${#line}-1))")
+ do
+ c1=${line:$i:1}
+ # if [[ $c1 =~ [a-zA-Zα-ωΑ-Ω] ]]
+ if [[ $c1 =~ [a-zæœ] ]]
+ then replacement+=${smallcaps[$c1]}
+ else replacement+=$c1
+ fi
+ done
+ echo "$replacement"
+done