1 # We just try to autodetect everything.
3 push(@MyRules, \
&hCardRule
);
5 my $addr = qr
(\G
(\S
+ \S
+)
7 ((?
:[A
-Z
][A
-Z
]?
-)?\d
+) (.*)(?
:
12 my $email = qr
(\G\s
*(\S
+@\S
+)\n?
);
14 my $tel = qr
(\G\s
*(\S
+): (\
+?
[-0-9 ]+)\n?
);
17 return undef unless $bol;
18 my ($fn, $street, $zip, $city, $country) = /$addr/cg;
20 my ($mail) = /$email/cg;
21 my ($phonetype, $phone) = /$tel/cg;
22 my $html = $q->span({-class=>'fn'}, $fn) . $q->br();
23 $html .= $q->span({-class=>'street-address'}, $street) . $q->br();
24 $html .= $q->span({-class=>'postal-code'}, $zip)
25 . ' ' . $q->span({-class=>'locality'}, $city);
27 . $q->span({-class=>'country-name'}, $country) if $country;
28 my $hCard = $q->p($html);
30 $html .= $q->span({-class=>'email'},
31 $q->a({-href
=>'mailto:' . $mail}, $mail)) if $mail;
32 $html .= $q->br() if $mail and $phone;
33 $html .= $q->span({-class=>'tel'},
34 $q->span({-class=>'type'}, $phonetype) . ': '
35 . $q->span({-class=>'value'}, $phone)) if $phone;
36 $hCard .= $q->p($html) if $html;
37 $hCard = $q->div({-class=>'vcard',
38 -style
=>'color:red;'}, $hCard);
39 return CloseHtmlEnvironments
() . $hCard . AddHtmlEnvironment
('p');