hmachine 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/.gitignore +2 -2
  2. data/Gemfile +6 -4
  3. data/Gemfile.lock +51 -0
  4. data/README.md +123 -9
  5. data/Rakefile +12 -3
  6. data/bin/hmachine +99 -0
  7. data/hmachine.gemspec +132 -0
  8. data/lib/hmachine.rb +121 -12
  9. data/lib/hmachine/microformat.rb +39 -20
  10. data/lib/hmachine/microformat/adr.rb +22 -0
  11. data/lib/hmachine/microformat/geo.rb +48 -0
  12. data/lib/hmachine/microformat/hcard.rb +169 -11
  13. data/lib/hmachine/microformat/rellicense.rb +20 -0
  14. data/lib/hmachine/microformat/reltag.rb +38 -0
  15. data/lib/hmachine/microformat/votelinks.rb +42 -0
  16. data/lib/hmachine/microformat/xfn.rb +54 -0
  17. data/lib/hmachine/microformat/xmdp.rb +14 -0
  18. data/lib/hmachine/microformat/xoxo.rb +69 -0
  19. data/lib/hmachine/pattern.rb +26 -0
  20. data/lib/hmachine/pattern/abbr.rb +21 -0
  21. data/lib/hmachine/pattern/datetime.rb +75 -0
  22. data/lib/hmachine/pattern/typevalue.rb +32 -0
  23. data/lib/hmachine/pattern/url.rb +32 -0
  24. data/lib/hmachine/pattern/valueclass.rb +51 -0
  25. data/lib/hmachine/posh.rb +3 -0
  26. data/lib/hmachine/posh/anchor.rb +40 -0
  27. data/lib/hmachine/posh/base.rb +204 -0
  28. data/lib/hmachine/posh/definition_list.rb +41 -0
  29. data/test/fixtures/huffduffer.html +466 -0
  30. data/test/fixtures/likeorhate.html +48 -0
  31. data/test/fixtures/rel_license.html +4 -0
  32. data/test/fixtures/test-fixture/hcard/hcard1.html +147 -0
  33. data/test/fixtures/test-fixture/hcard/hcard11.html +123 -0
  34. data/test/fixtures/test-fixture/hcard/hcard12.html +178 -0
  35. data/test/fixtures/test-fixture/hcard/hcard17.html +165 -0
  36. data/test/fixtures/test-fixture/hcard/hcard2.html +264 -0
  37. data/test/fixtures/test-fixture/hcard/hcard3.html +144 -0
  38. data/test/fixtures/test-fixture/hcard/hcard4.html +117 -0
  39. data/test/fixtures/test-fixture/hcard/hcard5.html +119 -0
  40. data/test/fixtures/test-fixture/hcard/hcard6.html +188 -0
  41. data/test/fixtures/test-fixture/hcard/hcard7.html +188 -0
  42. data/test/fixtures/test-fixture/hcard/hcard8.html +130 -0
  43. data/test/fixtures/test-fixture/hcard/hcard9.html +111 -0
  44. data/test/fixtures/test-fixture/hcard/hcard99.html +215 -0
  45. data/test/fixtures/test-fixture/value-class-date-time/value-dt-test-YYYY-MM-DD--HH-MM.html +9 -0
  46. data/test/fixtures/test-fixture/value-class-date-time/value-dt-test-abbr-YYYY-MM-DD--HH-MM.html +4 -0
  47. data/test/fixtures/xfn.html +198 -0
  48. data/test/fixtures/xmdp.html +32 -0
  49. data/test/fixtures/xoxo.html +51 -0
  50. data/test/hmachine_test.rb +122 -6
  51. data/test/microformat/adr_test.rb +47 -0
  52. data/test/microformat/geo_test.rb +66 -0
  53. data/test/microformat/hcard_test.rb +487 -20
  54. data/test/microformat/rellicense_test.rb +36 -0
  55. data/test/microformat/reltag_test.rb +61 -0
  56. data/test/microformat/votelinks_test.rb +44 -0
  57. data/test/microformat/xfn_test.rb +28 -0
  58. data/test/microformat/xmdp_test.rb +16 -0
  59. data/test/microformat/xoxo_test.rb +51 -0
  60. data/test/microformat_test.rb +12 -34
  61. data/test/pattern/date_time_test.rb +55 -0
  62. data/test/pattern/value_class_test.rb +33 -0
  63. data/test/pattern_test.rb +132 -0
  64. data/test/posh/anchor_test.rb +41 -0
  65. data/test/posh/base_test.rb +150 -0
  66. data/test/posh/definition_list_test.rb +38 -0
  67. data/test/test_helper.rb +24 -6
  68. metadata +93 -15
  69. data/lib/hmachine/microformat/base.rb +0 -17
