doc: add the rules-format file (as markdown)

Useful to have this as part of the documentation. The rendering isn't great but
at least not any worse than pure text. Markdown escapes % so explaining our use
of %S and %H would require a double % - not idea. Let's just wrap it as a code
block and done.

Includes two typo fixes too, yay.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
master
Peter Hutterer 2020-06-02 16:11:33 +10:00 committed by Ran Benita
parent fef179cfe7
commit a26578742c
2 changed files with 9 additions and 2 deletions

View File

@ -38,8 +38,9 @@ near the end.
Grammar Grammar
------- -------
(It might be helpful to look at a file like rules/evdev along with (It might be helpful to look at a file like rules/evdev along with
this grammer. Comments, whitespace, etc. are not shown.) this grammar. Comments, whitespace, etc. are not shown.)
```
File ::= { "!" (Include | Group | RuleSet) } File ::= { "!" (Include | Group | RuleSet) }
Include ::= "include" <ident> Include ::= "include" <ident>
@ -58,12 +59,14 @@ Kccgst ::= "keycodes" | "symbols" | "types" | "compat" | "geometry"
Rule ::= { MlvoValue } "=" { KccgstValue } "\n" Rule ::= { MlvoValue } "=" { KccgstValue } "\n"
MlvoValue ::= "*" | GroupName | <ident> MlvoValue ::= "*" | GroupName | <ident>
KccgstValue ::= <ident> KccgstValue ::= <ident>
```
Notes: Notes:
- Include processes the rules in the file path specified in the ident, - Include processes the rules in the file path specified in the ident,
in order. %-expanasion is performed, as follows: in order. %-expansion is performed, as follows:
```
%%: %%:
A literal %. A literal %.
@ -72,6 +75,7 @@ Notes:
%S: %S:
The system-installed rules directory (usually /usr/share/X11/xkb/rules). The system-installed rules directory (usually /usr/share/X11/xkb/rules).
```
- The order of values in a Rule must be the same as the Mapping it - The order of values in a Rule must be the same as the Mapping it
follows. The mapping line determines the meaning of the values in follows. The mapping line determines the meaning of the values in
@ -80,6 +84,7 @@ Notes:
- If a Rule is matched, %-expansion is performed on the KccgstValue, - If a Rule is matched, %-expansion is performed on the KccgstValue,
as follows: as follows:
```
%m, %l, %v: %m, %l, %v:
The model, layout or variant, if only one was given (e.g. The model, layout or variant, if only one was given (e.g.
%l for "us,il" is invalid). %l for "us,il" is invalid).
@ -94,6 +99,7 @@ Notes:
%(m), %(l), %(l[1]), %(v), %(v[1]): %(m), %(l), %(l[1]), %(v), %(v[1]):
As above, but prefixed by '(' and suffixed by ')'. As above, but prefixed by '(' and suffixed by ')'.
```
In case the expansion is invalid, as described above, it is In case the expansion is invalid, as described above, it is
skipped (the rest of the string is still processed); this includes skipped (the rest of the string is still processed); this includes

View File

@ -543,6 +543,7 @@ You can disable the documentation with -Denable-docs=false.''')
'doc/doxygen-extra.css', 'doc/doxygen-extra.css',
'doc/quick-guide.md', 'doc/quick-guide.md',
'doc/compat.md', 'doc/compat.md',
'doc/rules-format.md',
'xkbcommon/xkbcommon.h', 'xkbcommon/xkbcommon.h',
'xkbcommon/xkbcommon-names.h', 'xkbcommon/xkbcommon-names.h',
'xkbcommon/xkbcommon-x11.h', 'xkbcommon/xkbcommon-x11.h',