From 329862d3082ca7f45a3b2e0d403baf780ee5e80f Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Mon, 10 Sep 2012 11:28:17 -0700 Subject: [PATCH] Add support for silent E --- alphabet.js | 2 +- dan-smith.js | 8 +++- editor/index.html | 2 +- general-use.js | 23 ++++++++--- tengwar-annatar.js | 25 +++++++----- tengwar-parmaite.js | 41 +++++++++++++++----- tengwar.min.js | 107 ++++++++++++++++++++++++++-------------------------- 7 files changed, 127 insertions(+), 81 deletions(-) diff --git a/alphabet.js b/alphabet.js index 6dc6d4f..4bf19a4 100644 --- a/alphabet.js +++ b/alphabet.js @@ -20,7 +20,7 @@ exports.tehtarAbove = [ ]; exports.tehtarBelow = [ - "y", "s", "o-under" + "y", "s", "o-below", "i-below" ]; exports.tehtarFollowing = [ diff --git a/dan-smith.js b/dan-smith.js index d4a5043..e96ef16 100644 --- a/dan-smith.js +++ b/dan-smith.js @@ -115,13 +115,19 @@ exports.tehtar = { ], "w": "èéêë", // TODO custom hooks for tengwar parmaite from the alternate font "y": "ÌÍÎÏ´", - "o-under": [ + "o-below": [ "ä", "å", // a ring above "æ", "ç", "|" ], + "i-below": [ + "È", + "É", + "Ê", + "Ë" + ], "s": { "special": true, "calma": "|", diff --git a/editor/index.html b/editor/index.html index b867478..e6425e3 100644 --- a/editor/index.html +++ b/editor/index.html @@ -20,7 +20,7 @@
-
+
diff --git a/general-use.js b/general-use.js index 3ca096f..93e275d 100644 --- a/general-use.js +++ b/general-use.js @@ -441,16 +441,16 @@ function parseTengwa(callback, options, tehta) { exports.parseTengwaAnnotations = parseTengwaAnnotations; function parseTengwaAnnotations(callback, column) { - return parseFollowingW(function (column) { - return parseFollowingY(function (column) { - return parseFollowingS(callback, column); + return parseFollowingAbove(function (column) { + return parseFollowingBelow(function (column) { + return parseFollowing(callback, column); }, column); }, column); } // add a following-w above the current character if the next character is W and // there is room for it. -function parseFollowingW(callback, column) { +function parseFollowingAbove(callback, column) { if (column.canAddAbove("w")) { return function (character) { if (character === "w") { @@ -464,17 +464,28 @@ function parseFollowingW(callback, column) { } } -function parseFollowingY(callback, column) { +function parseFollowingBelow(callback, column) { return function (character) { if (character === "y" && column.canAddBelow("y")) { return callback(column.addBelow("y")); + } else if (character === "e" && column.canAddBelow("i-below")) { + return Parser.countPrimes(function (primes) { + if (primes === 0) { + return callback(column)(character); + } else { + if (primes > 1) { + column.addError("Following E has only one variation."); + } + return callback(column.addBelow("i-below")); + } + }); } else { return callback(column)(character); } }; } -function parseFollowingS(callback, column) { +function parseFollowing(callback, column) { return function (character) { if (character === "s") { if (column.canAddBelow("s")) { diff --git a/tengwar-annatar.js b/tengwar-annatar.js index e03a8f8..41c77ea 100644 --- a/tengwar-annatar.js +++ b/tengwar-annatar.js @@ -20,13 +20,13 @@ var positions = exports.positions = { "o": 3, "w": 3, "u": 3, - "o-under": 1, + "o-below": 1, "others": 2 }, "quesse": { "o": 3, "w": 3, - "o-under": 1, + "o-below": 1, "others": 2 }, "ando": { @@ -167,7 +167,8 @@ var positions = exports.positions = { "ó": 2, "ú": 2, "y": null, - "o-under": null, + "o-below": null, + "i-below": null, "others": 1 }, "arda": { @@ -180,7 +181,8 @@ var positions = exports.positions = { "ó": 2, "ú": 2, "y": null, - "o-under": null, + "o-below": null, + "i-below": null, "others": 0 }, "lambe": { @@ -189,17 +191,19 @@ var positions = exports.positions = { "y": 4, "ó": 1, "ú": 1, - "o-under": null, + "o-below": null, + "i-below": null, "others": 0 }, "alda": { "wide": true, - "o-under": null, + "o-below": null, "others": 1 }, "silme": { "y": 3, - "o-under": 2, + "o-below": 2, + "i-below": 2, "others": null }, "silme-nuquerna": { @@ -209,7 +213,8 @@ var positions = exports.positions = { "ó": 3, "ú": 3, "y": null, - "o-under": null, + "o-below": null, + "i-below": null, "others": 1 }, "esse": { @@ -250,12 +255,14 @@ var positions = exports.positions = { }, // should not occur: "halla": { + "i-below": 3, "others": null }, "short-carrier": 3, "long-carrier": { "y": null, - "o-under": null, + "o-below": null, + "i-below": null, "others": 3 }, "round-carrier": 3, diff --git a/tengwar-parmaite.js b/tengwar-parmaite.js index ce60396..a097446 100644 --- a/tengwar-parmaite.js +++ b/tengwar-parmaite.js @@ -11,12 +11,12 @@ var positions = exports.positions = { "parma": 2, "calma": { "y": 1, - "o-under": 1, + "o-below": 1, "others": 2 }, "quesse": { "y": 1, - "o-under": 1, + "o-below": 1, "others": 2 }, @@ -118,6 +118,7 @@ var positions = exports.positions = { "w": 1, "y": 1, "í": 2, + "i-below": 1, "others": 3 }, "anna": { @@ -138,7 +139,8 @@ var positions = exports.positions = { "o": 1, "u": 1, "y": 3, - "o-under": null, + "o-below": null, + "i-below": null, "others": 1 }, "arda": { @@ -150,7 +152,8 @@ var positions = exports.positions = { "w": 1, "í": 2, "y": null, - "o-under": null, + "o-below": null, + "i-below": null, "others": 0 }, "lambe": { @@ -158,26 +161,30 @@ var positions = exports.positions = { "e": 1, "y": 4, "w": 0, - "o-under": null, + "o-below": null, + "i-below": null, "others": 0 }, "alda": { "wide": true, "w": 0, "y": null, - "o-under": null, + "o-below": null, + "i-below": null, "others": 1 }, "silme": { "y": 2, - "o-under": 2, + "o-below": 2, + "i-below": 2, "others": null }, "silme-nuquerna": { "e": 2, "y": null, - "o-under": null, + "o-below": null, + "i-below": null, "others": 1 }, "esse": { @@ -186,17 +193,22 @@ var positions = exports.positions = { "esse-nuquerna": { "e": 2, "y": null, - "o-under": null, + "o-below": null, + "i-below": null, "others": 1 }, "hyarmen": { "y": 1, + "o-below": 1, + "i-below": 1, "others": 3 }, "hwesta-sindarinwa": { "w": 1, "y": 1, + "o-below": 1, + "i-below": 1, "others": 0 }, "yanta": { @@ -209,6 +221,8 @@ var positions = exports.positions = { }, "halla": { + "i-below": 3, + "o-below": 3, "others": null }, "short-carrier": { @@ -217,7 +231,8 @@ var positions = exports.positions = { }, "long-carrier": { "y": null, - "o-under": null, + "o-below": null, + "i-below": null, "others": 3 }, "round-carrier": 2, @@ -227,6 +242,7 @@ var positions = exports.positions = { "w": 3, "y": 3, "í": 3, + "o-below": 3, "others": 2 }, "parma-extended": { @@ -234,6 +250,7 @@ var positions = exports.positions = { "w": 3, "y": 3, "í": 3, + "o-below": 3, "others": 2 }, "calma-extended": { @@ -241,6 +258,8 @@ var positions = exports.positions = { "w": 1, "y": 0, "í": 0, + "i-below": 1, + "o-below": 1, "others": 0 }, "quesse-extended": { @@ -248,6 +267,8 @@ var positions = exports.positions = { "w": 1, "y": 0, "í": 0, + "i-below": 1, + "o-below": 1, "others": 0 } diff --git a/tengwar.min.js b/tengwar.min.js index 5b8d42f..be91eb4 100644 --- a/tengwar.min.js +++ b/tengwar.min.js @@ -1,63 +1,64 @@ (function(){function v(a,c){var b=!z[c]?null:z[c].special?z[c][a]||null:-1!==Ha.barsAndTildes.indexOf(c)?"lambe"===a||"alda"===a&&2<=z[c].length?2:p[a].wide?0:1:null==p[a]||null===p[a][c]?null:null!=p[a][c]?p[a][c]:null!=p[a].others?p[a].others:p[a];return null==b?null:z[c][a]||z[c][b]||""}function w(a,c){var b=!A[c]||-1!==Ia.indexOf(c)?null:A[c].special?A[c][a]||null:-1!==Ja.barsAndTildes.indexOf(c)?"lambe"===a||"alda"===a&&2<=A[c].length?2:q[a].wide?0:1:null==q[a]||null===q[a][c]?null:null!=q[a][c]? q[a][c]:null!=q[a].others?q[a].others:q[a];return null==b?null:A[c][a]||A[c][b]||null}function ca(a,c){return a.split(";").map(function(a){var a=a.split(":"),d=a.shift(),a=a.length?a.shift().split(","):[],e=c(d);a.forEach(function(a){"tilde-above"===a?e.addTildeAbove():"tilde-below"===a?e.addBarBelow():"y"===a?e.addBelow("y"):"s"===a||"s-inverse"===a||"s-extended"===a||"s-flourish"===a?"s"===a&&("calma"===d||"quesse"===d)?e.addBelow(a):e.addFollowing(a):e.addAbove(a)});return e})}function da(a){return function b(d, -e){e=e||[];return a(function(a){return null!=a?b(d,e.concat([a])):d(e)})}}function ea(a){return" "===a||"\n"===a||""===a}function fa(a,c){c=c||0;return function(b){return"'"===b?fa(a,c+1):a(c)(b)}}function ga(a){return N(function(){return ha(function(){return N(a)})})}function Ka(a){return N(function(){return La(function(){return N(a)})})}function ia(a){var c={value:void 0,children:{}},b={};Object.keys(a).forEach(function(d){if(0===d.length)c.value=a[d];else{var e=d[0];b[e]||(b[e]={});var i=d.slice(1); -b[e][i]=a[d]}});Object.keys(b).forEach(function(a){c.children[a]=ia(b[a])});return c}function ja(a,c,b,d){var e={},i=Object.keys(a.children);i.forEach(function(g){e[g]=ja(a.children[g],c,b,d)});var f;a.value&&(f=c(a.value));return i.reduceRight(function(a,c){return function(d){return function(i){return i===c?b(e[i](d)):a(d)(i)}}},function(a){return f?b(f(a)):d(a)})}function O(a){a=a||Na;return{font:a.font||Oa,block:a.block,plain:a.plain,doubleNasalsWithTildeBelow:a.doubleNasalsWithTildeBelow,reverseCurls:a.reverseCurls, -noAchLaut:a.noAchLaut,isHook:a.isHook}}function ka(a,c,b){b=b||"";return function(d){return P.isBreak(d)?a(b)(d):ka(a,c,b+d)}}function la(a,c,b){var d=function(e){return e.length?la(a,c,b.concat(e),e[e.length-1]):a(b)},e=function(a){return Q[a]?i("long-carrier").addAbove(Q[a]):i("short-carrier").addAbove(a)},i=c.font.makeColumn,f=function(a){var b=function(b){return b?a?"silme"===b.tengwa&&"i"===a&&c.isHook?d([i("short-carrier").addAbove("i").addBelow("s")]):-1!==V.indexOf(a)&&b.canAddAbove(a)?(c.reverseCurls&& -(a=Pa[a]||a),b.addAbove(a),G(function(a){return d([a])},b)):G(function(b){return d([e(a),b])},b):G(function(a){return d([a])},b):a?G(function(a){return d([a])},e(a)):function(a){return P.isBreak(a)?d([]):/\d/.test(a)?Qa(d,c)(a):ma[a]?d([i(ma[a])]):d([i("anna").addError("Unexpected character: "+JSON.stringify(a))])}},f=a,h=c.font.makeColumn;return function(a){return"n"===a?function(a){return"n"===a?c.doubleNasalsWithTildeBelow?b(h("numen").addTildeBelow()):b(h("numen").addTildeAbove()):"t"===a?function(a){return"h"=== +e){e=e||[];return a(function(a){return null!=a?b(d,e.concat([a])):d(e)})}}function ea(a){return" "===a||"\n"===a||""===a}function fa(a,c){c=c||0;return function(b){return"'"===b?fa(a,c+1):a(c)(b)}}function ga(a){return O(function(){return ha(function(){return O(a)})})}function Ka(a){return O(function(){return La(function(){return O(a)})})}function ia(a){var c={value:void 0,children:{}},b={};Object.keys(a).forEach(function(d){if(0===d.length)c.value=a[d];else{var e=d[0];b[e]||(b[e]={});var i=d.slice(1); +b[e][i]=a[d]}});Object.keys(b).forEach(function(a){c.children[a]=ia(b[a])});return c}function ja(a,c,b,d){var e={},i=Object.keys(a.children);i.forEach(function(g){e[g]=ja(a.children[g],c,b,d)});var f;a.value&&(f=c(a.value));return i.reduceRight(function(a,c){return function(d){return function(i){return i===c?b(e[i](d)):a(d)(i)}}},function(a){return f?b(f(a)):d(a)})}function P(a){a=a||Na;return{font:a.font||Oa,block:a.block,plain:a.plain,doubleNasalsWithTildeBelow:a.doubleNasalsWithTildeBelow,reverseCurls:a.reverseCurls, +noAchLaut:a.noAchLaut,isHook:a.isHook}}function ka(a,c,b){b=b||"";return function(d){return G.isBreak(d)?a(b)(d):ka(a,c,b+d)}}function la(a,c,b){var d=function(e){return e.length?la(a,c,b.concat(e),e[e.length-1]):a(b)},e=function(a){return Q[a]?i("long-carrier").addAbove(Q[a]):i("short-carrier").addAbove(a)},i=c.font.makeColumn,f=function(a){var b=function(b){return b?a?"silme"===b.tengwa&&"i"===a&&c.isHook?d([i("short-carrier").addAbove("i").addBelow("s")]):-1!==V.indexOf(a)&&b.canAddAbove(a)?(c.reverseCurls&& +(a=Pa[a]||a),b.addAbove(a),H(function(a){return d([a])},b)):H(function(b){return d([e(a),b])},b):H(function(a){return d([a])},b):a?H(function(a){return d([a])},e(a)):function(a){return G.isBreak(a)?d([]):/\d/.test(a)?Qa(d,c)(a):ma[a]?d([i(ma[a])]):d([i("anna").addError("Unexpected character: "+JSON.stringify(a))])}},f=a,h=c.font.makeColumn;return function(a){return"n"===a?function(a){return"n"===a?c.doubleNasalsWithTildeBelow?b(h("numen").addTildeBelow()):b(h("numen").addTildeAbove()):"t"===a?function(a){return"h"=== a?b(h("thule").addTildeAbove()):b(h("tinco").addTildeAbove())(a)}:"d"===a?b(h("ando").addTildeAbove()):"c"===a?b(h("quesse").addTildeAbove()):"g"===a?b(h("ungwe").addTildeAbove()):"j"===a?b(h("anca").addTildeAbove()):"f"===a?b(h("numen"))("v"):"w"===a?function(a){return"a"===a?function(a){return"l"===a?b(h("nwalme").addAbove("w"))("a")(a):b(h("numen").addAbove("w"))("a")(a)}:"nw'"===a?b(h("nwalme").addAbove("w")):b(h("numen").addAbove("w"))(a)}:b(h("numen"))(a)}:"m"===a?function(a){return"m"===a? c.doubleNasalsWithTildeBelow?b(h("malta").addTildeBelow()):b(h("malta").addTildeAbove()):"p"===a?b(h("parma").addTildeAbove()):"b"===a?b(h("umbar").addTildeAbove()):"f"===a?b(h("formen").addTildeAbove()):"v"===a?b(h("ampa").addTildeAbove()):b(h("malta"))(a)}:"\u00f1"===a?function(a){return"c"===a?b(h("quesse").addTildeAbove()):"g"===a?b(h("ungwe").addTildeAbove()):b(h("nwalme"))(a)}:"t"===a?function(a){return"t"===a?b(h("tinco").addTildeBelow()):"h"===a?b(h("thule")):"c"===a?function(a){return"h"=== a?b(h("tinco"))("c")("h")("'"):b(h("tinco"))("c")(a)}:b(h("tinco"))(a)}:"p"===a?function(a){return"p"===a?b(h("parma").addTildeBelow()):b(h("parma"))(a)}:"c"===a?function(a){return"c"===a?b(h("calma")):"h"===a?c.noAchLaut?b(h("calma")):b(h("hwesta")):b(h("quesse"))(a)}:"d"===a?function(a){return"d"===a?b(h("ando").addTildeBelow()):"j"===a?b(h("anga")):"h"===a?b(h("anto")):b(h("ando"))(a)}:"b"===a?function(a){return"b"===a?b(h("umbar").addTildeBelow()):b(h("umbar"))(a)}:"g"===a?function(a){return"g"=== a?b(h("ungwe").addTildeBelow()):"h"===a?b(h("unque")):b(h("ungwe"))(a)}:"f"===a?function(a){return"f"===a?b(h("formen").addTildeBelow()):b(h("formen"))(a)}:"v"===a?b(h("ampa")):"j"===a?b(h("anca")):"s"===a?function(a){return"s"===a?b(h("silme").addTildeBelow()):"h"===a?b(h("harma")):b(h("silme"))(a)}:"z"===a?function(a){return"z"===a?b(h("esse").addTildeBelow()):b(h("esse"))(a)}:"h"===a?function(a){return"w"===a?b(h("hwesta-sindarinwa")):b(h("hyarmen"))(a)}:"r"===a?function(a){return"r"===a?b(h("romen").addTildeBelow()): "h"===a?b(h("arda")):""===a?b(h("ore"))(a):b(h("romen"))(a)}:"l"===a?function(a){return"l"===a?b(h("lambe").addTildeBelow()):"h"===a?b(h("alda")):b(h("lambe"))(a)}:"i"===a?b(h("anna")):"u"===a?b(h("vala")):"w"===a?function(a){return"h"===a?b(h("hwesta-sindarinwa")):b(h("vala"))(a)}:"e"===a&&(!f||"a"===f)?b(h("yanta")):"y"===a?b(h("wilya").addBelow("y")):"\u00e1"===a?b(h("wilya").addAbove("a")):Q[a]&&-1==V.indexOf(a)?b(h("long-carrier").addAbove(Q[a])):b()(a)}};return function(a){return-1!==V.indexOf(a)? -f(a):f()(a)}}function G(a,c){var b=function(b){var c=function(b){return function(c){return"s"===c?b.canAddBelow("s")?a(b.addBelow("s")):P.countPrimes(function(c){return function(e){if(""===e){if(b.canAddFollowing("s-final")&&0===c--)b.addFollowing("s-final");else if(b.canAddFollowing("s-inverse")&&0===c--)b.addFollowing("s-inverse");else if(b.canAddFollowing("s-extended")&&0===c--)b.addFollowing("s-extended");else if(b.canAddFollowing("s-flourish"))b.addFollowing("s-flourish"),0":"",i=d?"
":"",f=d?"

":"";return a.map(function(a){return a.map(function(a){return e+a.map(function(a){return a.map(function(a){return a.map(function(a){var c=a.tengwa||"anna",d=[];a.above&&d.push(a.above);a.below&&d.push(a.below);a.tildeBelow&&d.push("tilde-below");a.tildeAbove&&d.push("tilde-above");a.following&&d.push(a.following);d=bb[c]+d.map(function(a){return v(c,a)}).join("");a.errors&&!b&&(d=''+d+"");return d}).join("")}).join(" ")}).join(i+"\n")+f}).join("\n\n")}).join("\n\n\n")};n.tehtaForTengwa=v;n.makeColumn=function(a,c,b){return new l(a,c,b)};var l=function(a,c,b){this.above=c;this.tildeAbove=void 0;this.tengwa=a;this.tildeBelow=void 0;this.below=b;this.error=this.following=void 0};l.prototype.canAddAbove=function(a){return!this.above&&!!v(this.tengwa,a)||!this.below&&("silme"===this.tengwa&&v("silme-nuquerna",a)||"esse"===this.tengwa&&v("esse-nuquerna",a))};l.prototype.addAbove= -function(a){"silme"===this.tengwa&&(this.tengwa="silme-nuquerna");"esse"===this.tengwa&&(this.tengwa="esse-nuquerna");this.above=a;return this};l.prototype.canAddBelow=function(a){return!this.below&&!!v(this.tengwa,a)};l.prototype.addBelow=function(a){this.below=a;return this};l.prototype.addTildeAbove=function(){this.tildeAbove=!0;return this};l.prototype.addTildeBelow=function(){this.tildeBelow=!0;return this};l.prototype.canAddFollowing=function(a){return!this.following&&!!v(this.tengwa,a)};l.prototype.addFollowing= -function(a){this.following=a;return this};l.prototype.addError=function(a){this.errors=this.errors||[];this.errors.push(a);return this};var s={},Ja=r,cb=s.tengwar=za,A=s.tehtar=Aa,q=s.positions={tinco:2,parma:2,calma:{y:1,"o-under":1,others:2},quesse:{y:1,"o-under":1,others:2},ando:{wide:!0,others:0},umbar:{wide:!0,others:0},anga:{wide:!0,others:0},ungwe:{wide:!0,others:0},thule:{a:3,w:3,others:2},formen:{a:3,w:3,"\u00ed":3,others:2},harma:{a:0,e:0,i:1,o:1,u:1,w:0,"\u00ed":0,others:1},hwesta:{a:0, -e:0,i:1,o:1,u:1,w:0,others:1},anto:{wide:!0,others:0},ampa:{wide:!0,others:0},anca:{wide:!0,others:0},unque:{wide:!0,others:0},numen:{wide:!0,others:0},malta:{wide:!0,others:0},noldo:{wide:!0,others:0},nwalme:{wide:!0,others:0},ore:{a:1,e:2,i:1,o:2,u:3,others:1},vala:{a:1,e:2,i:2,o:2,w:1,y:1,"\u00ed":2,others:3},anna:{a:1,w:3,others:2},wilya:{i:2,"\u00ed":2,others:1},romen:{a:1,e:1,i:2,o:1,u:1,y:3,"o-under":null,others:1},arda:{a:1,e:1,i:2,o:1,u:1,w:1,"\u00ed":2,y:null,"o-under":null,others:0},lambe:{wide:!0, -e:1,y:4,w:0,"o-under":null,others:0},alda:{wide:!0,w:0,y:null,"o-under":null,others:1},silme:{y:2,"o-under":2,others:null},"silme-nuquerna":{e:2,y:null,"o-under":null,others:1},esse:{others:null},"esse-nuquerna":{e:2,y:null,"o-under":null,others:1},hyarmen:{y:1,others:3},"hwesta-sindarinwa":{w:1,y:1,others:0},yanta:{a:1,others:2},ure:{a:1,others:2},halla:{others:null},"short-carrier":{y:null,others:3},"long-carrier":{y:null,"o-under":null,others:3},"round-carrier":2,"tinco-extended":{a:3,w:3,y:3, -"\u00ed":3,others:2},"parma-extended":{a:3,w:3,y:3,"\u00ed":3,others:2},"calma-extended":{i:1,w:1,y:0,"\u00ed":0,others:0},"quesse-extended":{i:1,w:1,y:0,"\u00ed":0,others:0}};s.transcribe=function(a,c){var c=c||{},b=c.plain||!1,d=c.block||!1,e=d?"

":"",i=d?"
":"",f=d?"

":"";return a.map(function(a){return a.map(function(a){return e+a.map(function(a){return a.map(function(a){return a.map(function(a){var c=a.tengwa||"anna",d=[];a.above&&d.push(a.above);a.below&&d.push(a.below);a.tildeBelow&& -d.push("tilde-below");a.tildeAbove&&d.push("tilde-above");a.following&&d.push(a.following);d=cb[c]+d.map(function(a){return w(c,a)}).join("");a.errors&&!b&&(d=''+d+"");return d}).join("")}).join(" ")}).join(i+"\n")+f}).join("\n\n")}).join("\n\n\n")};s.tehtaForTengwa=w;var Ia="\u00e1\u00e9\u00f3\u00fa";s.makeColumn=function(a,c,b){return new m(a,c,b)};var m=function(a,c,b){this.above=c;this.tildeAbove=void 0;this.tengwa= -a;this.tildeBelow=void 0;this.below=b;this.error=this.following=void 0};m.prototype.canAddAbove=function(a){return!this.above&&!!w(this.tengwa,a)||!this.below&&("silme"===this.tengwa&&w("silme-nuquerna",a)||"esse"===this.tengwa&&w("esse-nuquerna",a))};m.prototype.addAbove=function(a){"silme"===this.tengwa&&(this.tengwa="silme-nuquerna");"esse"===this.tengwa&&(this.tengwa="esse-nuquerna");this.above=a;return this};m.prototype.canAddBelow=function(a){return!this.below&&!!w(this.tengwa,a)};m.prototype.addBelow= -function(a){this.below=a;return this};m.prototype.addTildeAbove=function(){this.tildeAbove=!0;return this};m.prototype.addTildeBelow=function(){this.tildeBelow=!0;return this};m.prototype.canAddFollowing=function(a){return!this.following&&!!w(this.tengwa,a)};m.prototype.addFollowing=function(a){this.following=a;return this};m.prototype.addError=function(a){this.errors=this.errors||[];this.errors.push(a);return this};var x={module$exports:{"-":"comma",",":"comma",":":"comma",";":"full-stop",".":"full-stop", -"!":"exclamation-point","?":"question-mark","(":"open-paren",")":"close-paren",">":"flourish-left","<":"flourish-right"}};x.module$exports&&(x=x.module$exports);var U={encode:function(a){return a.map(function(a){return a.map(function(a){return a.map(function(a){return a.map(function(a){return a.map(function(a){var b=[];a.above&&b.push(a.above);a.below&&b.push(a.below);a.following&&b.push(a.following);a.tildeAbove&&b.push("tilde-above");a.tildeBelow&&b.push("tilde-below");return b.length?a.tengwa+ -":"+b.join(","):a.tengwa}).join(";")}).join(" ")}).join("\n")}).join("\n\n")}).join("\n\n\n")},decode:function(a,c){return a.split("\n\n\n").map(function(a){return a.split("\n\n").map(function(a){return a.split("\n").map(function(a){return a.split(" ").map(function(a){return ca(a,c)})})})})}};U.decodeWord=ca;var j={},db=x;j.makeParser=function(a,c){c=c||function(a,c){throw Error(a+" while parsing "+JSON.stringify(c));};return function(b){var d,e=a.apply(null,[function(a){d=a;return function(a){""!== +f(a):f()(a)}}function H(a,c){var b=function(b){var c=function(b){return function(c){return"s"===c?b.canAddBelow("s")?a(b.addBelow("s")):G.countPrimes(function(c){return function(e){if(""===e){if(b.canAddFollowing("s-final")&&0===c--)b.addFollowing("s-final");else if(b.canAddFollowing("s-inverse")&&0===c--)b.addFollowing("s-inverse");else if(b.canAddFollowing("s-extended")&&0===c--)b.addFollowing("s-extended");else if(b.canAddFollowing("s-flourish"))b.addFollowing("s-flourish"),0":"",i=d?"
":"",f=d?"

":"";return a.map(function(a){return a.map(function(a){return e+a.map(function(a){return a.map(function(a){return a.map(function(a){var c=a.tengwa||"anna",d=[];a.above&&d.push(a.above);a.below&&d.push(a.below); +a.tildeBelow&&d.push("tilde-below");a.tildeAbove&&d.push("tilde-above");a.following&&d.push(a.following);d=bb[c]+d.map(function(a){return v(c,a)}).join("");a.errors&&!b&&(d=''+d+"");return d}).join("")}).join(" ")}).join(i+"\n")+f}).join("\n\n")}).join("\n\n\n")};n.tehtaForTengwa=v;n.makeColumn=function(a,c,b){return new l(a,c,b)};var l=function(a,c,b){this.above=c;this.tildeAbove=void 0;this.tengwa=a;this.tildeBelow= +void 0;this.below=b;this.error=this.following=void 0};l.prototype.canAddAbove=function(a){return!this.above&&!!v(this.tengwa,a)||!this.below&&("silme"===this.tengwa&&v("silme-nuquerna",a)||"esse"===this.tengwa&&v("esse-nuquerna",a))};l.prototype.addAbove=function(a){"silme"===this.tengwa&&(this.tengwa="silme-nuquerna");"esse"===this.tengwa&&(this.tengwa="esse-nuquerna");this.above=a;return this};l.prototype.canAddBelow=function(a){return!this.below&&!!v(this.tengwa,a)};l.prototype.addBelow=function(a){this.below= +a;return this};l.prototype.addTildeAbove=function(){this.tildeAbove=!0;return this};l.prototype.addTildeBelow=function(){this.tildeBelow=!0;return this};l.prototype.canAddFollowing=function(a){return!this.following&&!!v(this.tengwa,a)};l.prototype.addFollowing=function(a){this.following=a;return this};l.prototype.addError=function(a){this.errors=this.errors||[];this.errors.push(a);return this};var s={},Ja=r,cb=s.tengwar=za,A=s.tehtar=Aa,q=s.positions={tinco:2,parma:2,calma:{y:1,"o-below":1,others:2}, +quesse:{y:1,"o-below":1,others:2},ando:{wide:!0,others:0},umbar:{wide:!0,others:0},anga:{wide:!0,others:0},ungwe:{wide:!0,others:0},thule:{a:3,w:3,others:2},formen:{a:3,w:3,"\u00ed":3,others:2},harma:{a:0,e:0,i:1,o:1,u:1,w:0,"\u00ed":0,others:1},hwesta:{a:0,e:0,i:1,o:1,u:1,w:0,others:1},anto:{wide:!0,others:0},ampa:{wide:!0,others:0},anca:{wide:!0,others:0},unque:{wide:!0,others:0},numen:{wide:!0,others:0},malta:{wide:!0,others:0},noldo:{wide:!0,others:0},nwalme:{wide:!0,others:0},ore:{a:1,e:2,i:1, +o:2,u:3,others:1},vala:{a:1,e:2,i:2,o:2,w:1,y:1,"\u00ed":2,"i-below":1,others:3},anna:{a:1,w:3,others:2},wilya:{i:2,"\u00ed":2,others:1},romen:{a:1,e:1,i:2,o:1,u:1,y:3,"o-below":null,"i-below":null,others:1},arda:{a:1,e:1,i:2,o:1,u:1,w:1,"\u00ed":2,y:null,"o-below":null,"i-below":null,others:0},lambe:{wide:!0,e:1,y:4,w:0,"o-below":null,"i-below":null,others:0},alda:{wide:!0,w:0,y:null,"o-below":null,"i-below":null,others:1},silme:{y:2,"o-below":2,"i-below":2,others:null},"silme-nuquerna":{e:2,y:null, +"o-below":null,"i-below":null,others:1},esse:{others:null},"esse-nuquerna":{e:2,y:null,"o-below":null,"i-below":null,others:1},hyarmen:{y:1,"o-below":1,"i-below":1,others:3},"hwesta-sindarinwa":{w:1,y:1,"o-below":1,"i-below":1,others:0},yanta:{a:1,others:2},ure:{a:1,others:2},halla:{"i-below":3,"o-below":3,others:null},"short-carrier":{y:null,others:3},"long-carrier":{y:null,"o-below":null,"i-below":null,others:3},"round-carrier":2,"tinco-extended":{a:3,w:3,y:3,"\u00ed":3,"o-below":3,others:2},"parma-extended":{a:3, +w:3,y:3,"\u00ed":3,"o-below":3,others:2},"calma-extended":{i:1,w:1,y:0,"\u00ed":0,"i-below":1,"o-below":1,others:0},"quesse-extended":{i:1,w:1,y:0,"\u00ed":0,"i-below":1,"o-below":1,others:0}};s.transcribe=function(a,c){var c=c||{},b=c.plain||!1,d=c.block||!1,e=d?"

":"",i=d?"
":"",f=d?"

":"";return a.map(function(a){return a.map(function(a){return e+a.map(function(a){return a.map(function(a){return a.map(function(a){var c=a.tengwa||"anna",d=[];a.above&&d.push(a.above);a.below&&d.push(a.below); +a.tildeBelow&&d.push("tilde-below");a.tildeAbove&&d.push("tilde-above");a.following&&d.push(a.following);d=cb[c]+d.map(function(a){return w(c,a)}).join("");a.errors&&!b&&(d=''+d+"");return d}).join("")}).join(" ")}).join(i+"\n")+f}).join("\n\n")}).join("\n\n\n")};s.tehtaForTengwa=w;var Ia="\u00e1\u00e9\u00f3\u00fa";s.makeColumn=function(a,c,b){return new m(a,c,b)};var m=function(a,c,b){this.above=c;this.tildeAbove=void 0; +this.tengwa=a;this.tildeBelow=void 0;this.below=b;this.error=this.following=void 0};m.prototype.canAddAbove=function(a){return!this.above&&!!w(this.tengwa,a)||!this.below&&("silme"===this.tengwa&&w("silme-nuquerna",a)||"esse"===this.tengwa&&w("esse-nuquerna",a))};m.prototype.addAbove=function(a){"silme"===this.tengwa&&(this.tengwa="silme-nuquerna");"esse"===this.tengwa&&(this.tengwa="esse-nuquerna");this.above=a;return this};m.prototype.canAddBelow=function(a){return!this.below&&!!w(this.tengwa,a)}; +m.prototype.addBelow=function(a){this.below=a;return this};m.prototype.addTildeAbove=function(){this.tildeAbove=!0;return this};m.prototype.addTildeBelow=function(){this.tildeBelow=!0;return this};m.prototype.canAddFollowing=function(a){return!this.following&&!!w(this.tengwa,a)};m.prototype.addFollowing=function(a){this.following=a;return this};m.prototype.addError=function(a){this.errors=this.errors||[];this.errors.push(a);return this};var x={module$exports:{"-":"comma",",":"comma",":":"comma",";":"full-stop", +".":"full-stop","!":"exclamation-point","?":"question-mark","(":"open-paren",")":"close-paren",">":"flourish-left","<":"flourish-right"}};x.module$exports&&(x=x.module$exports);var U={encode:function(a){return a.map(function(a){return a.map(function(a){return a.map(function(a){return a.map(function(a){return a.map(function(a){var b=[];a.above&&b.push(a.above);a.below&&b.push(a.below);a.following&&b.push(a.following);a.tildeAbove&&b.push("tilde-above");a.tildeBelow&&b.push("tilde-below");return b.length? +a.tengwa+":"+b.join(","):a.tengwa}).join(";")}).join(" ")}).join("\n")}).join("\n\n")}).join("\n\n\n")},decode:function(a,c){return a.split("\n\n\n").map(function(a){return a.split("\n\n").map(function(a){return a.split("\n").map(function(a){return a.split(" ").map(function(a){return ca(a,c)})})})})}};U.decodeWord=ca;var j={},db=x;j.makeParser=function(a,c){c=c||function(a,c){throw Error(a+" while parsing "+JSON.stringify(c));};return function(b){var d,e=a.apply(null,[function(a){d=a;return function(a){""!== a&&(a="Unexpected "+JSON.stringify(a),c(a,b));return function Ma(){return Ma}}}].concat(Array.prototype.slice.call(arguments,1)));for(Array.prototype.forEach.call(b,function(a){e=e(a)});!d;)e=e("");return d}};j.makeExpect=function(a){return function(c){return function(b){return b===a?c(b):c()(b)}}};j.makeParseSome=function(a){var c=da(a);return function(b){return a(function(a){return null!=a?c(b,[a]):b([])})}};j.makeParseAny=da;j.makeDelimitedParser=function(a,c){return function d(e,i,f){f=f||[]; return a(function(a){return a.length?(f=f.concat([a]),c(function(a){return a?d(e,i,f):e(f)})):e(f)},i)}};j.isBreak=ea;j.isFinal=function(a){return ea(a)||db[a]};j.countPrimes=fa;var C={module$exports:function(a,c){var b=c.font.makeColumn;return eb(function(c){if(c)var e=c.join(""),c=j.countPrimes(function(c){var d=e,g,j;0==c?j=10:(j=12,g=1