Skip to content

Commit

Permalink
CLDR-16633 kbd: use NMTOKEN for ids (#3226)
Browse files Browse the repository at this point in the history
* CLDR-16633 kbd: use NMTOKEN for ids

- document with link to future CLDR-17043

* CLDR-16633 kbd: more DTD fix
  • Loading branch information
srl295 authored Sep 19, 2023
1 parent 61b74a3 commit dda39b9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
14 changes: 11 additions & 3 deletions docs/ldml/tr35-keyboards.md
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,9 @@ This element defines a mapping between an abstract key and its output. This elem

_Attribute:_ `id`

> The `id` attribute uniquely identifies the key. NMTOKEN, restricted to `[a-zA-Z0-9_.-]`. It can (but needn't be) the Latin key name for a Latn script keyboard (a, b, c, A, B, C, …), or any other valid token (e-acute, alef, alif, alpha, …)
> The `id` attribute uniquely identifies the key. NMTOKEN. It can (but needn't be) the key name (a, b, c, A, B, C, …), or any other valid token (e-acute, alef, alif, alpha, …).
>
> 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:_ `flicks="flick-id"` (optional)

Expand Down Expand Up @@ -755,7 +757,9 @@ _Attribute:_ `switch="shift"` (optional)
> Also note that `switch=` is ignored for hardware layouts: their shifting is controlled via
> the modifier keys.
>
> This attribute is an NMTOKEN, restricted to `[a-zA-Z0-9-]`
> This attribute is an NMTOKEN.
>
> 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:_ `to`
Expand Down Expand Up @@ -899,9 +903,13 @@ The `flicks` element is used to generate results from a "flick" of the finger on
_Attribute:_ `id` (required)

> The `id` attribute identifies the flicks. It can be any NMTOKEN matching `[A-Za-z0-9][A-Za-z0-9-]*`
> The `id` attribute identifies the flicks. It can be any NMTOKEN.
>
> The `flicks` do not share a namespace with the `key`s, so it would also be allowed
> to have `<key id="a" flicks="a"/><flicks id="a"/>`
>
> 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.

**Syntax**

Expand Down
15 changes: 7 additions & 8 deletions keyboards/dtd/ldmlKeyboard.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ Please view the subcommittee page for the most recent information.

<!ELEMENT display EMPTY >
<!--@TECHPREVIEW-->
<!ATTLIST display id CDATA #IMPLIED >
<!--@MATCH:regex/[A-Za-z0-9][A-Za-z0-9-]*-->
<!ATTLIST display id NMTOKEN #IMPLIED >
<!ATTLIST display to CDATA #IMPLIED >
<!--@MATCH:any-->
<!--@ALLOWS_UESC-->
Expand All @@ -115,10 +114,10 @@ Please view the subcommittee page for the most recent information.

<!ELEMENT key EMPTY >
<!--@TECHPREVIEW-->
<!ATTLIST key id CDATA #REQUIRED >
<!--@MATCH:regex/[A-Za-z0-9][A-Za-z0-9-]*-->
<!ATTLIST key id NMTOKEN #REQUIRED >
<!--@MATCH:any-->
<!ATTLIST key flicks NMTOKEN #IMPLIED >
<!--@MATCH:regex/[A-Za-z0-9][A-Za-z0-9-]*-->
<!--@MATCH:any-->
<!ATTLIST key gap (true) #IMPLIED >
<!--@VALUE-->
<!ATTLIST key to CDATA #IMPLIED >
Expand All @@ -139,7 +138,7 @@ Please view the subcommittee page for the most recent information.
<!ATTLIST key stretch (true) #IMPLIED >
<!--@VALUE-->
<!ATTLIST key switch NMTOKEN #IMPLIED >
<!--@MATCH:regex/[A-Za-z0-9][A-Za-z0-9-]*-->
<!--@MATCH:any-->
<!--@VALUE-->
<!ATTLIST key transform (no) #IMPLIED >
<!--@VALUE-->
Expand All @@ -150,7 +149,7 @@ Please view the subcommittee page for the most recent information.
<!ELEMENT flicks ( flick+, special* ) >
<!--@TECHPREVIEW-->
<!ATTLIST flicks id NMTOKEN #REQUIRED >
<!--@MATCH:regex/[A-Za-z0-9][A-Za-z0-9-]*-->
<!--@MATCH:any-->

<!ELEMENT flick EMPTY >
<!--@TECHPREVIEW-->
Expand Down Expand Up @@ -185,7 +184,7 @@ Please view the subcommittee page for the most recent information.
<!ELEMENT layer ( row+, special* ) >
<!--@TECHPREVIEW-->
<!ATTLIST layer id NMTOKEN #IMPLIED >
<!--@MATCH:regex/[A-Za-z0-9][A-Za-z0-9-]*-->
<!--@MATCH:any-->
<!ATTLIST layer modifier NMTOKENS #IMPLIED >
<!--@MATCH:regex/(none|([A-Za-z0-9]+)( [A-Za-z0-9]+)*)-->

Expand Down
6 changes: 2 additions & 4 deletions keyboards/dtd/ldmlKeyboard.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file

<xs:element name="display">
<xs:complexType>
<xs:attribute name="id"/>
<xs:attribute name="id" type="xs:NMTOKEN"/>
<xs:attribute name="to"/>
<xs:attribute name="display" use="required"/>
</xs:complexType>
Expand All @@ -192,7 +192,6 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file




<xs:element name="displayOptions">
<xs:complexType>
<xs:attribute name="baseCharacter"/>
Expand All @@ -217,7 +216,7 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file

<xs:element name="key">
<xs:complexType>
<xs:attribute name="id" use="required"/>
<xs:attribute name="id" type="xs:NMTOKEN" use="required"/>
<xs:attribute name="flicks" type="xs:NMTOKEN"/>
<xs:attribute name="gap">
<xs:simpleType>
Expand Down Expand Up @@ -346,7 +345,6 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file
</xs:element>



<xs:element name="row">
<xs:complexType>
<xs:attribute name="keys" type="xs:NMTOKENS" use="required"/>
Expand Down
2 changes: 1 addition & 1 deletion keyboards/dtd/ldmlKeyboardTest.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Please see CLDR-15034 for the latest information. -->
<!--@ORDERED-->
<!--@TECHPREVIEW-->
<!ATTLIST keystroke key NMTOKEN #REQUIRED >
<!--@MATCH:regex/[A-Za-z0-9][A-Za-z0-9-]*-->
<!--@MATCH:any-->
<!--@VALUE-->
<!ATTLIST keystroke flick NMTOKENS #IMPLIED >
<!--@MATCH:any-->
Expand Down

0 comments on commit dda39b9

Please sign in to comment.