mida 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- metadata +2 -71
data/Rakefile
CHANGED
@@ -5,8 +5,8 @@ require 'rake/gempackagetask'
|
|
5
5
|
spec = Gem::Specification.new do |s|
|
6
6
|
s.name = "mida"
|
7
7
|
s.summary = "A Microdata parser/extractor library"
|
8
|
-
s.description =
|
9
|
-
s.version = "0.1.
|
8
|
+
s.description = "A Microdata parser and extractor library, based on the latest Published version of the Microdata Specification, dated 5th April 2011."
|
9
|
+
s.version = "0.1.1"
|
10
10
|
s.author = "Lawrence Woodman"
|
11
11
|
s.email = "lwoodman@vlifesystems.com"
|
12
12
|
s.homepage = %q{http://github.com/LawrenceWoodman/mida}
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: mida
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Lawrence Woodman
|
@@ -34,76 +34,7 @@ dependencies:
|
|
34
34
|
version: "0"
|
35
35
|
type: :development
|
36
36
|
version_requirements: *id002
|
37
|
-
description:
|
38
|
-
= Mida
|
39
|
-
|
40
|
-
* {Mida Project Page}[https://github.com/LawrenceWoodman/mida]
|
41
|
-
* {Mida Bug Tracker}[https://github.com/LawrenceWoodman/mida/issues]
|
42
|
-
|
43
|
-
== Description
|
44
|
-
A Microdata[http://en.wikipedia.org/wiki/Microdata_(HTML5)] parser and
|
45
|
-
extractor library for ruby.
|
46
|
-
This is based on the latest Published version of the Microdata Specification
|
47
|
-
dated {5th April 2011}[http://www.w3.org/TR/2011/WD-microdata-20110405/].
|
48
|
-
|
49
|
-
== Installation
|
50
|
-
With Ruby and Rubygems:
|
51
|
-
gem install mida
|
52
|
-
|
53
|
-
=== Requirements:
|
54
|
-
|
55
|
-
* +Nokogiri+
|
56
|
-
|
57
|
-
== Usage
|
58
|
-
The following examples assume that you have required +mida+ and
|
59
|
-
+open-uri+.
|
60
|
-
|
61
|
-
=== Extracting Microdata from a page
|
62
|
-
All the Microdata is extracted from a page when a new <tt>Mida::Document</tt> instance
|
63
|
-
is created.
|
64
|
-
|
65
|
-
To extract all the Microdata from a webpage:
|
66
|
-
url = 'http://example.com'
|
67
|
-
open(url) {|f| doc = Mida::Document.new(f, url)}
|
68
|
-
|
69
|
-
The top-level +Items+ will be held in an array accessible via
|
70
|
-
<tt>doc.items</tt>.
|
71
|
-
|
72
|
-
To simply list all the top-level +Items+ that have been found:
|
73
|
-
puts doc.items
|
74
|
-
|
75
|
-
=== Searching
|
76
|
-
If you want to search for an +Item+ that has a specific +itemtype+/vocabulary
|
77
|
-
this can be done with the +search+ method.
|
78
|
-
|
79
|
-
To return all the +Items+ that use one of Google's Review vocabularies:
|
80
|
-
doc.search(%r{http://data-vocabulary\.org.*?review.*?}i)
|
81
|
-
|
82
|
-
=== Inspecting an +Item+
|
83
|
-
Each +Item+ is a <tt>Mida::Item</tt> instance and has three main methods of
|
84
|
-
interest, +type+, +properties+ and +id+.
|
85
|
-
|
86
|
-
To find out the +itemtype+ of the +Item+:
|
87
|
-
puts doc.items.first.type
|
88
|
-
|
89
|
-
To find out the +itemid+ of the +Item+:
|
90
|
-
puts doc.items.first.id
|
91
|
-
|
92
|
-
Properties are returned as a hash containing name/values pairs. The
|
93
|
-
values will be an array of either +String+ or <tt>Mida::Item</tt> instances.
|
94
|
-
|
95
|
-
To see the +properties+ of the +Item+:
|
96
|
-
puts doc.items.first.properties
|
97
|
-
|
98
|
-
== Bugs/Feature Requests
|
99
|
-
If you find a bug or want to make a feature request, please report it at the
|
100
|
-
Mida project's {issues tracker}[https://github.com/LawrenceWoodman/mida/issues]
|
101
|
-
on github.
|
102
|
-
|
103
|
-
== License
|
104
|
-
Copyright (c) 2011 Lawrence Woodman.
|
105
|
-
This software is licensed under the MIT License. Please see the file, LICENSE.rdoc, for details.
|
106
|
-
|
37
|
+
description: A Microdata parser and extractor library, based on the latest Published version of the Microdata Specification, dated 5th April 2011.
|
107
38
|
email: lwoodman@vlifesystems.com
|
108
39
|
executables: []
|
109
40
|
|