Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,21 @@ preeti('sf7df08"');

#### Other fonts

You also can use converters for PCS Nepali and Kantipur by providing a second parameter.
You also can use converters for other fonts by providing a second parameter. Here is the list of all supported fonts.

```javascript
preeti('sf7df08"', 'PCS Nepali');
preeti('sf&df)*"', 'PCS Nepali');
preeti('sf7df08"', 'Kantipur');
preeti('sf&df)*"', 'Fontasy Himali TT');
preeti('sf7df08"', 'Sagarmatha');
```

### Original Shell and JS code

This project is based on code and regular expressions from the <a href="https://github.com/foss-np">FOSS Nepal</a> community
This project is based on code and regular expressions from the [FOSS Nepal](https://github.com/foss-np) community

- <a href="https://github.com/foss-np/2utf8">2utf8</a> a Bash command
- <a href="https://github.com/sapradhan/nep-ttf2utf">nep-ttf2utf</a> a JS and Python3 port by sapradhan
- [2utf8](https://github.com/foss-np/2utf8) a Bash command
- [nep-ttf2utf](https://github.com/sapradhan/nep-ttf2utf) a JS and Python3 port by sapradhan

### License

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "preeti",
"version": "1.0.3",
"description": "Convert Nepali Preeti ASCII font to Unicode",
"version": "1.1.0",
"description": "Convert text in Nepali ASCII fonts to Unicode",
"main": "preeti.js",
"scripts": {
"test": "mocha"
Expand All @@ -22,7 +22,7 @@
"url": "https://github.com/mapmeld/preeti/issues"
},
"devDependencies": {
"mocha": "^2.2.5"
"mocha": "^11.0.1"
},
"homepage": "https://github.com/mapmeld/preeti#readme",
"publicKey": "public_key.asc"
Expand Down
30 changes: 5 additions & 25 deletions preeti.js

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions test/fontasy_himali_tt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[["g]kfn", "नेपाल"],
["g]kfnL", "नेपाली"],
["rGb", "चन्द"],
["lxdfn", "हिमाल"],
["/fli^«o", "राष्ट्रिय"],
["ljz]if)f", "विशेषण"],
["u)f]z", "गणेश"],
["kfl)f", "पाणि"],
["ug{", "गर्न"],
["ug{]", "गर्ने"],
["ug]{", "गर्ने"],
["lgdfrf]{s", "निमार्चोक"],
["rGb|f]bo", "चन्द्रोदय"],
["O{Zj/", "ईश्वर"],
["k|mfO{", "फ्राई"],
[":ofk|m'a]zL", "स्याफ्रुबेशी"],
["cfkm\\gf]", "आफ्नो"],
["cfk\\mgf}", "आफ्नौ"],
["eQm", "भक्त"],
["em/gf", "झरना"],
["s|'/", "क्रुर"],
["qm'/", "क्रुर"],
["q'm/", "क्रुर"],
["k|ltlqmof", "प्रतिक्रिया"],
["hfpm", "जाऊ"],
["hfp¤m", "जाऊँ"],
["e]mNg'", "झेल्नु"],
["em]Ng'", "झेल्नु"],
["emfs|L", "झाक्री"],
["kf}jf", "पौवा"],
["If]qkf^L", "क्षेत्रपाटी"],
["cf]vtL", "ओखती"],
["P]gf", "ऐना"],
["hfcf}+", "जाऔं"],
["hfcf+}", "जाऔं"],
["#/d+}", "घरमैं"],
["-s_", "(क)"],
["1234567890", "१२३४५६७८९०"],
["k¥of]", "पऱ्यो"],
["x]Yof{]", "हेर्थ्यो"],
["x]Yof]{", "हेर्थ्यो"],
["d@t", "मद्दत"],
["Clif", "ऋषि"]]
36 changes: 27 additions & 9 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
var assert = require('assert');
var preeti = require('../preeti.js');

var pv = require('./preeti.vector.json');
var kv = require('./kantipur.vector.json');
var nv = require('./pcs_nepali.vector.json');
const preeti_vectors = require('./preeti.json');
const kantipur_vectors = require('./kantipur.json');
const pcs_nepali_vectors = require('./pcs_nepali.json');
const fontasy_himali_vectors = require('./fontasy_himali_tt.json');
const sagarmata_vectors = require('./sagarmatha.json');

describe("Converting Preeti", function() {
it('should return काठमाण्डू when the value is sf7df08"', function() {
Expand All @@ -12,24 +14,40 @@ describe("Converting Preeti", function() {
});

it('should process the nep-tt2utf preeti.vector list', function() {
for (var a = 0; a < pv.length; a+=2) {
assert.equal(preeti(pv[a]), pv[a+1]);
for (let v of preeti_vectors) {
assert.equal(preeti(v[0]), v[1]);
}
});
});

describe("Converting Kantipur", function() {
it('should process the nep-tt2utf kantipur.vector list', function() {
for (var a = 0; a < kv.length; a+=2) {
assert.equal(preeti(kv[a], 'Kantipur'), kv[a+1]);
for (let v of kantipur_vectors) {
assert.equal(preeti(v[0], 'Kantipur'), v[1]);
}
});
});

describe("Converting PCS Nepali", function() {
it('should process the nep-tt2utf pcs_nepali.vector list', function() {
for (var a = 0; a < nv.length; a+=2) {
assert.equal(preeti(nv[a], 'PCS Nepali'), nv[a+1]);
for (let v of pcs_nepali_vectors) {
assert.equal(preeti(v[0], 'PCS Nepali'), v[1]);
}
});
});

describe("Converting Fontasy himali TT", function() {
it('should process the nep-tt2utf fontasy_himali.vector list', function() {
for (let v of fontasy_himali_vectors) {
assert.equal(preeti(v[0], 'Fontasy Himali TT'), v[1]);
}
});
});

describe("Converting Sagarmatha", function() {
it('should process the nep-tt2utf sagarmatha.vector list', function() {
for (let v of sagarmata_vectors) {
assert.equal(preeti(v[0], 'sagarmatha'), v[1]);
}
});
});
45 changes: 45 additions & 0 deletions test/kantipur.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[["g]kfn", "नेपाल"],
["g]kfnL", "नेपाली"],
["rGb", "चन्द"],
["lxdfn", "हिमाल"],
["/fli6«o", "राष्ट्रिय"],
["ljz]if0f", "विशेषण"],
["u0f]z", "गणेश"],
["kfl0f", "पाणि"],
["ug{", "गर्न"],
["ug{]", "गर्ने"],
["ug]{", "गर्ने"],
["lgdfrf]{s", "निमार्चोक"],
["rGb|f]bo", "चन्द्रोदय"],
["O{Zj/", "ईश्वर"],
["k|mfO{", "फ्राई"],
[":ofk|m'a]zL", "स्याफ्रुबेशी"],
["cfkm\\gf]", "आफ्नो"],
["cfk\\mgf}", "आफ्नौ"],
["eQm", "भक्त"],
["em/gf", "झरना"],
["s|'/", "क्रुर"],
["qm'/", "क्रुर"],
["q'm/", "क्रुर"],
["k|ltlqmof", "प्रतिक्रिया"],
["hfpm", "जाऊ"],
["hfp“m", "जाऊँ"],
["e]mNg'", "झेल्नु"],
["em]Ng'", "झेल्नु"],
["emfs|L", "झाक्री"],
["kf}jf", "पौवा"],
["If]qkf6L", "क्षेत्रपाटी"],
["iff]8zL", "षोडशी"],
["cf]vtL", "ओखती"],
["P]gf", "ऐना"],
["hfcf}+", "जाऔं"],
["hfcf+}", "जाऔं"],
["3/d+}", "घरमैं"],
["-s_", "(क)"],
["!@#$%^&*()", "१२३४५६७८९०"],
["k¥of]", "पऱ्यो"],
["x]Yof{]", "हेर्थ्यो"],
["x]Yof]{", "हेर्थ्यो"],
["sFd", "काम"],
["d2t", "मद्दत"],
["Clif", "ऋषि"]]
45 changes: 0 additions & 45 deletions test/kantipur.vector.json

This file was deleted.

43 changes: 43 additions & 0 deletions test/pcs_nepali.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[["g]kfn", "नेपाल"],
["g]kfnL", "नेपाली"],
["rGb", "चन्द"],
["lxdfn", "हिमाल"],
["/fli^<o", "राष्ट्रिय"],
["ljz]if)f", "विशेषण"],
["u)f]z", "गणेश"],
["kfl)f", "पाणि"],
["ug{", "गर्न"],
["ug{]", "गर्ने"],
["ug]{", "गर्ने"],
["lgdfrf]{s", "निमार्चोक"],
["rGb|f]bo", "चन्द्रोदय"],
["O{Zj/", "ईश्वर"],
["k|mfO{", "फ्राई"],
[":ofk|m'a]zL", "स्याफ्रुबेशी"],
["cfkm\\gf]", "आफ्नो"],
["cfk\\mgf}", "आफ्नौ"],
["eQm", "भक्त"],
["em/gf", "झरना"],
["s|'/", "क्रुर"],
["qm'/", "क्रुर"],
["q'm/", "क्रुर"],
["k|ltlqmof", "प्रतिक्रिया"],
["hfpm", "जाऊ"],
["hfp¤m", "जाऊँ"],
["e]mNg'", "झेल्नु"],
["em]Ng'", "झेल्नु"],
["emfs|L", "झाक्री"],
["kf}jf", "पौवा"],
["If]qkf^L", "क्षेत्रपाटी"],
["cf]vtL", "ओखती"],
["P]gf", "ऐना"],
["hfcf}+", "जाऔं"],
["hfcf+}", "जाऔं"],
["#/d+}", "घरमैं"],
["-s_", "(क)"],
["1234567890", "१२३४५६७८९०"],
["kCof]", "पऱ्यो"],
["x]Yof{]", "हेर्थ्यो"],
["x]Yof]{", "हेर्थ्यो"],
["d@t", "मद्दत"],
["¥lif", "ऋषि"]]
43 changes: 0 additions & 43 deletions test/pcs_nepali.vector.json

This file was deleted.

48 changes: 48 additions & 0 deletions test/preeti.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[["g]kfn", "नेपाल"],
["g]kfnL", "नेपाली"],
["rGb", "चन्द"],
["lxdfn", "हिमाल"],
["/fli6«o", "राष्ट्रिय"],
["ljz]if0f", "विशेषण"],
["u0f]z", "गणेश"],
["kfl0f", "पाणि"],
["ug{", "गर्न"],
["ug{]", "गर्ने"],
["ug]{", "गर्ने"],
["lgdfrf]{s", "निमार्चोक"],
["rGb|f]bo", "चन्द्रोदय"],
["O{Zj/", "ईश्वर"],
["k|mfO{", "फ्राई"],
[":ofk|m'a]zL", "स्याफ्रुबेशी"],
["cfkm\\gf]", "आफ्नो"],
["cfk\\mgf}", "आफ्नौ"],
["eQm", "भक्त"],
["em/gf", "झरना"],
["s|'/", "क्रुर"],
["qm'/", "क्रुर"],
["q'm/", "क्रुर"],
["k|ltlqmof", "प्रतिक्रिया"],
["hfpm", "जाऊ"],
["hfpFm", "जाऊँ"],
["e]mNg'", "झेल्नु"],
["em]Ng'", "झेल्नु"],
["emfs|L", "झाक्री"],
["kf}jf", "पौवा"],
["If]qkf6L", "क्षेत्रपाटी"],
["iff]8zL", "षोडशी"],
["cf]vtL", "ओखती"],
["P]gf", "ऐना"],
["hfcf}+", "जाऔं"],
["hfcf+}", "जाऔं"],
["3/d+}", "घरमैं"],
["-s_", "(क)"],
["!@#$%^&*()", "१२३४५६७८९०"],
["k¥of]", "पऱ्यो"],
["x]Yof{]", "हेर्थ्यो"],
["x]Yof]{", "हेर्थ्यो"],
["d2t", "मद्दत"],
["Clif", "ऋषि"],
["6]«S;", "ट्रेक्स"],
["k|:'tt", "प्रस्तुत"],
["ad]flhd", "बमोजिम"],
["a]d}f;dL", "बेमौसमी"]]
Loading