Promote label with newlines to lint error (#17347)

This commit is contained in:
Joel Challis 2022-06-10 11:44:23 +01:00 committed by GitHub
parent d8ace624c8
commit 7baf9b3f35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 25 deletions

View File

@ -145,7 +145,10 @@
"type": "object",
"additionalProperties": false,
"properties": {
"label": {"type": "string"},
"label": {
"type": "string",
"pattern": "^[^\\n]*$"
},
"matrix": {
"type": "array",
"minItems": 2,

View File

@ -31,10 +31,10 @@
{"label": "I", "x": 8, "y": 1},
{"label": "O", "x": 9, "y": 1},
{"label": "P", "x": 10, "y": 1},
{"label": "|\n\\", "x": 11, "y": 1},
{"label": "7\nHome", "x": 12, "y": 1},
{"label": "8\nUp", "x": 13, "y": 1},
{"label": "9\nPgUp", "x": 14, "y": 1},
{"label": "|", "x": 11, "y": 1},
{"label": "7", "x": 12, "y": 1},
{"label": "8", "x": 13, "y": 1},
{"label": "9", "x": 14, "y": 1},
{"label": "Caps", "x": 0, "y": 2},
{"label": "A", "x": 1, "y": 2},
{"label": "S", "x": 2, "y": 2},
@ -47,9 +47,9 @@
{"label": "L", "x": 9, "y": 2},
{"label": ":", "x": 10, "y": 2},
{"label": "Enter", "x": 11, "y": 2},
{"label": "4\nLeft", "x": 12, "y": 2},
{"label": "4", "x": 12, "y": 2},
{"label": "5", "x": 13, "y": 2},
{"label": "6\nRight", "x": 14, "y": 2},
{"label": "6", "x": 14, "y": 2},
{"label": "Shift", "x": 0, "y": 3},
{"label": "Z", "x": 1, "y": 3},
{"label": "X", "x": 2, "y": 3},
@ -58,13 +58,13 @@
{"label": "B", "x": 5, "y": 3},
{"label": "N", "x": 6, "y": 3},
{"label": "M", "x": 7, "y": 3},
{"label": "<\n,", "x": 8, "y": 3},
{"label": ">\n.", "x": 9, "y": 3},
{"label": "?\n/", "x": 10, "y": 3},
{"label": "<", "x": 8, "y": 3},
{"label": ">", "x": 9, "y": 3},
{"label": "?", "x": 10, "y": 3},
{"label": "Shift", "x": 11, "y": 3},
{"label": "1\nEnd", "x": 12, "y": 3},
{"label": "2\nDown", "x": 13, "y": 3},
{"label": "3\nPgDn", "x": 14, "y": 3},
{"label": "1", "x": 12, "y": 3},
{"label": "2", "x": 13, "y": 3},
{"label": "3", "x": 14, "y": 3},
{"label": "Ctrl", "x": 0, "y": 4},
{"label": "Win", "x": 1, "y": 4},
{"label": "Alt", "x": 2, "y": 4},
@ -77,8 +77,8 @@
{"label": "Win", "x": 9, "y": 4},
{"label": "Menu", "x": 10, "y": 4},
{"label": "Ctrl", "x": 11, "y": 4},
{"label": "0\nIns", "x": 12, "y": 4},
{"label": ".\nDel", "x": 13, "y": 4},
{"label": "0", "x": 12, "y": 4},
{"label": ".", "x": 13, "y": 4},
{"label": "Enter", "x": 14, "y": 4}
]
}

View File

@ -26,13 +26,6 @@ def _valid_community_layout(layout):
return (Path('layouts/default') / layout).exists()
def _remove_newlines_from_labels(layouts):
for layout_name, layout_json in layouts.items():
for key in layout_json['layout']:
if '\n' in key['label']:
key['label'] = key['label'].split('\n')[0]
def info_json(keyboard):
"""Generate the info.json data for a specific keyboard.
"""
@ -111,9 +104,6 @@ def info_json(keyboard):
# Check that the reported matrix size is consistent with the actual matrix size
_check_matrix(info_data)
# Remove newline characters from layout labels
_remove_newlines_from_labels(layouts)
return info_data