hcard-pt-br

From Microformats Wiki
Jump to navigation Jump to search

hCard

hCard é um simples, aberto formato distribuído para represetar pessoas, companias, organizações e lugares usando uma representação 1:1 de propriedades e valores de padrão vCard (RFC2426) em semântica XHTML. hCard é um dos muitos padrões abertos de microformato apropriado para ser inserido em (X)HTML, Atom, RSS, e o arbitrário XML.

Quer começar a escrever em hCard? Use o criador de hCard

para detalhar algumas informações de contato e publicá-la, ou seguir hCard authoring tips para adicionar marcação hCard em sua página atual de contato.

Especificação

Editor

Tantek Çelik, Technorati, Inc.

Autores

Copyright

This specification is (C) 2004-2024 by the authors. However, the authors intend to submit (or already have submitted, see details in the spec) this specification to a standards body with a liberal copyright/licensing policy such as the GMPG, IETF, and/or W3C. Anyone wishing to contribute should read their copyright principles, policies and licenses (e.g. the GMPG Principles) and agree to them, including licensing of all contributions under all required licenses (e.g. CC-by 1.0 and later), before contributing.

Patentes

This specification is subject to a royalty free patent policy, e.g. per the W3C Patent Policy, and IETF RFC3667 & RFC3668.

Inspiração e Reconhecimentos

Agradecimento à: meu amigo Vadim que me introduziu ao vCard vários anos atrás, e se eu tivesse prestado mais atenção talvez então poderia ter ajudado muitas pessoas a evitar desperdiçar tempo reinventando várias rodas de padrões wheels.

Introdução

