Skip to content

Commit

Permalink
feat: "Parse multi-line layer descriptions correctly by removing newl…
Browse files Browse the repository at this point in the history
…ines from layer names

Previously, if a user formatted the YAML key with the ? | syntax to
allow a multi-line string in the key, the parse_layer_description
function would not capture any characters past the first line.
Now, the replace() method is used to replace all newline characters
with a space, ensuring that descriptions are added correctly to the
rule in karabiner.json
  • Loading branch information
al-ce committed Apr 24, 2023
1 parent f16f5c5 commit a741766
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions karaml/karaml_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ def parse_layer_key(layer_name: str) -> tuple[str, str]:
Returns a tuple of the layer name and the layer description as strings.
"""

# Remove newlines from the layer name in case the user formatted the YAML
# key with the `? |` syntax to allow a multi-line string in the key.
layer_name = layer_name.replace("\n", " ")

layer_info = re.search(r"^(/.+/)(.*)", layer_name)
if not layer_info:
invalidLayerName(layer_name)
Expand Down

0 comments on commit a741766

Please sign in to comment.