From 57e3be8caf04ee1bf0e89488d21b239496a7af4a Mon Sep 17 00:00:00 2001 From: Jochen Klein Date: Mon, 25 Jan 2016 17:45:05 +0100 Subject: [PATCH] BibFormat: vCard support for people collection * Adds vCard support for detailed profile pages for the people collection and contains full name, affiliation, email, phone, mobile, and fax number. Uses microformats hCard 1.0. Signed-off-by: Jochen Klein --- .../format_templates/People_HTML_detailed.bft | 7 ++- .../lib/elements/bfe_authority_contact.py | 44 +++++++++++++++---- 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/modules/bibformat/etc/format_templates/People_HTML_detailed.bft b/modules/bibformat/etc/format_templates/People_HTML_detailed.bft index 072c6402bd..ecf191c2d1 100644 --- a/modules/bibformat/etc/format_templates/People_HTML_detailed.bft +++ b/modules/bibformat/etc/format_templates/People_HTML_detailed.bft @@ -77,9 +77,10 @@ table tr td { } +
- - + +

Personal Information

@@ -112,6 +113,7 @@ table tr td {
@@ -121,6 +123,7 @@ table tr td { default="No profiles."/>
+

Publications

" + "" + "{0}" + "".format(phone_number)) if icon.lower() == "yes": icon_class = "fa fa-phone" phone_number = " {1}".format( @@ -41,8 +53,14 @@ def format_phone_number(phone_number, icon="no"): return phone_number -def format_mobile_number(mobile_number, icon="no"): +def format_mobile_number(mobile_number, icon="no", vcard_support="no"): """Return formatted mobile phone number.""" + if vcard_support.lower() == "yes": + mobile_number = ( + "" + "" + "{0}" + "".format(mobile_number)) if icon.lower() == "yes": icon_class = "fa fa-mobile" mobile_number = " {1}".format( @@ -50,19 +68,27 @@ def format_mobile_number(mobile_number, icon="no"): return mobile_number -def format_fax_number(fax_number, icon="no"): +def format_fax_number(fax_number, icon="no", vcard_support="no"): """Return formatted fax number.""" + if vcard_support.lower() == "yes": + fax_number = ( + "" + "" + "{0}" + "".format(fax_number)) if icon.lower() == "yes": icon_class = "fa fa-fax" fax_number = " {1}".format(icon_class, fax_number) return fax_number -def format_element(bfo, contact_type="all", email_href="yes", icon="no"): +def format_element(bfo, contact_type="all", vcard_support="no", + email_href="yes", icon="no"): """Return contact information for the record. :param string contact_type: return all contact information if 'all', other values: 'email', 'phone', 'mobile', or 'fax' + :param string vcard_support: enables vCard support if 'yes' :param string email_href: link email address using mailto if 'yes' :param string icon: display icon for the specified contact_type if 'yes' """ @@ -79,10 +105,12 @@ def format_element(bfo, contact_type="all", email_href="yes", icon="no"): tbl_row = "{0}{1}" if email: result += tbl_row.format( - _("Email address"), format_email(email[0].lower(), email_href)) + _("Email address"), format_email( + email[0].lower(), email_href, vcard_support=vcard_support)) if phone_number: result += tbl_row.format( - _("Phone number"), format_phone_number(phone_number[0])) + _("Phone number"), format_phone_number( + phone_number[0], vcard_support=vcard_support)) if mobile_number: result += tbl_row.format( _("Mobile number"), format_mobile_number(mobile_number[0]))