O padrão vCard (RFC2426), tem largamente implementado interoperabilidade (e.g. Apple's "Address Book" application built into MacOSX).

Em adição, muitos bloggers se identificam pelo nome e discutem a seus amigos e família. Com só um pouco de estrutura, bloggers podem discutir as pessoas em seus blog(s) de tal um modo que spiders e outros agregadores podem receber essa informação, automaticamente convertê-las para vCard e usá-las então e qualquer aplicativo vCard ou serviços.

Essa especificação introduz o formato hCard , que usa uma representação 1:1 de propriedades e valores de mencioado no padrão vCard acima, em elemento XHTML. podem ambos embutir diretamente hCards em suas páginas, e estilizá-las com CSS tornando-as parecido como desejado.

Em adição, hCard ativa aplicações para receber informação diretamente de páginas web sem ter que referenciar um arquivo separado

Use o criador de hCard para copiar o código HTML e gerar para seu blog ou website e publicá-lo em sua informação de contato.

Semântica XHTML Princípios de Design

Note: the Semantic XHTML Design Principles were written primarily within the context of developing hCard and hCalendar, thus it may be easier to understand these principles in the context of the hCard design methodology (i.e. read that first). Tantek

XHTML is built on XML, and thus XHTML based formats can be used not only for convenient display presentation, but also for general purpose data exchange. In many ways, XHTML based formats exemplify the best of both HTML and XML worlds. However, when building XHTML based formats, it helps to have a guiding set of principles.

  1. Reuse the schema (names, objects, properties, values, types, hierarchies, constraints) as much as possible from pre-existing, established, well-supported standards by reference. Avoid restating constraints expressed in the source standard. Informative mentions are ok.
    1. For types with multiple components, use nested elements with class names equivalent to the names of the components.
    2. Plural components are made singular, and thus multiple nested elements are used to represent multiple text values that are comma-delimited.
  2. Use the most accurately precise semantic XHTML building block for each object etc.
  3. Otherwise use a generic structural element (e.g. <span> or <div>), or the appropriate contextual element (e.g. an <li> inside a <ul> or <ol>).
  4. Use class names based on names from the original schema, unless the semantic XHTML building block precisely represents that part of the original schema. If names in the source schema are case-insensitive, then use an all lowercase equivalent. Components names implicit in prose (rather than explicit in the defined schema) should also use lowercase equivalents for ease of use. Spaces in component names become dash '-' characters.
  5. Finally, if the format of the data according to the original schema is too long and/or not human-friendly, use <abbr> instead of a generic structural element, and place the literal data into the 'title' attribute (where abbr expansions go), and the more brief and human readable equivalent into the element itself. Further informative explanation of this use of <abbr>: Human vs. ISO8601 dates problem solved

Formato

Em geral

The vCard standard (RFC2426) forma a base do hCard.

O formato básico de hCard é usar nomes vCard objeto/propriedade em caixa-baixa para nomes de classes, e mapear aninhando objetos vCard diretamente para elementos XHTML aninhado.

Mais Equivalente Semântico

Para algumas propriedades há o elemento HTML que é mais combinado e conduz suas semanticas.

A seguinte propriedade DEVE ser codificada com o seguinte (X)HTML:
  • URL um vCard que se torna <a class="url" href="...">...</a> dentro do elemento com class="vcard" em hCard.
  • Similarmente, EMAIL um vCard que se torna <a class="email" href="mailto:...">...</a>
  • PHOTO um vCard que se torna <img class="photo" src="..." alt="Foto de ..." /> ou <object class="photo" data="..." type="...">Foto de ...</object>
  • UID um vCard simply que se torna outro semantica aplicada a uma especifico URL (ou EMAIL) para um hCard.

Propriedades Singular vs. Plural

Para propriedades que estão no singular (ex. "N" e "FN"), o primeiro elemento descendente com aquela class deve ter efeito, qualquer outros serão ignorados.

Para propriedades que podem estar no plural (ex. "TEL"), each class instance should create a instance of that property.

Propriedades no Singular

Propriedades no Singular: "FN", "N", "BDAY", "TZ", "GEO", "SORT-STRING", "UID", "CLASS".

Todas as outras propriedades são plural. Essa lista foi derivada de uma analize de semantica de propriedades individuais em vCard RFC2426 e determinando logicamente que eles DEVEM ser singular pela sua semantica. Ver hcard-singular-properties para explicação.

Propriedades plurais Singularizadas

Desde que nomes de propriedades plurais tornam-se seus equivalente em singular, mesmo se propriedade no plural original permitiu só um único valor com componentes múltiplos, esses múltiplos componentes são representados cada um com suas próprios propriedade nomeada singularidade e a propriedade é efetivamente polivalente e submetido ao tratamento acima de propriedades polivalente.

Human vs. Machine readable

If an <abbr> element is used for a property, then the 'title' attribute of the <abbr> element is the value of the property, instead of the contents of the element, which instead provide a human presentable version of the value.

If an <a> element is used for one or more properties, it must be treated as follows:

  1. For the "PHOTO" property and any other property that takes a URL as its value, the href="..." attribute provides the property value.
  2. For other properties, the element's content is the value of the property.

If an <img> element is used for one or more properties, it must be treated as follows:

  1. For the "PHOTO" property and any other property that takes a URL as its value, the src="..." attribute provides the property value.
  2. For other properties, the <img> element's 'alt' attribute is the value of the property.

If an <object> element is used for one or more properties, it must be treated as follows:

  1. For the "PHOTO" property and any other property that takes a URL as its value, the data="..." attribute provides the property value.
  2. For other properties, the element's content is the value of the property.

Value excerpting

Sometimes only part of an element which is the equivalent for a property should be used for the value of the property. This typically occurs when a property has a subtype, like TEL. For this purpose, the special class name "value" is introduced to excerpt out the subset of the element that is the value of the property. E.g. here is an hCard fragment for marking up a home phone number:

vCard:

TEL;TYPE=HOME:+1.415.555.1212

hCard:

<span class="tel">
 <span class="type">home</span>:
 <span class="value">+1.415.555.1212</span>
</span>

This hCard fragment could be displayed as:

home: +1.415.555.1212

Property Exceptions

vCard has several properties which either do not make sense on, or are already implied within the context of a web page. This section explains what to (not) do with them.

  1. NAME, PROFILE, SOURCE, PRODID, VERSION properties as defined in Sections 2.1.2, 2.1.3, 2.1.4, 3.6.3, 3.6.9 of RFC 2426. Content publishers MUST NOT use these properties in their hCards, and as such, hCard consumers/parsers MUST IGNORE these properties if they are found within an hCard. Instead. hCard to vCard converters SHOULD use the title of the page where the hCard is found (e.g. the <title> element in (X)HTML documents) to construct the NAME property, MAY output a PROFILE value of "VCARD" per RFC 2426, SHOULD use the URL of the page where the hCard is found to construct the SOURCE property (e.g. perhaps as a parameter to a URL/service that converts hCards to vCards), for an output vCard stream (e.g. a .vcf file). Only services/applications that output actual vCards should write the PRODID property, with the product identifier for said service/application. Similarly only such services/applications should write the VERSION property, with the value "3.0" (without quotes) per RFC2426 Section 3.6.9.

Organization Contact Info

If the "FN" and "ORG" properties have the exact same value (typically because they are set on the same element, e.g. class="fn org"), then the hCard represents contact information for a company or organization and should be treated as such. In this case the author MUST also NOT set the "N" property, or set it (and any sub-properties) explicitly to the empty string "". Thus parsers should handle the missing "N" property in this case by implying empty values for all the "N" sub-properties.

Implied "n" Optimization

Although vCard requires that the "N" property be present, the authors of the vCard specification (RFC 2426) themselves do not include "N" properties in their vCards near the end of the spec (p.38). This apparent contradiction can be resolved by simply allowing the "FN" property to imply "N" property values in typical cases provided in the spec. We do so explicitly in hCard.

If "FN" and "ORG" are not the same (see previous section), and the value of the "FN" property is exactly two words (separated by whitespace), and there is no explicit "N" property, then the "N" property is inferred from the "FN" property. For "FN"s with either one word see below, and for three or more, the author MUST explicitly markup the "N", except for the organization contact info case, see above for that.

  1. The content of "FN" is broken into two "words" separated by whitespace.
  2. The first word of the "FN" is interpreted as the "given-name" for the "N" property.
  3. The second/last word of the "FN" is interpreted as the "family-name" for the "N" property.
  4. Exception: If the first word ends in a "," comma OR if the second word is a single character (optionally followed by a period "."), then the first word (minus the comma at the end if any) is interpreted as the "family-name" and the second word is interpreted as the "given-name".

This allows simplification in the typical case of people stating:

  • given-name (space) family-name
  • family-name (comma) given-name
  • family-name (comma) given-name-first-initial
  • family-name (space) given-name-first-initial (optional period)

Implied "nickname" Optimization

Due to the prevalence of the use of nicknames/handles/usernames on the Web in actual content published on the Web (e.g. authors of reviews), hCard also has an implied "nickname" optimization to handle this.

Similar to the implied "n" optimization, if "FN" and "ORG" are not the same, and the value of the "FN" property is exactly one word, and there is no explicit "N" property, then:

  1. The content of the "FN" is treated as a "nickname" property value.
  2. Parsers should handle the missing "N" property by implying empty values for all the "N" sub-properties.

Note: the hCard may have additional explicit "nickname" property values in addition to the implied nickname.

Implied "organization-name" Optimization

The "ORG" property has two subproperties, organization-name and organization-unit. Very often authors only publish the organization-name. Thus if an "ORG" property has no "organization-name" inside it, then its entire contents MUST be treated as the "organization-name".

Tags as Categories

Categories in hCard can optionally be represented by tags with rel-tag. When a category property is a rel-tag, the tag (as defined by rel-tag) is used for that category.

Root Class Name

The root class name for an hCard is "vcard".

Property List

This is the list of properties (and subproperties, in parentheses, like this) in hCard, taken from vCard:

  • fn, n (family-name, given-name, additional-name, honorific-prefix, honorific-suffix), nickname, sort-string
  • url, email (type, value), tel (type, value)
  • adr (post-office-box, extended-address, street-address, locality, region, postal-code, country-name, type, value), label
  • geo (latitude, longitude), tz
  • photo, logo, sound, bday
  • title, role, org (organization-name, organization-unit)
  • category, note
  • class, key, mailer, uid, rev

type subproperty values

The 'type' subproperty in particular takes different values depending on which property it is a subproperty of. These 'type' subproperty values are case-INSENSITIVE, meaning "Home" is the same as "home", as well as multivalued, e.g. a tel can be home and preferred:

vCard:

TEL;TYPE=HOME,PREF:+1.415.555.1212

hCard:

<span class="tel"><span class="type">Home</span> (<span class="type">pref</span>erred):
 <span class="value">+1.415.555.1212</span>
</span>

This could be displayed as:

Home (preferred): +1.415.555.1212

The following lists are informative. See RFC 2426 sections 3.2.1 ADR, 3.3.1 TEL, and 3.3.2 EMAIL respectively for normative type values. They are repeated here for convenience. Default type subproperty value(s) is(are) first in each list and indicated in ALL CAPS. types may be multivalued.

  • adr type: INTL, POSTAL, PARCEL, WORK, dom, home, pref
  • tel type: VOICE, home, msg, work, pref, fax, cell, video, pager, bbs, modem, car, isdn, pcs
  • email type: INTERNET, x400, pref, "other IANA registered address types"

XMDP Profile

See hcard-profile for the XMDP profile of hCard which contains the above complete list of properties, with references to their RFC 2426 definitions.

Parsing Details

See hCard parsing.

Examples

This section is informative.

Sample vCard

Here is a sample vCard:

BEGIN:VCARD
VERSION:3.0
N:Çelik;Tantek
FN:Tantek Çelik
URL:http://tantek.com/
ORG:Technorati
END:VCARD

and an equivalent in hCard with various elements optimized appropriately. See hCard Example 1 for the derivation.

<div class="vcard">
 <a class="url fn" href="http://tantek.com/">Tantek Çelik</a>
 <div class="org">Technorati</div>
</div>

This hCard might be displayed as:

Tantek Çelik
Technorati

Note: The version information is unnecessary in hCard markup directly since the version will be defined by the profile of hCard that is used/referred to in the 'profile' attribute of the <head> element.

More Examples

See hcard-examples for more examples, including all examples from vCard RFC 2426 converted into hCard.

Examples in the wild

This section is informative.

The following sites have published hCards, and thus are a great place to start for anyone looking for examples "in the wild" to try parsing, indexing, organizing etc. If you have an hCard on your own page, feel free to add it to the top of this list. Once the list grows too big, we'll make a separate wiki page.

New Examples

Please add new examples to this section.

Examples

UTF8 Examples in the Wild

These examples all contain one or more characters in UTF8 that are outside the ASCII7 range and make for excellent test cases to make sure you are handling UTF8 properly throughout your hCard parsing and transforming. And especially if you are generating vCards, these test cases will help you make sure you are generating UTF8 vCards in such a way that can be recognized by UTF8 supporting vCard applications.

Examples with some problems

  • Gerard Braad has published an example on his profile page that is almost consistent with his original vCard file. Also progress is made for transforming his FoaF file to a hCard encoded representation. (also done for my spouse:Yong Yuan)
    • (2005-09-27) PASSED, PASSED
    • WARNINGS
      • uses 'n given-name' and 'n family-name' instead of nesting the given- and family- names inside the 'n'
      • has one 'tel' value with a bunch of values stuffed in
      • probably more problems --RyanKing 17:19, 5 Jan 2006 (PST)
  • Cori Schlegel discusses how he has updated his contact page with hCard
    • INVALID - using 'prefix' instead of 'honorific-prefix' and type's in classnames (in both adr and tel) and has two photo's (the second could be 'logo') --RyanKing 15:15, 5 Jan 2006 (PST)
  • The good ship Leonid Miloslavskiy spotted in the North Atlantic
    • INVALID --RyanKing 00:50, 27 Oct 2005 (PDT)
      • class="family" should probably be family-name
      • the "n" property is missing and the "n" optimization can't be applied
      • the first geo propery is empty, the second one is invalid (ie, it doesn't contain lat/long)
  • Landsbanki Føroya
    • INVALID - using embedded rdf/xml invalidly
  • Chris Cherry's contact page with his hCard
    • WARNING - uses class="cell" instead of <span class="type">cell</span> Fixed -- Chris Cherry 19:54, 15 Sep 2006 (PST)
  • University of Bath Person Finder results are encoded with hCards so you can easily create a vCard from any result.
    • ERROR - attempt to use Implied-N optimization where that's not possible. --RyanKing 14:29, 5 Jan 2006 (PST)
    • Error appears for external users only. Won't be fixed any time soon. -- PhilWilson 00:03, 28 Jan 2006 (GMT)
  • Richi Jennings has put up his attempt
    • INVALID, missing FN --RyanKing 12:47, 5 Jan 2006 (PST)
  • Yellow Pencil Using microformats to present company contact information
    • First hcard has empty "fn" and no "n". "fn" should be with "org" -- ScottReynen 21:29, 19 Jun 2006 (CST)

Implementations

This section is informative.

The following implementations have been developed which either generate or parse hCards. If you have an hCard implementation, feel free to add it to the top of this list. Once the list grows too big, we'll make a separate wiki page.

  • Microformats Bookmarklet is a bookmarklet designed for Safari (works in Firefox and Camino) that overlays on the current page to allow users to import individual hCards or hCalendars. Written by Remy Sharp.
  • vCardExplorer 0.2 is a Mac OS X Application, that displays VCF-Files and extracts hCards from Websites written by Daniel Kagemann.
  • Extract Microformats is a script for NetNewsWire that supports extracting hCard and hCalendar data in blog posts (via technorati service). Written by Chris Casciano
  • hKit is an open source PHP 5 parsing library with support for hCard.
  • Technorati Microformats Search indexes hCard, hCalendar, and hReview as announced by Tantek.
    • list of pages with indexing Issues so they can be looked into as to why data is not being extracted
    • suda.co.uk/contact
    • multipack.co.uk

Additional Applications

This section is informative.

There are numerous potential additional uses and applications for hCards on the Web. The following are merely a few thoughts and possibilities that folks have come up with:

  • As an open standard/format for Gravatars.
  • Marking up individual authors of blog posts on a group blog
  • Marking up people's names and URLs in a blogroll
  • Any reference to people in blog posts (e.g. when citing them, or referencing them, or describing them, by name).
  • ...

References

Normative References

Informative References

Specifications That Use hCard

Similar Work

Related Pages

  • hCard creator (feedback) - create your own hCard.
  • hCard authoring - learn how to add hCard markup to your existing contact info.
  • hCard examples - Example usage of various classes within hCard,
  • hCard FAQ - If you have any questions about hCard, check here, and if you don't find answers, add your questions!
  • hCard parsing - Normatively details of how to parse hCards.
  • hCard issues - Please add any specific issues with the specification to the issues page.
  • hCard feedback - General feedback (as opposed to specific issues) should be added to the hCard feedback page.
  • hCard profile - The XMDP profile for hCard

This specification is a work in progress. As additional aspects are discussed, understood, and written, they will be added. These thoughts, issues, and questions are kept in separate pages.

  • hCard Brainstorming - where we are keeping our brainstorms and other explorations relating to hCard
  • hCard tests - a wiki page with actual embedded hCards to try parsing.

Further Reading