Support spaces in quoted metadata values

This commit is contained in:
Ben Sturmfels 2024-02-20 14:37:54 +11:00
parent 783d98c4da
commit 5421ae8adc
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0
2 changed files with 4 additions and 11 deletions

View file

@ -166,6 +166,7 @@
name
"rt:19462/674660"
(let [r-super-lines (filter #(str/starts-with? (:category %) "403b") records)
;; TODO: Have I got the liability/witholding right? Which is used in which report.
r-witholding-lines (filter #(= (:type %) "Withholding") records)
r-insurance-lines (filter #(and (= (:type %) "Withholding")
(str/includes? (:category %) "NY Disability")) records)

View file

@ -16,9 +16,7 @@
:key ::token
:_ #{\:}
:_ ::whitespace
:_ #{\"}
:value ::token
:_ #{\"}
:value ::quoted-token
:_ #{\newline}))
(s/def ::posting
@ -62,11 +60,9 @@
;; posting amount to bigdec
(and (= (type %) clojure.lang.PersistentArrayMap)
(contains? % :amount)) (dissoc (update % :amount bigdec) :_)
;; flatten description
;; flatten quoted-tokens
(and (= (type %) clojure.lang.PersistentArrayMap)
(contains? % :desc)) (-> %
(update :desc :token)
(dissoc :_))
(contains? % :token)) (:token %)
;; drop :_ keys
(= (type %) clojure.lang.PersistentArrayMap) (dissoc % :_)
;; convert {:key a :value b} to {:a b}
@ -83,7 +79,3 @@
[text]
(let [tree (s/conform ::transactions (conj (vec text) \newline))]
(convert-parse-tree tree)))
(convert-parse-tree
[{:desc {:token "foo"}}])