commit bb25e47cb3f791e6bf14199fbcdd3b1a18cf0997
parent 84782b157a733010d771e267880ea9e3fd389b53
Author: Skylar Hill <stellarskylark@posteo.net>
Date: Sat, 4 Jun 2022 21:47:25 -0500
Add tilde as separator, gets translated to hyphen
Diffstat:
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/rpgsheet.nimble b/rpgsheet.nimble
@@ -1,6 +1,6 @@
# Package
-version = "0.2.0"
+version = "0.2.1"
author = "Skylar Hill"
description = "CLI/TUI application for TTRPG character sheets"
license = "GPL-3.0-only"
diff --git a/src/utils.nim b/src/utils.nim
@@ -29,12 +29,15 @@ proc fancyDisplay*(exp: string, maxLen: int): string =
else:
exp[0..min(maxLen-1, exp.len-1)]
result = result.replace("_", " ")
+ result = result.replace("~", "-")
for word in result.split(" "):
if word notin noCap:
result = result.replace(word, word.capitalizeAscii)
proc deFancy*(display: string): string =
- result = display.replace(" ", "_").toLowerAscii()
+ result = display.replace(" ", "_")
+ result = result.replace("-", "~")
+ result = result.toLowerAscii()
proc contains*(node: YamlNode, search: string): bool =
for key in keys(node.fields):
diff --git a/src/verb.nim b/src/verb.nim
@@ -8,7 +8,7 @@ import
import utils
-let reRawExp = re"[\w_']+"
+let reRawExp = re"[\w_~']+"
let reProcessedExp = re"^[\d*+\-/()]*$"
let reDice = re"(\d+x)?(\d*d[\d%]+)(\*\d+)?([+-]\d+)?(s\d+)?"