diff --git a/index.ts b/index.ts index d4c78bc..8b77543 100644 --- a/index.ts +++ b/index.ts @@ -1,4 +1,4 @@ -const version = "2.2.1"; +const version = "2.3.0"; import x2i from "./x2i"; import { existsSync } from "fs"; @@ -29,6 +29,7 @@ async function handle(roomId, event) { if (event.content.body === "!xik") {xik(roomId); return;}; if (event.content.body === "!xpie") {xpie(roomId); return;}; if (event.content.body === "!xchr") {xchr(roomId); return;}; + if (event.content.body === "!xnav") {xnav(roomId); return;}; if (event.content.body === "!xdebug") {debug(roomId); return;}; console.log("Trying to convert the message!"); @@ -50,6 +51,7 @@ p - Proto-Indo-European Notation (see !xpie) i - Inuktitut Syllabics - https://en.wikipedia.org/wiki/Inuktitut_syllabics ik - Iñupiatun Orthographies (see !xik) chr - Cherokee (see !xchr) - https://en.wikipedia.org/wiki/Cherokee_syllabary +nav - Navajo (see !xnav) Find my source at https://github.com/Dali99/matrix-wug @@ -101,6 +103,22 @@ chr/tsa.la.gi ga.wo.ni.hi.s.di/ - ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ`; client.sendNotice(roomId, message); } +function xnav(roomId) { + var message = `My navajo encoding is as follows: +Caron after a vowel gives it an acute accent: o^ → ó, A^ → Á +At sign after a vowel gives it an ogonek: a@ → ą, E@ → Ę +Percentage sign after a vowel gives it both an ogonek and an acute accent: a% → ą́, I% → Į́ and after an l, it makes ł: l% → ł +You can also "stack the symbols" for an ogonek and an accute accent: (a^@, a@^) → ą́ +Single quotation mark is converted to the glottal stop/ejective mark (’) +For a plain quotation mark, you can type '^ + +Thanks to Tuugaalikkuluk for the encoding`; + + client.sendNotice(roomId, message); +} + + + async function debug(roomId) { var message = `Hi my name is ${await myself}, and I want to help you debug me! I run version ${version} 💝 and currently reside in ${roomId}`; diff --git a/x2i/dictionaries/nav.ts b/x2i/dictionaries/nav.ts new file mode 100644 index 0000000..fd9accb --- /dev/null +++ b/x2i/dictionaries/nav.ts @@ -0,0 +1,273 @@ +export function convert(input: string) +{ + var c=" "; + var rom=input+" "; + var flag=0; + while(rom.length > 1) { + if(rom[1]=='^') { + if(rom.length>=2 && rom[2]=='@') { + if(rom[0]=='a') { + c=c+'ą́'; + flag=1; + } + else if(rom[0]=='A') { + c=c+'Ą́'; + flag=1; + } + else if(rom[0]=='e') { + c=c+'ę́'; + flag=1; + } + else if(rom[0]=='E') { + c=c+'Ę́'; + flag=1; + } + else if(rom[0]=='i') { + c=c+'į́' + flag=1 + } + else if(rom[0]=='I') { + c=c+'Į́' + flag=1 + } + else if(rom[0]=='o') { + c=c+'ǫ́' + flag=1 + } + else if(rom[0]=='O') { + c=c+'Ǫ́' + flag=1 + } + else if(rom[0]=='u') { + c=c+'ų́' + flag=1 + } + else if(rom[0]=='U') { + c=c+'Ų́' + flag=1 + } + if(flag) { + rom=rom.slice(3) + flag=0 + continue + } + } + else { + if(rom[0]=='a') { + c=c+'á' + flag=1 + } + else if(rom[0]=='A') { + c=c+'Á' + flag=1 + } + else if(rom[0]=='e') { + c=c+'é' + flag=1 + } + else if(rom[0]=='E') { + c=c+'É' + flag=1 + } + else if(rom[0]=='i') { + c=c+'í' + flag=1 + } + else if(rom[0]=='I') { + c=c+'Í' + flag=1 + } + else if(rom[0]=='o') { + c=c+'ó' + flag=1 + } + else if(rom[0]=='O') { + c=c+'Ó' + flag=1 + } + else if(rom[0]=='u') { + c=c+'ú' + flag=1 + } + else if(rom[0]=='U') { + c=c+'Ú' + flag=1 + } + if(flag) { + rom=rom.slice(2) + flag=0 + continue + } + } + } + if(rom[1]=='@') { + if(rom.length>=2 && rom[2]=='^') { + if(rom[0]=='a') { + c=c+'ą́' + flag=1 + } + else if(rom[0]=='A') { + c=c+'Ą́' + flag=1 + } + else if(rom[0]=='e') { + c=c+'ę́' + flag=1 + } + else if(rom[0]=='E') { + c=c+'Ę́' + flag=1 + } + else if(rom[0]=='i') { + c=c+'į́' + flag=1 + } + else if(rom[0]=='I') { + c=c+'Į́' + flag=1 + } + else if(rom[0]=='o') { + c=c+'ǫ́' + flag=1 + } + else if(rom[0]=='O') { + c=c+'Ǫ́' + flag=1 + } + else if(rom[0]=='u') { + c=c+'ų́' + flag=1 + } + else if(rom[0]=='U') { + c=c+'Ų́' + flag=1 + } + if(flag) { + rom=rom.slice(3) + flag=0 + continue + } + } + else { + if(rom[0]=='a') { + c=c+'ą' + flag=1 + } + else if(rom[0]=='A') { + c=c+'Ą' + flag=1 + } + else if(rom[0]=='e') { + c=c+'ę' + flag=1 + } + else if(rom[0]=='E') { + c=c+'Ę' + flag=1 + } + else if(rom[0]=='i') { + c=c+'į' + flag=1 + } + else if(rom[0]=='I') { + c=c+'Į' + flag=1 + } + else if(rom[0]=='o') { + c=c+'ǫ' + flag=1 + } + else if(rom[0]=='O') { + c=c+'Ǫ' + flag=1 + } + else if(rom[0]=='u') { + c=c+'ų' + flag=1 + } + else if(rom[0]=='U') { + c=c+'Ų' + flag=1 + } + if(flag) { + rom=rom.slice(2) + flag=0 + continue + } + } + } + if(rom[1]=='%') { + if(rom[0]=='a') { + c=c+'ą́' + flag=1 + } + else if(rom[0]=='A') { + c=c+'Ą́' + flag=1 + } + else if(rom[0]=='e') { + c=c+'ę́' + flag=1 + } + else if(rom[0]=='E') { + c=c+'Ę́' + flag=1 + } + else if(rom[0]=='i') { + c=c+'į́' + flag=1 + } + else if(rom[0]=='I') { + c=c+'Į́' + flag=1 + } + else if(rom[0]=='o') { + c=c+'ǫ́' + flag=1 + } + else if(rom[0]=='O') { + c=c+'Ǫ́' + flag=1 + } + else if(rom[0]=='u') { + c=c+'ų́' + flag=1 + } + else if(rom[0]=='U') { + c=c+'Ų́' + flag=1 + } + else if(rom[0]=='l') { + c=c+'ł' + flag=1 + } + else if(rom[0]=='L') { + c=c+'Ł' + flag=1 + } + if(flag) { + rom=rom.slice(2) + flag=0 + continue + } + } + if(rom[0]=="'") { + if(rom[1]!='^') { + c=c+'’' + rom=rom.slice(1) + continue + } + if(rom[1]=='^') { + c=c+'\'' + rom=rom.slice(2) + continue + } + } + if(rom[0]=='#') { + break + } + c=c+rom[0] + rom=rom.slice(1) + } + return c; +} \ No newline at end of file diff --git a/x2i/index.ts b/x2i/index.ts index fff8bc0..40c4d68 100644 --- a/x2i/index.ts +++ b/x2i/index.ts @@ -39,12 +39,17 @@ const defaultMatchAction = (left: string, match: string, right: string) => left const defaultMatchFunction = (match: string, keys: ([RegExp, string | ((m: {[key: string]: string;}) => string), string][])) => OuterXRegExp.replaceEach(match, keys as (RegExp | string)[][]) import * as chr from "./dictionaries/chr"; +import * as nav from "./dictionaries/nav"; const matchType: { [key: string]: IMatchInstructions } = { chr: { join: (_, match) => `- ${match}`, matchFunction: chr.convert, }, + nav: { + join: (_, match) => `- ${match}`, + matchFunction: nav.convert, + }, ik: { join: (_, match) => `- ${match}`, keys: readKeys("./x2i/dictionaries/ik-keys.yaml"),