From 2fa0e8c5091a05bdfe2b5b279e06492e20e68d09 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Tue, 24 Oct 2023 08:05:15 -0500 Subject: [PATCH 01/12] =?UTF-8?q?chore(resources):=20ldml=20update=20to=20?= =?UTF-8?q?prefinal=20v44=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 022ff3ce172735f4a251003b1f429528deab44b3 - no corresponding CLDR tag at present, hopefully soon. For feat(developer): ldml re-sync with CLDR v44 spec 🙀 #9838 --- .../techpreview/3.0/fr-t-k0-azerty.xml | 103 ++++++----- .../techpreview/3.0/ja-Latn.xml | 11 +- .../techpreview/3.0/mt-t-k0-47key.xml | 56 +++--- .../ldml-keyboards/techpreview/3.0/mt.xml | 56 +++--- .../ldml-keyboards/techpreview/3.0/pcm.xml | 30 ++-- .../techpreview/3.0/pt-t-k0-abnt2.xml | 47 +++-- .../ldml-keyboards/techpreview/cldr_info.json | 6 +- .../techpreview/dtd/ldmlKeyboard3.dtd | 67 +++----- .../techpreview/dtd/ldmlKeyboard3.xsd | 84 ++++----- .../techpreview/import/keys-Latn-implied.xml | 126 +++++++------- .../techpreview/import/keys-Zyyy-currency.xml | 12 +- .../import/keys-Zyyy-punctuation.xml | 70 ++++---- .../techpreview/ldml-keyboard3.schema.json | 161 ++++++++---------- 13 files changed, 383 insertions(+), 446 deletions(-) diff --git a/resources/standards-data/ldml-keyboards/techpreview/3.0/fr-t-k0-azerty.xml b/resources/standards-data/ldml-keyboards/techpreview/3.0/fr-t-k0-azerty.xml index 190700d496..8a792be32f 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/3.0/fr-t-k0-azerty.xml +++ b/resources/standards-data/ldml-keyboards/techpreview/3.0/fr-t-k0-azerty.xml @@ -16,24 +16,23 @@ keyboard formats --> - - - - - - + - + + + + + @@ -42,10 +41,10 @@ - - - - + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + - - - + + + + - - - - - - - - - - - - - - - - - - - + + + + - + + + + + + + + + + + + + + + - + @@ -102,7 +119,7 @@ - + @@ -111,7 +128,7 @@ - + diff --git a/resources/standards-data/ldml-keyboards/techpreview/3.0/ja-Latn.xml b/resources/standards-data/ldml-keyboards/techpreview/3.0/ja-Latn.xml index 8b5b845bf2..b5364c5f92 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/3.0/ja-Latn.xml +++ b/resources/standards-data/ldml-keyboards/techpreview/3.0/ja-Latn.xml @@ -5,25 +5,22 @@ - - - - + - - + + - + diff --git a/resources/standards-data/ldml-keyboards/techpreview/3.0/mt-t-k0-47key.xml b/resources/standards-data/ldml-keyboards/techpreview/3.0/mt-t-k0-47key.xml index 02db33accc..62f90b47bc 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/3.0/mt-t-k0-47key.xml +++ b/resources/standards-data/ldml-keyboards/techpreview/3.0/mt-t-k0-47key.xml @@ -5,12 +5,8 @@ - - - - - - + + @@ -18,37 +14,37 @@ - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + - + - - + + @@ -56,7 +52,7 @@ - + @@ -64,7 +60,7 @@ - + @@ -72,7 +68,7 @@ - + diff --git a/resources/standards-data/ldml-keyboards/techpreview/3.0/mt.xml b/resources/standards-data/ldml-keyboards/techpreview/3.0/mt.xml index a5a415d874..5dcc9ea5c3 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/3.0/mt.xml +++ b/resources/standards-data/ldml-keyboards/techpreview/3.0/mt.xml @@ -11,12 +11,8 @@ - - - - - - + + @@ -24,34 +20,34 @@ - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + - + - - + + @@ -59,7 +55,7 @@ - + @@ -67,7 +63,7 @@ - + @@ -75,7 +71,7 @@ - + diff --git a/resources/standards-data/ldml-keyboards/techpreview/3.0/pcm.xml b/resources/standards-data/ldml-keyboards/techpreview/3.0/pcm.xml index 5ef43e5d68..89994773f6 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/3.0/pcm.xml +++ b/resources/standards-data/ldml-keyboards/techpreview/3.0/pcm.xml @@ -2,30 +2,26 @@ - - - - - + - - - + + + - - - - + + + + - + - - + + @@ -33,7 +29,7 @@ - + @@ -41,7 +37,7 @@ - + diff --git a/resources/standards-data/ldml-keyboards/techpreview/3.0/pt-t-k0-abnt2.xml b/resources/standards-data/ldml-keyboards/techpreview/3.0/pt-t-k0-abnt2.xml index 6de82a8f9d..ae1d7c4a74 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/3.0/pt-t-k0-abnt2.xml +++ b/resources/standards-data/ldml-keyboards/techpreview/3.0/pt-t-k0-abnt2.xml @@ -5,16 +5,13 @@ - - - - + - - - - - + + + + + @@ -22,37 +19,37 @@ - - - - - + + + + + - - + + - - - - - + + + + + - - + + - + - + diff --git a/resources/standards-data/ldml-keyboards/techpreview/cldr_info.json b/resources/standards-data/ldml-keyboards/techpreview/cldr_info.json index e9907a447a..3eff296a31 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/cldr_info.json +++ b/resources/standards-data/ldml-keyboards/techpreview/cldr_info.json @@ -1,5 +1,5 @@ { - "sha": "2aa2275158c29e8e41c7f0b67c8fb786a453b89c", - "description": "release-44-alpha3-14-g2aa2275158", - "date": "Mon, 09 Oct 2023 19:18:13 +0000" + "sha": "022ff3ce172735f4a251003b1f429528deab44b3", + "description": "release-44-beta3-18-g022ff3ce17", + "date": "Tue, 24 Oct 2023 13:00:38 +0000" } diff --git a/resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd b/resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd index 92cda0eddf..ef577e98bf 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd +++ b/resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.dtd @@ -10,7 +10,7 @@ The CLDR Keyboard Subcommittee is currently developing major changes to the CLDR Please view the subcommittee page for the most recent information. --> - + @@ -45,11 +45,11 @@ Please view the subcommittee page for the most recent information. - + - - + + @@ -58,23 +58,10 @@ Please view the subcommittee page for the most recent information. - - - - - - - - - - - - - - + @@ -82,9 +69,9 @@ Please view the subcommittee page for the most recent information. - + - + @@ -99,56 +86,56 @@ Please view the subcommittee page for the most recent information. - + + + + - + - + - + - - + - - + + - - + - - - + + + - + - + - + - + - @@ -166,7 +153,7 @@ Please view the subcommittee page for the most recent information. - + @@ -175,7 +162,7 @@ Please view the subcommittee page for the most recent information. - + diff --git a/resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.xsd b/resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.xsd index 47f299571b..96a6f821e9 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.xsd +++ b/resources/standards-data/ldml-keyboards/techpreview/dtd/ldmlKeyboard3.xsd @@ -22,11 +22,11 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file - - + + @@ -97,8 +97,8 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file + - @@ -112,33 +112,12 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file - - - - - - - - - - - - - - - - - - - - - - + - + @@ -160,8 +139,8 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file - - + + @@ -181,14 +160,13 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file + + - - - - + @@ -197,7 +175,7 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file - + @@ -205,10 +183,10 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file - - - - + + + + @@ -216,14 +194,7 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file - - - - - - - - + @@ -244,14 +215,20 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file - - - - + + + + + + + + + + @@ -259,17 +236,16 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file - + - + - @@ -306,7 +282,7 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file - + @@ -320,7 +296,7 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file - + diff --git a/resources/standards-data/ldml-keyboards/techpreview/import/keys-Latn-implied.xml b/resources/standards-data/ldml-keyboards/techpreview/import/keys-Latn-implied.xml index eed84d38f8..537860aeb9 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/import/keys-Latn-implied.xml +++ b/resources/standards-data/ldml-keyboards/techpreview/import/keys-Latn-implied.xml @@ -13,68 +13,68 @@ CLDR data files are interpreted according to the LDML specification (http://unic - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/standards-data/ldml-keyboards/techpreview/import/keys-Zyyy-currency.xml b/resources/standards-data/ldml-keyboards/techpreview/import/keys-Zyyy-currency.xml index 778cad451a..dd88113501 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/import/keys-Zyyy-currency.xml +++ b/resources/standards-data/ldml-keyboards/techpreview/import/keys-Zyyy-currency.xml @@ -13,10 +13,10 @@ CLDR data files are interpreted according to the LDML specification (http://unic --> - - - - - - + + + + + + diff --git a/resources/standards-data/ldml-keyboards/techpreview/import/keys-Zyyy-punctuation.xml b/resources/standards-data/ldml-keyboards/techpreview/import/keys-Zyyy-punctuation.xml index 1e540cf024..59c6280826 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/import/keys-Zyyy-punctuation.xml +++ b/resources/standards-data/ldml-keyboards/techpreview/import/keys-Zyyy-punctuation.xml @@ -8,39 +8,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/standards-data/ldml-keyboards/techpreview/ldml-keyboard3.schema.json b/resources/standards-data/ldml-keyboards/techpreview/ldml-keyboard3.schema.json index 6d6ba9d2a9..95eb1b244b 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/ldml-keyboard3.schema.json +++ b/resources/standards-data/ldml-keyboards/techpreview/ldml-keyboard3.schema.json @@ -11,10 +11,10 @@ "display": { "type": "string" }, - "id": { + "keyId": { "type": "string" }, - "to": { + "output": { "type": "string" } }, @@ -62,25 +62,9 @@ "flick": { "additionalProperties": false, "properties": { - "directions": { - "type": "string" - }, - "to": { - "type": "string" - } - }, - "required": [ - "directions", - "to" - ], - "type": "object" - }, - "flicks": { - "additionalProperties": false, - "properties": { - "flick": { + "flickSegment": { "items": { - "$ref": "#/definitions/flick" + "$ref": "#/definitions/flickSegment" }, "minItems": 1, "type": "array" @@ -96,11 +80,51 @@ } }, "required": [ - "flick", + "flickSegment", "id" ], "type": "object" }, + "flickSegment": { + "additionalProperties": false, + "properties": { + "directions": { + "type": "string" + }, + "keyId": { + "type": "string" + } + }, + "required": [ + "directions", + "keyId" + ], + "type": "object" + }, + "flicks": { + "additionalProperties": false, + "properties": { + "flick": { + "items": { + "$ref": "#/definitions/flick" + }, + "type": "array" + }, + "import": { + "items": { + "$ref": "#/definitions/import" + }, + "type": "array" + }, + "special": { + "items": { + "$ref": "#/definitions/special" + }, + "type": "array" + } + }, + "type": "object" + }, "form": { "additionalProperties": false, "properties": { @@ -180,16 +204,19 @@ "layout": { "type": "string" }, - "normalization": { + "name": { "type": "string" } }, + "required": [ + "name" + ], "type": "object" }, "key": { "additionalProperties": false, "properties": { - "flicks": { + "flickId": { "type": "string" }, "gap": { @@ -201,13 +228,19 @@ "id": { "type": "string" }, - "longPress": { + "layerId": { "type": "string" }, - "longPressDefault": { + "longPressDefaultKeyId": { "type": "string" }, - "multiTap": { + "longPressKeyIds": { + "type": "string" + }, + "multiTapKeyIds": { + "type": "string" + }, + "output": { "type": "string" }, "stretch": { @@ -216,18 +249,6 @@ ], "type": "string" }, - "switch": { - "type": "string" - }, - "to": { - "type": "string" - }, - "transform": { - "enum": [ - "no" - ], - "type": "string" - }, "width": { "type": "string" } @@ -240,12 +261,6 @@ "keys": { "additionalProperties": false, "properties": { - "flicks": { - "items": { - "$ref": "#/definitions/flicks" - }, - "type": "array" - }, "import": { "items": { "$ref": "#/definitions/import" @@ -273,7 +288,7 @@ "id": { "type": "string" }, - "modifier": { + "modifiers": { "type": "string" }, "row": { @@ -298,7 +313,7 @@ "layers": { "additionalProperties": false, "properties": { - "form": { + "formId": { "type": "string" }, "import": { @@ -324,7 +339,7 @@ } }, "required": [ - "form" + "formId" ], "type": "object" }, @@ -352,46 +367,6 @@ }, "type": "object" }, - "name": { - "additionalProperties": false, - "properties": { - "value": { - "type": "string" - } - }, - "required": [ - "value" - ], - "type": "object" - }, - "names": { - "additionalProperties": false, - "properties": { - "import": { - "items": { - "$ref": "#/definitions/import" - }, - "type": "array" - }, - "name": { - "items": { - "$ref": "#/definitions/name" - }, - "minItems": 1, - "type": "array" - }, - "special": { - "items": { - "$ref": "#/definitions/special" - }, - "type": "array" - } - }, - "required": [ - "name" - ], - "type": "object" - }, "reorder": { "additionalProperties": false, "properties": { @@ -462,9 +437,9 @@ "settings": { "additionalProperties": false, "properties": { - "fallback": { + "normalization": { "enum": [ - "omit" + "disabled" ], "type": "string" } @@ -650,6 +625,9 @@ "displays": { "$ref": "#/definitions/displays" }, + "flicks": { + "$ref": "#/definitions/flicks" + }, "forms": { "$ref": "#/definitions/forms" }, @@ -677,9 +655,6 @@ "locales": { "$ref": "#/definitions/locales" }, - "names": { - "$ref": "#/definitions/names" - }, "settings": { "$ref": "#/definitions/settings" }, @@ -703,7 +678,7 @@ } }, "required": [ - "names", + "info", "locale", "conformsTo" ], From 5dbda001fcd8973b4922292b5c0731748380a263 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Tue, 24 Oct 2023 14:47:22 -0500 Subject: [PATCH 02/12] =?UTF-8?q?chore(common,core):=20ldml=20update=20to?= =?UTF-8?q?=20prefinal=20v44=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - common passes tests - updated data files For feat(developer): ldml re-sync with CLDR v44 spec 🙀 #9838 --- .../ldml-keyboard/ldml-keyboard-xml-reader.ts | 16 +++--- .../src/ldml-keyboard/ldml-keyboard-xml.ts | 43 +++++++--------- .../types/test/fixtures/import-minimal.xml | 5 +- .../types/test/fixtures/import-minimal1.xml | 5 +- .../types/test/fixtures/import-minimal2.xml | 7 +-- .../types/test/fixtures/import-symbols.xml | 9 ++-- .../test/fixtures/invalid-conforms-to.xml | 10 ++-- .../test/fixtures/invalid-import-base.xml | 10 ++-- .../test/fixtures/invalid-import-path.xml | 10 ++-- .../test/fixtures/invalid-import-readfail.xml | 10 ++-- .../fixtures/invalid-import-wrongroot.xml | 17 ++++--- .../test-ldml-keyboard-xml-reader.ts | 40 +++++++-------- core/tests/unit/ldml/keyboards/k_001_tiny.xml | 12 ++--- .../unit/ldml/keyboards/k_002_tinyu32.xml | 14 ++---- .../unit/ldml/keyboards/k_003_transform.xml | 22 ++++---- .../unit/ldml/keyboards/k_004_tinyshift.xml | 20 +++----- .../unit/ldml/keyboards/k_005_modbittest.xml | 24 ++++----- .../unit/ldml/keyboards/k_006_backspace.xml | 22 ++++---- .../ldml/keyboards/k_007_transform_rgx.xml | 10 ++-- .../ldml/keyboards/k_008_transform_norm.xml | 24 ++++----- core/tests/unit/ldml/keyboards/k_010_mt.xml | 50 +++++++++---------- .../unit/ldml/keyboards/k_011_mt_iso.xml | 50 +++++++++---------- core/tests/unit/ldml/keyboards/k_020_fr.xml | 44 ++++++++-------- .../unit/ldml/keyboards/k_100_keytest.xml | 8 +-- .../unit/ldml/keyboards/k_101_keytest.xml | 8 +-- .../unit/ldml/keyboards/k_102_keytest.xml | 8 +-- .../ldml/keyboards/k_200_reorder_nod_Lana.xml | 21 ++++---- .../unit/ldml/keyboards/k_210_marker.xml | 17 +++---- .../src/kmc-ldml/test/fixtures/basic.xml | 12 ++--- .../test/fixtures/sections/keys/escaped.xml | 14 +++--- .../test/fixtures/sections/keys/escaped2.xml | 4 +- .../fixtures/sections/keys/gap-switch.xml | 6 +-- .../test/fixtures/sections/keys/hardware.xml | 14 +++--- .../fixtures/sections/keys/hardware_iso.xml | 4 +- .../fixtures/sections/keys/hardware_us.xml | 4 +- .../sections/keys/invalid-bad-modifier.xml | 4 +- .../keys/invalid-hardware-too-many-keys.xml | 32 ++++++------ .../keys/invalid-hardware-too-many-rows.xml | 6 +-- .../keys/invalid-key-missing-attrs.xml | 2 +- .../sections/keys/invalid-missing-flick.xml | 8 +-- .../sections/keys/invalid-undefined-key.xml | 4 +- .../test/fixtures/sections/keys/markers.xml | 6 +-- .../test/fixtures/sections/keys/maximal.xml | 18 +++---- .../test/fixtures/sections/keys/minimal.xml | 6 +-- .../sections/layr/error-custom-us-form.xml | 8 +-- .../sections/layr/error-custom-zzz-form.xml | 8 +-- .../sections/layr/invalid-invalid-form.xml | 6 +-- .../layr/invalid-missing-hardware.xml | 11 ++-- .../sections/layr/invalid-missing-layer.xml | 6 +-- .../sections/layr/invalid-multi-hardware.xml | 8 +-- .../sections/layr/warn-custom-us-form.xml | 8 +-- .../sections/layr/warn-custom-zzz-form.xml | 8 +-- .../sections/meta/invalid-normalization.xml | 6 +-- .../test/fixtures/sections/meta/maximal.xml | 6 +-- .../sections/vars/markers-maximal.xml | 2 +- .../techpreview/3.0/fr-t-k0-azerty.xml | 2 +- 56 files changed, 333 insertions(+), 426 deletions(-) diff --git a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts index 3d0b2c7131..8ff142693e 100644 --- a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts +++ b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts @@ -39,9 +39,9 @@ export class LDMLKeyboardXMLSourceFileReader { private boxArrays(source: any) : boolean { if (source?.keyboard3) { if (!source.keyboard3.keys) { + // Note: this is here to put a substrate for the imported keys source.keyboard3.keys = { key: [], - flicks: [], }; } if (!source.keyboard3.keys.import) { @@ -58,9 +58,8 @@ export class LDMLKeyboardXMLSourceFileReader { } boxXmlArray(source?.keyboard3, 'layers'); boxXmlArray(source?.keyboard3?.displays, 'display'); - boxXmlArray(source?.keyboard3?.names, 'name'); boxXmlArray(source?.keyboard3?.keys, 'key'); - boxXmlArray(source?.keyboard3?.keys, 'flicks'); + boxXmlArray(source?.keyboard3?.flicks, 'flick'); boxXmlArray(source?.keyboard3?.locales, 'locale'); boxXmlArray(source?.keyboard3, 'transforms'); if(source?.keyboard3?.layers) { @@ -79,9 +78,10 @@ export class LDMLKeyboardXMLSourceFileReader { boxXmlArray(form, 'scanCodes'); } } - if(source?.keyboard3?.keys?.flicks) { - for(let flicks of source?.keyboard3?.keys?.flicks) { - boxXmlArray(flicks, 'flick'); + if(source?.keyboard3?.flicks) { + boxXmlArray(source?.keyboard3?.flicks, 'flick'); + for(let flick of source?.keyboard3?.flicks?.flick) { + boxXmlArray(flick, 'flickSegment'); } } if(source?.keyboard3?.variables) { @@ -98,13 +98,13 @@ export class LDMLKeyboardXMLSourceFileReader { } } } - return this.boxImportsAndSpecials(source, 'keyboard'); + return this.boxImportsAndSpecials(source, 'keyboard3'); } /** * Recurse over object, boxing up any specials or imports * @param obj any object to be traversed - * @param subtag the leafmost enclosing tag such as 'keyboard' + * @param subtag the leafmost enclosing tag such as 'keyboard3' * @returns true on success, false on failure */ private boxImportsAndSpecials(obj: any, subtag: string) : boolean { diff --git a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts index 83720312dd..fd586273c6 100644 --- a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts +++ b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts @@ -21,9 +21,9 @@ export interface LKKeyboard { locales?: LKLocales; version?: LKVersion; info?: LKInfo; - names?: LKNames; settings?: LKSettings; keys?: LKKeys; + flicks?: LKFlicks; forms?: LKForms; displays?: LKDisplays; layers?: LKLayers[]; @@ -58,24 +58,14 @@ export interface LKVersion { } export interface LKInfo { + name?: string; author?: string; - indicator?: string; layout?: string; - normalization?: string; -}; - -export interface LKNames { - name: LKName[]; -}; - -export interface LKName { - value?: string; + indicator?: string; }; export interface LKSettings { - fallback: "omit"; - transformFailure: "omit"; - transformPartial: "hide"; + normalization: "disabled"; }; export interface LKKeys { @@ -85,27 +75,30 @@ export interface LKKeys { export interface LKKey { id?: string; - flicks?: string; - to?: string; + flickId?: string; + output?: string; gap?: boolean; - switch?: string; - longPress?: string; - longPressDefault?: string; - multiTap?: string; - transform?: "no"; + layerId?: string; + longPressKeyIds?: string; + longPressDefaultKeyId?: string; + multiTapKeyIds?: string; width?: number; }; export interface LKFlicks { - id?: string; flick?: LKFlick[]; }; export interface LKFlick { - directions?: string; - to?: string; + id?: string; + flickSegment?: LKFlickSegment; }; +export interface LKFlickSegment { + directions?: string; + keyId?: string; +} + export interface LKLayers { /** * `touch`, or hardware `us`, `iso`, `jis`, `abnt2` @@ -120,7 +113,7 @@ export interface LKLayers { export interface LKLayer { id?: string; - modifier?: string; + modifiers?: string; row?: LKRow[]; }; diff --git a/common/web/types/test/fixtures/import-minimal.xml b/common/web/types/test/fixtures/import-minimal.xml index f23bc5c325..02a4c0fdfe 100644 --- a/common/web/types/test/fixtures/import-minimal.xml +++ b/common/web/types/test/fixtures/import-minimal.xml @@ -1,8 +1,5 @@ - - - - + diff --git a/common/web/types/test/fixtures/import-minimal1.xml b/common/web/types/test/fixtures/import-minimal1.xml index ce2140893e..7239fc9a85 100644 --- a/common/web/types/test/fixtures/import-minimal1.xml +++ b/common/web/types/test/fixtures/import-minimal1.xml @@ -1,10 +1,7 @@ - - - - + diff --git a/common/web/types/test/fixtures/import-minimal2.xml b/common/web/types/test/fixtures/import-minimal2.xml index 66a836057d..3e30044f26 100644 --- a/common/web/types/test/fixtures/import-minimal2.xml +++ b/common/web/types/test/fixtures/import-minimal2.xml @@ -1,11 +1,8 @@ - - - - + - + diff --git a/common/web/types/test/fixtures/import-symbols.xml b/common/web/types/test/fixtures/import-symbols.xml index e3421c8ff3..763de4e78a 100644 --- a/common/web/types/test/fixtures/import-symbols.xml +++ b/common/web/types/test/fixtures/import-symbols.xml @@ -1,13 +1,10 @@ - - - - + - - + + diff --git a/common/web/types/test/fixtures/invalid-conforms-to.xml b/common/web/types/test/fixtures/invalid-conforms-to.xml index e5cca5ebac..01e463d817 100644 --- a/common/web/types/test/fixtures/invalid-conforms-to.xml +++ b/common/web/types/test/fixtures/invalid-conforms-to.xml @@ -5,15 +5,11 @@ Disabling doctype for this invalid file, not used by compiler, and avoids complaints in IDEs etc. --> - - - - - + - - + + diff --git a/common/web/types/test/fixtures/invalid-import-base.xml b/common/web/types/test/fixtures/invalid-import-base.xml index f52a13031e..05dcaad299 100644 --- a/common/web/types/test/fixtures/invalid-import-base.xml +++ b/common/web/types/test/fixtures/invalid-import-base.xml @@ -1,16 +1,12 @@ - - - - - + - - + + diff --git a/common/web/types/test/fixtures/invalid-import-path.xml b/common/web/types/test/fixtures/invalid-import-path.xml index c52b18ff56..b6d4c9da66 100644 --- a/common/web/types/test/fixtures/invalid-import-path.xml +++ b/common/web/types/test/fixtures/invalid-import-path.xml @@ -1,16 +1,12 @@ - - - - - + - - + + diff --git a/common/web/types/test/fixtures/invalid-import-readfail.xml b/common/web/types/test/fixtures/invalid-import-readfail.xml index d66288ecda..00f02e7da8 100644 --- a/common/web/types/test/fixtures/invalid-import-readfail.xml +++ b/common/web/types/test/fixtures/invalid-import-readfail.xml @@ -1,16 +1,12 @@ - - - - - + - - + + diff --git a/common/web/types/test/fixtures/invalid-import-wrongroot.xml b/common/web/types/test/fixtures/invalid-import-wrongroot.xml index 45d6b3b713..fbe75ffe19 100644 --- a/common/web/types/test/fixtures/invalid-import-wrongroot.xml +++ b/common/web/types/test/fixtures/invalid-import-wrongroot.xml @@ -1,16 +1,19 @@ - + - - - - - - + + + + + + + + + diff --git a/common/web/types/test/ldml-keyboard/test-ldml-keyboard-xml-reader.ts b/common/web/types/test/ldml-keyboard/test-ldml-keyboard-xml-reader.ts index 43429676a0..b218b8cefb 100644 --- a/common/web/types/test/ldml-keyboard/test-ldml-keyboard-xml-reader.ts +++ b/common/web/types/test/ldml-keyboard/test-ldml-keyboard-xml-reader.ts @@ -18,8 +18,8 @@ describe('ldml keyboard xml reader tests', function () { errors: [CommonTypesMessages.Error_SchemaValidationError({ instancePath: '/keyboard3', keyword: 'required', - message: `must have required property 'names'`, - params: 'missingProperty="names"', + message: `must have required property 'info'`, + params: 'missingProperty="info"', })], }, { @@ -37,9 +37,9 @@ describe('ldml keyboard xml reader tests', function () { assert.ok(source?.keyboard3?.keys); const k = pluckKeysFromKeybag(source?.keyboard3?.keys.key, ['a', 'b', 'c']); assert.sameDeepOrderedMembers(k, [ - {id: 'a', to: 'a'}, - {id: 'b', to: 'b'}, - {id: 'c', to: 'c'}, + {id: 'a', output: 'a'}, + {id: 'b', output: 'b'}, + {id: 'c', output: 'c'}, ]); // all of the keys are implied imports here assert.isTrue(ImportStatus.isImpliedImport(source?.keyboard3?.keys.key.find(({id}) => id === 'a'))); @@ -52,9 +52,9 @@ describe('ldml keyboard xml reader tests', function () { assert.ok(source?.keyboard3?.keys); const k = pluckKeysFromKeybag(source?.keyboard3?.keys.key, ['a', 'b', 'c']); assert.sameDeepOrderedMembers(k, [ - {id: 'a', to: 'a'}, - {id: 'b', to: 'b'}, - {id: 'c', to: 'c'}, + {id: 'a', output: 'a'}, + {id: 'b', output: 'b'}, + {id: 'c', output: 'c'}, ]); }, }, @@ -64,10 +64,10 @@ describe('ldml keyboard xml reader tests', function () { assert.ok(source?.keyboard3?.keys); const k = pluckKeysFromKeybag(source?.keyboard3?.keys.key, ['a', 'b', 'c']); assert.sameDeepOrderedMembers(k, [ - {id: 'a', to: 'a'}, - {id: 'b', to: 'b'}, - {id: 'c', to: 'c'}, - {id: 'a', to: 'å'}, // overridden + {id: 'a', output: 'a'}, + {id: 'b', output: 'b'}, + {id: 'c', output: 'c'}, + {id: 'a', output: 'å'}, // overridden ]); }, }, @@ -77,13 +77,13 @@ describe('ldml keyboard xml reader tests', function () { assert.ok(source?.keyboard3?.keys); const k = pluckKeysFromKeybag(source?.keyboard3?.keys.key, ['a', 'b', 'c', 'zz', 'hash', 'hyphen']); assert.sameDeepOrderedMembers(k, [ - {id: 'a', to: 'a'}, // implied - {id: 'b', to: 'b'}, - {id: 'c', to: 'c'}, - {id: 'hash', to: '#'}, // imported symbols - {id: 'hyphen', to: '-'}, - {id: 'zz', to: 'zz'}, // new key - {id: 'hash', to: '##'}, // override + { id: 'a', output: 'a' }, // implied + { id: 'b', output: 'b' }, + { id: 'c', output: 'c' }, + { id: 'hash', output: '#' }, // imported symbols + { id: 'hyphen', output: '-' }, + { id: 'zz', output: 'zz' }, // new key + { id: 'hash', output: '##' }, // override ]); // 'a' is an implied import assert.isTrue(ImportStatus.isImpliedImport(k.find(({id}) => id === 'a'))); @@ -136,7 +136,7 @@ describe('ldml keyboard xml reader tests', function () { CommonTypesMessages.Error_ImportWrongRoot({ base: null, path: 'techpreview/keys-Zyyy-punctuation.xml', - subtag: 'names', + subtag: 'flicks', }), ], }, diff --git a/core/tests/unit/ldml/keyboards/k_001_tiny.xml b/core/tests/unit/ldml/keyboards/k_001_tiny.xml index e17284025d..aae89fd411 100644 --- a/core/tests/unit/ldml/keyboards/k_001_tiny.xml +++ b/core/tests/unit/ldml/keyboards/k_001_tiny.xml @@ -10,18 +10,14 @@ --> - - - - - + - - + + - + diff --git a/core/tests/unit/ldml/keyboards/k_002_tinyu32.xml b/core/tests/unit/ldml/keyboards/k_002_tinyu32.xml index 7ef6c0b379..a8c5e37233 100644 --- a/core/tests/unit/ldml/keyboards/k_002_tinyu32.xml +++ b/core/tests/unit/ldml/keyboards/k_002_tinyu32.xml @@ -8,19 +8,15 @@ --> - - - - - + - - - + + + - + diff --git a/core/tests/unit/ldml/keyboards/k_003_transform.xml b/core/tests/unit/ldml/keyboards/k_003_transform.xml index 814b6829d8..ba837a7115 100644 --- a/core/tests/unit/ldml/keyboards/k_003_transform.xml +++ b/core/tests/unit/ldml/keyboards/k_003_transform.xml @@ -9,28 +9,24 @@ from https://github.com/unicode-org/cldr/blob/keyboard-preview/docs/ldml/tr35-ke --> - - - - - + - - - - + + + + - - + + - + @@ -45,7 +41,7 @@ from https://github.com/unicode-org/cldr/blob/keyboard-preview/docs/ldml/tr35-ke - + diff --git a/core/tests/unit/ldml/keyboards/k_004_tinyshift.xml b/core/tests/unit/ldml/keyboards/k_004_tinyshift.xml index fa7df96878..e2c442b28a 100644 --- a/core/tests/unit/ldml/keyboards/k_004_tinyshift.xml +++ b/core/tests/unit/ldml/keyboards/k_004_tinyshift.xml @@ -8,24 +8,20 @@ --> - - - - - + - - - - + + + + - - + + - + diff --git a/core/tests/unit/ldml/keyboards/k_005_modbittest.xml b/core/tests/unit/ldml/keyboards/k_005_modbittest.xml index a739728092..2af7cf2be0 100644 --- a/core/tests/unit/ldml/keyboards/k_005_modbittest.xml +++ b/core/tests/unit/ldml/keyboards/k_005_modbittest.xml @@ -8,37 +8,33 @@ --> - - - - - + - - + + - + - + - + - + - + - + - + diff --git a/core/tests/unit/ldml/keyboards/k_006_backspace.xml b/core/tests/unit/ldml/keyboards/k_006_backspace.xml index 940da405e1..f1d4237de2 100644 --- a/core/tests/unit/ldml/keyboards/k_006_backspace.xml +++ b/core/tests/unit/ldml/keyboards/k_006_backspace.xml @@ -2,28 +2,24 @@ - - - - - + - - - - + + + + - - + + - + @@ -38,7 +34,7 @@ - + diff --git a/core/tests/unit/ldml/keyboards/k_007_transform_rgx.xml b/core/tests/unit/ldml/keyboards/k_007_transform_rgx.xml index c2addf9dc1..45b06591ec 100644 --- a/core/tests/unit/ldml/keyboards/k_007_transform_rgx.xml +++ b/core/tests/unit/ldml/keyboards/k_007_transform_rgx.xml @@ -6,7 +6,7 @@ from https://github.com/unicode-org/cldr/blob/keyboard-preview/docs/ldml/tr35-ke --> - + @@ -14,18 +14,18 @@ from https://github.com/unicode-org/cldr/blob/keyboard-preview/docs/ldml/tr35-ke - + - - + + - + diff --git a/core/tests/unit/ldml/keyboards/k_008_transform_norm.xml b/core/tests/unit/ldml/keyboards/k_008_transform_norm.xml index b66ff1a4b6..1162a7769e 100644 --- a/core/tests/unit/ldml/keyboards/k_008_transform_norm.xml +++ b/core/tests/unit/ldml/keyboards/k_008_transform_norm.xml @@ -6,30 +6,26 @@ from https://github.com/unicode-org/cldr/blob/keyboard-preview/docs/ldml/tr35-ke --> - - - - - + - - - - - - + + + + + + - - + + - + diff --git a/core/tests/unit/ldml/keyboards/k_010_mt.xml b/core/tests/unit/ldml/keyboards/k_010_mt.xml index 3253c1f095..51c46d6a1f 100644 --- a/core/tests/unit/ldml/keyboards/k_010_mt.xml +++ b/core/tests/unit/ldml/keyboards/k_010_mt.xml @@ -17,7 +17,7 @@ Gets part of the way, - + @@ -30,37 +30,37 @@ Gets part of the way, - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + - + - - + + @@ -68,7 +68,7 @@ Gets part of the way, - + @@ -76,7 +76,7 @@ Gets part of the way, - + @@ -84,7 +84,7 @@ Gets part of the way, - + diff --git a/core/tests/unit/ldml/keyboards/k_011_mt_iso.xml b/core/tests/unit/ldml/keyboards/k_011_mt_iso.xml index 30378708cf..c2df9ae186 100644 --- a/core/tests/unit/ldml/keyboards/k_011_mt_iso.xml +++ b/core/tests/unit/ldml/keyboards/k_011_mt_iso.xml @@ -17,7 +17,7 @@ Exact copy of mt.xml from CLDR, but with: - + @@ -30,34 +30,34 @@ Exact copy of mt.xml from CLDR, but with: - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + - + - - + + @@ -65,7 +65,7 @@ Exact copy of mt.xml from CLDR, but with: - + @@ -73,7 +73,7 @@ Exact copy of mt.xml from CLDR, but with: - + @@ -81,7 +81,7 @@ Exact copy of mt.xml from CLDR, but with: - + diff --git a/core/tests/unit/ldml/keyboards/k_020_fr.xml b/core/tests/unit/ldml/keyboards/k_020_fr.xml index 42b7e1826f..a385fcda12 100644 --- a/core/tests/unit/ldml/keyboards/k_020_fr.xml +++ b/core/tests/unit/ldml/keyboards/k_020_fr.xml @@ -9,7 +9,7 @@ keyboard formats --> - + @@ -46,44 +46,44 @@ - + - - - - - + + + + + - - - + + + - + - - - + + + - + - - - + + + - + - + @@ -91,7 +91,7 @@ - + @@ -100,7 +100,7 @@ - + diff --git a/core/tests/unit/ldml/keyboards/k_100_keytest.xml b/core/tests/unit/ldml/keyboards/k_100_keytest.xml index 0078ed9c26..47457bb99f 100644 --- a/core/tests/unit/ldml/keyboards/k_100_keytest.xml +++ b/core/tests/unit/ldml/keyboards/k_100_keytest.xml @@ -7,18 +7,14 @@ - - - - - + - + diff --git a/core/tests/unit/ldml/keyboards/k_101_keytest.xml b/core/tests/unit/ldml/keyboards/k_101_keytest.xml index 827fe9cd9d..cf083071b3 100644 --- a/core/tests/unit/ldml/keyboards/k_101_keytest.xml +++ b/core/tests/unit/ldml/keyboards/k_101_keytest.xml @@ -6,11 +6,7 @@ --> - - - - - + @@ -21,7 +17,7 @@ - + diff --git a/core/tests/unit/ldml/keyboards/k_102_keytest.xml b/core/tests/unit/ldml/keyboards/k_102_keytest.xml index 3f379fd76b..9441d980af 100644 --- a/core/tests/unit/ldml/keyboards/k_102_keytest.xml +++ b/core/tests/unit/ldml/keyboards/k_102_keytest.xml @@ -7,13 +7,9 @@ - - - - - + - + diff --git a/core/tests/unit/ldml/keyboards/k_200_reorder_nod_Lana.xml b/core/tests/unit/ldml/keyboards/k_200_reorder_nod_Lana.xml index 061b40c882..183c28278c 100644 --- a/core/tests/unit/ldml/keyboards/k_200_reorder_nod_Lana.xml +++ b/core/tests/unit/ldml/keyboards/k_200_reorder_nod_Lana.xml @@ -7,25 +7,22 @@ - - - - + - - - - - + + + + + - + - - + + diff --git a/core/tests/unit/ldml/keyboards/k_210_marker.xml b/core/tests/unit/ldml/keyboards/k_210_marker.xml index d411725f6d..01a086a493 100644 --- a/core/tests/unit/ldml/keyboards/k_210_marker.xml +++ b/core/tests/unit/ldml/keyboards/k_210_marker.xml @@ -6,10 +6,7 @@ - - - - + @@ -17,14 +14,14 @@ - - - - + + + + - - + + diff --git a/developer/src/kmc-ldml/test/fixtures/basic.xml b/developer/src/kmc-ldml/test/fixtures/basic.xml index 144bcb4924..353d61b5fd 100644 --- a/developer/src/kmc-ldml/test/fixtures/basic.xml +++ b/developer/src/kmc-ldml/test/fixtures/basic.xml @@ -8,11 +8,7 @@ - - - - - + @@ -22,11 +18,11 @@ - - + + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped.xml index 6caeda0dfd..9942243f65 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped.xml @@ -8,23 +8,23 @@ - + - - + - - + + - + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped2.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped2.xml index 63a4384260..8a11ded611 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped2.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped2.xml @@ -7,10 +7,10 @@ - + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/gap-switch.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/gap-switch.xml index 9734a7cf82..76a9cd9332 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/gap-switch.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/gap-switch.xml @@ -9,11 +9,11 @@ - - + + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware.xml index 2c23b582c3..70e7f80a85 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware.xml @@ -7,18 +7,18 @@ - - - - + + + + - - + + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_iso.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_iso.xml index 6c9e5e4708..b8de55cb57 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_iso.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_iso.xml @@ -10,8 +10,8 @@ - - + + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_us.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_us.xml index 35be4e6ee3..6853420eac 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_us.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_us.xml @@ -10,8 +10,8 @@ - - + + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-bad-modifier.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-bad-modifier.xml index 8bb9f69513..dd4376f923 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-bad-modifier.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-bad-modifier.xml @@ -8,8 +8,8 @@ - - + + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-keys.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-keys.xml index 59abe6c9bf..8c9d973ec0 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-keys.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-keys.xml @@ -7,24 +7,24 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-rows.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-rows.xml index 5c6cc4ae4f..3b68eeed78 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-rows.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-rows.xml @@ -7,11 +7,11 @@ - - + + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-key-missing-attrs.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-key-missing-attrs.xml index 53af177744..8e286a2ca0 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-key-missing-attrs.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-key-missing-attrs.xml @@ -10,7 +10,7 @@ - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-missing-flick.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-missing-flick.xml index 0ccd239239..4a2db8ac40 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-missing-flick.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-missing-flick.xml @@ -7,14 +7,14 @@ - - + + - + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-undefined-key.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-undefined-key.xml index 5d030c2929..b5cea6c525 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-undefined-key.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-undefined-key.xml @@ -7,10 +7,10 @@ - + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/markers.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/markers.xml index 42b7013bd8..6dcf4e02fc 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/markers.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/markers.xml @@ -7,13 +7,13 @@ - + - + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/maximal.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/maximal.xml index 40f0be95ba..62ebcd2a07 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/maximal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/maximal.xml @@ -8,27 +8,27 @@ - + - - + + - - + + - + - + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/minimal.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/minimal.xml index 801524e65f..41a7961bfb 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/minimal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/minimal.xml @@ -7,11 +7,11 @@ - - + + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-us-form.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-us-form.xml index 2c92c0d860..94ea34abeb 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-us-form.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-us-form.xml @@ -7,9 +7,9 @@ - - - + + + @@ -18,7 +18,7 @@ - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-zzz-form.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-zzz-form.xml index 0ab10f3d03..4b8171be01 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-zzz-form.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-zzz-form.xml @@ -7,9 +7,9 @@ - - - + + + @@ -18,7 +18,7 @@ - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-invalid-form.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-invalid-form.xml index 9758cf8bbd..7d54b9788e 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-invalid-form.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-invalid-form.xml @@ -7,11 +7,11 @@ - - + + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-hardware.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-hardware.xml index 4be11f2604..5170744233 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-hardware.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-hardware.xml @@ -2,16 +2,13 @@ - - - - + - - + + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-layer.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-layer.xml index f0ca747ae7..e55d7caa91 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-layer.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-layer.xml @@ -7,11 +7,11 @@ - - + + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-multi-hardware.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-multi-hardware.xml index 644b8d452f..a403c503f2 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-multi-hardware.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-multi-hardware.xml @@ -7,18 +7,18 @@ - - + + - + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-us-form.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-us-form.xml index d3a0573b21..67c811dd11 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-us-form.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-us-form.xml @@ -7,9 +7,9 @@ - - - + + + @@ -18,7 +18,7 @@ - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-zzz-form.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-zzz-form.xml index 502b254135..4a9fa9e422 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-zzz-form.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-zzz-form.xml @@ -7,9 +7,9 @@ - - - + + + @@ -17,7 +17,7 @@ - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml b/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml index ffb1befffe..b8998df93b 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml @@ -2,11 +2,7 @@ - - - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/meta/maximal.xml b/developer/src/kmc-ldml/test/fixtures/sections/meta/maximal.xml index 06f56ebbb0..a26f8d9c9b 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/meta/maximal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/meta/maximal.xml @@ -4,11 +4,7 @@ - - - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/markers-maximal.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/markers-maximal.xml index 345e70d8f4..e0486d679f 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/markers-maximal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/markers-maximal.xml @@ -19,7 +19,7 @@ - + diff --git a/resources/standards-data/ldml-keyboards/techpreview/3.0/fr-t-k0-azerty.xml b/resources/standards-data/ldml-keyboards/techpreview/3.0/fr-t-k0-azerty.xml index 8a792be32f..c969ecf543 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/3.0/fr-t-k0-azerty.xml +++ b/resources/standards-data/ldml-keyboards/techpreview/3.0/fr-t-k0-azerty.xml @@ -52,7 +52,7 @@ From 870cf76049afea92740f6ede092867ec68a062ef Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Tue, 24 Oct 2023 14:56:09 -0500 Subject: [PATCH 03/12] =?UTF-8?q?chore(developer,core):=20ldml=20update=20?= =?UTF-8?q?to=20prefinal=20v44=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - more data files For feat(developer): ldml re-sync with CLDR v44 spec 🙀 #9838 --- .../ldml/keyboards/k_007_transform_rgx.xml | 7 +------ core/tests/unit/ldml/keyboards/k_010_mt.xml | 7 +------ .../tests/unit/ldml/keyboards/k_011_mt_iso.xml | 7 +------ core/tests/unit/ldml/keyboards/k_020_fr.xml | 18 +++++++----------- .../unit/ldml/keyboards/k_101_keytest.xml | 2 +- .../tests/unit/ldml/keyboards/k_210_marker.xml | 4 ++-- developer/src/kmc-ldml/test/fixtures/basic.xml | 4 ++-- .../test/fixtures/sections/bksp/minimal.xml | 4 +--- .../test/fixtures/sections/disp/escaped.xml | 8 +++----- .../fixtures/sections/disp/invalid-both.xml | 6 ++---- .../fixtures/sections/disp/invalid-dupid.xml | 10 ++++------ .../fixtures/sections/disp/invalid-dupto.xml | 10 ++++------ .../fixtures/sections/disp/invalid-none.xml | 4 +--- .../test/fixtures/sections/disp/maximal.xml | 10 ++++------ .../test/fixtures/sections/disp/minimal.xml | 4 +--- .../fixtures/sections/disp/options-only.xml | 4 +--- .../test/fixtures/sections/disp/typical.xml | 6 ++---- .../test/fixtures/sections/finl/minimal.xml | 4 +--- .../test/fixtures/sections/keys/escaped2.xml | 4 +--- .../test/fixtures/sections/keys/gap-switch.xml | 6 ++---- .../test/fixtures/sections/keys/hardware.xml | 4 +--- .../fixtures/sections/keys/hardware_iso.xml | 4 +--- .../fixtures/sections/keys/hardware_us.xml | 4 +--- .../sections/keys/invalid-bad-modifier.xml | 4 +--- .../keys/invalid-hardware-too-many-keys.xml | 4 +--- .../keys/invalid-hardware-too-many-rows.xml | 4 +--- .../keys/invalid-key-missing-attrs.xml | 4 +--- .../sections/keys/invalid-missing-flick.xml | 4 +--- .../sections/keys/invalid-undefined-key.xml | 4 +--- .../test/fixtures/sections/keys/markers.xml | 4 +--- .../test/fixtures/sections/keys/maximal.xml | 4 +--- .../test/fixtures/sections/keys/minimal.xml | 4 +--- .../sections/layr/error-custom-us-form.xml | 4 +--- .../sections/layr/error-custom-zzz-form.xml | 4 +--- .../sections/layr/invalid-invalid-form.xml | 4 +--- .../sections/layr/invalid-missing-layer.xml | 4 +--- .../sections/layr/invalid-missing-layer2.xml | 4 +--- .../sections/layr/invalid-multi-hardware.xml | 4 +--- .../sections/layr/warn-custom-us-form.xml | 4 +--- .../sections/layr/warn-custom-zzz-form.xml | 5 +---- .../fixtures/sections/loca/invalid-locale.xml | 4 +--- .../test/fixtures/sections/loca/minimal.xml | 4 +--- .../test/fixtures/sections/loca/multiple.xml | 4 +--- .../sections/meta/invalid-normalization.xml | 2 +- .../sections/meta/invalid-version-1.0.xml | 4 +--- .../sections/meta/invalid-version-v1.0.3.xml | 4 +--- .../test/fixtures/sections/meta/maximal.xml | 2 +- .../test/fixtures/sections/meta/minimal.xml | 4 +--- .../test/fixtures/sections/name/minimal.xml | 4 +--- .../test/fixtures/sections/ordr/minimal.xml | 4 +--- .../fixtures/sections/ordr/multi-escape.xml | 4 +--- .../test/fixtures/sections/ordr/nod-Lana.xml | 4 +--- .../sections/tran/fail-duplicate-type.xml | 4 +--- .../test/fixtures/sections/tran/fail-empty.xml | 4 +--- .../tran/fail-invalid-duplicate-type.xml | 4 +--- .../sections/tran/fail-invalid-type.xml | 4 +--- .../test/fixtures/sections/tran/fail-mixed.xml | 4 +--- .../test/fixtures/sections/tran/minimal.xml | 4 +--- .../test/fixtures/sections/tran/tran-vars.xml | 4 +--- .../test/fixtures/sections/vars/dup0.xml | 4 +--- .../test/fixtures/sections/vars/dup1.xml | 4 +--- .../fixtures/sections/vars/fail-badref-0.xml | 4 +--- .../fixtures/sections/vars/fail-badref-1.xml | 4 +--- .../fixtures/sections/vars/fail-badref-2.xml | 4 +--- .../fixtures/sections/vars/fail-badref-3.xml | 4 +--- .../fixtures/sections/vars/fail-badref-4.xml | 4 +--- .../fixtures/sections/vars/fail-badref-5.xml | 4 +--- .../fixtures/sections/vars/fail-badref-6.xml | 4 +--- .../sections/vars/fail-markers-badref-0.xml | 8 +++----- .../sections/vars/fail-uset-props1.xml | 4 +--- .../sections/vars/fail-uset-props2.xml | 4 +--- .../sections/vars/fail-uset-strings.xml | 4 +--- .../sections/vars/fail-uset-syntax.xml | 4 +--- .../fixtures/sections/vars/markers-maximal.xml | 6 ++---- .../test/fixtures/sections/vars/maximal.xml | 4 +--- .../test/fixtures/sections/vars/minimal.xml | 4 +--- 76 files changed, 101 insertions(+), 255 deletions(-) diff --git a/core/tests/unit/ldml/keyboards/k_007_transform_rgx.xml b/core/tests/unit/ldml/keyboards/k_007_transform_rgx.xml index 45b06591ec..2be92ea39c 100644 --- a/core/tests/unit/ldml/keyboards/k_007_transform_rgx.xml +++ b/core/tests/unit/ldml/keyboards/k_007_transform_rgx.xml @@ -6,12 +6,7 @@ from https://github.com/unicode-org/cldr/blob/keyboard-preview/docs/ldml/tr35-ke --> - - - - - - + diff --git a/core/tests/unit/ldml/keyboards/k_010_mt.xml b/core/tests/unit/ldml/keyboards/k_010_mt.xml index 51c46d6a1f..2fd3e2b44f 100644 --- a/core/tests/unit/ldml/keyboards/k_010_mt.xml +++ b/core/tests/unit/ldml/keyboards/k_010_mt.xml @@ -17,12 +17,7 @@ Gets part of the way, - - - - - - + diff --git a/core/tests/unit/ldml/keyboards/k_011_mt_iso.xml b/core/tests/unit/ldml/keyboards/k_011_mt_iso.xml index c2df9ae186..59496726fa 100644 --- a/core/tests/unit/ldml/keyboards/k_011_mt_iso.xml +++ b/core/tests/unit/ldml/keyboards/k_011_mt_iso.xml @@ -17,12 +17,7 @@ Exact copy of mt.xml from CLDR, but with: - - - - - - + diff --git a/core/tests/unit/ldml/keyboards/k_020_fr.xml b/core/tests/unit/ldml/keyboards/k_020_fr.xml index a385fcda12..113164ae53 100644 --- a/core/tests/unit/ldml/keyboards/k_020_fr.xml +++ b/core/tests/unit/ldml/keyboards/k_020_fr.xml @@ -9,19 +9,15 @@ keyboard formats --> - - - - - + - + > - + - - - - + + + + diff --git a/core/tests/unit/ldml/keyboards/k_101_keytest.xml b/core/tests/unit/ldml/keyboards/k_101_keytest.xml index cf083071b3..9dc35408fa 100644 --- a/core/tests/unit/ldml/keyboards/k_101_keytest.xml +++ b/core/tests/unit/ldml/keyboards/k_101_keytest.xml @@ -9,7 +9,7 @@ - + diff --git a/core/tests/unit/ldml/keyboards/k_210_marker.xml b/core/tests/unit/ldml/keyboards/k_210_marker.xml index 01a086a493..750a1870bb 100644 --- a/core/tests/unit/ldml/keyboards/k_210_marker.xml +++ b/core/tests/unit/ldml/keyboards/k_210_marker.xml @@ -9,8 +9,8 @@ - - + + diff --git a/developer/src/kmc-ldml/test/fixtures/basic.xml b/developer/src/kmc-ldml/test/fixtures/basic.xml index 353d61b5fd..ea796e9653 100644 --- a/developer/src/kmc-ldml/test/fixtures/basic.xml +++ b/developer/src/kmc-ldml/test/fixtures/basic.xml @@ -12,8 +12,8 @@ - - + + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/bksp/minimal.xml b/developer/src/kmc-ldml/test/fixtures/sections/bksp/minimal.xml index cdff4b37fa..184991ad4c 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/bksp/minimal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/bksp/minimal.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/disp/escaped.xml b/developer/src/kmc-ldml/test/fixtures/sections/disp/escaped.xml index d934eb8399..44412e2c1f 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/disp/escaped.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/disp/escaped.xml @@ -2,13 +2,11 @@ - - - + - - + + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-both.xml b/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-both.xml index 4c2be92e49..07481be8bb 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-both.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-both.xml @@ -2,12 +2,10 @@ - - - + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-dupid.xml b/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-dupid.xml index 20cda7475f..c3db581640 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-dupid.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-dupid.xml @@ -2,14 +2,12 @@ - - - + - - - + + + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-dupto.xml b/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-dupto.xml index 0018f0a5d9..ec5cda2e42 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-dupto.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-dupto.xml @@ -2,14 +2,12 @@ - - - + - - - + + + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-none.xml b/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-none.xml index fd05facbaa..e6c43aafd9 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-none.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-none.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/disp/maximal.xml b/developer/src/kmc-ldml/test/fixtures/sections/disp/maximal.xml index 862c931004..d3b6657673 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/disp/maximal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/disp/maximal.xml @@ -2,14 +2,12 @@ - - - + - - - + + + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/disp/minimal.xml b/developer/src/kmc-ldml/test/fixtures/sections/disp/minimal.xml index 23ff75e29b..15590710ba 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/disp/minimal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/disp/minimal.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/disp/options-only.xml b/developer/src/kmc-ldml/test/fixtures/sections/disp/options-only.xml index e2b9869521..ee967fc027 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/disp/options-only.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/disp/options-only.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/disp/typical.xml b/developer/src/kmc-ldml/test/fixtures/sections/disp/typical.xml index 78ab408dec..9486e904b7 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/disp/typical.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/disp/typical.xml @@ -2,11 +2,9 @@ - - - + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/finl/minimal.xml b/developer/src/kmc-ldml/test/fixtures/sections/finl/minimal.xml index 6ed9631029..022241b4f5 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/finl/minimal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/finl/minimal.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped2.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped2.xml index 8a11ded611..13835331a9 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped2.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped2.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/gap-switch.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/gap-switch.xml index 76a9cd9332..e714f74c76 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/gap-switch.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/gap-switch.xml @@ -2,13 +2,11 @@ - - - + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware.xml index 70e7f80a85..6f7884888c 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_iso.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_iso.xml index b8de55cb57..39947cd189 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_iso.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_iso.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_us.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_us.xml index 6853420eac..238f89e432 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_us.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/hardware_us.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-bad-modifier.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-bad-modifier.xml index dd4376f923..5bde7c586c 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-bad-modifier.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-bad-modifier.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-keys.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-keys.xml index 8c9d973ec0..f4d78bf203 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-keys.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-keys.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-rows.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-rows.xml index 3b68eeed78..77ec94b805 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-rows.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-hardware-too-many-rows.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-key-missing-attrs.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-key-missing-attrs.xml index 8e286a2ca0..0aa7fe9562 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-key-missing-attrs.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-key-missing-attrs.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-missing-flick.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-missing-flick.xml index 4a2db8ac40..b28710acde 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-missing-flick.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-missing-flick.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-undefined-key.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-undefined-key.xml index b5cea6c525..395e9204a0 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-undefined-key.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-undefined-key.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/markers.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/markers.xml index 6dcf4e02fc..4a7fb98871 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/markers.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/markers.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/maximal.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/maximal.xml index 62ebcd2a07..3836379d5c 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/maximal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/maximal.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/minimal.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/minimal.xml index 41a7961bfb..38002138f9 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/minimal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/minimal.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-us-form.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-us-form.xml index 94ea34abeb..916ea8cb08 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-us-form.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-us-form.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-zzz-form.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-zzz-form.xml index 4b8171be01..12d3f6f77b 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-zzz-form.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/error-custom-zzz-form.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-invalid-form.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-invalid-form.xml index 7d54b9788e..469c8d0d8f 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-invalid-form.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-invalid-form.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-layer.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-layer.xml index e55d7caa91..b3ca93e077 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-layer.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-layer.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-layer2.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-layer2.xml index 062e745dd1..26b5b98bdc 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-layer2.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-missing-layer2.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-multi-hardware.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-multi-hardware.xml index a403c503f2..df544e4070 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-multi-hardware.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/invalid-multi-hardware.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-us-form.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-us-form.xml index 67c811dd11..ec1a75afe7 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-us-form.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-us-form.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-zzz-form.xml b/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-zzz-form.xml index 4a9fa9e422..bf17a8a087 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-zzz-form.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/layr/warn-custom-zzz-form.xml @@ -2,10 +2,7 @@ - - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/loca/invalid-locale.xml b/developer/src/kmc-ldml/test/fixtures/sections/loca/invalid-locale.xml index 0661d9a021..3dd5e8b1c3 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/loca/invalid-locale.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/loca/invalid-locale.xml @@ -2,8 +2,6 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/loca/minimal.xml b/developer/src/kmc-ldml/test/fixtures/sections/loca/minimal.xml index 4fe10cba2a..99e84cdaa9 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/loca/minimal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/loca/minimal.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/loca/multiple.xml b/developer/src/kmc-ldml/test/fixtures/sections/loca/multiple.xml index a6363c3533..4df6a1b0f4 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/loca/multiple.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/loca/multiple.xml @@ -10,9 +10,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml b/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml index b8998df93b..35e60b0416 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml @@ -2,7 +2,7 @@ - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-version-1.0.xml b/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-version-1.0.xml index 9e2536ba75..f8fe4bdeec 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-version-1.0.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-version-1.0.xml @@ -4,9 +4,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-version-v1.0.3.xml b/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-version-v1.0.3.xml index 04ecb5a656..de81a4b701 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-version-v1.0.3.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-version-v1.0.3.xml @@ -4,9 +4,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/meta/maximal.xml b/developer/src/kmc-ldml/test/fixtures/sections/meta/maximal.xml index a26f8d9c9b..d1e5bf3e22 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/meta/maximal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/meta/maximal.xml @@ -6,7 +6,7 @@ - + > diff --git a/developer/src/kmc-ldml/test/fixtures/sections/meta/minimal.xml b/developer/src/kmc-ldml/test/fixtures/sections/meta/minimal.xml index e523031e53..35e60b0416 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/meta/minimal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/meta/minimal.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/name/minimal.xml b/developer/src/kmc-ldml/test/fixtures/sections/name/minimal.xml index f1e4914e99..bc3277a312 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/name/minimal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/name/minimal.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/ordr/minimal.xml b/developer/src/kmc-ldml/test/fixtures/sections/ordr/minimal.xml index e019298c24..baae3588f9 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/ordr/minimal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/ordr/minimal.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/ordr/multi-escape.xml b/developer/src/kmc-ldml/test/fixtures/sections/ordr/multi-escape.xml index 6d27dc48e3..430bdb2417 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/ordr/multi-escape.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/ordr/multi-escape.xml @@ -1,9 +1,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/ordr/nod-Lana.xml b/developer/src/kmc-ldml/test/fixtures/sections/ordr/nod-Lana.xml index 1053655c9d..8395ea581a 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/ordr/nod-Lana.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/ordr/nod-Lana.xml @@ -1,9 +1,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-duplicate-type.xml b/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-duplicate-type.xml index ec268acfe3..70be7647e3 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-duplicate-type.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-duplicate-type.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-empty.xml b/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-empty.xml index 61d3ab896a..f37d9e5c57 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-empty.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-empty.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-invalid-duplicate-type.xml b/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-invalid-duplicate-type.xml index 15d3b5dcb0..050bd4466d 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-invalid-duplicate-type.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-invalid-duplicate-type.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-invalid-type.xml b/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-invalid-type.xml index 9fc7f7c3f5..2c921d9046 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-invalid-type.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-invalid-type.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-mixed.xml b/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-mixed.xml index d16e55fd4e..e949828837 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-mixed.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-mixed.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/tran/minimal.xml b/developer/src/kmc-ldml/test/fixtures/sections/tran/minimal.xml index a5392f596e..a8a99bb0d5 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/tran/minimal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/tran/minimal.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/tran/tran-vars.xml b/developer/src/kmc-ldml/test/fixtures/sections/tran/tran-vars.xml index 676d281f97..e78fef350e 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/tran/tran-vars.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/tran/tran-vars.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/dup0.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/dup0.xml index 12c2706730..1a93df1349 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/dup0.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/dup0.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/dup1.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/dup1.xml index a5bef8196f..91369d2391 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/dup1.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/dup1.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-0.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-0.xml index be94255504..018770ff0d 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-0.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-0.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-1.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-1.xml index 45b7670a80..1ba9dbec8f 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-1.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-1.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-2.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-2.xml index 656faf0cd0..c6bd3159c6 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-2.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-2.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-3.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-3.xml index 628148a821..956b8b4e2e 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-3.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-3.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-4.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-4.xml index c05a8ec653..2233d4a32a 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-4.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-4.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-5.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-5.xml index 82721d834b..63c009c68c 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-5.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-5.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-6.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-6.xml index dbe9deb07c..e06fef4353 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-6.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-badref-6.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-markers-badref-0.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-markers-badref-0.xml index cdfaf3f324..780c00e776 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-markers-badref-0.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-markers-badref-0.xml @@ -6,15 +6,13 @@ This will fail because the two markers given don't exist anywhere. --> - - - + - + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-props1.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-props1.xml index 110af57940..c0cd2008db 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-props1.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-props1.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-props2.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-props2.xml index 5c03b0d682..43c6cca213 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-props2.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-props2.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-strings.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-strings.xml index 5d691f3d4b..1a4254898a 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-strings.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-strings.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-syntax.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-syntax.xml index 9ed1b08c9a..50694739a4 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-syntax.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/fail-uset-syntax.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/markers-maximal.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/markers-maximal.xml index e0486d679f..7c183bdc22 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/markers-maximal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/markers-maximal.xml @@ -10,12 +10,10 @@ --> - - - + - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/maximal.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/maximal.xml index 89d32d89db..5f464ae7a2 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/maximal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/maximal.xml @@ -2,9 +2,7 @@ - - - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/vars/minimal.xml b/developer/src/kmc-ldml/test/fixtures/sections/vars/minimal.xml index 6e6a3ab02e..a9ebc962ff 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/vars/minimal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/vars/minimal.xml @@ -2,9 +2,7 @@ - - - + From 1ff2bfc4d7ce7b4c9149ac7c01989f233fc343c4 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Tue, 24 Oct 2023 17:28:08 -0500 Subject: [PATCH 04/12] =?UTF-8?q?chore(developer,common,core):=20ldml=20up?= =?UTF-8?q?date=20to=20prefinal=20v44=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - more data file updates - now updating some developer files - updating the KMX+ spec with some changes. (vkey was dropped in #7135, remove it from the spec) For feat(developer): ldml re-sync with CLDR v44 spec 🙀 #9838 --- .../src/kmx/kmx-plus-builder/build-keys.ts | 4 +- .../src/kmx/kmx-plus-builder/build-meta.ts | 4 +- .../src/kmx/kmx-plus-builder/build-name.ts | 37 -------- .../kmx/kmx-plus-builder/kmx-plus-builder.ts | 5 -- common/web/types/src/kmx/kmx-plus.ts | 50 ++--------- .../src/ldml-keyboard/ldml-keyboard-xml.ts | 2 +- core/include/ldml/keyman_core_ldml.h | 8 +- core/include/ldml/keyman_core_ldml.ts | 41 +-------- core/src/ldml/C7043_ldml.md | 69 ++++----------- .../src/kmc-ldml/src/compiler/compiler.ts | 2 - .../src/compiler/keymanweb-compiler.ts | 2 +- developer/src/kmc-ldml/src/compiler/keys.ts | 84 +++++++------------ developer/src/kmc-ldml/src/compiler/layr.ts | 6 +- .../src/kmc-ldml/src/compiler/messages.ts | 14 ++-- developer/src/kmc-ldml/src/compiler/meta.ts | 18 ++-- .../src/compiler/metadata-compiler.ts | 4 +- developer/src/kmc-ldml/src/compiler/name.ts | 25 ------ .../src/compiler/touch-layout-compiler.ts | 8 +- .../src/compiler/visual-keyboard-compiler.ts | 2 +- developer/src/kmc-ldml/src/util/util.ts | 19 +++-- .../sections/meta/invalid-normalization.xml | 2 +- .../test/fixtures/sections/meta/maximal.xml | 5 +- .../test/fixtures/sections/name/minimal.xml | 8 -- .../test/fixtures/sections/name/multiple.xml | 15 ---- developer/src/kmc-ldml/test/test-keys.ts | 16 ++-- developer/src/kmc-ldml/test/test-layr.ts | 2 +- developer/src/kmc-ldml/test/test-meta.ts | 7 +- developer/src/kmc-ldml/test/test-name.ts | 34 -------- developer/src/kmc-ldml/test/test-utils.ts | 26 +++--- 29 files changed, 128 insertions(+), 391 deletions(-) delete mode 100644 common/web/types/src/kmx/kmx-plus-builder/build-name.ts delete mode 100644 developer/src/kmc-ldml/src/compiler/name.ts delete mode 100644 developer/src/kmc-ldml/test/fixtures/sections/name/minimal.xml delete mode 100644 developer/src/kmc-ldml/test/fixtures/sections/name/multiple.xml delete mode 100644 developer/src/kmc-ldml/test/test-name.ts diff --git a/common/web/types/src/kmx/kmx-plus-builder/build-keys.ts b/common/web/types/src/kmx/kmx-plus-builder/build-keys.ts index d9d30e8683..d2f7564bb3 100644 --- a/common/web/types/src/kmx/kmx-plus-builder/build-keys.ts +++ b/common/web/types/src/kmx/kmx-plus-builder/build-keys.ts @@ -41,7 +41,6 @@ interface BUILDER_KEYS_FLICKS { */ interface BUILDER_KEYS_FLICK { directions: BUILDER_LIST_REF; // list of cardinal/intercardinal directions - flags: number; // to: BUILDER_STR_REF | number; // str or single codepoint }; @@ -106,8 +105,7 @@ export function build_keys(kmxplus: KMXPlusData, sect_strs: BUILDER_STRS, sect_l flicks._flicks.forEach((flick) => { keys.flick.push({ directions: build_list_index(sect_list, flick.directions), - flags: flick.flags, - to: build_strs_index(sect_strs, flick.to), + to: build_strs_index(sect_strs, flick.keyId), }); keys.flickCount++; }); diff --git a/common/web/types/src/kmx/kmx-plus-builder/build-meta.ts b/common/web/types/src/kmx/kmx-plus-builder/build-meta.ts index c1633aeca7..23dd303a7d 100644 --- a/common/web/types/src/kmx/kmx-plus-builder/build-meta.ts +++ b/common/web/types/src/kmx/kmx-plus-builder/build-meta.ts @@ -15,7 +15,7 @@ export interface BUILDER_META extends BUILDER_SECTION { author: BUILDER_STR_REF; //str conform: BUILDER_STR_REF; //str layout: BUILDER_STR_REF; //str - normalization: BUILDER_STR_REF; //str + name: BUILDER_STR_REF; //str indicator: BUILDER_STR_REF; //str version: BUILDER_STR_REF; //str settings: number; //bitfield @@ -29,7 +29,7 @@ export function build_meta(kmxplus: KMXPlusData, sect_strs: BUILDER_STRS): BUILD author: build_strs_index(sect_strs, kmxplus.meta.author), conform: build_strs_index(sect_strs, kmxplus.meta.conform), layout: build_strs_index(sect_strs, kmxplus.meta.layout), - normalization: build_strs_index(sect_strs, kmxplus.meta.normalization), + name: build_strs_index(sect_strs, kmxplus.meta.name), indicator: build_strs_index(sect_strs, kmxplus.meta.indicator), version: build_strs_index(sect_strs, kmxplus.meta.version), settings: kmxplus.meta.settings ?? 0, diff --git a/common/web/types/src/kmx/kmx-plus-builder/build-name.ts b/common/web/types/src/kmx/kmx-plus-builder/build-name.ts deleted file mode 100644 index 9463d15204..0000000000 --- a/common/web/types/src/kmx/kmx-plus-builder/build-name.ts +++ /dev/null @@ -1,37 +0,0 @@ - -/* ------------------------------------------------------------------ - * name section - ------------------------------------------------------------------ */ - -import { constants } from "@keymanapp/ldml-keyboard-constants"; -import { KMXPlusData } from "../kmx-plus.js"; -import { build_strs_index, BUILDER_STR_REF, BUILDER_STRS } from "./build-strs.js"; -import { BUILDER_SECTION } from "./builder-section.js"; - -/** - * Builder for the 'name' section - */ -export interface BUILDER_NAME extends BUILDER_SECTION { - count: number; - items: BUILDER_STR_REF[]; -}; - -export function build_name(kmxplus: KMXPlusData, sect_strs: BUILDER_STRS): BUILDER_NAME { - if(!kmxplus.name.names.length) { - return null; - } - - let name: BUILDER_NAME = { - ident: constants.hex_section_id(constants.section.name), - size: constants.length_name + constants.length_name_item * kmxplus.name.names.length, - _offset: 0, - count: kmxplus.name.names.length, - items: [] - }; - - for(let item of kmxplus.name.names) { - name.items.push(build_strs_index(sect_strs, item)); - } - - return name; -} diff --git a/common/web/types/src/kmx/kmx-plus-builder/kmx-plus-builder.ts b/common/web/types/src/kmx/kmx-plus-builder/kmx-plus-builder.ts index e77c60fbe7..381e1d6d19 100644 --- a/common/web/types/src/kmx/kmx-plus-builder/kmx-plus-builder.ts +++ b/common/web/types/src/kmx/kmx-plus-builder/kmx-plus-builder.ts @@ -10,7 +10,6 @@ import { BUILDER_LAYR, build_layr } from './build-layr.js'; import { BUILDER_LIST, build_list } from './build-list.js'; import { BUILDER_LOCA, build_loca } from './build-loca.js'; import { BUILDER_META, build_meta } from './build-meta.js'; -import { BUILDER_NAME, build_name } from './build-name.js'; import { BUILDER_STRS, build_strs } from './build-strs.js'; import { BUILDER_TRAN, build_tran } from './build-tran.js'; import { BUILDER_USET, build_uset } from './build-uset.js'; @@ -30,7 +29,6 @@ type SectionBuilders = { list?: BUILDER_LIST; loca?: BUILDER_LOCA; meta?: BUILDER_META; - name?: BUILDER_NAME; strs?: BUILDER_STRS; tran?: BUILDER_TRAN; uset?: BUILDER_USET; @@ -65,7 +63,6 @@ export default class KMXPlusBuilder { this.emitSection(file, this.file.COMP_PLUS_LIST, this.sect.list); this.emitSection(file, this.file.COMP_PLUS_LOCA, this.sect.loca); this.emitSection(file, this.file.COMP_PLUS_META, this.sect.meta); - this.emitSection(file, this.file.COMP_PLUS_NAME, this.sect.name); this.emitSection(file, this.file.COMP_PLUS_STRS, this.sect.strs); this.emitStrings(file); this.emitSection(file, this.file.COMP_PLUS_TRAN, this.sect.tran); @@ -93,7 +90,6 @@ export default class KMXPlusBuilder { this.sect.layr = build_layr(this.file.kmxplus, this.sect.strs, this.sect.list); this.sect.loca = build_loca(this.file.kmxplus, this.sect.strs); this.sect.meta = build_meta(this.file.kmxplus, this.sect.strs); - this.sect.name = build_name(this.file.kmxplus, this.sect.strs); this.sect.tran = build_tran(this.file.kmxplus.tran, this.sect.strs, this.sect.elem); this.sect.uset = build_uset(this.file.kmxplus, this.sect.strs); this.sect.vars = build_vars(this.file.kmxplus, this.sect.strs, this.sect.elem, this.sect.list); @@ -129,7 +125,6 @@ export default class KMXPlusBuilder { offset = this.finalize_sect_item(this.sect.list, offset); offset = this.finalize_sect_item(this.sect.loca, offset); offset = this.finalize_sect_item(this.sect.meta, offset); - offset = this.finalize_sect_item(this.sect.name, offset); offset = this.finalize_sect_item(this.sect.strs, offset); offset = this.finalize_sect_item(this.sect.tran, offset); offset = this.finalize_sect_item(this.sect.uset, offset); diff --git a/common/web/types/src/kmx/kmx-plus.ts b/common/web/types/src/kmx/kmx-plus.ts index 1060e50fba..8f0149ca85 100644 --- a/common/web/types/src/kmx/kmx-plus.ts +++ b/common/web/types/src/kmx/kmx-plus.ts @@ -64,29 +64,19 @@ export class Loca extends Section { export enum KeyboardSettings { none = 0, - fallback = constants.meta_settings_fallback_omit, - transformFailure = constants.meta_settings_transformFailure_omit, - transformPartial = constants.meta_settings_transformPartial_hide, + normalizationDisabled = constants.meta_settings_normalization_disabled, }; -export enum Meta_NormalizationForm { NFC='NFC', NFD='NFD', other='other' }; - export class Meta extends Section { author: StrsItem; conform: StrsItem; layout: StrsItem; - normalization: StrsItem; + name: StrsItem; indicator: StrsItem; version: StrsItem; // semver version string, defaults to "0" settings: KeyboardSettings; }; -// 'name' - -export class Name extends Section { - names: StrsItem[] = []; -}; - // 'strs' /** @@ -502,8 +492,7 @@ export class KeysFlicks { export class KeysFlick { directions: ListItem; - flags: number; - to: StrsItem; + keyId: StrsItem; }; export class Keys extends Section { @@ -571,7 +560,6 @@ export interface KMXPlusData { list?: List; // list is ignored in-memory loca?: Loca; meta?: Meta; - name?: Name; strs?: Strs; // strs is ignored in-memory tran?: Tran; uset?: Uset; // uset is ignored in-memory @@ -619,9 +607,6 @@ export class KMXPlusFile extends KMXFile { public readonly COMP_PLUS_META: any; - public readonly COMP_PLUS_NAME_ITEM: any; - public readonly COMP_PLUS_NAME: any; - public readonly COMP_PLUS_STRS_ITEM: any; public readonly COMP_PLUS_STRS: any; @@ -832,22 +817,13 @@ export class KMXPlusFile extends KMXFile { author: STR_REF, //str conform: STR_REF, //str layout: STR_REF, //str - normalization: STR_REF, //str + name: STR_REF, //str indicator: STR_REF, //str version: STR_REF, //str - settings: r.uint32le, //new r.Bitfield(r.uint32le, ['fallback', 'transformFailure', 'transformPartial']) + settings: r.uint32le, //new r.Bitfield(r.uint32le, ['normalizationDisabled']) }); - // 'name' - - this.COMP_PLUS_NAME_ITEM = r.uint32le; //str - - this.COMP_PLUS_NAME = new r.Struct({ - ident: IDENT, - size: r.uint32le, - count: r.uint32le, - items: new r.Array(this.COMP_PLUS_NAME_ITEM, 'count') - }); + // 'name' is gone // 'ordr' now part of 'tran' @@ -937,19 +913,7 @@ export class KMXPlusFile extends KMXFile { varEntries: new r.Array(this.COMP_PLUS_VARS_ITEM, 'varCount'), }); - // 'vkey' - - this.COMP_PLUS_VKEY_ITEM = new r.Struct({ - vkey: r.uint32le, - target: r.uint32le - }); - - this.COMP_PLUS_VKEY = new r.Struct({ - ident: IDENT, - size: r.uint32le, - count: r.uint32le, - items: new r.Array(this.COMP_PLUS_VKEY_ITEM, 'count') - }); + // 'vkey' is removed // Aliases diff --git a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts index fd586273c6..87f0b0515d 100644 --- a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts +++ b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts @@ -91,7 +91,7 @@ export interface LKFlicks { export interface LKFlick { id?: string; - flickSegment?: LKFlickSegment; + flickSegment?: LKFlickSegment[]; }; export interface LKFlickSegment { diff --git a/core/include/ldml/keyman_core_ldml.h b/core/include/ldml/keyman_core_ldml.h index 41f87a0d50..a8e9576e18 100644 --- a/core/include/ldml/keyman_core_ldml.h +++ b/core/include/ldml/keyman_core_ldml.h @@ -32,10 +32,8 @@ #define LDML_ELEM_FLAGS_TYPE_STR 0x1 #define LDML_ELEM_FLAGS_TYPE_USET 0x2 #define LDML_FINL_FLAGS_ERROR 0x1 -#define LDML_KEYS_FLICK_FLAGS_EXTEND 0x1 #define LDML_KEYS_KEY_FLAGS_EXTEND 0x1 #define LDML_KEYS_KEY_FLAGS_GAP 0x2 -#define LDML_KEYS_KEY_FLAGS_NOTRANSFORM 0x4 #define LDML_KEYS_MOD_ALL 0x17F #define LDML_KEYS_MOD_ALT 0x40 #define LDML_KEYS_MOD_ALTL 0x4 @@ -58,7 +56,7 @@ #define LDML_LENGTH_FINL_ITEM 0x10 #define LDML_LENGTH_HEADER 0x8 #define LDML_LENGTH_KEYS 0x18 -#define LDML_LENGTH_KEYS_FLICK_ELEMENT 0xC +#define LDML_LENGTH_KEYS_FLICK_ELEMENT 0x8 #define LDML_LENGTH_KEYS_FLICK_LIST 0xC #define LDML_LENGTH_KEYS_KEY 0x24 #define LDML_LENGTH_KEYS_KMAP 0xC @@ -73,8 +71,6 @@ #define LDML_LENGTH_LOCA 0xC #define LDML_LENGTH_LOCA_ITEM 0x4 #define LDML_LENGTH_META 0x24 -#define LDML_LENGTH_NAME 0xC -#define LDML_LENGTH_NAME_ITEM 0x4 #define LDML_LENGTH_SECT 0x10 #define LDML_LENGTH_SECT_ITEM 0x8 #define LDML_LENGTH_STRS 0xC @@ -112,8 +108,6 @@ #define LDML_SECTIONNAME_LOCA "loca" #define LDML_SECTIONID_META 0x6174656D /* "meta" */ #define LDML_SECTIONNAME_META "meta" -#define LDML_SECTIONID_NAME 0x656D616E /* "name" */ -#define LDML_SECTIONNAME_NAME "name" #define LDML_SECTIONID_SECT 0x74636573 /* "sect" */ #define LDML_SECTIONNAME_SECT "sect" #define LDML_SECTIONID_STRS 0x73727473 /* "strs" */ diff --git a/core/include/ldml/keyman_core_ldml.ts b/core/include/ldml/keyman_core_ldml.ts index b404a05bcc..8edc0688db 100644 --- a/core/include/ldml/keyman_core_ldml.ts +++ b/core/include/ldml/keyman_core_ldml.ts @@ -33,7 +33,6 @@ export type SectionIdent = 'list' | 'loca' | 'meta' | - 'name' | 'strs' | 'tran' | 'uset' | @@ -312,7 +311,7 @@ class Constants { /** * Length of each item in the 'keys' flick elements sub-table */ - readonly length_keys_flick_element = 12; + readonly length_keys_flick_element = 8; /** * Length of each item in the 'keys.kmap' key map subtable */ @@ -328,16 +327,6 @@ class Constants { */ readonly keys_key_flags_gap = 0x00000002; - /** - * 1 if the key is transform=no - */ - readonly keys_key_flags_notransform = 0x00000004; - - /** - * 0 if to is a char, 1 if it is a string - */ - readonly keys_flick_flags_extend = 0x00000001; - /* ------------------------------------------------------------------ * layr section ------------------------------------------------------------------ */ @@ -404,32 +393,11 @@ class Constants { /** * length of the 'meta' section */ - readonly length_meta = 36; + readonly length_meta = 32; /** - * bitwise or value for fallback=omit in meta.settings + * bitwise or value for normalization=disabled in meta.settings */ - readonly meta_settings_fallback_omit = 1; - /** - * bitwise or value for transformFailure=omit in meta.settings - */ - readonly meta_settings_transformFailure_omit = 2; - /** - * bitwise or value for transformPartial=hide in meta.settings - */ - readonly meta_settings_transformPartial_hide = 4; - - /* ------------------------------------------------------------------ - * name section - ------------------------------------------------------------------ */ - - /** - * Minimum length of the 'name' section not including variable parts - */ - readonly length_name = 12; - /** - * Length of each item in the 'name' section variable part - */ - readonly length_name_item = 4; + readonly meta_settings_normalization_disabled = 1; /* ------------------------------------------------------------------ * strs section @@ -537,7 +505,6 @@ class Constants { list: 'list', loca: 'loca', meta: 'meta', - name: 'name', sect: 'sect', strs: 'strs', tran: 'tran', diff --git a/core/src/ldml/C7043_ldml.md b/core/src/ldml/C7043_ldml.md index f91b30c347..8714e01f02 100644 --- a/core/src/ldml/C7043_ldml.md +++ b/core/src/ldml/C7043_ldml.md @@ -137,40 +137,20 @@ locale IDs (starting at offset 16) are in sorted binary order. | 8 | 32 | author | str: Keyboard author | |12 | 32 | conform | str: CLDR 'conformsTo' version | |16 | 32 | layout | str: layout type | -|20 | 32 | normalization | str: normalization mode | +|20 | 32 | name | str: keyboard nme | |24 | 32 | indicator | str: indicator | -|28 | 32 | settings | int: keyboard settings | +|28 | 32 | version | str: keyboard version | +|32 | 32 | settings | int: keyboard settings | The `settings` is a 32-bit bitfield as below: | Bit position | Meaning | Description | |--------------|------------------|------------------------------| -| 0 | fallback | fallback=omit | -| 1 | transformFailure | transformFailure=omit | -| 2 | transformPartial | transformPartial=hide | +| 0 | normalization | normalization=disabled | ### C7043.2.8 `name`—Names -Defines the names of the keyboard as found in the source `` element. -While this section is optional in the binary format, in practice it will always -be present, as the source format requires at least one name. - -| ∆ | Bits | Name | Description | -|---|------|---------|------------------------------------------| -| 0 | 32 | ident | `name` | -| 4 | 32 | size | int: Length of section | -| 8 | 32 | count | int: Number of names | - -Note that `count` is always ≥1, as the source format requires at least one name. - -For each name in `count`: - -| ∆ | Bits | Name | Description | -|---|------|---------|------------------------------------------| -|16+| 32 | name | str: A name for the keyboard | - -Names are stored in source file order, and the semantic meaning of each name is -not defined here. +_Removed. See `meta.name`._ ### C7043.2.9 Removed: `ordr` @@ -290,23 +270,7 @@ For each reorder item: ### C7043.2.12 `vkey`—VKey Map -| ∆ | Bits | Name | Description | -|---|------|---------|------------------------------------------| -| 0 | 32 | ident | `vkey` | -| 4 | 32 | size | int: Length of section | -| 8 | 32 | count | int: Number of vkeys | - -The keys are sorted in binary order based on the `vkey` field. - -For each key: - -| ∆ | Bits | Name | Description | -|---|------|---------|------------------------------------------| -|16+| 32 | vkey | int: source vkey ID (0…255) | -|20+| 32 | target | int: target vkey ID (0…255) | - -- `vkey`: Is the standard vkey, 0-255 -- `target`: Is the target (resolved) vkey, 0-255. +_Removed._ ### C7043.2.13 `layr`—Layers list @@ -348,6 +312,9 @@ Layer lists are sorted by `hardware` string, then minDeviceWidth ascending. Each layer entry corresponds to one `` element There are `layerCount` total layer entries. +Note that comma-separated modifiers in the XML will result in duplicate `layers` entries. +For example, `id="abc" modifiers="none, shift caps"` will result in two `layers` elements, +both with `id="abc"`, but one with key flags of 0x0000 and one with keyflags of 0x0110. | ∆ | Bits | Name | Description | |---|------|------------|------------------------------------------------| @@ -427,9 +394,9 @@ For each key: | 8+| 32 | id | str: key id | |12+| 32 | switch | str: layer id to switch to | |16+| 32 | width | int: key width*10 (supports 0.1 as min width) | -|20+| 32 | longPress | list: index into `list` section with longPress list or 0 | -|24+| 32 | longPressDefault | str: default longpress target or 0 | -|28+| 32 | multiTap | list: index into `list` section with multiTap list or 0 | +|20+| 32 | longPress | list: index into `list` section with longPress key id list or 0 | +|24+| 32 | longPressDefault | str: default longpress key id or 0 | +|28+| 32 | multiTap | list: index into `list` section with multiTap key id list or 0 | |32+| 32 | flicks | int: index into `key2.flicks` subtable | - `id`: The original string id from XML. This may be 0 to save space (i.e. omit the string id). @@ -439,10 +406,10 @@ For each key: |--------------|-----------|---------------------------------------------| | 0 | extend | 0: `to` is a char, 1: `to` is a string | | 1 | gap | 1 if the key is a gap | -| 2 | transform | 1 if the key is transform=no | - `to`: If `extend` is 0, `to` is a UTF-32LE codepoint. If `extend` is 1, `to` is a 32 bit index into the `strs` table. The string may be zero-length. +- `longPress`, `longPressDefault`, and `multiTap` refer to key ids or lists of key ids in this same `key2.keys` subtable. #### `key2.flicks` flick list subtable @@ -466,20 +433,14 @@ For each flick element: | ∆ | Bits | Name | Description | |---|------|---------------- |----------------------------------------------------------| | 0+| 32 | directions | list: index into `list` section with direction list | -| 8+| 32 | flags | int: per-key flags | -|12+| 32 | to | str: output string, or ucs32: output char, see flags | +| 8+| 32 | keyId | str: id of key | If this section is present, it must have a 'flick element' at position zero with directions=0, flags=0, and to=0 meaning 'no flick'. There is not a 'null' flick element at the end of each list. -Elements are ordered by the `flicks.id`, and secondarily by the directions list id. +Elements are ordered by the `flicks.keyId`, and secondarily by the directions list id. -- `flags`: Flags is a 32-bit bitfield defined as below: - -| Bit position | Meaning | Description | -|--------------|-----------|---------------------------------------------| -| 0 | extend | 0: `to` is a char, 1: `to` is a string | #### `key2.kmap` key map subtable diff --git a/developer/src/kmc-ldml/src/compiler/compiler.ts b/developer/src/kmc-ldml/src/compiler/compiler.ts index c29aa9fa93..f5f27c0a39 100644 --- a/developer/src/kmc-ldml/src/compiler/compiler.ts +++ b/developer/src/kmc-ldml/src/compiler/compiler.ts @@ -7,7 +7,6 @@ import { KeysCompiler } from './keys.js'; import { LayrCompiler } from './layr.js'; import { LocaCompiler } from './loca.js'; import { MetaCompiler } from './meta.js'; -import { NameCompiler } from './name.js'; import { VarsCompiler } from './vars.js'; import { StrsCompiler, ElemCompiler, ListCompiler, UsetCompiler } from './empty-compiler.js'; @@ -35,7 +34,6 @@ export const SECTION_COMPILERS = [ LayrCompiler, LocaCompiler, MetaCompiler, - NameCompiler, TranCompiler, ]; diff --git a/developer/src/kmc-ldml/src/compiler/keymanweb-compiler.ts b/developer/src/kmc-ldml/src/compiler/keymanweb-compiler.ts index 542cbc7d8f..6869f1441e 100644 --- a/developer/src/kmc-ldml/src/compiler/keymanweb-compiler.ts +++ b/developer/src/kmc-ldml/src/compiler/keymanweb-compiler.ts @@ -73,7 +73,7 @@ export class LdmlKeyboardKeymanWebCompiler { // `${tab}${this.setupDebug()}${nl}` + ? we may use this for modifierBitmask in future // `${tab}this._v=(typeof keyman!="undefined"&&typeof keyman.version=="string")?parseInt(keyman.version,10):9;${nl}` + ? we probably don't need this, it's for back-compat `${tab}this.KI="${sName}";${nl}` + - `${tab}this.KN=${JSON.stringify(source.keyboard3.names.name[0])};${nl}` + + `${tab}this.KN=${JSON.stringify(source.keyboard3.info.name)};${nl}` + `${tab}this.KMINVER=${JSON.stringify(MINIMUM_KMW_VERSION)};${nl}` + `${tab}this.KV=${this.compileVisualKeyboard(source)};${nl}` + `${tab}this.KDU=${displayUnderlying ? '1' : '0'};${nl}` + diff --git a/developer/src/kmc-ldml/src/compiler/keys.ts b/developer/src/kmc-ldml/src/compiler/keys.ts index a09ebbf2b2..89e9f803b2 100644 --- a/developer/src/kmc-ldml/src/compiler/keys.ts +++ b/developer/src/kmc-ldml/src/compiler/keys.ts @@ -15,8 +15,8 @@ export class KeysCompiler extends SectionCompiler { keyboard: LDMLKeyboard.LKKeyboard, mt: MarkerTracker ): boolean { - keyboard.keys?.key?.forEach(({ to }) => - mt.add(MarkerUse.emit, MarkerParser.allReferences(to)) + keyboard.keys?.key?.forEach(({ output }) => + mt.add(MarkerUse.emit, MarkerParser.allReferences(output)) ); return true; } @@ -49,21 +49,21 @@ export class KeysCompiler extends SectionCompiler { const usedKeys = allUsedKeyIdsInLayers(this.keyboard3?.layers); const uniqueKeys = calculateUniqueKeys([...this.keyboard3.keys?.key]); for (let key of uniqueKeys) { - const { id, flicks } = key; + const { id, flickId } = key; if (!usedKeys.has(id)) { continue; // unused key, ignore } // TODO-LDML: further key-level validation here - if (!flicks) { + if (!flickId) { continue; // no flicks } - const flickEntry = this.keyboard3.keys?.flicks?.find( - (x) => x.id === flicks + const flickEntry = this.keyboard3?.flicks?.flick.find( + ({id}) => id === flickId ); if (!flickEntry) { valid = false; this.callbacks.reportMessage( - CompilerMessages.Error_MissingFlicks({ flicks, id }) + CompilerMessages.Error_MissingFlicks({ flickId, id }) ); } } @@ -123,29 +123,22 @@ export class KeysCompiler extends SectionCompiler { } public loadFlicks(sections: DependencySections, sect: Keys) { - for (let lkflicks of this.keyboard3.keys.flicks) { + for (let flick of this.keyboard3.flicks?.flick) { let flicks: KeysFlicks = new KeysFlicks( - sections.strs.allocString(lkflicks.id) + sections.strs.allocString(flick.id) ); - for (let lkflick of lkflicks.flick) { - let flags = 0; - const to = sections.strs.allocString(lkflick.to, { - stringVariables: true, markers: true, unescape: true, singleOk: true - }, sections); - if (!to.isOneChar) { - flags |= constants.keys_flick_flags_extend; - } - let directions: ListItem = sections.list.allocListFromSpaces( - lkflick.directions, + for (let {keyId, directions} of flick.flickSegment) { + const keyIdStr = sections.strs.allocString(keyId); + let directionsList: ListItem = sections.list.allocListFromSpaces( + directions, { stringVariables: true, markers: true, unescape: true }, sections); flicks.flicks.push({ - directions, - flags, - to, + directions: directionsList, + keyId: keyIdStr, }); } @@ -163,45 +156,30 @@ export class KeysCompiler extends SectionCompiler { continue; // unused key, skip } let flags = 0; - const flicks = key.flicks; - if (!!key.gap) { + const { flickId, gap, longPressDefaultKeyId, longPressKeyIds, multiTapKeyIds, layerId, output } = key; + if (!!gap) { flags |= constants.keys_key_flags_gap; } - if (key.transform === "no") { - flags |= constants.keys_key_flags_notransform; - } const id = sections.strs.allocString(key.id); const longPress: ListItem = sections.list.allocListFromSpaces( - key.longPress, { - stringVariables: true, - markers: true, - unescape: true, - }, + longPressKeyIds, {}, sections); - const longPressDefault = sections.strs.allocString(key.longPressDefault, - { - stringVariables: true, - markers: true, - unescape: true, - }, + const longPressDefault = sections.strs.allocString(longPressDefaultKeyId, + {}, sections); const multiTap: ListItem = sections.list.allocListFromSpaces( - key.multiTap, - { - stringVariables: true, - markers: true, - unescape: true, - }, + multiTapKeyIds, + {}, sections); - const keySwitch = sections.strs.allocString(key.switch); // 'switch' is a reserved word + const keySwitch = sections.strs.allocString(layerId); // 'switch' is a reserved word - const toRaw = key.to; + const toRaw = output; let toCooked = sections.vars.substituteStrings(toRaw, sections); toCooked = sections.vars.substituteMarkerString(toCooked); - const to = sections.strs.allocString(key.to, + const to = sections.strs.allocString(toCooked, { stringVariables: true, markers: true, @@ -215,7 +193,7 @@ export class KeysCompiler extends SectionCompiler { const width = Math.ceil((key.width || 1) * 10.0); // default, width=1 sect.keys.push({ flags, - flicks, + flicks: flickId, id, longPress, longPressDefault, @@ -260,10 +238,10 @@ export class KeysCompiler extends SectionCompiler { ) { let valid = true; - const { modifier } = layer; - if (!validModifier(modifier)) { + const { modifiers } = layer; + if (!validModifier(modifiers)) { this.callbacks.reportMessage( - CompilerMessages.Error_InvalidModifier({ modifier, layer: layer.id }) + CompilerMessages.Error_InvalidModifier({ modifiers, layer: layer.id }) ); valid = false; } @@ -301,7 +279,7 @@ export class KeysCompiler extends SectionCompiler { CompilerMessages.Error_RowOnHardwareLayerHasTooManyKeys({ row: y + 1, hardware, - modifier, + modifiers, }) ); valid = false; @@ -325,7 +303,7 @@ export class KeysCompiler extends SectionCompiler { valid = false; continue; } - if (!keydef.to && !keydef.gap && !keydef.switch) { + if (!keydef.output && !keydef.gap && !keydef.flickId) { this.callbacks.reportMessage( CompilerMessages.Error_KeyMissingToGapOrSwitch({ keyId: key }) ); diff --git a/developer/src/kmc-ldml/src/compiler/layr.ts b/developer/src/kmc-ldml/src/compiler/layr.ts index 0559c57f6d..8cacbb853f 100644 --- a/developer/src/kmc-ldml/src/compiler/layr.ts +++ b/developer/src/kmc-ldml/src/compiler/layr.ts @@ -38,10 +38,10 @@ export class LayrCompiler extends SectionCompiler { } } layers.layer.forEach((layer) => { - const { modifier, id } = layer; + const { modifiers, id } = layer; totalLayerCount++; - if (!validModifier(modifier)) { - this.callbacks.reportMessage(CompilerMessages.Error_InvalidModifier({ modifier, layer: id })); + if (!validModifier(modifiers)) { + this.callbacks.reportMessage(CompilerMessages.Error_InvalidModifier({ modifiers, layer: id })); valid = false; } }); diff --git a/developer/src/kmc-ldml/src/compiler/messages.ts b/developer/src/kmc-ldml/src/compiler/messages.ts index e22a9f6281..4f4d86f8ae 100644 --- a/developer/src/kmc-ldml/src/compiler/messages.ts +++ b/developer/src/kmc-ldml/src/compiler/messages.ts @@ -7,7 +7,7 @@ const SevError = CompilerErrorSeverity.Error | CompilerErrorNamespace.LdmlKeyboa const SevFatal = CompilerErrorSeverity.Fatal | CompilerErrorNamespace.LdmlKeyboardCompiler; export class CompilerMessages { - static Error_InvalidNormalization = (o:{form: string}) => m(this.ERROR_InvalidNormalization, `Invalid normalization form '${o.form}`); + static Error_InvalidNormalization = () => m(this.ERROR_InvalidNormalization, `normalization=disabled is not allowed.`); static ERROR_InvalidNormalization = SevError | 0x0001; static Error_InvalidLocale = (o:{tag: string}) => m(this.ERROR_InvalidLocale, `Invalid BCP 47 locale form '${o.tag}'`); @@ -16,7 +16,7 @@ export class CompilerMessages { static Error_HardwareLayerHasTooManyRows = () => m(this.ERROR_HardwareLayerHasTooManyRows, `'hardware' layer has too many rows`); static ERROR_HardwareLayerHasTooManyRows = SevError | 0x0003; - static Error_RowOnHardwareLayerHasTooManyKeys = (o:{row: number, hardware: string, modifier: string}) => m(this.ERROR_RowOnHardwareLayerHasTooManyKeys, `Row #${o.row} on 'hardware' ${o.hardware} layer for modifier ${o.modifier || 'none'} has too many keys`); + static Error_RowOnHardwareLayerHasTooManyKeys = (o:{row: number, hardware: string, modifiers: string}) => m(this.ERROR_RowOnHardwareLayerHasTooManyKeys, `Row #${o.row} on 'hardware' ${o.hardware} layer for modifier ${o.modifiers || 'none'} has too many keys`); static ERROR_RowOnHardwareLayerHasTooManyKeys = SevError | 0x0004; static Error_KeyNotFoundInKeyBag = (o:{keyId: string, col: number, row: number, layer: string, form: string}) => @@ -76,7 +76,7 @@ export class CompilerMessages { static ERROR_DisplayIsRepeated = SevError | 0x0010; static Error_KeyMissingToGapOrSwitch = (o:{keyId: string}) => - m(this.ERROR_KeyMissingToGapOrSwitch, `key id='${o.keyId}' must have either to=, gap=, or switch=.`); + m(this.ERROR_KeyMissingToGapOrSwitch, `key id='${o.keyId}' must have either output=, gap=, or layerId=.`); static ERROR_KeyMissingToGapOrSwitch = SevError | 0x0011; static Error_ExcessHardware = (o:{form: string}) => m(this.ERROR_ExcessHardware, @@ -87,12 +87,12 @@ export class CompilerMessages { `layers has invalid value form=${o.form}`); static ERROR_InvalidHardware = SevError | 0x0013; - static Error_InvalidModifier = (o:{layer: string, modifier: string}) => m(this.ERROR_InvalidModifier, - `layer has invalid modifier='${o.modifier}' on layer id=${o.layer}`); + static Error_InvalidModifier = (o:{layer: string, modifiers: string}) => m(this.ERROR_InvalidModifier, + `layer has invalid modifiers='${o.modifiers}' on layer id=${o.layer}`); static ERROR_InvalidModifier = SevError | 0x0014; - static Error_MissingFlicks = (o:{flicks: string, id: string}) => m(this.ERROR_MissingFlicks, - `key id=${o.id} refers to missing flicks=${o.flicks}`); + static Error_MissingFlicks = (o:{flickId: string, id: string}) => m(this.ERROR_MissingFlicks, + `key id=${o.id} refers to missing flickId=${o.flickId}`); static ERROR_MissingFlicks = SevError | 0x0015; static Error_DuplicateVariable = (o:{ids: string}) => m(this.ERROR_DuplicateVariable, diff --git a/developer/src/kmc-ldml/src/compiler/meta.ts b/developer/src/kmc-ldml/src/compiler/meta.ts index 187a2ca951..6c58370d55 100644 --- a/developer/src/kmc-ldml/src/compiler/meta.ts +++ b/developer/src/kmc-ldml/src/compiler/meta.ts @@ -1,14 +1,12 @@ import { constants } from "@keymanapp/ldml-keyboard-constants"; import { KMXPlus } from '@keymanapp/common-types'; -import { isValidEnumValue } from "../util/util.js"; import { CompilerMessages } from "./messages.js"; import { SectionCompiler } from "./section-compiler.js"; import semver from "semver"; import DependencySections = KMXPlus.DependencySections; import Meta = KMXPlus.Meta; -import Meta_NormalizationForm = KMXPlus.Meta_NormalizationForm; import KeyboardSettings = KMXPlus.KeyboardSettings; export class MetaCompiler extends SectionCompiler { @@ -20,7 +18,7 @@ export class MetaCompiler extends SectionCompiler { public validate(): boolean { let valid = true; - valid &&= this.validateNormalization(this.keyboard3.info?.normalization); + valid &&= this.validateNormalization(this.keyboard3.settings?.normalization); valid &&= this.validateVersion(this.keyboard3.version?.number); return valid; @@ -42,11 +40,9 @@ export class MetaCompiler extends SectionCompiler { } private validateNormalization(normalization?: string) { - if (normalization !== undefined) { - if (!isValidEnumValue(Meta_NormalizationForm, normalization)) { - this.callbacks.reportMessage(CompilerMessages.Error_InvalidNormalization({ form: normalization })); - return false; - } + if (normalization === 'disabled') { + this.callbacks.reportMessage(CompilerMessages.Error_InvalidNormalization()); + return false; } return true; } @@ -56,13 +52,11 @@ export class MetaCompiler extends SectionCompiler { result.author = sections.strs.allocString(this.keyboard3.info?.author); result.conform = sections.strs.allocString(this.keyboard3.conformsTo); result.layout = sections.strs.allocString(this.keyboard3.info?.layout); - result.normalization = sections.strs.allocString(this.keyboard3.info?.normalization); + result.name = sections.strs.allocString(this.keyboard3.info?.name); result.indicator = sections.strs.allocString(this.keyboard3.info?.indicator); result.version = sections.strs.allocString(this.keyboard3.version?.number ?? "0.0.0"); result.settings = - (this.keyboard3.settings?.fallback == "omit" ? KeyboardSettings.fallback : 0) | - (this.keyboard3.settings?.transformFailure == "omit" ? KeyboardSettings.transformFailure : 0) | - (this.keyboard3.settings?.transformPartial == "hide" ? KeyboardSettings.transformPartial : 0); + (this.keyboard3.settings?.normalization == "disabled" ? KeyboardSettings.normalizationDisabled : 0); return result; } } diff --git a/developer/src/kmc-ldml/src/compiler/metadata-compiler.ts b/developer/src/kmc-ldml/src/compiler/metadata-compiler.ts index 7aed16d545..35ebb2405f 100644 --- a/developer/src/kmc-ldml/src/compiler/metadata-compiler.ts +++ b/developer/src/kmc-ldml/src/compiler/metadata-compiler.ts @@ -26,7 +26,7 @@ export class KMXPlusMetadataCompiler { // TSS_NAME: User friendly name of keyboard keyboard.stores.push({ dpName: '&NAME', - dpString: kmxplus.name?.names?.[0]?.value ?? 'unknown', // Empty name should not happen, so ok to use 'unknown' here + dpString: kmxplus.meta?.name?.value ?? 'unknown', // Empty name should not happen, so ok to use 'unknown' here dwSystemID: KMXFile.TSS_NAME }); @@ -54,4 +54,4 @@ export class KMXPlusMetadataCompiler { }); } -} \ No newline at end of file +} diff --git a/developer/src/kmc-ldml/src/compiler/name.ts b/developer/src/kmc-ldml/src/compiler/name.ts deleted file mode 100644 index 138732ae30..0000000000 --- a/developer/src/kmc-ldml/src/compiler/name.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { constants } from "@keymanapp/ldml-keyboard-constants"; -import { KMXPlus } from '@keymanapp/common-types'; -import { SectionCompiler } from "./section-compiler.js"; - -import DependencySections = KMXPlus.DependencySections; -import Name = KMXPlus.Name; - -export class NameCompiler extends SectionCompiler { - - public get id() { - return constants.section.name; - } - - public validate(): boolean { - let valid = true; - valid = (this.keyboard3.names?.name?.length ?? 0) > 0; - return valid; - } - - public compile(sections: DependencySections): Name { - let result = new Name(); - result.names = this.keyboard3.names?.name?.map(v => sections.strs.allocString(v.value)) ?? []; - return result; - } -} diff --git a/developer/src/kmc-ldml/src/compiler/touch-layout-compiler.ts b/developer/src/kmc-ldml/src/compiler/touch-layout-compiler.ts index 19ac78f13c..6a2821c4cd 100644 --- a/developer/src/kmc-ldml/src/compiler/touch-layout-compiler.ts +++ b/developer/src/kmc-ldml/src/compiler/touch-layout-compiler.ts @@ -27,7 +27,7 @@ export class TouchLayoutCompiler { // TODO-LDML: consider consolidation with keys.ts? let fileLayer: TouchLayout.TouchLayoutLayer = { - id: this.translateLayerIdToTouchLayoutLayerId(layer.id, layer.modifier), + id: this.translateLayerIdToTouchLayoutLayerId(layer.id, layer.modifiers), row: [] }; @@ -45,7 +45,7 @@ export class TouchLayoutCompiler { if(keydef) { const fileKey: TouchLayout.TouchLayoutKey = { id: this.translateKeyIdentifierToTouch(keydef.id) as TouchLayout.TouchLayoutKeyId, - text: keydef.to || '', + text: keydef.output || '', // TODO-LDML: additional properties }; fileRow.key.push(fileKey); @@ -83,6 +83,10 @@ export class TouchLayoutCompiler { }; // canonicalize modifier string, alphabetical + // TODO-LDML: need to support multiple here + if (modifier.indexOf(',') !== -1) { + throw Error(`Internal error: TODO-LDML: multiple modifiers ${modifier} not yet supported.`); + } modifier = (modifier||'').split(/\b/).sort().join(' ').trim(); if(Object.hasOwn(map, modifier)) { diff --git a/developer/src/kmc-ldml/src/compiler/visual-keyboard-compiler.ts b/developer/src/kmc-ldml/src/compiler/visual-keyboard-compiler.ts index 1ad0a4ea1c..7a068181aa 100644 --- a/developer/src/kmc-ldml/src/compiler/visual-keyboard-compiler.ts +++ b/developer/src/kmc-ldml/src/compiler/visual-keyboard-compiler.ts @@ -56,7 +56,7 @@ export class LdmlKeyboardVisualKeyboardCompiler { vk.keys.push({ flags: VisualKeyboard.VisualKeyboardKeyFlags.kvkkUnicode, shift: shift, - text: keydef.to, // TODO-LDML: displays + text: keydef.output, // TODO-LDML: displays vkey: keymap[y][x], }); } diff --git a/developer/src/kmc-ldml/src/util/util.ts b/developer/src/kmc-ldml/src/util/util.ts index bfbd9eb47f..63eaa68a11 100644 --- a/developer/src/kmc-ldml/src/util/util.ts +++ b/developer/src/kmc-ldml/src/util/util.ts @@ -103,10 +103,14 @@ export function verifyValidAndUnique( * @returns modifier */ export function translateLayerAttrToModifier(layer: LDMLKeyboard.LKLayer) : number { - const { modifier } = layer; - if (modifier) { + const { modifiers } = layer; + if (modifiers) { + // TODO-LDML + if (modifiers.indexOf(',') !== -1) { + throw Error(`TODO-LDML #9838: ”,” in modifiers not supported yet.`); + } let mod = constants.keys_mod_none; - for (let str of modifier.split(' ')) { + for (let str of modifiers.split(' ')) { const submod = constants.keys_mod_map.get(str); mod |= submod; } @@ -122,9 +126,12 @@ export function translateLayerAttrToModifier(layer: LDMLKeyboard.LKLayer) : numb */ export function validModifier(modifier?: string) : boolean { if (!modifier) return true; // valid to have no modifier, == none - for (let str of modifier.split(' ')) { - if (!constants.keys_mod_map.has(str)) { - return false; + // TODO-LDML: enforce illegal combinations per spec. + for (let sub of modifier.split(',')) { + for (let str of sub.split(' ')) { + if (!constants.keys_mod_map.has(str)) { + return false; + } } } return true; diff --git a/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml b/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml index 35e60b0416..36351deecc 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml @@ -3,6 +3,6 @@ - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/meta/maximal.xml b/developer/src/kmc-ldml/test/fixtures/sections/meta/maximal.xml index d1e5bf3e22..ab22d5a140 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/meta/maximal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/meta/maximal.xml @@ -1,12 +1,9 @@ - - - - > + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/name/minimal.xml b/developer/src/kmc-ldml/test/fixtures/sections/name/minimal.xml deleted file mode 100644 index bc3277a312..0000000000 --- a/developer/src/kmc-ldml/test/fixtures/sections/name/minimal.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/developer/src/kmc-ldml/test/fixtures/sections/name/multiple.xml b/developer/src/kmc-ldml/test/fixtures/sections/name/multiple.xml deleted file mode 100644 index 8f4fd6d72f..0000000000 --- a/developer/src/kmc-ldml/test/fixtures/sections/name/multiple.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/developer/src/kmc-ldml/test/test-keys.ts b/developer/src/kmc-ldml/test/test-keys.ts index 5a085a0d0f..1e97866d57 100644 --- a/developer/src/kmc-ldml/test/test-keys.ts +++ b/developer/src/kmc-ldml/test/test-keys.ts @@ -57,11 +57,11 @@ describe('keys', function () { const [flick0_nw_se] = flick0.flicks.filter(({ directions }) => directions && directions.isEqual('nw se'.split(' '))); assert.ok(flick0_nw_se); - assert.equal(flick0_nw_se.to?.value, 'ç'); + assert.equal(flick0_nw_se.keyId?.value, 'ç'); const [flick0_ne_sw] = flick0.flicks.filter(({ directions }) => directions && directions.isEqual('ne sw'.split(' '))); assert.ok(flick0_ne_sw); - assert.equal(flick0_ne_sw.to?.value, 'ê'); // via variable + assert.equal(flick0_ne_sw.keyId?.value, 'ê'); // via variable }, }, { @@ -87,11 +87,11 @@ describe('keys', function () { const [flick0_nw_se] = flick0.flicks.filter(({ directions }) => directions && directions.isEqual('nw se'.split(' '))); assert.ok(flick0_nw_se); - assert.equal(flick0_nw_se.to?.value, 'ç'); + assert.equal(flick0_nw_se.keyId?.value, 'ç'); const [flick0_ne_sw] = flick0.flicks.filter(({ directions }) => directions && directions.isEqual('ne sw'.split(' '))); assert.ok(flick0_ne_sw); - assert.equal(flick0_ne_sw.to?.value, 'ế'); + assert.equal(flick0_ne_sw.keyId?.value, 'ế'); }, }, { @@ -137,7 +137,7 @@ describe('keys', function () { assert.equal(ww.multiTap[0].value.value, MARKER_1); const [flickw] = keys.flicks?.filter(({id}) => id.value === 'flickw'); assert.ok(flickw); - assert.equal(flickw.flicks[0].to.value, MARKER_1); + assert.equal(flickw.flicks[0].keyId.value, MARKER_1); }, }, ]); @@ -236,13 +236,13 @@ describe('keys.kmap', function () { { subpath: 'sections/keys/invalid-bad-modifier.xml', errors: [ - CompilerMessages.Error_InvalidModifier({layer:'base',modifier:'altR-shift'}), + CompilerMessages.Error_InvalidModifier({layer:'base',modifiers:'altR-shift'}), ] }, { subpath: 'sections/keys/invalid-missing-flick.xml', errors: [ - CompilerMessages.Error_MissingFlicks({flicks:'an-undefined-flick-id',id:'Q'}), + CompilerMessages.Error_MissingFlicks({flickId:'an-undefined-flick-id',id:'Q'}), ] }, { @@ -344,7 +344,7 @@ describe('keys.kmap', function () { assert.isNull(keys); assert.equal(compilerTestCallbacks.messages.length, 1); - assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_RowOnHardwareLayerHasTooManyKeys({row: 1, hardware: 'us', modifier: 'none'})); + assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_RowOnHardwareLayerHasTooManyKeys({row: 1, hardware: 'us', modifiers: 'none'})); }); it('should reject layouts with undefined keys', async function() { diff --git a/developer/src/kmc-ldml/test/test-layr.ts b/developer/src/kmc-ldml/test/test-layr.ts index 126935c33b..42b686c743 100644 --- a/developer/src/kmc-ldml/test/test-layr.ts +++ b/developer/src/kmc-ldml/test/test-layr.ts @@ -97,7 +97,7 @@ describe('layr', function () { errors: [ CompilerMessages.Error_InvalidModifier({ layer: 'base', - modifier: 'altR-shift' + modifiers: 'altR-shift' }), ], }, diff --git a/developer/src/kmc-ldml/test/test-meta.ts b/developer/src/kmc-ldml/test/test-meta.ts index a5f5939a67..c6c197baec 100644 --- a/developer/src/kmc-ldml/test/test-meta.ts +++ b/developer/src/kmc-ldml/test/test-meta.ts @@ -18,9 +18,9 @@ describe('meta', function () { assert.isEmpty(meta.author.value); // TODO-LDML: default author string "unknown"? assert.equal(meta.conform.value, 'techpreview'); assert.isEmpty(meta.layout.value); // TODO-LDML: assumed layout? - assert.isEmpty(meta.normalization.value); // TODO-LDML: assumed normalization? assert.isEmpty(meta.indicator.value); // TODO-LDML: synthesize an indicator? assert.equal(meta.settings, KeyboardSettings.none); + assert.equal(meta.name?.value, "meta-minimal"); }); it('should compile maximal metadata', async function() { @@ -30,17 +30,16 @@ describe('meta', function () { assert.equal(meta.author.value, 'The Keyman Team'); assert.equal(meta.conform.value, 'techpreview'); assert.equal(meta.layout.value, 'QWIRKY'); - assert.equal(meta.normalization.value, 'NFC'); assert.equal(meta.indicator.value, 'QW'); assert.equal(meta.version.value, "1.2.3"); - assert.equal(meta.settings, KeyboardSettings.fallback); + assert.equal(meta.settings, KeyboardSettings.none); }); it('should reject invalid normalization', async function() { let meta = await loadSectionFixture(MetaCompiler, 'sections/meta/invalid-normalization.xml', compilerTestCallbacks) as Meta; assert.isNull(meta); assert.equal(compilerTestCallbacks.messages.length, 1); - assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_InvalidNormalization({form:'NFQ'})); + assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_InvalidNormalization()); }); it('should reject invalid version', async function() { diff --git a/developer/src/kmc-ldml/test/test-name.ts b/developer/src/kmc-ldml/test/test-name.ts deleted file mode 100644 index 47bf1a2936..0000000000 --- a/developer/src/kmc-ldml/test/test-name.ts +++ /dev/null @@ -1,34 +0,0 @@ -import 'mocha'; -import { assert } from 'chai'; -import { NameCompiler } from '../src/compiler/name.js'; -import { compilerTestCallbacks, loadSectionFixture } from './helpers/index.js'; -import { KMXPlus } from '@keymanapp/common-types'; - -import Name = KMXPlus.Name; - -describe('name', function () { - this.slow(500); // 0.5 sec -- json schema validation takes a while - - it('should compile minimal name data', async function() { - let name = await loadSectionFixture(NameCompiler, 'sections/name/minimal.xml', compilerTestCallbacks) as Name; - assert.equal(compilerTestCallbacks.messages.length, 0); - - assert.equal(name.names.length, 1); - assert.equal(name.names[0].value, 'My First Keyboard'); - }); - - it('should compile multiple names', async function() { - let name = await loadSectionFixture(NameCompiler, 'sections/name/multiple.xml', compilerTestCallbacks) as Name; - assert.equal(compilerTestCallbacks.messages.length, 0); - - assert.equal(name.names.length, 5); - assert.equal(name.names[0].value, 'My Second Keyboard'); - assert.equal(name.names[1].value, 'My 2nd Keyboard'); - assert.equal(name.names[2].value, 'win:kbd2'); - assert.equal(name.names[3].value, 'mac:keybd_2'); - assert.equal(name.names[4].value, 'web:keyboard-2'); - }); - - //TODO-LDML: should we be linting on repeated names? -}); - diff --git a/developer/src/kmc-ldml/test/test-utils.ts b/developer/src/kmc-ldml/test/test-utils.ts index b4ef73cff6..627a820e91 100644 --- a/developer/src/kmc-ldml/test/test-utils.ts +++ b/developer/src/kmc-ldml/test/test-utils.ts @@ -50,13 +50,13 @@ describe('test of util/util.ts', () => { }); it('should handle some real cases', () => { assert.sameDeepMembers(calculateUniqueKeys([ - { id: 'a', to: 'a' }, - { id: 'a', to: 'a' }, // dup - { id: 'b', to: 'b' }, - { id: 'a', to: 'å' }, // override + { id: 'a', output: 'a' }, + { id: 'a', output: 'a' }, // dup + { id: 'b', output: 'b' }, + { id: 'a', output: 'å' }, // override ]),[ - { id: 'b', to: 'b' }, - { id: 'a', to: 'å' }, + { id: 'b', output: 'b' }, + { id: 'a', output: 'å' }, ]); }); }); @@ -105,30 +105,30 @@ describe('test of util/util.ts', () => { }), constants.keys_mod_none); assert.equal(translateLayerAttrToModifier({ id: 'base', - modifier: '', + modifiers: '', }), constants.keys_mod_none); assert.equal(translateLayerAttrToModifier({ id: 'base', - modifier: 'none', + modifiers: 'none', }), constants.keys_mod_none); assert.equal(translateLayerAttrToModifier({ id: 'shift', - modifier: 'shift', + modifiers: 'shift', }), constants.keys_mod_shift); assert.equal(translateLayerAttrToModifier({ id: 'shift', - modifier: 'shift', + modifiers: 'shift', }), constants.keys_mod_shift); assert.equal(translateLayerAttrToModifier({ id: 'altshift', - modifier: 'alt shift', + modifiers: 'alt shift', }), constants.keys_mod_alt | constants.keys_mod_shift); }); it('should round trip each possible modifier', () => { for(let str of constants.keys_mod_map.keys()) { const layer : LDMLKeyboard.LKLayer = { id: str, - modifier: `${str}`, + modifiers: `${str}`, }; assert.equal(translateLayerAttrToModifier(layer), constants.keys_mod_map.get(str), str); @@ -138,7 +138,7 @@ describe('test of util/util.ts', () => { for(let str of constants.keys_mod_map.keys()) { const layer : LDMLKeyboard.LKLayer = { id: str, - modifier: `${str} altL`, + modifiers: `${str} altL`, }; assert.equal(translateLayerAttrToModifier(layer), constants.keys_mod_map.get(str) | constants.keys_mod_altL, str); From a9f437f97a059fc30ebcd1a7dc7da9f4ceae5969 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Tue, 24 Oct 2023 17:40:34 -0500 Subject: [PATCH 05/12] =?UTF-8?q?chore(common,developer):=20ldml=20update?= =?UTF-8?q?=20to=20prefinal=20v44=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - more data and developer fixes For feat(developer): ldml re-sync with CLDR v44 spec 🙀 #9838 --- .../src/ldml-keyboard/ldml-keyboard-xml.ts | 4 +-- developer/src/kmc-ldml/src/compiler/disp.ts | 30 +++++++++---------- .../src/kmc-ldml/src/compiler/messages.ts | 22 +++++++------- .../src/kmc-ldml/test/fixtures/basic.xml | 2 +- developer/src/kmc-ldml/test/test-disp.ts | 8 ++--- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts index 87f0b0515d..9d4a8e3a8d 100644 --- a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts +++ b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts @@ -168,9 +168,9 @@ export interface LKDisplayOptions { }; export interface LKDisplay { - to?: string; + output?: string; display?: string; - id?: string; + keyId?: string; }; export interface LKDisplays { diff --git a/developer/src/kmc-ldml/src/compiler/disp.ts b/developer/src/kmc-ldml/src/compiler/disp.ts index ade215b1fa..b5389103c1 100644 --- a/developer/src/kmc-ldml/src/compiler/disp.ts +++ b/developer/src/kmc-ldml/src/compiler/disp.ts @@ -11,8 +11,8 @@ import { MarkerTracker, MarkerUse } from "./marker-tracker.js"; export class DispCompiler extends SectionCompiler { static validateMarkers(keyboard: LDMLKeyboard.LKKeyboard, mt : MarkerTracker): boolean { - keyboard.displays?.display?.forEach(({ to }) => - mt.add(MarkerUse.match, MarkerParser.allReferences(to))); + keyboard.displays?.display?.forEach(({ output }) => + mt.add(MarkerUse.match, MarkerParser.allReferences(output))); // no marker references in 'id' return true; } @@ -28,23 +28,23 @@ export class DispCompiler extends SectionCompiler { const ids = new Set(); if (this.keyboard3.displays?.display) { - for (const { to, id } of this.keyboard3.displays?.display) { - if ((to && id) || (!to && !id)) { - this.callbacks.reportMessage(CompilerMessages.Error_DisplayNeedsToOrId({ to, id })); + for (const { output, keyId } of this.keyboard3.displays?.display) { + if ((output && keyId) || (!output && !keyId)) { + this.callbacks.reportMessage(CompilerMessages.Error_DisplayNeedsToOrId({ output, keyId })); return false; - } else if (to) { - if (tos.has(to)) { - this.callbacks.reportMessage(CompilerMessages.Error_DisplayIsRepeated({ to })); + } else if (output) { + if (tos.has(output)) { + this.callbacks.reportMessage(CompilerMessages.Error_DisplayIsRepeated({ output })); return false; } else { - tos.add(to); + tos.add(output); } - } else if (id) { - if (ids.has(id)) { - this.callbacks.reportMessage(CompilerMessages.Error_DisplayIsRepeated({ id })); + } else if (keyId) { + if (ids.has(keyId)) { + this.callbacks.reportMessage(CompilerMessages.Error_DisplayIsRepeated({ keyId })); return false; } else { - ids.add(id); + ids.add(keyId); } } } @@ -61,12 +61,12 @@ export class DispCompiler extends SectionCompiler { // displays result.disps = this.keyboard3.displays?.display.map(display => ({ - to: sections.strs.allocString(display.to, { + to: sections.strs.allocString(display.output, { stringVariables: true, markers: true, unescape: true, }, sections), - id: sections.strs.allocString(display.id), // not escaped, not substituted + id: sections.strs.allocString(display.keyId), // not escaped, not substituted display: sections.strs.allocString(display.display, { stringVariables: true, unescape: true, diff --git a/developer/src/kmc-ldml/src/compiler/messages.ts b/developer/src/kmc-ldml/src/compiler/messages.ts index 4f4d86f8ae..182bf1a84b 100644 --- a/developer/src/kmc-ldml/src/compiler/messages.ts +++ b/developer/src/kmc-ldml/src/compiler/messages.ts @@ -59,20 +59,20 @@ export class CompilerMessages { static FATAL_SectionCompilerFailed = SevFatal | 0x000F; /** annotate the to= or id= entry */ - private static toOrId(o:{to?: string, id?: string}) { - if (o.to && o.id) { - return `to='${o.to}' id='${o.id}'`; - } else if(o.id) { - return `id='${o.id}'`; - } else if (o.to) { - return `to='${o.to}'`; + private static outputOrKeyId(o:{output?: string, keyId?: string}) { + if (o.output && o.keyId) { + return `to='${o.output}' id='${o.keyId}'`; + } else if(o.keyId) { + return `id='${o.keyId}'`; + } else if (o.output) { + return `to='${o.output}'`; } else { return ''; } } - static Error_DisplayIsRepeated = (o:{to?: string, id?: string}) => - m(this.ERROR_DisplayIsRepeated, `display ${CompilerMessages.toOrId(o)} has more than one display entry.`); + static Error_DisplayIsRepeated = (o:{output?: string, keyId?: string}) => + m(this.ERROR_DisplayIsRepeated, `display ${CompilerMessages.outputOrKeyId(o)} has more than one display entry.`); static ERROR_DisplayIsRepeated = SevError | 0x0010; static Error_KeyMissingToGapOrSwitch = (o:{keyId: string}) => @@ -140,8 +140,8 @@ export class CompilerMessages { m(this.ERROR_MissingMarkers, `Markers used for matching but not defined: ${o.ids?.join(',')}`); static ERROR_MissingMarkers = SevError | 0x0021; - static Error_DisplayNeedsToOrId = (o:{to?: string, id?: string}) => - m(this.ERROR_DisplayNeedsToOrId, `display ${CompilerMessages.toOrId(o)} needs to= or id=, but not both`); + static Error_DisplayNeedsToOrId = (o:{output?: string, keyId?: string}) => + m(this.ERROR_DisplayNeedsToOrId, `display ${CompilerMessages.outputOrKeyId(o)} needs output= or keyId=, but not both`); static ERROR_DisplayNeedsToOrId = SevError | 0x0022; } diff --git a/developer/src/kmc-ldml/test/fixtures/basic.xml b/developer/src/kmc-ldml/test/fixtures/basic.xml index ea796e9653..382e2cf3a9 100644 --- a/developer/src/kmc-ldml/test/fixtures/basic.xml +++ b/developer/src/kmc-ldml/test/fixtures/basic.xml @@ -18,7 +18,7 @@ - + diff --git a/developer/src/kmc-ldml/test/test-disp.ts b/developer/src/kmc-ldml/test/test-disp.ts index 74c14c8c1c..fa4cd24a9c 100644 --- a/developer/src/kmc-ldml/test/test-disp.ts +++ b/developer/src/kmc-ldml/test/test-disp.ts @@ -19,7 +19,7 @@ describe('disp', function () { }); it('should compile typical disp', async function() { let disp = await loadSectionFixture(DispCompiler, 'sections/disp/typical.xml', compilerTestCallbacks) as Disp; - assert.equal(compilerTestCallbacks.messages.length, 0); + assert.equal(compilerTestCallbacks.messages, []); assert.ok(disp?.disps); assert.equal(disp.disps.length, 1); @@ -61,13 +61,13 @@ describe('disp', function () { let disp = await loadSectionFixture(DispCompiler, 'sections/disp/invalid-dupto.xml', compilerTestCallbacks) as Disp; assert.isNull(disp); assert.equal(compilerTestCallbacks.messages.length, 1); - assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_DisplayIsRepeated({to:'e'})); + assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_DisplayIsRepeated({output:'e'})); }); it('should reject duplicate ids', async function() { let disp = await loadSectionFixture(DispCompiler, 'sections/disp/invalid-dupid.xml', compilerTestCallbacks) as Disp; assert.isNull(disp); assert.equal(compilerTestCallbacks.messages.length, 1); - assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_DisplayIsRepeated({id:'e'})); + assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_DisplayIsRepeated({output:'e'})); }); it('should reject if neither to nor id', async function() { let disp = await loadSectionFixture(DispCompiler, 'sections/disp/invalid-none.xml', compilerTestCallbacks) as Disp; @@ -79,7 +79,7 @@ describe('disp', function () { let disp = await loadSectionFixture(DispCompiler, 'sections/disp/invalid-both.xml', compilerTestCallbacks) as Disp; assert.isNull(disp); assert.equal(compilerTestCallbacks.messages.length, 1); - assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_DisplayNeedsToOrId({ to: 'e', id: 'e' })); + assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_DisplayNeedsToOrId({ output: 'e', keyId: 'e' })); }); }); From 6da64553fc5d74feaeafb8fc2170f21231c0ad25 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Wed, 25 Oct 2023 08:56:55 -0500 Subject: [PATCH 06/12] =?UTF-8?q?chore(developer):=20ldml=20update=20to=20?= =?UTF-8?q?prefinal=20v44=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - form For feat(developer): ldml re-sync with CLDR v44 spec 🙀 #9838 --- .../types/src/ldml-keyboard/ldml-keyboard-xml.ts | 2 +- developer/src/kmc-ldml/src/compiler/keys.ts | 10 +++++----- developer/src/kmc-ldml/src/compiler/layr.ts | 8 ++++---- developer/src/kmc-ldml/src/compiler/messages.ts | 14 +++++++------- .../src/compiler/visual-keyboard-compiler.ts | 4 ++-- developer/src/kmc-ldml/test/test-keys.ts | 2 +- developer/src/kmc-ldml/test/test-layr.ts | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts index 9d4a8e3a8d..abde61c428 100644 --- a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts +++ b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml.ts @@ -103,7 +103,7 @@ export interface LKLayers { /** * `touch`, or hardware `us`, `iso`, `jis`, `abnt2` */ - form?: string; + formId?: string; /** * Minimum width in millimeters */ diff --git a/developer/src/kmc-ldml/src/compiler/keys.ts b/developer/src/kmc-ldml/src/compiler/keys.ts index 89e9f803b2..4c7132ee19 100644 --- a/developer/src/kmc-ldml/src/compiler/keys.ts +++ b/developer/src/kmc-ldml/src/compiler/keys.ts @@ -30,7 +30,7 @@ export class KeysCompiler extends SectionCompiler { * @returns just the non-touch layers. */ public hardwareLayers() { - return this.keyboard3.layers?.filter(({ form }) => form !== "touch"); + return this.keyboard3.layers?.filter(({ formId }) => formId !== "touch"); } public validate() { @@ -78,7 +78,7 @@ export class KeysCompiler extends SectionCompiler { for (let layers of hardwareLayers) { for (let layer of layers.layer) { valid = - this.validateHardwareLayerForKmap(layers.form, layer) && valid; // note: always validate even if previously invalid results found + this.validateHardwareLayerForKmap(layers.formId, layer) && valid; // note: always validate even if previously invalid results found } } // TODO-LDML: } else { touch? @@ -113,9 +113,9 @@ export class KeysCompiler extends SectionCompiler { ); } else if (hardwareLayers.length === 1) { const theLayers = hardwareLayers[0]; - const { form } = theLayers; + const { formId } = theLayers; for (let layer of theLayers.layer) { - this.compileHardwareLayerToKmap(sections, layer, sect, form); + this.compileHardwareLayerToKmap(sections, layer, sect, formId); } } // else: TODO-LDML do nothing if only touch layers @@ -250,7 +250,7 @@ export class KeysCompiler extends SectionCompiler { const keymap = this.getKeymapFromForm(hardware, badScans); if (!keymap) { this.callbacks.reportMessage( - CompilerMessages.Error_InvalidHardware({ form: hardware }) + CompilerMessages.Error_InvalidHardware({ formId: hardware }) ); valid = false; return valid; diff --git a/developer/src/kmc-ldml/src/compiler/layr.ts b/developer/src/kmc-ldml/src/compiler/layr.ts index 8cacbb853f..6b1aa6d028 100644 --- a/developer/src/kmc-ldml/src/compiler/layr.ts +++ b/developer/src/kmc-ldml/src/compiler/layr.ts @@ -23,8 +23,8 @@ export class LayrCompiler extends SectionCompiler { let hardwareLayers = 0; // let touchLayers = 0; this.keyboard3.layers?.forEach((layers) => { - const { form } = layers; - if (form === 'touch') { + const { formId } = layers; + if (formId === 'touch') { // touchLayers++; // multiple touch layers are OK totalLayerCount += layers.layer?.length; @@ -34,7 +34,7 @@ export class LayrCompiler extends SectionCompiler { hardwareLayers++; if (hardwareLayers > 1) { valid = false; - this.callbacks.reportMessage(CompilerMessages.Error_ExcessHardware({form})); + this.callbacks.reportMessage(CompilerMessages.Error_ExcessHardware({formId})); } } layers.layer.forEach((layer) => { @@ -58,7 +58,7 @@ export class LayrCompiler extends SectionCompiler { const sect = new Layr(); sect.lists = this.keyboard3.layers.map((layers) => { - const hardware = sections.strs.allocString(layers.form); + const hardware = sections.strs.allocString(layers.formId); // Already validated in validate const list: LayrList = { hardware, diff --git a/developer/src/kmc-ldml/src/compiler/messages.ts b/developer/src/kmc-ldml/src/compiler/messages.ts index 182bf1a84b..2f3a007495 100644 --- a/developer/src/kmc-ldml/src/compiler/messages.ts +++ b/developer/src/kmc-ldml/src/compiler/messages.ts @@ -61,11 +61,11 @@ export class CompilerMessages { /** annotate the to= or id= entry */ private static outputOrKeyId(o:{output?: string, keyId?: string}) { if (o.output && o.keyId) { - return `to='${o.output}' id='${o.keyId}'`; + return `output='${o.output}' keyId='${o.keyId}'`; } else if(o.keyId) { - return `id='${o.keyId}'`; + return `keyId='${o.keyId}'`; } else if (o.output) { - return `to='${o.output}'`; + return `output='${o.output}'`; } else { return ''; } @@ -79,12 +79,12 @@ export class CompilerMessages { m(this.ERROR_KeyMissingToGapOrSwitch, `key id='${o.keyId}' must have either output=, gap=, or layerId=.`); static ERROR_KeyMissingToGapOrSwitch = SevError | 0x0011; - static Error_ExcessHardware = (o:{form: string}) => m(this.ERROR_ExcessHardware, - `layers form=${o.form}: Can only have one non-'touch' element`); + static Error_ExcessHardware = (o:{formId: string}) => m(this.ERROR_ExcessHardware, + `layers formId=${o.formId}: Can only have one non-'touch' element`); static ERROR_ExcessHardware = SevError | 0x0012; - static Error_InvalidHardware = (o:{form: string}) => m(this.ERROR_InvalidHardware, - `layers has invalid value form=${o.form}`); + static Error_InvalidHardware = (o:{formId: string}) => m(this.ERROR_InvalidHardware, + `layers has invalid value formId=${o.formId}`); static ERROR_InvalidHardware = SevError | 0x0013; static Error_InvalidModifier = (o:{layer: string, modifiers: string}) => m(this.ERROR_InvalidModifier, diff --git a/developer/src/kmc-ldml/src/compiler/visual-keyboard-compiler.ts b/developer/src/kmc-ldml/src/compiler/visual-keyboard-compiler.ts index 7a068181aa..2db9da2b53 100644 --- a/developer/src/kmc-ldml/src/compiler/visual-keyboard-compiler.ts +++ b/developer/src/kmc-ldml/src/compiler/visual-keyboard-compiler.ts @@ -15,9 +15,9 @@ export class LdmlKeyboardVisualKeyboardCompiler { result.header.unicodeFont = {...VisualKeyboard.DEFAULT_KVK_FONT}; for(let layers of source.keyboard3.layers) { - const hardware = layers.form; + const { formId } = layers; for(let layer of layers.layer) { - this.compileHardwareLayer(source, result, layer, hardware); + this.compileHardwareLayer(source, result, layer, formId); } } return result; diff --git a/developer/src/kmc-ldml/test/test-keys.ts b/developer/src/kmc-ldml/test/test-keys.ts index 1e97866d57..bcb5e673bd 100644 --- a/developer/src/kmc-ldml/test/test-keys.ts +++ b/developer/src/kmc-ldml/test/test-keys.ts @@ -248,7 +248,7 @@ describe('keys.kmap', function () { { subpath: 'sections/layr/invalid-invalid-form.xml', errors: [CompilerMessages.Error_InvalidHardware({ - form: 'holographic', + formId: 'holographic', }),], }, { diff --git a/developer/src/kmc-ldml/test/test-layr.ts b/developer/src/kmc-ldml/test/test-layr.ts index 42b686c743..62b03b1eea 100644 --- a/developer/src/kmc-ldml/test/test-layr.ts +++ b/developer/src/kmc-ldml/test/test-layr.ts @@ -103,7 +103,7 @@ describe('layr', function () { }, { subpath: 'sections/layr/invalid-multi-hardware.xml', - errors: [CompilerMessages.Error_ExcessHardware({ form: 'iso' })], + errors: [CompilerMessages.Error_ExcessHardware({ formId: 'iso' })], }, { // missing layer element From a8e2be5e9ec5c9a7f4fccd55ef07718ffb109468 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Wed, 25 Oct 2023 15:40:24 -0500 Subject: [PATCH 07/12] =?UTF-8?q?chore(developer):=20ldml=20update=20to=20?= =?UTF-8?q?prefinal=20v44=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - more tweaks For feat(developer): ldml re-sync with CLDR v44 spec 🙀 #9838 --- core/include/ldml/keyman_core_ldml.h | 4 +- core/include/ldml/keyman_core_ldml.ts | 2 +- developer/src/kmc-ldml/src/compiler/keys.ts | 41 ++++++++++--------- .../src/compiler/touch-layout-compiler.ts | 3 ++ developer/src/kmc-ldml/test/fixtures/basic.js | 2 +- .../src/kmc-ldml/test/fixtures/basic.xml | 1 + .../fixtures/sections/disp/invalid-both.xml | 2 +- .../test/fixtures/sections/keys/escaped.xml | 26 +++++++----- .../sections/keys/invalid-missing-flick.xml | 16 ++++---- .../test/fixtures/sections/keys/markers.xml | 14 +++++-- .../test/fixtures/sections/keys/maximal.xml | 26 +++++++++--- developer/src/kmc-ldml/test/test-disp.ts | 8 ++-- 12 files changed, 88 insertions(+), 57 deletions(-) diff --git a/core/include/ldml/keyman_core_ldml.h b/core/include/ldml/keyman_core_ldml.h index a8e9576e18..3733442862 100644 --- a/core/include/ldml/keyman_core_ldml.h +++ b/core/include/ldml/keyman_core_ldml.h @@ -89,9 +89,7 @@ #define LDML_MARKER_MAX_COUNT 0xD7FE #define LDML_MARKER_MAX_INDEX 0xD7FE #define LDML_MARKER_MIN_INDEX 0x1 -#define LDML_META_SETTINGS_FALLBACK_OMIT 0x1 -#define LDML_META_SETTINGS_TRANSFORMFAILURE_OMIT 0x2 -#define LDML_META_SETTINGS_TRANSFORMPARTIAL_HIDE 0x4 +#define LDML_META_SETTINGS_NORMALIZATION_DISABLED 0x1 #define LDML_SECTIONID_BKSP 0x70736B62 /* "bksp" */ #define LDML_SECTIONNAME_BKSP "bksp" #define LDML_SECTIONID_DISP 0x70736964 /* "disp" */ diff --git a/core/include/ldml/keyman_core_ldml.ts b/core/include/ldml/keyman_core_ldml.ts index 8edc0688db..9b76549074 100644 --- a/core/include/ldml/keyman_core_ldml.ts +++ b/core/include/ldml/keyman_core_ldml.ts @@ -393,7 +393,7 @@ class Constants { /** * length of the 'meta' section */ - readonly length_meta = 32; + readonly length_meta = 36; /** * bitwise or value for normalization=disabled in meta.settings */ diff --git a/developer/src/kmc-ldml/src/compiler/keys.ts b/developer/src/kmc-ldml/src/compiler/keys.ts index 4c7132ee19..b9c41ef4c3 100644 --- a/developer/src/kmc-ldml/src/compiler/keys.ts +++ b/developer/src/kmc-ldml/src/compiler/keys.ts @@ -123,26 +123,29 @@ export class KeysCompiler extends SectionCompiler { } public loadFlicks(sections: DependencySections, sect: Keys) { - for (let flick of this.keyboard3.flicks?.flick) { - let flicks: KeysFlicks = new KeysFlicks( - sections.strs.allocString(flick.id) - ); + if (this.keyboard3?.flicks?.flick) { + for (let flick of this.keyboard3?.flicks?.flick) { + const { id } = flick; + let flicks: KeysFlicks = new KeysFlicks( + sections.strs.allocString(id) + ); - for (let {keyId, directions} of flick.flickSegment) { - const keyIdStr = sections.strs.allocString(keyId); - let directionsList: ListItem = sections.list.allocListFromSpaces( - directions, - { - stringVariables: true, markers: true, unescape: true - }, - sections); - flicks.flicks.push({ - directions: directionsList, - keyId: keyIdStr, - }); + for (let {keyId, directions} of flick.flickSegment) { + const keyIdStr = sections.strs.allocString(keyId); + let directionsList: ListItem = sections.list.allocListFromSpaces( + directions, + { + stringVariables: true, markers: true, unescape: true + }, + sections); + flicks.flicks.push({ + directions: directionsList, + keyId: keyIdStr, + }); + } + + sect.flicks.push(flicks); } - - sect.flicks.push(flicks); } } @@ -303,7 +306,7 @@ export class KeysCompiler extends SectionCompiler { valid = false; continue; } - if (!keydef.output && !keydef.gap && !keydef.flickId) { + if (!keydef.output && !keydef.gap && !keydef.layerId) { this.callbacks.reportMessage( CompilerMessages.Error_KeyMissingToGapOrSwitch({ keyId: key }) ); diff --git a/developer/src/kmc-ldml/src/compiler/touch-layout-compiler.ts b/developer/src/kmc-ldml/src/compiler/touch-layout-compiler.ts index 6a2821c4cd..45ed3b26d5 100644 --- a/developer/src/kmc-ldml/src/compiler/touch-layout-compiler.ts +++ b/developer/src/kmc-ldml/src/compiler/touch-layout-compiler.ts @@ -59,6 +59,9 @@ export class TouchLayoutCompiler { } private translateLayerIdToTouchLayoutLayerId(id: string, modifier: string): string { + if (!modifier) { + modifier = 'none'; + } // Touch layout layers have a set of reserved names that correspond to // hardware modifiers. We want to map these identifiers first before falling // back to the layer ids diff --git a/developer/src/kmc-ldml/test/fixtures/basic.js b/developer/src/kmc-ldml/test/fixtures/basic.js index e2eef59518..c74798cfac 100644 --- a/developer/src/kmc-ldml/test/fixtures/basic.js +++ b/developer/src/kmc-ldml/test/fixtures/basic.js @@ -5,7 +5,7 @@ if(typeof keyman === 'undefined') { } function Keyboard_basic() { this.KI="Keyboard_basic"; - this.KN={"value":"TestKbd"}; + this.KN="TestKbd"; this.KMINVER="16.0"; this.KV={F: ' 1em "Arial"', K102: 0}; this.KV.KLS={ diff --git a/developer/src/kmc-ldml/test/fixtures/basic.xml b/developer/src/kmc-ldml/test/fixtures/basic.xml index 382e2cf3a9..71c7b4b158 100644 --- a/developer/src/kmc-ldml/test/fixtures/basic.xml +++ b/developer/src/kmc-ldml/test/fixtures/basic.xml @@ -57,3 +57,4 @@ +ti diff --git a/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-both.xml b/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-both.xml index 07481be8bb..41c414b41e 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-both.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/disp/invalid-both.xml @@ -5,7 +5,7 @@ - + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped.xml index 9942243f65..00e67686e4 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/escaped.xml @@ -2,23 +2,29 @@ - - - + + + + + + + + - + - - - - - + + + + + + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-missing-flick.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-missing-flick.xml index b28710acde..494d61fe59 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-missing-flick.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/invalid-missing-flick.xml @@ -1,17 +1,17 @@ - - + - - - - - + + - + + + + + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/markers.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/markers.xml index 4a7fb98871..4dab6ea4f2 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/markers.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/markers.xml @@ -5,11 +5,17 @@ - - - - + + + + + + + + + + diff --git a/developer/src/kmc-ldml/test/fixtures/sections/keys/maximal.xml b/developer/src/kmc-ldml/test/fixtures/sections/keys/maximal.xml index 3836379d5c..35a58057cb 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/keys/maximal.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/keys/maximal.xml @@ -5,17 +5,31 @@ + + + + + + + + + + + + - + - - - - + + + + + + diff --git a/developer/src/kmc-ldml/test/test-disp.ts b/developer/src/kmc-ldml/test/test-disp.ts index fa4cd24a9c..4faa866c4d 100644 --- a/developer/src/kmc-ldml/test/test-disp.ts +++ b/developer/src/kmc-ldml/test/test-disp.ts @@ -19,7 +19,7 @@ describe('disp', function () { }); it('should compile typical disp', async function() { let disp = await loadSectionFixture(DispCompiler, 'sections/disp/typical.xml', compilerTestCallbacks) as Disp; - assert.equal(compilerTestCallbacks.messages, []); + assert.sameDeepMembers(compilerTestCallbacks.messages, []); assert.ok(disp?.disps); assert.equal(disp.disps.length, 1); @@ -61,13 +61,13 @@ describe('disp', function () { let disp = await loadSectionFixture(DispCompiler, 'sections/disp/invalid-dupto.xml', compilerTestCallbacks) as Disp; assert.isNull(disp); assert.equal(compilerTestCallbacks.messages.length, 1); - assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_DisplayIsRepeated({output:'e'})); + assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_DisplayIsRepeated({ output: 'e' })); }); it('should reject duplicate ids', async function() { - let disp = await loadSectionFixture(DispCompiler, 'sections/disp/invalid-dupid.xml', compilerTestCallbacks) as Disp; + let disp = await loadSectionFixture(DispCompiler, 'sections/disp/invalid-dupid.xml', compilerTestCallbacks) as Disp;1 assert.isNull(disp); assert.equal(compilerTestCallbacks.messages.length, 1); - assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_DisplayIsRepeated({output:'e'})); + assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_DisplayIsRepeated({ keyId: 'e' })); }); it('should reject if neither to nor id', async function() { let disp = await loadSectionFixture(DispCompiler, 'sections/disp/invalid-none.xml', compilerTestCallbacks) as Disp; From 4d358cabda600f6bb96d24da1d912edaf7114fae Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 26 Oct 2023 12:57:07 -0500 Subject: [PATCH 08/12] =?UTF-8?q?chore(developer):=20ldml=20update=20to=20?= =?UTF-8?q?prefinal=20v44=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - utilities for extracting key ids - more key validation and munging - touch layout - fix basic.txt For feat(developer): ldml re-sync with CLDR v44 spec 🙀 #9838 --- .../unit/ldml/keyboards/k_006_backspace.xml | 2 +- core/tests/unit/ldml/keyboards/k_020_fr.xml | 7 +- developer/src/kmc-ldml/src/compiler/keys.ts | 239 +++++++++++++----- .../src/kmc-ldml/src/compiler/messages.ts | 5 +- .../src/compiler/touch-layout-compiler.ts | 6 +- developer/src/kmc-ldml/src/util/util.ts | 60 ++++- .../kmc-ldml/test/fixtures/basic-no-debug.js | 2 +- .../src/kmc-ldml/test/fixtures/basic.txt | 58 +++-- .../src/kmc-ldml/test/fixtures/basic.xml | 2 +- .../kmc-ldml/test/test-keymanweb-compiler.ts | 6 +- developer/src/kmc-ldml/test/test-keys.ts | 57 +++-- developer/src/kmc-ldml/test/test-utils.ts | 76 +++++- 12 files changed, 388 insertions(+), 132 deletions(-) diff --git a/core/tests/unit/ldml/keyboards/k_006_backspace.xml b/core/tests/unit/ldml/keyboards/k_006_backspace.xml index f1d4237de2..d9f2995695 100644 --- a/core/tests/unit/ldml/keyboards/k_006_backspace.xml +++ b/core/tests/unit/ldml/keyboards/k_006_backspace.xml @@ -8,7 +8,7 @@ - + diff --git a/core/tests/unit/ldml/keyboards/k_020_fr.xml b/core/tests/unit/ldml/keyboards/k_020_fr.xml index 113164ae53..dc589638b5 100644 --- a/core/tests/unit/ldml/keyboards/k_020_fr.xml +++ b/core/tests/unit/ldml/keyboards/k_020_fr.xml @@ -54,10 +54,11 @@ - + + - + @@ -65,7 +66,7 @@ - + diff --git a/developer/src/kmc-ldml/src/compiler/keys.ts b/developer/src/kmc-ldml/src/compiler/keys.ts index b9c41ef4c3..77e19c6f17 100644 --- a/developer/src/kmc-ldml/src/compiler/keys.ts +++ b/developer/src/kmc-ldml/src/compiler/keys.ts @@ -7,7 +7,7 @@ import DependencySections = KMXPlus.DependencySections; import Keys = KMXPlus.Keys; import ListItem = KMXPlus.ListItem; import KeysFlicks = KMXPlus.KeysFlicks; -import { allUsedKeyIdsInLayers, calculateUniqueKeys, translateLayerAttrToModifier, validModifier } from '../util/util.js'; +import { allUsedKeyIdsInFlick, allUsedKeyIdsInKey, allUsedKeyIdsInLayers, calculateUniqueKeys, hashFlicks, hashKeys, translateLayerAttrToModifier, validModifier } from '../util/util.js'; import { MarkerTracker, MarkerUse } from './marker-tracker.js'; export class KeysCompiler extends SectionCompiler { @@ -15,9 +15,25 @@ export class KeysCompiler extends SectionCompiler { keyboard: LDMLKeyboard.LKKeyboard, mt: MarkerTracker ): boolean { - keyboard.keys?.key?.forEach(({ output }) => - mt.add(MarkerUse.emit, MarkerParser.allReferences(output)) - ); + // TODO-LDML: repetition + + const uniqueKeys = calculateUniqueKeys([...keyboard.keys?.key]); + const keyBag = hashKeys(uniqueKeys); // for easier lookup + // will be the set of ALL keys used in this keyboard + const usedKeys = allUsedKeyIdsInLayers(keyboard?.layers); + // save off the layer key IDs before we mutate the set + const layerKeyIds = Array.from(usedKeys.values()); + const flickHash = hashFlicks(keyboard?.flicks?.flick); // for easier lookup + const usedFlicks = KeysCompiler.getUsedFlicks(layerKeyIds, keyBag); + KeysCompiler.addKeysFromFlicks(usedFlicks, flickHash, usedKeys); + KeysCompiler.addUsedGestureKeys(layerKeyIds, keyBag, usedKeys); + + // process each key + for (let keyId of usedKeys.values()) { + const key = keyBag.get(keyId); + if (!key) continue; + mt.add(MarkerUse.emit, MarkerParser.allReferences(key.output)); + } return true; } @@ -45,30 +61,54 @@ export class KeysCompiler extends SectionCompiler { } }); - // general key-level validation here, only of used keys - const usedKeys = allUsedKeyIdsInLayers(this.keyboard3?.layers); - const uniqueKeys = calculateUniqueKeys([...this.keyboard3.keys?.key]); - for (let key of uniqueKeys) { - const { id, flickId } = key; - if (!usedKeys.has(id)) { - continue; // unused key, ignore + const keyBag = this.getKeyBag(); + // will be the set of ALL keys used in this keyboard + const usedKeys = this.getLayerKeyIds(); + // save off the layer key IDs before we mutate the set + const layerKeyIds = Array.from(usedKeys.values()); + const flickHash = this.getFlicks(); // for easier lookup + const usedFlicks = KeysCompiler.getUsedFlicks(layerKeyIds, keyBag); + + // go through each layer key and collect flicks and gestures + for(const keyId of layerKeyIds) { + const key = keyBag.get(keyId); + + if (!key) { + // Note: validateHardwareLayerForKmap(), below, will raise an error for hardware keys that are missing, with additional + // context. For this section, we just skip missing keys. + continue; } - // TODO-LDML: further key-level validation here - if (!flickId) { - continue; // no flicks + + const { flickId } = key; + if (flickId) { + if (!flickHash.has(flickId)) { + valid = false; + this.callbacks.reportMessage( + CompilerMessages.Error_MissingFlicks({ flickId, id: keyId }) + ); + } } - const flickEntry = this.keyboard3?.flicks?.flick.find( - ({id}) => id === flickId - ); - if (!flickEntry) { - valid = false; - this.callbacks.reportMessage( - CompilerMessages.Error_MissingFlicks({ flickId, id }) - ); + const gestureKeys = allUsedKeyIdsInKey(key); + + for(const [gestureKeyId, attrs] of gestureKeys.entries()) { + const gestureKey = keyBag.get(gestureKeyId); + if (gestureKey == null) { + // TODO-LDML: could keep track of already missing keys so we don't warn multiple times on gesture keys + valid = false; + this.callbacks.reportMessage( + CompilerMessages.Error_GestureKeyNotFoundInKeyBag({keyId: gestureKeyId, parentKeyId: keyId, attribute: attrs.join(',')}) + ); + } else { + usedKeys.add(gestureKeyId); + } } } - // the layr compiler does more extensive validation of the layer attributes. + // now, check the flicks + KeysCompiler.addKeysFromFlicks(usedFlicks, flickHash, usedKeys); + // TODO-LDML: hint on unused flicks (that aren't imported) + + // Note: the layr compiler does more extensive validation of the layer attributes. // Kmap validation const hardwareLayers = this.hardwareLayers(); @@ -78,7 +118,7 @@ export class KeysCompiler extends SectionCompiler { for (let layers of hardwareLayers) { for (let layer of layers.layer) { valid = - this.validateHardwareLayerForKmap(layers.formId, layer) && valid; // note: always validate even if previously invalid results found + this.validateHardwareLayerForKmap(layers.formId, layer, keyBag) && valid; // note: always validate even if previously invalid results found } } // TODO-LDML: } else { touch? @@ -87,6 +127,30 @@ export class KeysCompiler extends SectionCompiler { return valid; } + static addKeysFromFlicks(usedFlicks: Set, flickHash: Map, usedKeys: Set) { + for (let flickId of usedFlicks.values()) { + const flick = flickHash.get(flickId); + if (!flick) continue; + const flickKeys = allUsedKeyIdsInFlick(flick); + flickKeys.forEach(keyId => usedKeys.add(keyId)); + } + } + + private getFlicks() { + return hashFlicks(this.keyboard3?.flicks?.flick); + } + + /** a set with all key ids used in all layers */ + private getLayerKeyIds() { + return allUsedKeyIdsInLayers(this.keyboard3?.layers); + } + + /** the entire keybag (used or unused) as a hash */ + private getKeyBag() : Map { + const uniqueKeys = calculateUniqueKeys([...this.keyboard3.keys?.key]); + return hashKeys(uniqueKeys); // for easier lookup + } + public compile(sections: DependencySections): Keys { /* c8 ignore next 4 */ if (!this.keyboard3?.keys?.key && !this.keyboard3?.keys?.flicks) { @@ -96,11 +160,21 @@ export class KeysCompiler extends SectionCompiler { let sect = new Keys(sections.strs); - // Load the flicks first - this.loadFlicks(sections, sect); + // TODO-LDML: some duplication with validate() + const keyBag = this.getKeyBag(); + // We only want to include used keys in .kmx + const usedKeys = this.getLayerKeyIds(); + // save off the layer key IDs before we mutate the set + const layerKeyIds = Array.from(usedKeys.values()); - // Now, load the keys - this.loadKeys(sections, sect); + // Load the flicks first + this.loadFlicks(sections, sect, keyBag, layerKeyIds, usedKeys); + + // add in the gesture keys + KeysCompiler.addUsedGestureKeys(layerKeyIds, keyBag, usedKeys); + + // Now, load the keys into memory + this.loadKeys(sections, sect, keyBag, layerKeyIds, usedKeys); // Finally, kmap // Use LayerMap + keys to generate compiled keys for hardware @@ -122,42 +196,79 @@ export class KeysCompiler extends SectionCompiler { return sect; } - public loadFlicks(sections: DependencySections, sect: Keys) { - if (this.keyboard3?.flicks?.flick) { - for (let flick of this.keyboard3?.flicks?.flick) { - const { id } = flick; - let flicks: KeysFlicks = new KeysFlicks( - sections.strs.allocString(id) - ); - - for (let {keyId, directions} of flick.flickSegment) { - const keyIdStr = sections.strs.allocString(keyId); - let directionsList: ListItem = sections.list.allocListFromSpaces( - directions, - { - stringVariables: true, markers: true, unescape: true - }, - sections); - flicks.flicks.push({ - directions: directionsList, - keyId: keyIdStr, - }); - } - - sect.flicks.push(flicks); + static addUsedGestureKeys(layerKeyIds: string[], keyBag: Map, usedKeys: Set) { + for (let keyId of layerKeyIds) { + const key = keyBag.get(keyId); + if (!key) continue; + for (let gestureKeyId of allUsedKeyIdsInKey(key).keys()) { + usedKeys.add(gestureKeyId); } } } - public loadKeys(sections: DependencySections, sect: Keys) { - const usedKeys = allUsedKeyIdsInLayers(this.keyboard3?.layers); - const uniqueKeys = calculateUniqueKeys([...this.keyboard3.keys?.key]); + /** + * + * @param keyBag the keybag as a hash + * @param layerKeyIds list of keys from the layer, to extract used flicks + * @param usedKeys will be populated with keys used in the flick + */ + public loadFlicks(sections: DependencySections, sect: Keys, + keyBag: Map, layerKeyIds: string[], usedKeys: Set) { + const flickHash = this.getFlicks(); // for easier lookup + const usedFlicks = KeysCompiler.getUsedFlicks(layerKeyIds, keyBag); - for (let key of uniqueKeys) { - if (!usedKeys.has(key.id)) { - // TODO-LDML: linting for unused, non-implied and non-imported keys, - continue; // unused key, skip + // only include used flicks in the table + // this way, extra unused imported flicks are ignored + // in id order, for now + for (let flickId of Array.from(usedFlicks.values()).sort()) { + const flick = flickHash.get(flickId); + if (!flick) continue; // already reported by validate() + + // allocate the in-memory + let flicks: KeysFlicks = new KeysFlicks( + sections.strs.allocString(flickId) + ); + + // add data from each segment + for (let { keyId, directions } of flick.flickSegment) { + const keyIdStr = sections.strs.allocString(keyId); + let directionsList: ListItem = sections.list.allocListFromSpaces( + directions, + { + stringVariables: true, markers: true, unescape: true + }, + sections); + flicks.flicks.push({ + directions: directionsList, + keyId: keyIdStr, + }); + usedKeys.add(keyId); } + + sect.flicks.push(flicks); + } + } + + static getUsedFlicks(layerKeyIds: string[], keyBag: Map) { + const usedFlicks = new Set(); + for (let keyId of layerKeyIds) { + const key = keyBag.get(keyId); + if (!key) continue; + if (!key.flickId) continue; + usedFlicks.add(key.flickId); + } + return usedFlicks; + } + + public loadKeys(sections: DependencySections, sect: Keys, keyBag: Map, + layerKeyIds: string[], usedKeys: Set) { + + // for each used key (whether from layer, gesture, etc.) + // push these in id order, for tidiness + for (let keyId of Array.from(usedKeys.values()).sort()) { + const key = keyBag.get(keyId); + if (!key) continue; // missing key + let flags = 0; const { flickId, gap, longPressDefaultKeyId, longPressKeyIds, multiTapKeyIds, layerId, output } = key; if (!!gap) { @@ -229,16 +340,17 @@ export class KeysCompiler extends SectionCompiler { } /** - * TODO-LDML: from old 'keys' * Validate for purpose of kmap * @param hardware the 'form' parameter * @param layer - * @returns + * @param keyHash the keybag's hash + * @returns true if valid */ private validateHardwareLayerForKmap( hardware: string, - layer: LDMLKeyboard.LKLayer - ) { + layer: LDMLKeyboard.LKLayer, + keyHash: Map + ): boolean { let valid = true; const { modifiers } = layer; @@ -266,7 +378,6 @@ export class KeysCompiler extends SectionCompiler { return valid; } - const uniqueKeys = calculateUniqueKeys([...this.keyboard3.keys?.key]); if (layer.row.length > keymap.length) { this.callbacks.reportMessage( CompilerMessages.Error_HardwareLayerHasTooManyRows() @@ -292,7 +403,7 @@ export class KeysCompiler extends SectionCompiler { for (let key of keys) { x++; - let keydef = uniqueKeys.find((x) => x.id == key); + let keydef = keyHash.get(key); if (!keydef) { this.callbacks.reportMessage( CompilerMessages.Error_KeyNotFoundInKeyBag({ diff --git a/developer/src/kmc-ldml/src/compiler/messages.ts b/developer/src/kmc-ldml/src/compiler/messages.ts index 2f3a007495..34d0f8c763 100644 --- a/developer/src/kmc-ldml/src/compiler/messages.ts +++ b/developer/src/kmc-ldml/src/compiler/messages.ts @@ -43,7 +43,10 @@ export class CompilerMessages { m(this.WARN_CustomForm, `Custom
element. Key layout may not be as expected.`); static WARN_CustomForm = SevWarn | 0x000A; - // 0x000B - available + static Error_GestureKeyNotFoundInKeyBag = (o:{keyId: string, parentKeyId: string, attribute: string}) => + m(this.ERROR_GestureKeyNotFoundInKeyBag, `Key '${o.keyId}' not found in key bag, referenced from other '${o.parentKeyId}' in ${o.attribute}`); + static ERROR_GestureKeyNotFoundInKeyBag = SevError | 0x000B; + // 0x000C - available static Error_InvalidVersion = (o:{version: string}) => diff --git a/developer/src/kmc-ldml/src/compiler/touch-layout-compiler.ts b/developer/src/kmc-ldml/src/compiler/touch-layout-compiler.ts index 45ed3b26d5..5c5c7eb194 100644 --- a/developer/src/kmc-ldml/src/compiler/touch-layout-compiler.ts +++ b/developer/src/kmc-ldml/src/compiler/touch-layout-compiler.ts @@ -59,9 +59,6 @@ export class TouchLayoutCompiler { } private translateLayerIdToTouchLayoutLayerId(id: string, modifier: string): string { - if (!modifier) { - modifier = 'none'; - } // Touch layout layers have a set of reserved names that correspond to // hardware modifiers. We want to map these identifiers first before falling // back to the layer ids @@ -76,7 +73,6 @@ export class TouchLayoutCompiler { // rightalt | altR // rightalt-shift | altR shift // - const map = { none: 'default', shift: 'shift', @@ -87,7 +83,7 @@ export class TouchLayoutCompiler { // canonicalize modifier string, alphabetical // TODO-LDML: need to support multiple here - if (modifier.indexOf(',') !== -1) { + if (modifier && modifier.indexOf(',') !== -1) { throw Error(`Internal error: TODO-LDML: multiple modifiers ${modifier} not yet supported.`); } modifier = (modifier||'').split(/\b/).sort().join(' ').trim(); diff --git a/developer/src/kmc-ldml/src/util/util.ts b/developer/src/kmc-ldml/src/util/util.ts index 63eaa68a11..a3f43b1b6e 100644 --- a/developer/src/kmc-ldml/src/util/util.ts +++ b/developer/src/kmc-ldml/src/util/util.ts @@ -32,12 +32,29 @@ export function calculateUniqueKeys(keys?: LDMLKeyboard.LKKey[]): LDMLKeyboard.L return uniqueKeys; } +/** Convert an array of keys to a hash */ +export function hashKeys(keys?: LDMLKeyboard.LKKey[]) : Map { + const m = new Map(); + for (const k of keys ?? []) { + m.set(k.id, k); + } + return m; +} + +export function hashFlicks(flicks?: LDMLKeyboard.LKFlick[]) : Map { + const m = new Map(); + for (const k of flicks ?? []) { + m.set(k.id, k); + } + return m; +} + + /** - * * @param layersList list of layers elements, from `keyboard?.layers` * @returns set of key IDs */ -export function allUsedKeyIdsInLayers(layersList : LDMLKeyboard.LKLayers[] | null): Set { +export function allUsedKeyIdsInLayers(layersList?: LDMLKeyboard.LKLayers[]): Set { const s = new Set(); if (layersList) { for (const layers of layersList || []) { @@ -55,6 +72,45 @@ export function allUsedKeyIdsInLayers(layersList : LDMLKeyboard.LKLayers[] | nul return s; } +/** + * Extract all of the key ids that this key refers to, not counting flicks + * @returns map from the key id to a set of attribute names (such as `multiTapDefaultKeyId` etc.) used by that key. + */ +export function allUsedKeyIdsInKey(key : LDMLKeyboard.LKKey) : Map { + const m = new Map(); + /** add one key */ + function addKey(keyId : string | undefined, attr: string) { + if (!keyId) return; + if (!m.has(keyId)) m.set(keyId,[]); + m.get(keyId).push(attr); + } + /** add a set of keys */ + function addKeys(keyIds : string | undefined, attr: string) { + if (!keyIds) return; + for (const keyId of keyIds?.split(' ')) { + addKey(keyId, attr); + } + } + + const {longPressKeyIds, longPressDefaultKeyId, multiTapKeyIds} = key; + + addKey(longPressDefaultKeyId, 'longPressDefaultKeyId'); + addKeys(longPressKeyIds, 'longPressKeyIds'); + addKeys(multiTapKeyIds, 'multiTapKeyIds'); + + return m; +} + +export function allUsedKeyIdsInFlick(flick? : LDMLKeyboard.LKFlick) : Set { + const s = new Set(); + if(flick) { + for (const {keyId} of flick.flickSegment) { + s.add(keyId); + } + } + return s; +} + /** * Helper function for validating child elements. Written for the convenience of message passing functions. * diff --git a/developer/src/kmc-ldml/test/fixtures/basic-no-debug.js b/developer/src/kmc-ldml/test/fixtures/basic-no-debug.js index e6df39356a..84168414cf 100644 --- a/developer/src/kmc-ldml/test/fixtures/basic-no-debug.js +++ b/developer/src/kmc-ldml/test/fixtures/basic-no-debug.js @@ -1 +1 @@ -if(typeof keyman === 'undefined') {console.error('Keyboard requires KeymanWeb 16.0 or later');} else {KeymanWeb.KR(new Keyboard_basic());}function Keyboard_basic() {this.KI="Keyboard_basic";this.KN={"value":"TestKbd"};this.KMINVER="16.0";this.KV={F: ' 1em "Arial"', K102: 0};this.KV.KLS={TODO_LDML: 2};this.KDU=1;this.KH="";this.KM=0;this.KBVER="1.0.0";this.KMBM=0;this.KVKL={"desktop":{"defaultHint":"none","layer":[{"id":"base","row":[{"id":"0","key":[{"id":"T_hmaqtugha","text":"ħ"},{"id":"T_that","text":"ថា"}]}]}],"displayUnderlying":false}};this.gs=function(t,e){return 0;};} \ No newline at end of file +if(typeof keyman === 'undefined') {console.error('Keyboard requires KeymanWeb 16.0 or later');} else {KeymanWeb.KR(new Keyboard_basic());}function Keyboard_basic() {this.KI="Keyboard_basic";this.KN="TestKbd";this.KMINVER="16.0";this.KV={F: ' 1em "Arial"', K102: 0};this.KV.KLS={TODO_LDML: 2};this.KDU=1;this.KH="";this.KM=0;this.KBVER="1.0.0";this.KMBM=0;this.KVKL={"desktop":{"defaultHint":"none","layer":[{"id":"base","row":[{"id":"0","key":[{"id":"T_hmaqtugha","text":"ħ"},{"id":"T_that","text":"ថា"}]}]}],"displayUnderlying":false}};this.gs=function(t,e){return 0;};} diff --git a/developer/src/kmc-ldml/test/fixtures/basic.txt b/developer/src/kmc-ldml/test/fixtures/basic.txt index 0cd2fa77c1..302e802a08 100644 --- a/developer/src/kmc-ldml/test/fixtures/basic.txt +++ b/developer/src/kmc-ldml/test/fixtures/basic.txt @@ -122,9 +122,6 @@ block(sectitems) 6d 65 74 61 diff(sect,meta) - 6e 61 6d 65 - diff(sect,name) - 73 74 72 73 diff(sect,strs) @@ -249,12 +246,32 @@ block(endelem) block(keys) # struct COMP_KMXPLUS_KEYS { 6b 65 79 73 # KMX_DWORD header.ident; // 0000 Section name - keys sizeof(keys) # KMX_DWORD header.size; // 0004 Section length - 02 00 00 00 # KMX_DWORD keyCount + 04 00 00 00 # KMX_DWORD keyCount 01 00 00 00 # KMX_DWORD flicksCount 00 00 00 00 # KMX_DWORD flickCount 02 00 00 00 # KMX_DWORD kmapCount; // 0008 number of kmap # keys - # (#0000) hmaqtugha + # (#0000) a + 61 00 00 00 # 'a' + 00 00 00 00 # KMX_DWORD flags = extend + index(strNull,strA,2) # KMXPLUS_STR 'a' (key id) + 00 00 00 00 # KMXPLUS_STR switch + 0A 00 00 00 # KMX_DWORD width*10 + 00 00 00 00 # TODO: index(listNull,listNull,4) # LIST longPress + 00 00 00 00 # STR longPressDefault + 00 00 00 00 # TODO: index(listNull,listNull,4) # LIST multiTap + 00 00 00 00 # flicks + # (#0001) e + 65 00 00 00 # 'e' + 00 00 00 00 # KMX_DWORD flags = extend + index(strNull,strElemBkspFrom2,2) # KMXPLUS_STR 'e' (key id) + 00 00 00 00 # KMXPLUS_STR switch + 0A 00 00 00 # KMX_DWORD width*10 + 00 00 00 00 # TODO: index(listNull,listNull,4) # LIST longPress + 00 00 00 00 # STR longPressDefault + 00 00 00 00 # TODO: index(listNull,listNull,4) # LIST multiTap + 00 00 00 00 # flicks + # (#0002) hmaqtugha 27 01 00 00 # UTF-32 'U+0127' 00 00 00 00 # KMX_DWORD (flags: none) index(strNull,strHmaqtugha,2) # KMXPLUS_STR 'hmaqtugha' @@ -264,7 +281,7 @@ block(keys) # struct COMP_KMXPLUS_KEYS { 00 00 00 00 # STR longPressDefault 00 00 00 00 # TODO: index(listNull,listNull,4) # LIST multiTap 00 00 00 00 # flicks 0 - # (#0001) that + # (#0003) that index(strNull,strKeys,2) # KMXPLUS_STR 'U+0127' 01 00 00 00 # KMX_DWORD flags = extend index(strNull,strThat,2) # KMXPLUS_STR 'hmaqtugha' @@ -284,10 +301,19 @@ block(keys) # struct COMP_KMXPLUS_KEYS { #00 00 00 00 # LIST directions #00 00 00 01 # flags #00 00 00 00 # str: to - # kmapdata: - 31 00 00 00 00 00 00 00 01 00 00 00 # KMX_DWORD vkey, mod, key; - c0 00 00 00 00 00 00 00 00 00 00 00 # KMX_DWORD vkey, mod, key; + # kmapdata: + # note that 'a' and 'e' are omitted, as they aren't on the layers (just from gestures) + + # #0 + 31 00 00 00 # KMX_DWORD vkey + 00 00 00 00 # KMX_DWORD modifiers (none) + 03 00 00 00 # KMX_DWORD key index (that) + + # #1 + c0 00 00 00 # KMX_DWORD vkey + 00 00 00 00 # KMX_DWORD modifiers (none) + 02 00 00 00 # KMX_DWORD key index (hmaqtugha) # ---------------------------------------------------------------------------------------------------- @@ -372,21 +398,11 @@ block(meta) # struct COMP_KMXPLUS_META { index(strNull,strAuthor,2) # KMXPLUS_STR author; index(strNull,strConformsTo,2) # KMXPLUS_STR conform; index(strNull,strLayout,2) # KMXPLUS_STR layout; - index(strNull,strNorm,2) # KMXPLUS_STR normalization; + index(strNull,strName,2) # KMXPLUS_STR name; index(strNull,strIndicator,2) # KMXPLUS_STR indicator; index(strNull,strVersion,2) # KMXPLUS_STR version; 00 00 00 00 # KMX_DWORD settings; # }; -# ---------------------------------------------------------------------------------------------------- -# store_targets_name -# ---------------------------------------------------------------------------------------------------- - -block(name) # struct COMP_KMXPLUS_META { - 6e 61 6d 65 # KMX_DWORD header.ident; // 0000 Section name - name - sizeof(name) # KMX_DWORD header.size; // 0004 Section length - 01 00 00 00 # KMX_DWORD count; // 0008 number of names - index(strNull,strName,2) # KMXPLUS_STR name; // 000C+ name string entry = 'TestKbd' - # }; # ---------------------------------------------------------------------------------------------------- # strs @@ -404,7 +420,6 @@ block(strs) # struct COMP_KMXPLUS_STRS { diff(strs,strNull) sizeof(strNull,2) diff(strs,strVersion) sizeof(strVersion,2) - diff(strs,strNorm) sizeof(strNorm,2) diff(strs,strName) sizeof(strName,2) diff(strs,strFromSet) sizeof(strFromSet,2) diff(strs,strUSet) sizeof(strUSet,2) @@ -439,7 +454,6 @@ block(strs) # struct COMP_KMXPLUS_STRS { #str #00 block(strNull) block(x) 00 00 # the zero-length string block(strVersion) 31 00 2e 00 30 00 2e 00 30 00 block(x) 00 00 # '1.0.0' - block(strNorm) 4e 00 46 00 43 00 block(x) 00 00 # 'NFC' block(strName) 54 00 65 00 73 00 74 00 4b 00 62 00 64 00 block(x) 00 00 # 'TestKbd' block(strFromSet) 5B 00 5C 00 75 00 31 00 41 00 37 00 35 00 2D 00 5C 00 75 00 31 00 41 00 37 00 39 00 5D 00 block(x) 00 00 # [\u1a75-\u1a79] block(strUSet) 5b 00 61 00 62 00 63 00 5d 00 block(x) 00 00 # '[abc]' diff --git a/developer/src/kmc-ldml/test/fixtures/basic.xml b/developer/src/kmc-ldml/test/fixtures/basic.xml index 71c7b4b158..0044812652 100644 --- a/developer/src/kmc-ldml/test/fixtures/basic.xml +++ b/developer/src/kmc-ldml/test/fixtures/basic.xml @@ -18,6 +18,7 @@ + @@ -57,4 +58,3 @@ -ti diff --git a/developer/src/kmc-ldml/test/test-keymanweb-compiler.ts b/developer/src/kmc-ldml/test/test-keymanweb-compiler.ts index a03ba5875b..ab8c4b2fc2 100644 --- a/developer/src/kmc-ldml/test/test-keymanweb-compiler.ts +++ b/developer/src/kmc-ldml/test/test-keymanweb-compiler.ts @@ -40,10 +40,10 @@ describe('LdmlKeyboardKeymanWebCompiler', function() { const outputNoDebug = jsCompilerNoDebug.compile('basic.xml', source); assert.isNotNull(outputNoDebug); - // Does the emitted js match? - const outputFixtureNoDebug = fs.readFileSync(outputFilenameNoDebug, 'utf-8').replaceAll(/\r\n/g, '\n'); + // Does the emitted js match? The nodebug has no newline at end, but allow one in the fixture + const outputFixtureNoDebug = fs.readFileSync(outputFilenameNoDebug, 'utf-8').replaceAll(/\r\n/g, '\n').trim(); assert.strictEqual(outputNoDebug, outputFixtureNoDebug); // TODO(lowpri): consider using Typescript parser to generate AST for further validation }); -}); \ No newline at end of file +}); diff --git a/developer/src/kmc-ldml/test/test-keys.ts b/developer/src/kmc-ldml/test/test-keys.ts index bcb5e673bd..d10298ae34 100644 --- a/developer/src/kmc-ldml/test/test-keys.ts +++ b/developer/src/kmc-ldml/test/test-keys.ts @@ -20,14 +20,15 @@ describe('keys', function () { assert.equal(compilerTestCallbacks.messages.length, 0); assert.equal(keys.keys.length, 2); assert.equal(keys.flicks.length, 1); // there's always a 'null' flick - assert.equal(keys.keys[0].to.value, 'oops'); - assert.isFalse(keys.keys[0].to.isOneChar); - assert.equal(keys.keys[0].flags, constants.keys_key_flags_extend); - assert.equal(keys.keys[0].id.value, 'mistake'); - assert.isTrue(keys.keys[1].to.isOneChar); - assert.equal(keys.keys[1].to.value, String.fromCodePoint(0x1FAA6)); - assert.equal(keys.keys[1].flags, 0); - assert.equal(keys.keys[1].id.value, 'grave'); + // ids are in sorted order in memory` + assert.isTrue(keys.keys[0].to.isOneChar); + assert.equal(keys.keys[0].to.value, String.fromCodePoint(0x1FAA6)); + assert.equal(keys.keys[0].flags, 0); + assert.equal(keys.keys[0].id.value, 'grave'); + assert.equal(keys.keys[1].to.value, 'oops'); + assert.isFalse(keys.keys[1].to.isOneChar); + assert.equal(keys.keys[1].flags, constants.keys_key_flags_extend); + assert.equal(keys.keys[1].id.value, 'mistake'); }, }, { @@ -36,7 +37,7 @@ describe('keys', function () { const keys = sect; assert.ok(keys); assert.equal(compilerTestCallbacks.messages.length, 0); - assert.equal(keys.keys.length, 4); + assert.equal(keys.keys.length, 12); // includes flick and gesture keys const [w] = keys.keys.filter(({ id }) => id.value === 'w'); assert.ok(w); @@ -47,9 +48,9 @@ describe('keys', function () { assert.isFalse(!!(q.flags & constants.keys_key_flags_gap)); assert.equal(q.width, 32, 'q\'s width'); // ceil(3.14159 * 10.0) assert.equal(q.flicks, 'flick0'); // note this is a string, not a StrsItem - assert.equal(q.longPress.toString(), 'á é í'); - assert.equal(q.longPressDefault.value, 'é'); - assert.equal(q.multiTap.toString(), 'ä ë ï'); + assert.equal(q.longPress.toString(), 'a-acute e-acute i-acute'); + assert.equal(q.longPressDefault.value, 'e-acute'); + assert.equal(q.multiTap.toString(), 'a-umlaut e-umlaut i-umlaut'); const [flick0] = keys.flicks.filter(({ id }) => id.value === 'flick0'); assert.ok(flick0); @@ -57,11 +58,11 @@ describe('keys', function () { const [flick0_nw_se] = flick0.flicks.filter(({ directions }) => directions && directions.isEqual('nw se'.split(' '))); assert.ok(flick0_nw_se); - assert.equal(flick0_nw_se.keyId?.value, 'ç'); + assert.equal(flick0_nw_se.keyId?.value, 'c-cedilla'); const [flick0_ne_sw] = flick0.flicks.filter(({ directions }) => directions && directions.isEqual('ne sw'.split(' '))); assert.ok(flick0_ne_sw); - assert.equal(flick0_ne_sw.keyId?.value, 'ê'); // via variable + assert.equal(flick0_ne_sw.keyId?.value, 'e-caret'); // via variable }, }, { @@ -70,16 +71,16 @@ describe('keys', function () { const keys = sect; assert.ok(keys); assert.equal(compilerTestCallbacks.messages.length, 0); - assert.equal(keys.keys.length, 4); + assert.equal(keys.keys.length, 12); // flick and gesture keys const [q] = keys.keys.filter(({ id }) => id.value === 'q'); assert.ok(q); assert.isFalse(!!(q.flags & constants.keys_key_flags_gap)); assert.equal(q.width, 32); // ceil(3.1 * 10) assert.equal(q.flicks, 'flick0'); // note this is a string, not a StrsItem - assert.equal(q.longPress.toString(), 'á é í'); - assert.equal(q.longPressDefault.value, 'é'); - assert.equal(q.multiTap.toString(), 'ä ë ï'); + assert.equal(q.longPress.toString(), 'a-acute e-acute i-acute'); + assert.equal(q.longPressDefault.value, 'e-acute'); + assert.equal(q.multiTap.toString(), 'a-umlaut e-umlaut i-umlaut'); const [flick0] = keys.flicks.filter(({ id }) => id.value === 'flick0'); assert.ok(flick0); @@ -87,11 +88,11 @@ describe('keys', function () { const [flick0_nw_se] = flick0.flicks.filter(({ directions }) => directions && directions.isEqual('nw se'.split(' '))); assert.ok(flick0_nw_se); - assert.equal(flick0_nw_se.keyId?.value, 'ç'); + assert.equal(flick0_nw_se.keyId?.value, 'c'); const [flick0_ne_sw] = flick0.flicks.filter(({ directions }) => directions && directions.isEqual('ne sw'.split(' '))); assert.ok(flick0_ne_sw); - assert.equal(flick0_ne_sw.keyId?.value, 'ế'); + assert.equal(flick0_ne_sw.keyId?.value, 'eee'); }, }, { @@ -126,18 +127,18 @@ describe('keys', function () { const keys = sect; assert.ok(keys); assert.equal(compilerTestCallbacks.messages.length, 0); - assert.equal(keys.keys.length, 1); + assert.equal(keys.keys.length, 5); - const [ww] = keys.keys.filter(({ id }) => id.value === 'ww'); + const ww = keys.keys.find(({ id }) => id.value === 'ww'); assert.ok(ww); - const MARKER_1 = MarkerParser.markerOutput(1); - assert.equal(ww.to.value, MARKER_1); - assert.equal(ww.longPressDefault.value, MARKER_1); - assert.equal(ww.longPress[0].value.value, MARKER_1); - assert.equal(ww.multiTap[0].value.value, MARKER_1); + const MARKER_5 = MarkerParser.markerOutput(5); + assert.equal(ww.to.value, MARKER_5); + assert.equal(ww.longPressDefault.value, 'bb'); + assert.equal(ww.longPress[0].value.value, 'aa'); + assert.equal(ww.multiTap[0].value.value, 'cc'); const [flickw] = keys.flicks?.filter(({id}) => id.value === 'flickw'); assert.ok(flickw); - assert.equal(flickw.flicks[0].keyId.value, MARKER_1); + assert.equal(flickw.flicks[0].keyId.value, 'dd'); }, }, ]); diff --git a/developer/src/kmc-ldml/test/test-utils.ts b/developer/src/kmc-ldml/test/test-utils.ts index 627a820e91..015af09e1d 100644 --- a/developer/src/kmc-ldml/test/test-utils.ts +++ b/developer/src/kmc-ldml/test/test-utils.ts @@ -1,6 +1,9 @@ import 'mocha'; import {assert} from 'chai'; -import { isValidEnumValue, calculateUniqueKeys, allUsedKeyIdsInLayers, translateLayerAttrToModifier, validModifier, verifyValidAndUnique } from '../src/util/util.js'; +import { + allUsedKeyIdsInFlick, allUsedKeyIdsInKey, + isValidEnumValue, calculateUniqueKeys, allUsedKeyIdsInLayers, + translateLayerAttrToModifier, validModifier, verifyValidAndUnique } from '../src/util/util.js'; import { constants } from "@keymanapp/ldml-keyboard-constants"; import { LDMLKeyboard } from '@keymanapp/common-types'; @@ -98,6 +101,77 @@ describe('test of util/util.ts', () => { 'q w e r t y Q W E R T Y a s d f A S D F 0 1 2 3'.split(' ')); }); }); + describe('allUsedKeyIdsInFlick', () => { + it('should handle a null case', () => { + assert.sameDeepMembers(Array.from(allUsedKeyIdsInFlick( + undefined + )), + []); + }); + it('should handle a simple case', () => { + assert.sameDeepMembers(Array.from(allUsedKeyIdsInFlick( + { + id: 'something', + flickSegment: [ + { keyId: 'aaa', directions: 'nnw se w up' }, + ] + } + )), + 'aaa'.split(' ')); + }); + it('should handle a redundant case', () => { + assert.sameDeepMembers(Array.from(allUsedKeyIdsInFlick( + { + id: 'something', + flickSegment: [ + { keyId: 'aaa', directions: 'nnw se w up' }, + { keyId: 'bbb', directions: 'e ne e' }, + { keyId: 'ccc', directions: 'turn left here, go about half a mile past where old man henry’s place used to be, hang a right, can’t miss it' }, + { keyId: 'aaa', directions: 'w e n s' }, + ] + } + )), + ['aaa','bbb','ccc']); // aaa is in there twice + }); + }); + describe('allUsedKeyIdsInKey', () => { + it('should handle a simple case', () => { + assert.sameDeepMembers(Array.from(allUsedKeyIdsInKey( + {} + ).keys()), + []); + }); + it('should handle a straightforward case', () => { + assert.sameDeepMembers(Array.from(allUsedKeyIdsInKey( + { + flickId: 'ignore me', + multiTapKeyIds: 'tap1 tap2 tap3', + longPressDefaultKeyId: 'longPress0', + longPressKeyIds: 'longPress1 longPress2 longPress0' + } + ).keys()), + ['tap1','tap2','tap3','longPress0', 'longPress1','longPress2']); + }); + it('should handle a duplicate case', () => { + const auk = allUsedKeyIdsInKey( + { + flickId: 'ignore me', + multiTapKeyIds: 'a b c', + longPressDefaultKeyId: 'd', + longPressKeyIds: 'c d e' + } + ); + assert.sameDeepMembers(Array.from(auk.keys()), + ['a','b','c','d','e']); + assert.sameDeepMembers(Array.from(auk.entries()), [ + ['a',['multiTapKeyIds']], + ['b',['multiTapKeyIds']], + ['c',['longPressKeyIds','multiTapKeyIds']], + ['d',['longPressDefaultKeyId','longPressKeyIds']], + ['e',['longPressKeyIds']], + ]); + }); + }); describe('translateLayerAttrToModifier', () => { it('should map from layer info to modifier number', () => { assert.equal(translateLayerAttrToModifier({ From a45dc5c345007f0e4577c63eab8e58999fe0f09c Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 26 Oct 2023 18:21:56 -0500 Subject: [PATCH 09/12] =?UTF-8?q?chore(developer):=20ldml=20update=20to=20?= =?UTF-8?q?prefinal=20v44=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fix binary size issue - upstream: issue in abnt2 sample keyboard For feat(developer): ldml re-sync with CLDR v44 spec 🙀 #9838 --- .../src/kmx/kmx-plus-builder/build-keys.ts | 2 +- common/web/types/src/kmx/kmx-plus.ts | 1 - core/tests/unit/ldml/keyboards/k_020_fr.xml | 172 ++++++++++-------- developer/src/kmc-ldml/src/compiler/keys.ts | 4 +- .../techpreview/3.0/pt-t-k0-abnt2.xml | 2 +- 5 files changed, 101 insertions(+), 80 deletions(-) diff --git a/common/web/types/src/kmx/kmx-plus-builder/build-keys.ts b/common/web/types/src/kmx/kmx-plus-builder/build-keys.ts index d2f7564bb3..ec7e505c57 100644 --- a/common/web/types/src/kmx/kmx-plus-builder/build-keys.ts +++ b/common/web/types/src/kmx/kmx-plus-builder/build-keys.ts @@ -41,7 +41,7 @@ interface BUILDER_KEYS_FLICKS { */ interface BUILDER_KEYS_FLICK { directions: BUILDER_LIST_REF; // list of cardinal/intercardinal directions - to: BUILDER_STR_REF | number; // str or single codepoint + to: BUILDER_STR_REF; // str }; diff --git a/common/web/types/src/kmx/kmx-plus.ts b/common/web/types/src/kmx/kmx-plus.ts index 8f0149ca85..4ce22c33dd 100644 --- a/common/web/types/src/kmx/kmx-plus.ts +++ b/common/web/types/src/kmx/kmx-plus.ts @@ -737,7 +737,6 @@ export class KMXPlusFile extends KMXFile { this.COMP_PLUS_KEYS_FLICK = new r.Struct({ directions: LIST_REF, // list - flags: r.uint32le, to: STR_OR_CHAR32, // str | codepoint }); diff --git a/core/tests/unit/ldml/keyboards/k_020_fr.xml b/core/tests/unit/ldml/keyboards/k_020_fr.xml index dc589638b5..a5fd85f1a3 100644 --- a/core/tests/unit/ldml/keyboards/k_020_fr.xml +++ b/core/tests/unit/ldml/keyboards/k_020_fr.xml @@ -9,15 +9,15 @@ keyboard formats --> - - - > + - + + - + - + @@ -49,7 +49,21 @@ - + + + + + + + + + + + + + + + @@ -58,30 +72,36 @@ - - - - - - - - - - - - - - - - - + + + - + + + + + + + + + + + + + + + - + @@ -97,7 +117,8 @@ - + @@ -115,63 +136,66 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/developer/src/kmc-ldml/src/compiler/keys.ts b/developer/src/kmc-ldml/src/compiler/keys.ts index 77e19c6f17..526039e59f 100644 --- a/developer/src/kmc-ldml/src/compiler/keys.ts +++ b/developer/src/kmc-ldml/src/compiler/keys.ts @@ -234,9 +234,7 @@ export class KeysCompiler extends SectionCompiler { const keyIdStr = sections.strs.allocString(keyId); let directionsList: ListItem = sections.list.allocListFromSpaces( directions, - { - stringVariables: true, markers: true, unescape: true - }, + { }, sections); flicks.flicks.push({ directions: directionsList, diff --git a/resources/standards-data/ldml-keyboards/techpreview/3.0/pt-t-k0-abnt2.xml b/resources/standards-data/ldml-keyboards/techpreview/3.0/pt-t-k0-abnt2.xml index ae1d7c4a74..010f515073 100644 --- a/resources/standards-data/ldml-keyboards/techpreview/3.0/pt-t-k0-abnt2.xml +++ b/resources/standards-data/ldml-keyboards/techpreview/3.0/pt-t-k0-abnt2.xml @@ -45,7 +45,7 @@ - + From d349959deaaf6f7e0b5073ed710502675d47d5ec Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 26 Oct 2023 18:35:55 -0500 Subject: [PATCH 10/12] =?UTF-8?q?chore(core):=20ldml=20update=20to=20prefi?= =?UTF-8?q?nal=20v44=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - drop name section - drop flick flags - drop normalization,add name to meta - debug printf fix - assertion fix for display For feat(developer): ldml re-sync with CLDR v44 spec 🙀 #9838 --- core/src/kmx/kmx_plus.cpp | 10 +++++----- core/src/kmx/kmx_plus.h | 28 ++-------------------------- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/core/src/kmx/kmx_plus.cpp b/core/src/kmx/kmx_plus.cpp index ca25f07ebb..295d92a4b2 100644 --- a/core/src/kmx/kmx_plus.cpp +++ b/core/src/kmx/kmx_plus.cpp @@ -209,7 +209,7 @@ COMP_KMXPLUS_META::valid(KMX_DWORD _kmn_unused(length)) const { DebugLog(" author:\t#0x%X\n", author); DebugLog(" conform:\t#0x%X\n", conform); DebugLog(" layout:\t#0x%X\n", layout); - DebugLog(" normalization:\t#0x%X\n", normalization); + DebugLog(" name:\t#0x%X\n", name); DebugLog(" indicator:\t#0x%X\n", indicator); DebugLog(" settings:\t0x%X\n", settings); return true; @@ -227,9 +227,9 @@ COMP_KMXPLUS_DISP::valid(KMX_DWORD _kmn_unused(length)) const { DebugLog("disp: baseCharacter str#0x%X", baseCharacter); } for (KMX_DWORD i=0; i str0x%X", i, entries[i].to, entries[i].display); - if (entries[i].to == 0 || entries[i].display == 0) { - DebugLog("disp to: or display: has a zero string"); + DebugLoad("disp#%d: id: str0x%X to: str0x%X -> str0x%X", i, entries[i].id, entries[i].to, entries[i].display); + if ((entries[i].to == 0 && entries[i].id == 0) || entries[i].display == 0) { + DebugLog("disp must have either keyId/output, and must have display"); assert(false); return false; } @@ -812,7 +812,7 @@ COMP_KMXPLUS_KEYS_Helper::setKeys(const COMP_KMXPLUS_KEYS *newKeys) { is_valid = false; assert(is_valid); } - DebugLoad(" %d: to=0x%X, directions=0x%X, flags=0x%X", i, e.to, e.directions, e.flags); + DebugLoad(" %d: to=0x%X, directions=0x%X", i, e.to, e.directions); } // now the kmap DebugLoad(" kmap count: #0x%X", key2->kmapCount); diff --git a/core/src/kmx/kmx_plus.h b/core/src/kmx/kmx_plus.h index b6ac0c7fa3..fdfcf6f5cb 100644 --- a/core/src/kmx/kmx_plus.h +++ b/core/src/kmx/kmx_plus.h @@ -184,7 +184,7 @@ struct COMP_KMXPLUS_META { KMXPLUS_STR author; KMXPLUS_STR conform; KMXPLUS_STR layout; - KMXPLUS_STR normalization; + KMXPLUS_STR name; KMXPLUS_STR indicator; KMXPLUS_STR version; KMX_DWORD_unaligned settings; @@ -196,28 +196,6 @@ struct COMP_KMXPLUS_META { static_assert(sizeof(struct COMP_KMXPLUS_META) == LDML_LENGTH_META, "mismatched size of section meta"); -/* ------------------------------------------------------------------ - * name section - ------------------------------------------------------------------ */ - -struct COMP_KMXPLUS_NAME_ENTRY { - KMXPLUS_STR name; -}; - -struct COMP_KMXPLUS_NAME { - static const KMXPLUS_IDENT IDENT = LDML_SECTIONID_NAME; - COMP_KMXPLUS_HEADER header; - KMX_DWORD_unaligned count; - COMP_KMXPLUS_NAME_ENTRY entries[]; - /** - * @brief True if section is valid. - */ - bool valid(KMX_DWORD length) const; -}; - -static_assert(sizeof(struct COMP_KMXPLUS_NAME) % 0x4 == 0, "Structs prior to variable part should align to 32-bit boundary"); -static_assert(sizeof(struct COMP_KMXPLUS_NAME) == LDML_LENGTH_NAME, "mismatched size of section name"); - /* ------------------------------------------------------------------ * strs section ------------------------------------------------------------------ */ @@ -512,9 +490,7 @@ struct COMP_KMXPLUS_KEYS { struct COMP_KMXPLUS_KEYS_FLICK_ELEMENT { KMXPLUS_LIST directions; - KMX_DWORD_unaligned flags; - KMXPLUS_STR to; // string or codepoint - /** get the 'to' string if a char */ + KMXPLUS_STR to; // string std::u16string get_to_string() const; }; From 3176f88ba4a38203a4db874cbe9ebe3017f1f88d Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 26 Oct 2023 21:42:21 -0500 Subject: [PATCH 11/12] =?UTF-8?q?fix(developer):=20ldml=20only=20hint=20on?= =?UTF-8?q?=20normalization=3Ddisabled=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For feat(developer): ldml re-sync with CLDR v44 spec 🙀 #9838 --- developer/src/kmc-ldml/src/compiler/messages.ts | 4 ++-- developer/src/kmc-ldml/src/compiler/meta.ts | 3 +-- .../{invalid-normalization.xml => hint-normalization.xml} | 2 +- developer/src/kmc-ldml/test/test-meta.ts | 8 ++++---- 4 files changed, 8 insertions(+), 9 deletions(-) rename developer/src/kmc-ldml/test/fixtures/sections/meta/{invalid-normalization.xml => hint-normalization.xml} (87%) diff --git a/developer/src/kmc-ldml/src/compiler/messages.ts b/developer/src/kmc-ldml/src/compiler/messages.ts index 34d0f8c763..640081635c 100644 --- a/developer/src/kmc-ldml/src/compiler/messages.ts +++ b/developer/src/kmc-ldml/src/compiler/messages.ts @@ -7,8 +7,8 @@ const SevError = CompilerErrorSeverity.Error | CompilerErrorNamespace.LdmlKeyboa const SevFatal = CompilerErrorSeverity.Fatal | CompilerErrorNamespace.LdmlKeyboardCompiler; export class CompilerMessages { - static Error_InvalidNormalization = () => m(this.ERROR_InvalidNormalization, `normalization=disabled is not allowed.`); - static ERROR_InvalidNormalization = SevError | 0x0001; + static Hint_NormalizationDisabled = () => m(this.HINT_NormalizationDisabled, `normalization=disabled is not recommended.`); + static HINT_NormalizationDisabled = SevHint | 0x0001; static Error_InvalidLocale = (o:{tag: string}) => m(this.ERROR_InvalidLocale, `Invalid BCP 47 locale form '${o.tag}'`); static ERROR_InvalidLocale = SevError | 0x0002; diff --git a/developer/src/kmc-ldml/src/compiler/meta.ts b/developer/src/kmc-ldml/src/compiler/meta.ts index 6c58370d55..279e1d47c3 100644 --- a/developer/src/kmc-ldml/src/compiler/meta.ts +++ b/developer/src/kmc-ldml/src/compiler/meta.ts @@ -41,8 +41,7 @@ export class MetaCompiler extends SectionCompiler { private validateNormalization(normalization?: string) { if (normalization === 'disabled') { - this.callbacks.reportMessage(CompilerMessages.Error_InvalidNormalization()); - return false; + this.callbacks.reportMessage(CompilerMessages.Hint_NormalizationDisabled()); } return true; } diff --git a/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml b/developer/src/kmc-ldml/test/fixtures/sections/meta/hint-normalization.xml similarity index 87% rename from developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml rename to developer/src/kmc-ldml/test/fixtures/sections/meta/hint-normalization.xml index 36351deecc..3921edc441 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/meta/invalid-normalization.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/meta/hint-normalization.xml @@ -2,7 +2,7 @@ - + diff --git a/developer/src/kmc-ldml/test/test-meta.ts b/developer/src/kmc-ldml/test/test-meta.ts index c6c197baec..428d96f4b7 100644 --- a/developer/src/kmc-ldml/test/test-meta.ts +++ b/developer/src/kmc-ldml/test/test-meta.ts @@ -35,11 +35,11 @@ describe('meta', function () { assert.equal(meta.settings, KeyboardSettings.none); }); - it('should reject invalid normalization', async function() { - let meta = await loadSectionFixture(MetaCompiler, 'sections/meta/invalid-normalization.xml', compilerTestCallbacks) as Meta; - assert.isNull(meta); + it('should hint when normalization=disabled', async function() { + let meta = await loadSectionFixture(MetaCompiler, 'sections/meta/hint-normalization.xml', compilerTestCallbacks) as Meta; + assert.isNotNull(meta); assert.equal(compilerTestCallbacks.messages.length, 1); - assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Error_InvalidNormalization()); + assert.deepEqual(compilerTestCallbacks.messages[0], CompilerMessages.Hint_NormalizationDisabled()); }); it('should reject invalid version', async function() { From d1bbdbf07adbe7091036583d02d14b99d932c3c4 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 26 Oct 2023 21:45:32 -0500 Subject: [PATCH 12/12] =?UTF-8?q?fix(developer):=20ldml=20improve=20key=20?= =?UTF-8?q?compiler=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - shorten one line For feat(developer): ldml re-sync with CLDR v44 spec 🙀 #9838 --- developer/src/kmc-ldml/src/compiler/keys.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/developer/src/kmc-ldml/src/compiler/keys.ts b/developer/src/kmc-ldml/src/compiler/keys.ts index 526039e59f..6fdf0791d0 100644 --- a/developer/src/kmc-ldml/src/compiler/keys.ts +++ b/developer/src/kmc-ldml/src/compiler/keys.ts @@ -251,8 +251,7 @@ export class KeysCompiler extends SectionCompiler { const usedFlicks = new Set(); for (let keyId of layerKeyIds) { const key = keyBag.get(keyId); - if (!key) continue; - if (!key.flickId) continue; + if (!key?.flickId) continue; usedFlicks.add(key.flickId); } return usedFlicks;