[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 72aba6a 228/350: New label/field alist for vcard e
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 72aba6a 228/350: New label/field alist for vcard export |
Date: |
Mon, 14 Aug 2017 11:46:43 -0400 (EDT) |
branch: externals/ebdb
commit 72aba6a0017281e7b99e43259621f5cafeebf775
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
New label/field alist for vcard export
Addresses #2
* ebdb-vcard.el (ebdb-vcard-label-alist): New customization option, an
alist mapping Vcard string labels to field class names. This is
another step towards Vcard import/parsing; this alist will be used
in that process.
---
ebdb-vcard.el | 70 ++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 41 insertions(+), 29 deletions(-)
diff --git a/ebdb-vcard.el b/ebdb-vcard.el
index bfde104..b08af56 100644
--- a/ebdb-vcard.el
+++ b/ebdb-vcard.el
@@ -93,6 +93,31 @@
:group 'ebdb-vcard
:type 'ebdb-formatter-vcard)
+(defcustom ebdb-vcard-label-alist
+ '(("REV" . ebdb-field-timestamp)
+ ("NOTE" . ebdb-field-notes)
+ ("X-CREATION-DATE" . ebdb-field-creation-date)
+ ("UID" . ebdb-field-uuid)
+ ("EMAIL" . ebdb-field-mail)
+ ("TEL" . ebdb-field-phone)
+ ("RELATED" . ebdb-field-relation)
+ ("CATEGORIES" . ebdb-org-field-tags)
+ ("BDAY" . ebdb-field-anniversary)
+ ("ANNIVERSARY" . ebdb-field-anniversary)
+ ("URL" . ebdb-field-url)
+ ("ADR" . ebdb-field-address)
+ ("NICKNAME" . ebdb-field-name-complex))
+ "Correspondences between VCard properties and EBDB field classes.
+
+This alist is neither exhaustive nor authoritative. It's purpose
+is to simplify property labeling during the export process, and
+to classify properties during import. The import process does
+not always respect these headings."
+
+ :group 'ebdb-vcard
+ :type '(repeat
+ (cons string symbol)))
+
(cl-defmethod ebdb-fmt-process-fields ((fmt ebdb-formatter-vcard)
(record ebdb-record)
field-list)
@@ -197,22 +222,12 @@ method is just responsible for formatting the record
name."
(ebdb-string field))
(cl-defmethod ebdb-fmt-field-label ((_f ebdb-formatter-vcard)
- (_field ebdb-field-timestamp)
+ (field ebdb-field)
_style
_record)
- "REV")
-
-(cl-defmethod ebdb-fmt-field-label ((_f ebdb-formatter-vcard)
- (_field ebdb-field-notes)
- _style
- _record)
- "NOTE")
-
-(cl-defmethod ebdb-fmt-field-label ((_f ebdb-formatter-vcard)
- (_field ebdb-field-creation-date)
- _style
- _record)
- "X-CREATION-DATE")
+ (car (rassoc (eieio-class-name
+ (eieio-object-class field))
+ ebdb-vcard-label-alist)))
(cl-defmethod ebdb-fmt-field ((_f ebdb-formatter-vcard)
(mail ebdb-field-mail)
@@ -242,15 +257,15 @@ method is just responsible for formatting the record
name."
(_field ebdb-field-uuid)
_style
_record)
- "UID:urn:uuid")
+ (concat (cl-call-next-method) ":urn:uuid"))
(cl-defmethod ebdb-fmt-field-label ((_f ebdb-formatter-vcard)
(mail ebdb-field-mail)
_style
_record)
(with-slots (priority) mail
- (format
- "EMAIL%s"
+ (concat
+ (cl-call-next-method)
(cl-case priority
('primary ";PREF=1")
('normal ";PREF=10")
@@ -261,31 +276,28 @@ method is just responsible for formatting the record
name."
(phone ebdb-field-phone)
_style
_record)
- (format "TEL;TYPE=%s" (slot-value phone 'object-name)))
+ (concat (cl-call-next-method)
+ ";TYPE=" (slot-value phone 'object-name)))
(cl-defmethod ebdb-fmt-field-label ((_f ebdb-formatter-vcard)
(rel ebdb-field-relation)
_style
_record)
- (format "RELATED;TYPE=%s" (slot-value rel 'object-name)))
+ (concat (cl-call-next-method)
+ ";TYPE=" (slot-value rel 'object-name)))
(cl-defmethod ebdb-fmt-field-label ((_f ebdb-formatter-vcard)
(url ebdb-field-url)
_style
_record)
- (format "URL;TYPE=%s" (slot-value url 'object-name)))
+ (concat (cl-call-next-method)
+ ";TYPE=" (slot-value url 'object-name)))
(cl-defmethod ebdb-fmt-field ((_f ebdb-formatter-vcard)
(rel ebdb-field-relation)
_style
_record)
- (format "urn:uuid:%s" (slot-value rel 'rel-uuid)))
-
-(cl-defmethod ebdb-fmt-field-label ((_f ebdb-formatter-vcard)
- (_tags ebdb-org-field-tags)
- _style
- _record)
- "CATEGORIES")
+ (concat ":urn:uuid:" (slot-value rel 'rel-uuid)))
(cl-defmethod ebdb-fmt-field ((_f ebdb-formatter-vcard)
(tags ebdb-org-field-tags)
@@ -301,8 +313,8 @@ method is just responsible for formatting the record name."
(label-string
(if (string= label "birthday")
"BDAY"
- (format "ANNIVERSARY;TYPE=%s" label))))
- (format "%s;CALSCALE=%s" label-string (slot-value ann 'calendar))))
+ (concat "ANNIVERSARY;TYPE=" label))))
+ (concat label-string ";CALSCALE=" (slot-value ann 'calendar))))
(provide 'ebdb-vcard)
;;; ebdb-vcard.el ends here
- [elpa] externals/ebdb f316417 202/350: Change keybinding for ebdb-prev-field, (continued)
- [elpa] externals/ebdb f316417 202/350: Change keybinding for ebdb-prev-field, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb bfc5d9d 208/350: Internationalized ebdb-parse method for names must accept slots arg, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 0c2056c 209/350: Basic tests for EBDB's internationalization support, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 2bfb04e 220/350: Move ebdb-message-search to ebdb.el, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 40d71b9 222/350: Steal UUID generating function from Org, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 4937cbd 225/350: Specify class of name fields when updating from MUA, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 13c0a38 216/350: Tweaks to testing macros, more tests, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 2b28f57 239/350: Bump to version 0.2, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ff3cfa4 232/350: ebdb-parse-i18n for Chinese phones should pass class arg through, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb d5bec83 229/350: Fix to UUID change, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 72aba6a 228/350: New label/field alist for vcard export,
Eric Abrahamsen <=
- [elpa] externals/ebdb d0d0bbb 233/350: Shift transformation of search strings into ebdb-search, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb dc4217d 213/350: Compiler-inspired fixes, volume 5453, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ce5d9ee 242/350: Fix vCard formatting for anniversaries, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5d7a58c 246/350: Add option for character fold searching, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e5696fa 253/350: Add counsel-ebdb.el, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb fb4d5d5 255/350: Migration should guard against unparseable emails, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb aa15250 252/350: Change newline approach in vCard handling, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 0120729 240/350: Add vcard unescaping, and some vcard tests, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 6f8d59b 254/350: Fix record citation, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 3106b45 256/350: Require ebdb-format in ebdb-vcard, Eric Abrahamsen, 2017/08/14