mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-19 21:59:11 +00:00
allow commenting lines in json layouts by starting the line with //
This commit is contained in:
parent
82705e5d5e
commit
1a91ce5dd0
1 changed files with 5 additions and 1 deletions
|
@ -65,7 +65,7 @@ object RawKeyboardParser {
|
|||
* codes of multi_text_key not used, only the label
|
||||
* (currently) popups is always read to [number, main, relevant] layoutPopupKeys, no choice of which to use or which hint is provided
|
||||
*/
|
||||
fun parseJsonString(layoutText: String): List<List<AbstractKeyData>> = florisJsonConfig.decodeFromString(layoutText)
|
||||
fun parseJsonString(layoutText: String): List<List<AbstractKeyData>> = florisJsonConfig.decodeFromString(layoutText.stripCommentLines())
|
||||
|
||||
/** Parse simple layouts, defined only as rows of (normal) keys with popup keys. */
|
||||
fun parseSimpleString(layoutText: String): List<List<KeyData>> {
|
||||
|
@ -166,6 +166,10 @@ object RawKeyboardParser {
|
|||
}
|
||||
}
|
||||
|
||||
// allow commenting lines by starting them with "//"
|
||||
private fun String.stripCommentLines(): String =
|
||||
split("\n").filterNot { it.startsWith("//") }.joinToString("\n")
|
||||
|
||||
/*
|
||||
* Copyright (C) 2021 Patrick Goldinger
|
||||
* modified
|
||||
|
|
Loading…
Add table
Reference in a new issue