fix toml escape
This commit is contained in:
9
toml.cm
9
toml.cm
@@ -211,8 +211,13 @@ function encode_toml(obj) {
|
||||
}
|
||||
|
||||
function quote_key(k) {
|
||||
if (search(k, '.') != null || search(k, '"') != null || search(k, ' ') != null) {
|
||||
return '"' + toml_escape(k) + '"'
|
||||
var i = 0
|
||||
var c = null
|
||||
for (i = 0; i < length(k); i++) {
|
||||
c = k[i]
|
||||
if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_' || c == '-')) {
|
||||
return '"' + toml_escape(k) + '"'
|
||||
}
|
||||
}
|
||||
return k
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user