@@ -0,0 +1,117 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+
4
+ <head>
5
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6
+ <title>hCard 4 - n (name) singular and multiple occurrence test</title>
7
+
8
+ <!-- This will be replace with one CSS file and one JavaScipt file -->
9
+ <link rel="stylesheet" href="../css/uftestsuite.css" type="text/css" />
10
+ <link rel="stylesheet" href="../../testrunner/css/testrunner.css" type="text/css" />
11
+
12
+ <script type="text/javascript" src="../../testrunner/javascript/prototype-1.6.0.2.js"></script>
13
+ <script type="text/javascript" src="../../testrunner/javascript/beautify.js"></script>
14
+ <script type="text/javascript" src="../../testrunner/javascript/sumo/microformat.js"></script>
15
+ <script type="application/javascript;version=1.7" src="http://svn.mozilla.org/labs/operator/chrome/operator/content/Microformats/Microformats.js"></script>
16
+ <script type="text/javascript" src="../../testrunner/javascript/testrunner.js"></script>
17
+
18
+ </head>
19
+ <body>
20
+
21
+ <div class="test-fixture">
22
+
23
+ <p>
24
+ <a href="../"><img border="0" id="testsuite-image" alt="Microformats test suite" src="../images/testsuite.gif" /></a><br />
25
+ </p>
26
+
27
+ <h1 class="summary">hCard 4 - n (name) singular and multiple occurrence test</h1>
28
+ <p class="description">This page was design to test singular and multiple occurrence values in the n element of a hcard.</p>
29
+ <p>From: <a href="default.htm"><span class="format">hCard</span> test suite 1.0</a></p>
30
+ <p class="author vcard">
31
+ Author: <a class="url fn" href="http://www.glennjones.net/">Glenn Jones</a>
32
+ </p>
33
+ <!--
34
+ <p>Output examples:
35
+ <ul>
36
+ <li class="output"><a class="url" href="hcard1.js"><span class="type">JSON</span></a></li>
37
+ <li class="output"><a class="url" href="hcard1.xml"><span class="type">XML</span></a></li>
38
+ </ul>
39
+ </p>
40
+ -->
41
+
42
+ <p>Tests:</p>
43
+ <table id="assetTable" cellpadding="0" cellspacing="0">
44
+ <thead>
45
+ <tr>
46
+ <th>Test</th>
47
+ <th>Result</th>
48
+ <th>Comment</th>
49
+ </tr>
50
+ </thead>
51
+ <tbody>
52
+ <tr class="assert">
53
+ <td class="test">vcard[0].n.honorific-prefix[0]</td>
54
+ <td class="result">IsEqualTo("Dr")</td>
55
+ <td class="comment">The honorific-prefix is a optional multiple value</td>
56
+ </tr>
57
+ <tr class="assert">
58
+ <td class="test">vcard[0].n.given-name[0]</td>
59
+ <td class="result">IsEqualTo("John")</td>
60
+ <td class="comment">The given-name is a optional multiple value</td>
61
+ </tr>
62
+ <tr class="assert">
63
+ <td class="test">vcard[0].n.additional-name[0]</td>
64
+ <td class="result">IsEqualTo("Peter")</td>
65
+ <td class="comment">The additional-name is a optional multiple value</td>
66
+ </tr>
67
+ <tr class="assert">
68
+ <td class="test">vcard[0].n.family-name[0]</td>
69
+ <td class="result">IsEqualTo("Doe")</td>
70
+ <td class="comment">The family-name is a optional multiple value</td>
71
+ </tr>
72
+ <tr class="assert">
73
+ <td class="test">vcard[0].n.honorific-suffix[1]</td>
74
+ <td class="result">IsEqualTo("PHD")</td>
75
+ <td class="comment">The honorific-suffix is a optional multiple value</td>
76
+ </tr>
77
+ </tbody>
78
+ </table>
79
+
80
+
81
+ <p>History:</p>
82
+ <ul>
83
+ <li class="history vevent">
84
+ <span class="summary">Created</span>: <abbr class="dtstart" title="2008-04-08">8 April 2008</abbr>
85
+ <span class="description">by Glenn Jones</span>
86
+ </li>
87
+ </ul>
88
+
89
+
90
+
91
+ </div>
92
+
93
+ <div id="uf">
94
+ <div class="vcard">
95
+ <!-- This may not be the best semantic use of HTML element -->
96
+ <div class="fn n">
97
+ <span class="honorific-prefix">Dr</span>
98
+ <span class="given-name">John</span>
99
+ <span class="additional-name">Peter</span>
100
+ <span class="family-name">Doe</span>
101
+ <span class="honorific-suffix">MSc</span>,
102
+ <span class="honorific-suffix">PHD</span>
103
+ </div>
104
+
105
+
106
+
107
+ </div>
108
+ </div>
109
+
110
+ <p>
111
+ <a rel="license" href="../license.txt">Some rights reserved</a>
112
+ </p>
113
+
114
+
115
+ </body>
116
+
117
+ </html>
@@ -0,0 +1,119 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+
4
+ <head>
5
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6
+ <title>hCard 5 - multiple values in class attribute test</title>
7
+
8
+ <!-- This will be replace with one CSS file and one JavaScipt file -->
9
+ <link rel="stylesheet" href="../css/uftestsuite.css" type="text/css" />
10
+ <link rel="stylesheet" href="../../../testrunner/css/testrunner.css" type="text/css" />
11
+
12
+ <script type="text/javascript" src="../../testrunner/javascript/prototype-1.6.0.2.js"></script>
13
+ <script type="text/javascript" src="../../testrunner/javascript/beautify.js"></script>
14
+ <script type="text/javascript" src="../../testrunner/javascript/sumo/microformat.js"></script>
15
+ <script type="application/javascript;version=1.7" src="http://svn.mozilla.org/labs/operator/chrome/operator/content/Microformats/Microformats.js"></script>
16
+ <script type="text/javascript" src="../../testrunner/javascript/testrunner.js"></script>
17
+
18
+
19
+ <script type="application/javascript;version=1.7" src="http://svn.mozilla.org/labs/operator/chrome/operator/content/Microformats/Microformats.js"></script>
20
+
21
+ </head>
22
+ <body>
23
+
24
+ <div class="test-fixture">
25
+
26
+ <p>
27
+ <a href="../"><img border="0" id="testsuite-image" alt="Microformats test suite" src="../images/testsuite.gif" /></a><br />
28
+ </p>
29
+
30
+ <h1 class="summary">hCard 5 - multiple values in class attribute test</h1>
31
+ <p class="description">This page test that parsers can find a class name where a author has used multiple values in the class attributes.
32
+ The IsEqualToISODate method <a href="../documentation/iso-date.htm">normalisation and compares</a> dates.
33
+ </p>
34
+ <p>From: <a href="default.htm"><span class="format">hCard</span> test suite 1.0</a></p>
35
+ <p class="author vcard">
36
+ Author: <a class="url fn" href="http://www.glennjones.net/">Glenn Jones</a>
37
+ </p>
38
+ <!--
39
+ <p>Output examples:
40
+ <ul>
41
+ <li class="output"><a class="url" href="hcard1.js"><span class="type">JSON</span></a></li>
42
+ <li class="output"><a class="url" href="hcard1.xml"><span class="type">XML</span></a></li>
43
+ </ul>
44
+ </p>
45
+ -->
46
+
47
+ <p>Tests:</p>
48
+ <table id="assetTable" cellpadding="0" cellspacing="0">
49
+ <thead>
50
+ <tr>
51
+ <th>Test</th>
52
+ <th>Result</th>
53
+ <th>Comment</th>
54
+ </tr>
55
+ </thead>
56
+ <tbody>
57
+ <tr class="assert">
58
+ <td class="test">vcard[0].n.given-name[0]</td>
59
+ <td class="result">IsEqualTo("John")</td>
60
+ <td class="comment">Should find given-name value even if class attribute has multiple values</td>
61
+ </tr>
62
+ <tr class="assert">
63
+ <td class="test">vcard[0].category[1]</td>
64
+ <td class="result">IsEqualTo("development")</td>
65
+ <td class="comment">Should find category value even if class and rel attribute have multiple values</td>
66
+ </tr>
67
+ <tr class="assert">
68
+ <td class="test">vcard[0].rev</td>
69
+ <td class="result">IsEqualToISODate("2008-01-01T13:45:00")</td>
70
+ <td class="comment">Should find rev value even if class attribute has multiple values</td>
71
+ </tr>
72
+
73
+
74
+
75
+ </tbody>
76
+ </table>
77
+
78
+
79
+ <p>History:</p>
80
+ <ul>
81
+ <li class="history vevent">
82
+ <span class="summary">Created</span>: <abbr class="dtstart" title="2008-04-08">8 April 2008</abbr>
83
+ <span class="description">by Glenn Jones</span>
84
+ </li>
85
+ </ul>
86
+
87
+
88
+
89
+ </div>
90
+
91
+ <div id="uf">
92
+ <!-- This may not be the best semantic use of HTML element -->
93
+
94
+ <div class="attendee vcard first">
95
+ <span class="fn n">
96
+ <span class="bold given-name">John</span>
97
+ <span class="family-name">Doe</span>
98
+ </span>
99
+
100
+ <p>Tags:
101
+ <a rel="tag next" class="category" href="http://en.wikipedia.org/wiki/design">design</a>,
102
+ <a rel="tag" class="category" href="http://en.wikipedia.org/wiki/development">development</a> and
103
+ <a rel="previous tag" class="category" href="http://en.wikipedia.org/wiki/web">web</a>
104
+ </p>
105
+
106
+ <div>Last updated: <abbr class="datetime rev" title="2008-01-01T13:45:00">January 1st, 2008 - 13:45</abbr></div>
107
+
108
+ </div>
109
+
110
+ </div>
111
+
112
+ <p>
113
+ <a rel="license" href="../license.txt">Some rights reserved</a>
114
+ </p>
115
+
116
+
117
+ </body>
118
+
119
+ </html>
@@ -0,0 +1,188 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+
4
+ <head>
5
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6
+ <title>hCard 6 - extracting email addresses test</title>
7
+
8
+ <!-- This will be replace with one CSS file and one JavaScipt file -->
9
+ <link rel="stylesheet" href="../css/uftestsuite.css" type="text/css" />
10
+ <link rel="stylesheet" href="../../../testrunner/css/testrunner.css" type="text/css" />
11
+
12
+ <script type="text/javascript" src="../../testrunner/javascript/prototype-1.6.0.2.js"></script>
13
+ <script type="text/javascript" src="../../testrunner/javascript/beautify.js"></script>
14
+ <script type="text/javascript" src="../../testrunner/javascript/sumo/microformat.js"></script>
15
+ <script type="application/javascript;version=1.7" src="http://svn.mozilla.org/labs/operator/chrome/operator/content/Microformats/Microformats.js"></script>
16
+ <script type="text/javascript" src="../../testrunner/javascript/testrunner.js"></script>
17
+
18
+ </head>
19
+ <body>
20
+
21
+ <div class="test-fixture">
22
+
23
+ <p>
24
+ <a href="../"><img border="0" id="testsuite-image" alt="Microformats test suite" src="../images/testsuite.gif" /></a><br />
25
+ </p>
26
+
27
+ <h1 class="summary">hCard 6 - extracting email addresses test</h1>
28
+ <p class="description">This page test that parsers can extract email addresses from differnt structures. This includes type property and value excerpting test.</p>
29
+ <p>From: <a href="default.htm"><span class="format">hCard</span> test suite 1.0</a></p>
30
+ <p class="author vcard">
31
+ Author: <a class="url fn" href="http://www.glennjones.net/">Glenn Jones</a>
32
+ </p>
33
+ <!--
34
+ <p>Output examples:
35
+ <ul>
36
+ <li class="output"><a class="url" href="hcard1.js"><span class="type">JSON</span></a></li>
37
+ <li class="output"><a class="url" href="hcard1.xml"><span class="type">XML</span></a></li>
38
+ </ul>
39
+ </p>
40
+ -->
41
+
42
+ <p>Tests:</p>
43
+ <table id="assetTable" cellpadding="0" cellspacing="0">
44
+ <thead>
45
+ <tr>
46
+ <th>Test</th>
47
+ <th>Result</th>
48
+ <th>Comment</th>
49
+ </tr>
50
+ </thead>
51
+ <tbody>
52
+
53
+ <tr class="assert">
54
+ <td class="test">vcard[0].email[0].value</td>
55
+ <td class="result">IsEqualTo("john@example.com")</td>
56
+ <td class="comment">Should collect the email address from href attribute</td>
57
+ </tr>
58
+
59
+ <tr class="assert">
60
+ <td class="test">vcard[1].email[0].value</td>
61
+ <td class="result">IsEqualTo("john@example.com")</td>
62
+ <td class="comment">Where a type is specified, but the value is not then the node text is the value</td>
63
+ </tr>
64
+
65
+ <tr class="assert">
66
+ <td class="test">vcard[2].email[0].value</td>
67
+ <td class="result">IsEqualTo("john@example.com")</td>
68
+ <td class="comment">Should collect the email address from the node text</td>
69
+ </tr>
70
+
71
+ <tr class="assert">
72
+ <td class="test">vcard[3].email[0].type[0]</td>
73
+ <td class="result">IsEqualToCaseInsensitive("Internet")</td>
74
+ <td class="comment">Should find the type value. Types are case insensitive</td>
75
+ </tr>
76
+
77
+ <tr class="assert">
78
+ <td class="test">vcard[4].email[0].type[3]</td>
79
+ <td class="result">HasProperty(false)</td>
80
+ <td class="comment">The thrid type value "lotus-notes" is incorrect</td>
81
+ </tr>
82
+
83
+ <tr class="assert">
84
+ <td class="test">vcard[5].email[0].value</td>
85
+ <td class="result">IsEqualTo("john@example.com")</td>
86
+ <td class="comment">Should not conatin quertystring "?subject=parser-test"</td>
87
+ </tr>
88
+
89
+ <tr class="assert">
90
+ <td class="test">vcard[6].email[0].value</td>
91
+ <td class="result">IsEqualTo("john@example.com")</td>
92
+ <td class="comment">Where a type is specified, but the value is not then the node text is the value</td>
93
+ </tr>
94
+
95
+
96
+ </tbody>
97
+ </table>
98
+
99
+
100
+ <p>History:</p>
101
+ <ul>
102
+ <li class="history vevent">
103
+ <span class="summary">Created</span>: <abbr class="dtstart" title="2008-05-10">10 May 2008</abbr>
104
+ <span class="description">by Glenn Jones</span>
105
+ </li>
106
+ <li class="history vevent">
107
+ <span class="summary">Updated</span>: <abbr class="dtstart" title="2008-05-14">14 May 2008</abbr>
108
+ <span class="description">by Glenn Jones - Added any additional test and example hCard 6. Removed the duplicate class="email" which made hCard 7
109
+ invalid. </span>
110
+ </li>
111
+ </ul>
112
+
113
+
114
+
115
+ </div>
116
+
117
+ <div id="uf">
118
+ <!-- This may not be the best semantic use of HTML element -->
119
+
120
+ <!-- 0 -->
121
+ <p class="vcard">
122
+ <span class="fn">John Doe</span> -
123
+ <a href="mailto:john@example.com" class="email">notthis@example.com</a>
124
+ </p>
125
+
126
+ <!-- 1 -->
127
+ <p class="vcard">
128
+ <span class="fn">John Doe</span> -
129
+ <span class="email">
130
+ <span class="type">internet</span>
131
+ <a href="mailto:notthis@example.com">john@example.com</a>
132
+ </span>
133
+ </p>
134
+
135
+ <!-- 2 -->
136
+ <p class="vcard">
137
+ <span class="fn">John Doe</span> -
138
+ <span class="email">john@example.com</span>
139
+ </p>
140
+
141
+ <!-- 3 -->
142
+ <div class="vcard">
143
+ <span class="fn">John Doe</span> -
144
+ <div class="email">
145
+ <span class="type">internet</span>
146
+ <span class="type">pref</span>:
147
+ <a class="value" href="mailto:john@example.com">john@example.com</a>
148
+ </div>
149
+
150
+ <div class="email">
151
+ <span class="type">internet</span>:
152
+ <a class="value" href="mailto:jdoe@example.com">jdoe@example.com</a>
153
+ </div>
154
+ </div>
155
+
156
+ <!-- 4 -->
157
+ <div class="vcard">
158
+ <span class="fn">John Doe</span> -
159
+ <span class="email">
160
+ <span class="type">internet</span>
161
+ <span class="type">pref</span>
162
+ <span class="type">x400</span>
163
+ <span class="type">lotus-notes</span>:
164
+ <a class="value" href="mailto:john@example.com">john@example.com</a>
165
+ </span>
166
+ </div>
167
+
168
+ <!-- 5 -->
169
+ <p class="vcard">
170
+ <span class="fn">John Doe</span> -
171
+ <a href="mailto:john@example.com?subject=parser-test" class="email">john@example.com</a>
172
+ </p>
173
+
174
+ <!-- 6 -->
175
+ <p class="vcard">
176
+ <span class="email"><span class="type">Home</span> john@example.com</span>
177
+ </p>
178
+
179
+ </div>
180
+
181
+ <p>
182
+ <a rel="license" href="../license.txt">Some rights reserved</a>
183
+ </p>
184
+
185
+
186
+ </body>
187
+
188
+ </html>
@@ -0,0 +1,188 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+
4
+ <head>
5
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6
+ <title>hCard 7 - extracting telephone number test</title>
7
+
8
+ <!-- This will be replace with one CSS file and one JavaScipt file -->
9
+ <link rel="stylesheet" href="../css/uftestsuite.css" type="text/css" />
10
+ <link rel="stylesheet" href="../../../testrunner/css/testrunner.css" type="text/css" />
11
+
12
+ <script type="text/javascript" src="../../testrunner/javascript/prototype-1.6.0.2.js"></script>
13
+ <script type="text/javascript" src="../../testrunner/javascript/beautify.js"></script>
14
+ <script type="text/javascript" src="../../testrunner/javascript/sumo/microformat.js"></script>
15
+ <script type="application/javascript;version=1.7" src="http://svn.mozilla.org/labs/operator/chrome/operator/content/Microformats/Microformats.js"></script>
16
+ <script type="text/javascript" src="../../testrunner/javascript/testrunner.js"></script>
17
+
18
+ </head>
19
+ <body>
20
+
21
+ <div class="test-fixture">
22
+
23
+ <p>
24
+ <a href="../"><img border="0" id="testsuite-image" alt="Microformats test suite" src="../images/testsuite.gif" /></a><br />
25
+ </p>
26
+
27
+ <h1 class="summary">hCard 7 - extracting tel (telephone) number test</h1>
28
+ <p class="description">
29
+ This page test that parsers can extract telephone numbers from different structures. This includes type property and value excerpting test.
30
+ The IsEqualToPhoneNumber method <a href="../documentation/phone-number.htm">canonicalises and compares</a> phone numbers.
31
+ </p>
32
+
33
+ <p>From: <a href="default.htm"><span class="format">hCard</span> test suite 1.0</a></p>
34
+ <p class="author vcard">
35
+ Author: <a class="url fn" href="http://www.glennjones.net/">Glenn Jones</a>
36
+ </p>
37
+ <!--
38
+ <p>Output examples:
39
+ <ul>
40
+ <li class="output"><a class="url" href="hcard1.js"><span class="type">JSON</span></a></li>
41
+ <li class="output"><a class="url" href="hcard1.xml"><span class="type">XML</span></a></li>
42
+ </ul>
43
+ </p>
44
+ -->
45
+
46
+ <p>Tests:</p>
47
+ <table id="assetTable" cellpadding="0" cellspacing="0">
48
+ <thead>
49
+ <tr>
50
+ <th>Test</th>
51
+ <th>Result</th>
52
+ <th>Comment</th>
53
+ </tr>
54
+ </thead>
55
+ <tbody>
56
+
57
+ <tr class="assert">
58
+ <td class="test">vcard[0].tel[0].value</td>
59
+ <td class="result">IsEqualTo("01273 700100")</td>
60
+ <td class="comment">Should collect the telephone number from the node text</td>
61
+ </tr>
62
+
63
+ <tr class="assert">
64
+ <td class="test">vcard[1].tel[0].value</td>
65
+ <td class="result">IsEqualToPhoneNumber("01273 700100")</td>
66
+ <td class="comment">Should collect the telephone number from a
67
+ descendant node with value property</td>
68
+ </tr>
69
+
70
+ <tr class="assert">
71
+ <td class="test">vcard[2].tel[0].type[11]</td>
72
+ <td class="result">IsEqualToCaseInsensitive("PCS")</td>
73
+ <td class="comment">Should find the type value. Types are case insensitive</td>
74
+ </tr>
75
+
76
+
77
+ <tr class="assert">
78
+ <td class="test">vcard[3].tel[0].type[1]</td>
79
+ <td class="result">HasProperty(false)</td>
80
+ <td class="comment">The second type value "next-door" is incorrect</td>
81
+ </tr>
82
+
83
+ <tr class="assert">
84
+ <td class="test">vcard[4].tel[0].value</td>
85
+ <td class="result">IsEqualToPhoneNumber("01273 700301")</td>
86
+ <td class="comment">Where a type is specified, but the value is not then the node text is the value</td>
87
+ </tr>
88
+
89
+
90
+
91
+ </tbody>
92
+ </table>
93
+
94
+
95
+ <p>History:</p>
96
+ <ul>
97
+
98
+ <li class="history vevent">
99
+ <span class="summary">Created</span>: <abbr class="dtstart" title="2008-05-10">10 May 2008</abbr>
100
+ <span class="description">by Glenn Jones</span>
101
+ </li>
102
+ <li class="history vevent">
103
+ <span class="summary">Updated</span>: <abbr class="dtstart" title="2008-05-14">14 May 2008</abbr>
104
+ <span class="description">by Glenn Jones - Added any additional test and example hCard 4. Changed the type values to match hCard specification
105
+ invalid removing "video" and adding "pcs". Remove the test where email had atype but no value.</span>
106
+ </li>
107
+
108
+ </ul>
109
+
110
+
111
+
112
+ </div>
113
+
114
+ <div id="uf">
115
+ <!-- This may not be the best semantic use of HTML element -->
116
+
117
+ <!-- 0 -->
118
+ <p class="vcard">
119
+ <span class="fn">John Doe</span> -
120
+ <span class="tel">01273 700100</span>:
121
+ </p>
122
+
123
+ <!-- 1 -->
124
+ <p class="vcard">
125
+ <span class="fn">John Doe</span> -
126
+ <span class="tel">
127
+ <span class="type">pref</span>erred:
128
+ <span class="value">01273 700100</span>
129
+ </span>
130
+ </p>
131
+
132
+ <!-- 2 -->
133
+ <div class="vcard">
134
+ <span class="fn">John Doe</span> -
135
+ <div class="tel">
136
+ <span class="type">home</span>,
137
+ <span class="type">work</span>,
138
+ <span class="type">pref</span>,
139
+ <span class="type">voice</span>,
140
+ <span class="type">fax</span>,
141
+ <span class="type">msg</span>,
142
+ <span class="type">cell</span>,
143
+ <span class="type">pager</span>,
144
+ <span class="type">bbs</span>,
145
+ <span class="type">modem</span>,
146
+ <span class="type">car</span>,
147
+ <span class="type">isdn</span> and
148
+ <span class="type">pcs</span>
149
+
150
+ <span class="value">01273 700100</span>
151
+ </div>
152
+
153
+ <div class="tel">
154
+ <span class="type">home</span>:
155
+ <span class="value">01273 700200</span>
156
+ </div>
157
+ </div>
158
+
159
+ <!-- 3 -->
160
+ <div class="vcard">
161
+ <span class="fn">John Doe</span> -
162
+ <span class="tel">
163
+ <span class="type">home</span>
164
+ <span class="type">next-door</span>
165
+ <span class="value">01273 700101</span>
166
+ </span>
167
+ </div>
168
+
169
+ <!-- 4 -->
170
+ <div class="vcard">
171
+ <span class="fn">John Doe</span> -
172
+ <span class="tel"> <span class="type">home</span> 01273 700301</span>
173
+ </div>
174
+
175
+
176
+
177
+
178
+
179
+ </div>
180
+
181
+ <p>
182
+ <a rel="license" href="../license.txt">Some rights reserved</a>
183
+ </p>
184
+
185
+
186
+ </body>
187
+
188
+ </html>