Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • N node-ostatus
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Administrator
  • node-ostatus
  • Wiki
  • Hcard

Hcard · Changes

Page history
Created Hcard (markdown) authored Mar 03, 2011 by eschnou's avatar eschnou
Hide whitespace changes
Inline Side-by-side
Showing with 87 additions and 0 deletions
+87 -0
  • Hcard.md Hcard.md +87 -0
  • No files found.
Hcard.md 0 → 100644
View page @ ebc9a9a7
hCard is a simple, open, distributed format for representing people, companies, organizations, and places, using a 1:1 representation of vCard (RFC2426) properties and values in semantic HTML or XHTML. hCard is one of several open microformat standards suitable for embedding in HTML, XHTML, Atom, RSS, and arbitrary XML.
**Spec:** <http://microformats.org/wiki/hcard>
## lookup(url, callback)
Attempt to fetch a HCard at the given URL. If a HCard is present, it is parsed and returned to the callback as a Javascript associative array. The keys match the names of the HCard properties.
Example:
var ostatus = require('ostatus');
ostatus.hcard.lookup("http://identi.ca/eschnou/hcard", function(err, hcard) {
console.log(hcard);
});
Will outpout:
{ photo: 'http://avatar.identi.ca/16106-96-20080722053859.png',
nickname: 'eschnou',
fn: 'Laurent',
label: 'Liège, Belgium',
url: 'http://eschnou.com',
note: 'Coder, not blogger. Technology enthusiast. Exploring the future of the web & mobility.'
}
## render(hcard, callback)
Given an associative array whose keys are matching HCard parameters, this function will render a proper HCard. In practice, it is simply rendering the template hcard.html.mu using the provided content.
Examples:
var ostatus = require('ostatus');
var hcard = { avatar: 'http://avatar.identi.ca/16106-96-20080722053859.png',
nickname: 'eschnou',
fn: 'Laurent',
location: 'Liège, Belgium',
note: 'Coder, not blogger. Technology enthusiast. Exploring the future of the web & mobility.'
}
ostatus.hcard.render(hcard, function(err, html) {
console.log(html);
});
Will output:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>HCard - eschnou</title>
</head>
<body id="hcard">
<div id="wrapper">
<div id="i" class="entity_profile vcard author">
<h2>User profile</h2>
<dl class="entity_depiction">
<dt>Photo</dt>
<dd>
<img src="http://avatar.identi.ca/16106-96-20080722053859.png"
Class="photo avatar" width="96" height="96" alt="eschnou"/>
</dd>
</dl>
<dl class="entity_nickname">
<dt>Nickname</dt>
<dd>
<a href="" rel="me" class="nickname url uid">eschnou</a>
</dd>
</dl>
<dl class="entity_fn">
<dt>Full name</dt>
<dd>
<span class="fn">Laurent</span>
</dd>
</dl>
<dl class="entity_location">
<dt>Location</dt>
<dd class="label">Liège, Belgium</dd>
</dl>
<dl class="entity_note">
<dt>Note</dt>
<dd class="note">Software hacker, building socialJS.</dd>
</dl>
</div>
</div>
</body>
</html>
Clone repository
  • Activitystreams
  • Hcard
  • Home
  • Profile.js
  • Pubsubhubbub
  • Salmon
  • Status.js
  • Webfinger.js
  • Webfinger