[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tomelr ae983711be 78/84: fix: Auto-stringify symbols li
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tomelr ae983711be 78/84: fix: Auto-stringify symbols like 1.10.1 |
Date: |
Tue, 3 May 2022 09:58:16 -0400 (EDT) |
branch: externals/tomelr
commit ae983711be15d95abd22ae4d7b8c116031de60a0
Author: Kaushal Modi <kaushal.modi@gmail.com>
Commit: Kaushal Modi <kaushal.modi@gmail.com>
fix: Auto-stringify symbols like 1.10.1
---
test/tscalar.el | 4 ++++
tomelr.el | 11 ++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/test/tscalar.el b/test/tscalar.el
index e6ede6d85a..cb93af2c27 100644
--- a/test/tscalar.el
+++ b/test/tscalar.el
@@ -83,6 +83,8 @@
((string2 . "Roses are red\nViolets are blue")) ;Newline in
string
((string3 . "\"Hello!\"")) ;Quote in string
((string4 . "Line 1\n\nLine 3\n\n Line 5 with 2 space
indentation\n\nLine 7")) ;Blank lines in string
+ ((audio . "audio path with space.mp3")) ;String with
non-alphameric chars like space and period
+ ((version . 1.10.1))
))
(ref '(
"string1 = \"Roses are red\""
@@ -99,6 +101,8 @@ Line 3
Line 5 with 2 space indentation
Line 7\"\"\""
+ "audio = \"audio path with space.mp3\""
+ "version = \"1.10.1\""
))
out)
(dolist (el inp)
diff --git a/tomelr.el b/tomelr.el
index 3a93c750c8..35cfd1f142 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -201,6 +201,7 @@ Possible values of TYPE are `normal-key', `table-key',
`table-array-key', `keyword', or nil.
Return nil if OBJECT cannot be encoded as a TOML string."
+ ;; (message "[tomelr--print-stringlike DBG] object = %S" object)
(let ((sym-name (cond ((and type (stringp object))
;; https://toml.io/en/v1.0.0#keys
;; Bare keys may only contain ASCII letters, ASCII
digits,
@@ -216,7 +217,15 @@ Return nil if OBJECT cannot be encoded as a TOML string."
((keywordp object)
(string-trim-left (symbol-name object) ":"))
((symbolp object)
- (symbol-name object)))))
+ (let ((str (symbol-name object)))
+ (unless (or ;; RFC 3339 formatted date-time with
offset
+ (string-match-p
tomelr--date-time-regexp str)
+ (string-match-p "\\`[A-Za-z0-9_-]+\\'"
str))
+ ;; Wrap string in double-quotes if it's
+ ;; neither a date-time symbol not
+ ;; contains only A-Za-z0-9_- chars.
+ (setq str (format "\"%s\"" str)))
+ str)))))
(when (member type '(table-key table-array-key))
;; (message "[tomelr--print-stringlike DBG] %S is symbol, type = %S,
depth = %d"
;; object type tomelr--print-indentation-depth)
- [elpa] externals/tomelr 26f1fc2f3c 55/84: doc: Update the medley example, (continued)
- [elpa] externals/tomelr 26f1fc2f3c 55/84: doc: Update the medley example, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr e2b313ca3b 52/84: feat: Implement everything planned in the initial spec, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 4434ccc64b 70/84: chore: Bump version, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 10a1994aed 51/84: feat: Support (lightly tested) nested TOML Table Arrays, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr df0e73334f 59/84: Revert "doc: Update the medley example", ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr ec381fd723 79/84: fix: Auto-stringify and auto-quote symbol values, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr a25d952a17 77/84: feat: Auto-coerce string to integers, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr b2ba4c46b5 82/84: refactor: Minor code reorg, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr d86fd721ce 63/84: fix: Compatibility for emacs 26.3, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr a1fa47379e 84/84: chore: Add CHANGELOG generated using git cliff tool, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr ae983711be 78/84: fix: Auto-stringify symbols like 1.10.1,
ELPA Syncer <=
- [elpa] externals/tomelr 61397410af 01/84: Initial empty commit, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 846676a172 06/84: feat: Add plist example, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 8bc506af5a 02/84: Add s-exp->toml examples and spec, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 7d8d41f15b 19/84: feat: Encode to multi-line TOML string automatically, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 0ba5f2ff69 24/84: chore(readme): Move mixed type array example to the 'medley' example, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr ca9245038a 35/84: fix: Attempt to make tomelr--toml-table-p more robust, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 000067cf7d 14/84: chore(readme): Update, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 69217d47a6 22/84: feat: Skip converting keys whose values are nil, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr af40c0b40f 11/84: fix: Require subr-x for older Emacs versions, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 060c38b934 16/84: chore(readme): Limit up to 3 levels of headings for Org exports, ELPA Syncer, 2022/05/03