[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tomelr a33dbd1286 50/84: fix: Detect nested TTA correct
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tomelr a33dbd1286 50/84: fix: Detect nested TTA correctly when not present in first TT key |
Date: |
Tue, 3 May 2022 09:58:12 -0400 (EDT) |
branch: externals/tomelr
commit a33dbd1286cd1f539c1e07bd21dc60464dd2f667
Author: Kaushal Modi <kaushal.modi@gmail.com>
Commit: Kaushal Modi <kaushal.modi@gmail.com>
fix: Detect nested TTA correctly when not present in first TT key
---
test/tinternal.el | 4 ++++
test/ttable-array.el | 12 +++++++++++-
tomelr.el | 24 ++++++++++++++++++------
3 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/test/tinternal.el b/test/tinternal.el
index 29346b43bf..63e58a7fab 100644
--- a/test/tinternal.el
+++ b/test/tinternal.el
@@ -35,6 +35,10 @@
((a . 1)
(b . ((c . 3)
(d . 4))))
+ ;; Nested TTA
+ ((a . 1)
+ (b . (((c . 3))
+ ((c . 300)))))
)))
(dolist (el inp)
(should (equal t (tomelr--toml-table-p el))))))
diff --git a/test/ttable-array.el b/test/ttable-array.el
index 740cf10de9..7247f9d132 100644
--- a/test/ttable-array.el
+++ b/test/ttable-array.el
@@ -83,6 +83,9 @@ See
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
(let ((inp '(
((fruits . (((varieties . (((name . "red delicious"))
((name . "granny smith"))))))))
+ ((fruits . (((name . "apple")
+ (varieties . (((name . "red delicious"))
+ ((name . "granny smith"))))))))
;; ((fruits . (((name . "apple")
;; (physical . ((color . "red")
;; (shape . "round")))
@@ -91,7 +94,14 @@ See
[org#Drawers](https://www.gnu.org/software/emacs/manual/html_mono/org.html#D
;; ((name . "banana")
;; (varieties . (((name . "plantain"))))))))
))
- (ref '("[[fruits]]
+ (ref '(
+ "[[fruits]]
+ [[fruits.varieties]]
+ name = \"red delicious\"
+ [[fruits.varieties]]
+ name = \"granny smith\""
+ "[[fruits]]
+ name = \"apple\"
[[fruits.varieties]]
name = \"red delicious\"
[[fruits.varieties]]
diff --git a/tomelr.el b/tomelr.el
index 01b652b0f4..0c97552b62 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -292,12 +292,24 @@ Definition of a TOML Table (TT):
;; (when (listp elem)
;; (message " [tomelr--toml-table-p DBG] sub-elem 0 = %S,
type = %S, len = %d"
;; (car elem) (type-of (car elem)) (safe-length
(car elem))))
- (or (and (consp elem)
- (= 1 (safe-length elem))
- (not (consp (car elem))))
- (and (listp elem)
- (symbolp (car elem))
- (tomelr--toml-table-p (cdr elem)))))
+ (or
+ ;; Basic TT case
+ ;; ((a . 1)
+ ;; (b . 2))
+ (and (consp elem)
+ (= 1 (safe-length elem))
+ (not (consp (car elem))))
+ (and (listp elem)
+ (symbolp (car elem))
+ (or
+ ;; Nested TT case
+ ;; ((b . ((c . 3)
+ ;; (d . 4))))
+ (tomelr--toml-table-p (cdr elem))
+ ;; Nested TTA case
+ ;; ((b . (((c . 3))
+ ;; ((c . 300)))))
+ (tomelr--toml-table-array-p (cdr elem))))))
object)
t)
(t
- [elpa] externals/tomelr ebe5959174 75/84: feat: Auto-coerce string to boolean, (continued)
- [elpa] externals/tomelr ebe5959174 75/84: feat: Auto-coerce string to boolean, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr a676192b43 81/84: fix: Integer coercing of a number strings with underscores, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 8da825067b 15/84: chore(readme): Update, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 65653d53ee 30/84: chore(doc): M-x checkdoc fixes, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr bcaea16ec0 39/84: chore(doc): Clean up old code block, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 45542fb234 67/84: chore: Bump version, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 7c004af90d 66/84: style: Remove unnecessary tomelr-encode-* functions, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 568de5efb2 83/84: chore: Bump version, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 0d4674f782 42/84: test: Test `tomelr--toml-table-p`, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 0eb4fa04ac 43/84: fix: Don't let array of TOML tables be recognized as TOML tables, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr a33dbd1286 50/84: fix: Detect nested TTA correctly when not present in first TT key,
ELPA Syncer <=
- [elpa] externals/tomelr dc9b2a63f8 60/84: doc: Remove an invalid example, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 044b5e1a04 61/84: fix: TT with key with array value are detected correctly, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 171e5a7682 62/84: fix: List format array of plists now detected as TOML Table Array, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 57bed2cca8 73/84: test: Add a test for string scalar with blank lines, ELPA Syncer, 2022/05/03