Update parsecfg.nim
Value includes double quotation marks.
This commit is contained in:
parent
9a1c87d6bf
commit
89d4574445
1 changed files with 10 additions and 4 deletions
|
|
@ -512,10 +512,16 @@ proc writeConfig*(dict: Config, filename: string) =
|
||||||
kv = key
|
kv = key
|
||||||
if value != "": ## If the key is not empty
|
if value != "": ## If the key is not empty
|
||||||
if not allCharsInSet(value, SymChars):
|
if not allCharsInSet(value, SymChars):
|
||||||
kv.add(segmentChar)
|
if find(value, '"') == -1:
|
||||||
kv.add("\"")
|
kv.add(segmentChar)
|
||||||
kv.add(replace(value))
|
kv.add("\"")
|
||||||
kv.add("\"")
|
kv.add(replace(value))
|
||||||
|
kv.add("\"")
|
||||||
|
else:
|
||||||
|
kv.add(segmentChar)
|
||||||
|
kv.add("\"\"\"")
|
||||||
|
kv.add(replace(value))
|
||||||
|
kv.add("\"\"\"")
|
||||||
else:
|
else:
|
||||||
kv.add(segmentChar)
|
kv.add(segmentChar)
|
||||||
kv.add(value)
|
kv.add(value)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue