Fix broken property-splitting
Also, now we avoid using regex, which is apparently more efficient, According to TIME.
This commit is contained in:
parent
7af1c41b35
commit
8e73f121be
15
vcarded.scm
15
vcarded.scm
|
@ -50,8 +50,21 @@
|
|||
|
||||
|
||||
;; Splits a key or value-element into its (potentially multiple) parameters.
|
||||
;; … basically just splits along non-escaped semi-colons.
|
||||
;; "Bird;dad;apple\;mom" → ("Bird" "dad" "apple\;mom")
|
||||
(define (split-vcard-element key-or-value)
|
||||
(irregex-extract "(\\\\;|[^;])*" key-or-value))
|
||||
(let [(appendee "")]
|
||||
(remove
|
||||
not
|
||||
(map (lambda (str)
|
||||
(let [(str (string-concatenate `(,appendee ,str)))]
|
||||
(if (and (not (string-null? str))
|
||||
(eq? (last (string->list str))
|
||||
#\\))
|
||||
(and (set! appendee (string-concatenate `(,str ";")))
|
||||
#f)
|
||||
(and (set! appendee "") str))))
|
||||
(string-split key-or-value ";")))))
|
||||
|
||||
|
||||
;; Parse a line of a vcard file into an alist-friendly format:
|
||||
|
|
Ŝarĝante…
Reference in New Issue