Skip to content

Commit

Permalink
CLDR-17113 kbd: move keyList back into attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
srl295 committed Oct 10, 2023
1 parent 24f19c8 commit a0ee437
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 130 deletions.
93 changes: 21 additions & 72 deletions docs/ldml/tr35-keyboards.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ This is the top level element. All other elements defined below are under this e
>
> Parents: _none_
>
> Children: [displays](#Element_displays), [import](#Element_import), [info](#Element_info), [keys](#Element_keys), [keyLists](#Element_keyLists), [flicks](#Element_flicks), [layers](#Element_layers), [locales](#Element_locales), [settings](#Element_settings), [_special_](tr35.md#special), [transforms](#Element_transforms), [variables](#Element_variables), [version](#Element_version)
> Children: [displays](#Element_displays), [import](#Element_import), [info](#Element_info), [keys](#Element_keys), [flicks](#Element_flicks), [layers](#Element_layers), [locales](#Element_locales), [settings](#Element_settings), [_special_](tr35.md#special), [transforms](#Element_transforms), [variables](#Element_variables), [version](#Element_version)
>
> Occurrence: required, single
>
Expand Down Expand Up @@ -618,8 +618,9 @@ This element defines a mapping between an abstract key and its output. This elem
id="{key id}"
flickId="{flick identifier}"
gap="true"
longPressKeyListId="{long press list id}"
multiTapKeyListId="{multi tap list id}"
longPressKeyIds="{long press list id}"
longPressDefault="true"
multiTapKeyIds="{multi tap list id}"
stretch="true"
layerId="{switch layer id}"
output="{the output}"
Expand Down Expand Up @@ -659,13 +660,13 @@ _Attribute:_ `gap="true"` (optional)
<key id="mediumgap" gap="true" width="1.5"/>
```

_Attribute:_ `longPressKeyListId="a b c"` (optional)
_Attribute:_ `longPressKeyIds="a b c"` (optional)

> The id of a specific [keyList](#element-keylist) element, whose keys which can be emitted by "long-pressing" this key. This feature is prominent in mobile devices.
> A space-separated ordered list of `key` element ids, which keys which can be emitted by "long-pressing" this key. This feature is prominent in mobile devices.
>
> The list’s `defaultKeyId` attribute specifies which of the keys in the list is the default long-press target, which could be different than the first element.
> In a list of keys specified by `longPressKeyIds`, the key with the `longPressDefault="true"` attribute specifies the default long-press target, which could be different than the first element. It is an error to specify more than one key which has `longPressDefault="true"`.
>
> For example, if the `defaultKeyId` is a key whose [display](#Element_displays) value is `{`, an implementation might render the key as follows:
> For example, if the default key is a key whose [display](#Element_displays) value is `{`, an implementation might render the key as follows:
>
> ![keycap hint](images/keycapHint.png)
>
Expand All @@ -679,21 +680,22 @@ _Attribute:_ `longPressKeyListId="a b c"` (optional)
> </displays>
>
> <keys>
> <key id="o" output="o" longPressKeyListId="o-list">
> <key id="o" output="o" longPressKeyIds="o-acute marker">
> <key id="o-acute" output="ó"/>
> <key id="marker" display="{"/>
> <key id="marker" longPressDefault="true" display="{"/>
> </key>
>
>
> <keyLists>
> <keyList id="o-list" defaultKeyId="open" keyIds="o-acute marker"/>
> </keyLists>
> ```
_Attribute:_ `longPressDefault="true"` (optional)
> Specifies the default key in a list of long-press keys. See the discussion of `LongPressKeyIds`, above. If present, this attribute must have the value `"true"`.
_Attribute:_ `multiTapKeyListId` (optional)
_Attribute:_ `multiTapKeyIds` (optional)
> The id of a specific [keyList](#element-keylist) element, where each successive key in the list is produced by the corresponding number of quick taps.
> A space-separated ordered list of `key` element ids, which keys, where each successive key in the list is produced by the corresponding number of quick taps.
> It is an error for a key to referene itself in the `multiTapKeyIds` list.
>
> _Example:_
> - first tap on the key will produce “a”
Expand All @@ -703,12 +705,11 @@ _Attribute:_ `multiTapKeyListId` (optional)
>
> ```xml
> <keys>
> <key id="a" output="a" multiTapKeyListId="a-taps">
> <key id="a" output="a" multiTapKeyIds="bb c d">
> <key id="bb" output="bb" />
> <key id="c" output="c" />
> <key id="d" output="d" />
> </key>
>
> <keyLists>
> <keyList id="a-list" keyIds="bb c d"/>
> </keyLists>
> ```
**Note**: Behavior past the end of the multiTap list is implementation specific.
Expand Down Expand Up @@ -846,58 +847,6 @@ Thus, the implied keys behave as if the following import were present.

* * *

### <a name="Element_keyLists" href="#Element_keyLists">Element: keyLists</a>

This element contains `keyList` elements, indicating an ordered list of keys.

> <small>
>
> Parents: [keyboard3](#Element_keyboard3)
>
> Children: [import](#Element_import), [keyList](#Element_keyList), [_special_](tr35.md#special)
>
> Occurrence: optional, single
> </small>
* * *

### <a name="Element_keyList" href="#Element_keyList">Element: keyList</a>

> <small>
>
> Parents: [keyLists](#Element_keyLists)
>
> Children: _none_
>
> Occurrence: optional, multiple
> </small>
_Attribute:_ `id` (required)

> The `id` attribute identifies the list. It can be any NMTOKEN.
>
> The `keyList` elements have their own id namespace.
>
> In the future, this attribute’s definition is expected to be updated to align with [UAX#31](https://www.unicode.org/reports/tr31/). Please see [CLDR-17043](https://unicode-org.atlassian.net/browse/CLDR-17043) for more details.
_Attribute:_ `keyIds` (required)

> This attribute specifies an ordered, space-separated list of `key` elements, by id.
_Attribute:_ `defaultKeyId`

> This attribute specifies a 'default' key for the list. The key id must be one of those present in the `keyIds` list. For long press gesture, this is used to specify the default key when performing a long press. This attribute is ignored for multi tap gestures.
**Syntax**

```xml
<keyLists>
<keyList id="lower-a" defaultKeyId="a-grave" keyIds="a-grave a-caret a-acute" />
</keyLists>
```

* * *

#### <a name="Element_flicks" href="#Element_flicks">Elements: flicks</a>

The `flicks` element is a collection of `flick` elements.
Expand Down
24 changes: 8 additions & 16 deletions keyboards/3.0/fr-t-k0-azerty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@
<key id="e-grave" output="é" /> <!-- 2 -->
<key id="e-acute" output="è" /> <!-- 7 -->
<key id="c-cedilla" output="ç" /> <!-- 9 -->
<key id="a-grave" output="à" /> <!-- 0 -->
<key id="a-grave" output="à" />
<key id="a-acute" output="á" />
<key id="a-caret" output="â" />
<key id="a-caret" output="â" longPressDefault="true" />
<key id="a-umlaut" output="ä" />
<key id="a-tilde" output="ã" />
<key id="a-ring" output="å" />
<key id="a-caron" output="ā" />

<key id="A-grave" output="À" /> <!-- 0 -->
<key id="A-acute" output="Á" />
<key id="A-caret" output="Â" />
<key id="A-caret" output="Â" longPressDefault="true" />
<key id="A-umlaut" output="Ä" />
<key id="A-tilde" output="Ã" />
<key id="A-ring" output="Å" />
Expand All @@ -81,23 +81,15 @@
<!-- extra symbols -->
<key id="bullet" output="" />
<key id="umlaut" output="¨" />
<key id="super-2" output="²" longPressKeyListId="sub-2" multiTapKeyListId="list-2" />
<key id="super-2" output="²" multiTapKeyIds="sub-2 2" /> <!-- taps produce: ² ₂ 2 -->
<key id="sub-2" output="" />

<!-- test key -->
<key id="a" flickId="a" output="a" longPressKeyListId="lower-a" />
<!-- test key -->
<key id="A" flickId="b" output="A" longPressKeyListId="upper-a" />
<!-- TODO: all additional maps, hardware and touch -->
<!-- note that a-caret is the default-->
<key id="a" flickId="a" output="a" longPressKeyIds="a-grave a-caret a-acute a-umlaut a-tilde a-ring a-caron" />
<!-- note that A-caret is the default-->
<key id="A" flickId="b" output="A" longPressKeyIds="A-grave A-caret A-acute A-umlaut a-tilde A-ring A-caron" />
</keys>

<keyLists>
<keyList id="sub-2" keyIds="sub-2" />
<keyList id="list-2" keyIds="2 super-2 sub-2" />
<keyList id="lower-a" defaultKeyId="a-grave" keyIds="a-grave a-caret a-acute a-umlaut a-tilde a-ring a-caron" />
<keyList id="upper-a" defaultKeyId="A-grave" keyIds="A-grave A-caret A-acute A-umlaut A-tilde A-ring A-caron" />
</keyLists>

<flicks>
<flick id="b">
<flickSegment directions="nw" keyId="A-grave" />
Expand Down
22 changes: 5 additions & 17 deletions keyboards/dtd/ldmlKeyboard3.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
<https://cldr.unicode.org/index/keyboard-workgroup> -->

<!ELEMENT keyboard3 ( import*, locales?, version?, info, settings?, displays?, keys?, keyLists?, flicks?, forms?, layers*, variables?, transforms*, special* ) >
<!ELEMENT keyboard3 ( import*, locales?, version?, info, settings?, displays?, keys?, flicks?, forms?, layers*, variables?, transforms*, special* ) >
<!--@TECHPREVIEW-->
<!ATTLIST keyboard3 locale CDATA #REQUIRED >
<!--@MATCH:validity/bcp47-wellformed-->
Expand Down Expand Up @@ -104,10 +104,12 @@ Please view the subcommittee page for the most recent information.
<!--@MATCH:any-->
<!--@VALUE-->
<!--@ALLOWS_UESC-->
<!ATTLIST key longPressKeyListId NMTOKEN #IMPLIED >
<!ATTLIST key longPressKeyIds NMTOKENS #IMPLIED >
<!--@MATCH:any-->
<!--@VALUE-->
<!ATTLIST key multiTapKeyListId NMTOKEN #IMPLIED >
<!ATTLIST key longPressDefault (true) #IMPLIED >
<!--@VALUE-->
<!ATTLIST key multiTapKeyIds NMTOKENS #IMPLIED >
<!--@MATCH:any-->
<!--@VALUE-->
<!ATTLIST key stretch (true) #IMPLIED >
Expand All @@ -121,20 +123,6 @@ Please view the subcommittee page for the most recent information.
<!--@MATCH:range/0.01~100.0-->
<!--@VALUE-->

<!ELEMENT keyLists ( import*, keyList*, special* ) >
<!--@TECHPREVIEW-->

<!ELEMENT keyList EMPTY >
<!--@TECHPREVIEW-->
<!ATTLIST keyList id NMTOKEN #REQUIRED >
<!--@MATCH:any-->
<!ATTLIST keyList keyIds NMTOKENS #REQUIRED >
<!--@MATCH:any-->
<!--@VALUE-->
<!ATTLIST keyList defaultKeyId NMTOKEN #IMPLIED >
<!--@MATCH:any-->
<!--@VALUE-->

<!ELEMENT flicks ( import*, flick*, special* ) >

<!ELEMENT flick ( flickSegment+, special* ) >
Expand Down
34 changes: 9 additions & 25 deletions keyboards/dtd/ldmlKeyboard3.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file
<xs:element minOccurs="0" ref="settings"/>
<xs:element minOccurs="0" ref="displays"/>
<xs:element minOccurs="0" ref="keys"/>
<xs:element minOccurs="0" ref="keyLists"/>
<xs:element minOccurs="0" ref="flicks"/>
<xs:element minOccurs="0" ref="forms"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="layers"/>
Expand Down Expand Up @@ -185,8 +184,15 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file
</xs:simpleType>
</xs:attribute>
<xs:attribute name="output"/>
<xs:attribute name="longPressKeyListId" type="xs:NMTOKEN"/>
<xs:attribute name="multiTapKeyListId" type="xs:NMTOKEN"/>
<xs:attribute name="longPressKeyIds" type="xs:NMTOKENS"/>
<xs:attribute name="longPressDefault">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="true"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="multiTapKeyIds" type="xs:NMTOKENS"/>
<xs:attribute name="stretch">
<xs:simpleType>
<xs:restriction base="xs:token">
Expand Down Expand Up @@ -222,28 +228,6 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file



<xs:element name="keyLists">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="import"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="keyList"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="special"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="keyList">
<xs:complexType>
<xs:attribute name="id" type="xs:NMTOKEN" use="required"/>
<xs:attribute name="keyIds" type="xs:NMTOKENS" use="required"/>
<xs:attribute name="defaultKeyId" type="xs:NMTOKEN"/>
</xs:complexType>
</xs:element>






<xs:element name="flicks">
<xs:complexType>
Expand Down

0 comments on commit a0ee437

Please sign in to comment.