Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dfbe938b68 | ||
|
|
70fad99e71 | ||
|
|
268f73a9ce | ||
|
|
4b313d6dcd | ||
|
|
059e83aa16 | ||
|
|
c8b721bf80 | ||
|
|
f27347d6ec | ||
|
|
e34de2f569 | ||
|
|
002b941ee7 | ||
|
|
cea04d0e2a | ||
|
|
6ac0b87e0d | ||
|
|
81a205f781 | ||
|
|
3268701820 | ||
|
|
75d4d41744 | ||
|
|
bb4b7a6534 | ||
|
|
614287c31b | ||
|
|
919ee380d2 | ||
|
|
6f8f06d5e2 |
@@ -1,6 +1,21 @@
|
|||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- deploy
|
||||||
|
|
||||||
|
|
||||||
image: node:10-slim
|
image: node:10-slim
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
stage: build
|
||||||
script:
|
script:
|
||||||
- npm install
|
- npm install
|
||||||
- npm build
|
- npm run build
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
stage: deploy
|
||||||
|
script:
|
||||||
|
- echo "Deploy to dodsorf.as"
|
||||||
|
environment:
|
||||||
|
name: wug dodsorf.as
|
||||||
|
only:
|
||||||
|
- master
|
||||||
10
README.md
10
README.md
@@ -10,14 +10,8 @@ p[x2"owis x1"ek'wo:s-kve] gives *h₂ówis h₁é"kwōs-kʷe
|
|||||||
|
|
||||||
Guides to these systems can be found here:
|
Guides to these systems can be found here:
|
||||||
X-sampa: https://en.wikipedia.org/wiki/X-SAMPA
|
X-sampa: https://en.wikipedia.org/wiki/X-SAMPA
|
||||||
Z-sampa: http://www.kneequickie.com/kq/Z-SAMPA
|
Z-sampa: https://web.archive.org/web/20191116002807/http://kneequickie.com/kq/Z-SAMPA
|
||||||
For the PIE notation:
|
APIE: https://gist.github.com/xsduan/8ebd580be71214c57aa554ec9050916c
|
||||||
|
|
||||||
* a preceding " is acute accent
|
|
||||||
* a following : is the macron
|
|
||||||
* a following . is the syllabicity marker
|
|
||||||
* h always becomes superscript and v is superscript w.
|
|
||||||
* Palato-velars are marked with a following ' and x1, x2, x3 etc. yields the laryngeals, with x@ for the subscript a laryngeal, and xx for an unknown laryngeal.
|
|
||||||
|
|
||||||
This is best learned by experimenting.
|
This is best learned by experimenting.
|
||||||
|
|
||||||
|
|||||||
29
index.ts
29
index.ts
@@ -1,4 +1,4 @@
|
|||||||
const version = "2.2.0";
|
const version = "2.3.2";
|
||||||
import x2i from "./x2i";
|
import x2i from "./x2i";
|
||||||
import { existsSync } from "fs";
|
import { existsSync } from "fs";
|
||||||
|
|
||||||
@@ -24,11 +24,13 @@ async function handle(roomId, event) {
|
|||||||
|
|
||||||
if (event.unsigned.age > 1000 * 60) { console.log("Message was old!"); return; };
|
if (event.unsigned.age > 1000 * 60) { console.log("Message was old!"); return; };
|
||||||
if (event.sender === await myself) { console.log("Wait a minute... That's me!"); return;};
|
if (event.sender === await myself) { console.log("Wait a minute... That's me!"); return;};
|
||||||
|
if (event.content.msgtype === "m.notice") { return; };
|
||||||
|
|
||||||
if (event.content.body === "!xhelp" || event.content.body === (await client.getUserProfile(await myself)).displayname + ": help") {help(roomId); return;};
|
if (event.content.body === "!xhelp" || event.content.body === (await client.getUserProfile(await myself)).displayname + ": help") {help(roomId); return;};
|
||||||
if (event.content.body === "!xik") {xik(roomId); return;};
|
if (event.content.body === "!xik") {xik(roomId); return;};
|
||||||
if (event.content.body === "!xpie") {xpie(roomId); return;};
|
if (event.content.body === "!xpie") {xpie(roomId); return;};
|
||||||
if (event.content.body === "!xchr") {xchr(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;};
|
if (event.content.body === "!xdebug") {debug(roomId); return;};
|
||||||
|
|
||||||
console.log("Trying to convert the message!");
|
console.log("Trying to convert the message!");
|
||||||
@@ -45,11 +47,12 @@ function help(roomId) {
|
|||||||
To use me, type a key together with either / or [] as delimeters
|
To use me, type a key together with either / or [] as delimeters
|
||||||
|
|
||||||
x - X-SAMPA - https://en.wikipedia.org/wiki/X-SAMPA
|
x - X-SAMPA - https://en.wikipedia.org/wiki/X-SAMPA
|
||||||
z - Z-SAMPA - http://www.kneequickie.com/kq/Z-SAMPA
|
z - Z-SAMPA - https://web.archive.org/web/20191116002807/http://kneequickie.com/kq/Z-SAMPA
|
||||||
p - Proto-Indo-European Notation (see !xpie)
|
p - Proto-Indo-European Notation - https://gist.github.com/xsduan/8ebd580be71214c57aa554ec9050916c
|
||||||
i - Inuktitut Syllabics - https://en.wikipedia.org/wiki/Inuktitut_syllabics
|
i - Inuktitut Syllabics - https://en.wikipedia.org/wiki/Inuktitut_syllabics
|
||||||
ik - Iñupiatun Orthographies (see !xik)
|
ik - Iñupiatun Orthographies (see !xik)
|
||||||
chr - Cherokee (see !xchr) - https://en.wikipedia.org/wiki/Cherokee_syllabary
|
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
|
Find my source at https://github.com/Dali99/matrix-wug
|
||||||
|
|
||||||
@@ -70,7 +73,7 @@ a following . is the syllabicity marker
|
|||||||
h always becomes superscript and v is superscript w.
|
h always becomes superscript and v is superscript w.
|
||||||
Palato-velars are marked with a following ' and x1, x2, x3 etc. yields the laryngeals, with x@ for the subscript a laryngeal, and xx for an unknown laryngeal.
|
Palato-velars are marked with a following ' and x1, x2, x3 etc. yields the laryngeals, with x@ for the subscript a laryngeal, and xx for an unknown laryngeal.
|
||||||
|
|
||||||
There's probably more, but this is best learned by experimenting (or reading https://github.com/dali99/matrix-wug/blob/master/x2i/apie-keys.yaml)
|
There's probably more, but this is best learned by experimenting (or reading https://gist.github.com/xsduan/8ebd580be71214c57aa554ec9050916c)
|
||||||
|
|
||||||
Thanks to conniebot (xsduan) for the encoding`;
|
Thanks to conniebot (xsduan) for the encoding`;
|
||||||
|
|
||||||
@@ -91,7 +94,7 @@ Thanks to Tuugaalikkuluk for the encoding`;
|
|||||||
function xchr(roomId) {
|
function xchr(roomId) {
|
||||||
var message = `I'm sadly not smart enough to know which syllable to use in certain situations.
|
var message = `I'm sadly not smart enough to know which syllable to use in certain situations.
|
||||||
That means you have to help me out a little.
|
That means you have to help me out a little.
|
||||||
Write the wanted syllables down, but separate them by a dot (.)
|
Write the wanted syllables down, but separate them by a dot (.) or an apostrophe (')
|
||||||
|
|
||||||
Thanks to Tuugaalikkuluk for the encoding
|
Thanks to Tuugaalikkuluk for the encoding
|
||||||
|
|
||||||
@@ -101,6 +104,22 @@ chr/tsa.la.gi ga.wo.ni.hi.s.di/ - ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ`;
|
|||||||
client.sendNotice(roomId, message);
|
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) {
|
async function debug(roomId) {
|
||||||
var message = `Hi my name is ${await myself}, and I want to help you debug me!
|
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}`;
|
I run version ${version} 💝 and currently reside in ${roomId}`;
|
||||||
|
|||||||
3272
package-lock.json
generated
3272
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -11,13 +11,11 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"matrix-bot-sdk": "^0.3.2",
|
"matrix-bot-sdk": "^0.3.2",
|
||||||
"@types/js-yaml": "^3.11.2",
|
"@types/js-yaml": "^3.12.1",
|
||||||
"@types/node": "^10.12.11",
|
"@types/node": "^10.12.11",
|
||||||
"@types/xregexp": "^3.0.29",
|
"@types/xregexp": "^3.0.29",
|
||||||
"js-yaml": "^3.12.0",
|
"js-yaml": "^3.13.1",
|
||||||
"ts-node": "^7.0.1",
|
|
||||||
"typescript": "^3.2.1",
|
"typescript": "^3.2.1",
|
||||||
"xregexp": "^4.2.0",
|
"xregexp": "^4.2.0"
|
||||||
"nodemon": "^1.18.7"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,37 +23,37 @@ export function convert(input: string)
|
|||||||
else if (i==1) {
|
else if (i==1) {
|
||||||
if (rom[0].toLowerCase()=='a') {
|
if (rom[0].toLowerCase()=='a') {
|
||||||
c=c+'Ꭰ';
|
c=c+'Ꭰ';
|
||||||
if(rom[1]=="."&& isAlpha(rom[2])) rom=rom.slice(2)
|
if((rom[1] == "." || rom[1] == "'")&& isAlpha(rom[2])) rom=rom.slice(2)
|
||||||
else rom=rom.slice(1);
|
else rom=rom.slice(1);
|
||||||
}
|
}
|
||||||
else if (rom[0].toLowerCase()=='e') {
|
else if (rom[0].toLowerCase()=='e') {
|
||||||
c=c+'Ꭱ';
|
c=c+'Ꭱ';
|
||||||
if(rom[1]=="."&& isAlpha(rom[2])) rom=rom.slice(2);
|
if((rom[1] == "." || rom[1] == "'")&& isAlpha(rom[2])) rom=rom.slice(2);
|
||||||
else rom=rom.slice(1);
|
else rom=rom.slice(1);
|
||||||
}
|
}
|
||||||
else if (rom[0].toLowerCase()=='i') {
|
else if (rom[0].toLowerCase()=='i') {
|
||||||
c=c+'Ꭲ';
|
c=c+'Ꭲ';
|
||||||
if(rom[1]=="."&& isAlpha(rom[2])) rom=rom.slice(2);
|
if((rom[1] == "." || rom[1] == "'")&& isAlpha(rom[2])) rom=rom.slice(2);
|
||||||
else rom=rom.slice(1);
|
else rom=rom.slice(1);
|
||||||
}
|
}
|
||||||
else if (rom[0].toLowerCase()=='o') {
|
else if (rom[0].toLowerCase()=='o') {
|
||||||
c=c+'Ꭳ';
|
c=c+'Ꭳ';
|
||||||
if(rom[1]=="."&& isAlpha(rom[2])) rom=rom.slice(2);
|
if((rom[1] == "." || rom[1] == "'")&& isAlpha(rom[2])) rom=rom.slice(2);
|
||||||
else rom=rom.slice(1);
|
else rom=rom.slice(1);
|
||||||
}
|
}
|
||||||
else if (rom[0].toLowerCase()=='u') {
|
else if (rom[0].toLowerCase()=='u') {
|
||||||
c=c+'Ꭴ';
|
c=c+'Ꭴ';
|
||||||
if(rom[1]=="."&& isAlpha(rom[2])) rom=rom.slice(2);
|
if((rom[1] == "." || rom[1] == "'")&& isAlpha(rom[2])) rom=rom.slice(2);
|
||||||
else rom=rom.slice(1);
|
else rom=rom.slice(1);
|
||||||
}
|
}
|
||||||
else if (rom[0].toLowerCase()=='v') {
|
else if (rom[0].toLowerCase()=='v') {
|
||||||
c=c+'Ꭵ';
|
c=c+'Ꭵ';
|
||||||
if(rom[1]=="."&& isAlpha(rom[2])) rom=rom.slice(2);
|
if((rom[1] == "." || rom[1] == "'")&& isAlpha(rom[2])) rom=rom.slice(2);
|
||||||
else rom=rom.slice(1);
|
else rom=rom.slice(1);
|
||||||
}
|
}
|
||||||
else if (rom[0].toLowerCase()=='s') {
|
else if (rom[0].toLowerCase()=='s') {
|
||||||
c=c+'Ꮝ';
|
c=c+'Ꮝ';
|
||||||
if(rom[1]=="."&& isAlpha(rom[2])) rom=rom.slice(2);
|
if((rom[1] == "." || rom[1] == "'")&& isAlpha(rom[2])) rom=rom.slice(2);
|
||||||
else rom=rom.slice(1);
|
else rom=rom.slice(1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -78,7 +78,7 @@ export function convert(input: string)
|
|||||||
};
|
};
|
||||||
if(flag) {
|
if(flag) {
|
||||||
c=c+syl[j][k];
|
c=c+syl[j][k];
|
||||||
if(rom[2]=="."&& isAlpha(rom[3])) rom=rom.slice(3);
|
if((rom[2] == "." || rom[2] == "'")&& isAlpha(rom[3])) rom=rom.slice(3);
|
||||||
else rom=rom.slice(2);
|
else rom=rom.slice(2);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -103,17 +103,17 @@ export function convert(input: string)
|
|||||||
};
|
};
|
||||||
if(flag) {
|
if(flag) {
|
||||||
c=c+syl[j][k];
|
c=c+syl[j][k];
|
||||||
if(rom[3]=="." && isAlpha(rom[4])) rom=rom.slice(4);
|
if((rom[3] == "." || rom[3] == "'") && isAlpha(rom[4])) rom=rom.slice(4);
|
||||||
else rom=rom.slice(3);
|
else rom=rom.slice(3);
|
||||||
}
|
}
|
||||||
else if (rom.slice(0,3).toLowerCase()=="nah") {
|
else if (rom.slice(0,3).toLowerCase()=="nah") {
|
||||||
c=c+"Ꮐ";
|
c=c+"Ꮐ";
|
||||||
if(rom[3]=="." && isAlpha(rom[4])) rom=rom.slice(4);
|
if((rom[3] == "." || rom[3] == "'") && isAlpha(rom[4])) rom=rom.slice(4);
|
||||||
else rom=rom.slice(3);
|
else rom=rom.slice(3);
|
||||||
}
|
}
|
||||||
else if (rom.slice(0,3).toLowerCase()=="hna") {
|
else if (rom.slice(0,3).toLowerCase()=="hna") {
|
||||||
c=c+"Ꮏ";
|
c=c+"Ꮏ";
|
||||||
if(rom[3]=="." && isAlpha(rom[4])) rom=rom.slice(4);
|
if((rom[3] == "." || rom[3] == "'") && isAlpha(rom[4])) rom=rom.slice(4);
|
||||||
else rom=rom.slice(3);
|
else rom=rom.slice(3);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
273
x2i/dictionaries/nav.ts
Normal file
273
x2i/dictionaries/nav.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
20
x2i/index.ts
20
x2i/index.ts
@@ -38,30 +38,35 @@ const regex = OuterXRegExp(
|
|||||||
const defaultMatchAction = (left: string, match: string, right: string) => left + match + right;
|
const defaultMatchAction = (left: string, match: string, right: string) => left + match + right;
|
||||||
const defaultMatchFunction = (match: string, keys: ([RegExp, string | ((m: {[key: string]: string;}) => string), string][])) => OuterXRegExp.replaceEach(match, keys as (RegExp | string)[][])
|
const defaultMatchFunction = (match: string, keys: ([RegExp, string | ((m: {[key: string]: string;}) => string), string][])) => OuterXRegExp.replaceEach(match, keys as (RegExp | string)[][])
|
||||||
|
|
||||||
import * as chr from "./chr";
|
import * as chr from "./dictionaries/chr";
|
||||||
|
import * as nav from "./dictionaries/nav";
|
||||||
|
|
||||||
const matchType: { [key: string]: IMatchInstructions } = {
|
const matchType: { [key: string]: IMatchInstructions } = {
|
||||||
chr: {
|
chr: {
|
||||||
join: (_, match) => `- ${match}`,
|
join: (_, match) => `- ${match}`,
|
||||||
matchFunction: chr.convert,
|
matchFunction: chr.convert,
|
||||||
},
|
},
|
||||||
|
nav: {
|
||||||
|
join: (_, match) => `- ${match}`,
|
||||||
|
matchFunction: nav.convert,
|
||||||
|
},
|
||||||
ik: {
|
ik: {
|
||||||
join: (_, match) => `- ${match}`,
|
join: (_, match) => `- ${match}`,
|
||||||
keys: readKeys("./x2i/ik-keys.yaml"),
|
keys: readKeys("./x2i/dictionaries/ik-keys.yaml"),
|
||||||
},
|
},
|
||||||
p: {
|
p: {
|
||||||
join: (_, match) => `*${match}`,
|
join: (_, match) => `*${match}`,
|
||||||
keys: readKeys("./x2i/apie-keys.yaml"),
|
keys: readKeys("./x2i/dictionaries/apie-keys.yaml"),
|
||||||
},
|
},
|
||||||
x: {
|
x: {
|
||||||
keys: readKeys("./x2i/x2i-keys.yaml"),
|
keys: readKeys("./x2i/dictionaries/x2i-keys.yaml"),
|
||||||
},
|
},
|
||||||
z: {
|
z: {
|
||||||
keys: readKeys("./x2i/z2i-keys.yaml"),
|
keys: readKeys("./x2i/dictionaries/z2i-keys.yaml"),
|
||||||
},
|
},
|
||||||
i: {
|
i: {
|
||||||
join: (_, match) => `- ${match}`,
|
join: (_, match) => `- ${match}`,
|
||||||
keys: readKeys("./x2i/i-keys.yaml"),
|
keys: readKeys("./x2i/dictionaries/i-keys.yaml"),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -72,8 +77,9 @@ const matchType: { [key: string]: IMatchInstructions } = {
|
|||||||
* @returns Compiled keys.
|
* @returns Compiled keys.
|
||||||
*/
|
*/
|
||||||
function readKeys(fpath: string) {
|
function readKeys(fpath: string) {
|
||||||
return yaml
|
var keys: any = yaml
|
||||||
.safeLoad(fs.readFileSync(fpath, "utf8"))
|
.safeLoad(fs.readFileSync(fpath, "utf8"))
|
||||||
|
return keys
|
||||||
.map(compileKey)
|
.map(compileKey)
|
||||||
.filter(Boolean) as CompiledReplacer[];
|
.filter(Boolean) as CompiledReplacer[];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user