microformats 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +19 -4
- data/bin/microformats +28 -0
- data/lib/microformats/absolute_uri.rb +3 -2
- data/lib/microformats/version.rb +1 -1
- data/microformats.gemspec +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 782c4644eac7e969915cb788d5e93849653e94dc
|
4
|
+
data.tar.gz: d9e1cc5d37ee4115412431a6f56957abbfccc9b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f6ea2627813c51d87cd7bfd764c9f1966d0f0c5708023fd4a473c3aea157008b01df1a89f1d936f8b16c07dafb98e1f856151171f3fbcac1dfb8cf30faeae9f
|
7
|
+
data.tar.gz: 61d6557764e72d320679b683f9de610a24682aa55227a2b2d35b9d13b2ccbd21ebbd8dc466d33238dccdb6bbc8b79ed35a0eb66fc176aaf82d1152575797a70c
|
data/README.md
CHANGED
@@ -34,9 +34,9 @@ Not Implemented:
|
|
34
34
|
|
35
35
|
## Current Version
|
36
36
|
|
37
|
-
4.0.
|
37
|
+
4.0.2
|
38
38
|
|
39
|
-

|
40
40
|
|
41
41
|
|
42
42
|
## Requirements
|
@@ -122,6 +122,22 @@ collection.entry.author(:all)[1].name #=> "Brandon Edens"
|
|
122
122
|
|
123
123
|
* `source` can be a URL, filepath, or HTML
|
124
124
|
|
125
|
+
### Console utility
|
126
|
+
|
127
|
+
This gem also provides a command like script 'microformats' that will return the JSON equivalent
|
128
|
+
```
|
129
|
+
microformats http://example.com
|
130
|
+
```
|
131
|
+
|
132
|
+
You can give the microformats script a URL, filepath, or HTML
|
133
|
+
|
134
|
+
additionally, the script will accept input piped from stdin
|
135
|
+
|
136
|
+
```
|
137
|
+
curl http://example.com | microformats
|
138
|
+
```
|
139
|
+
|
140
|
+
|
125
141
|
|
126
142
|
## Ruby Gem release process
|
127
143
|
|
@@ -212,9 +228,8 @@ This uses a copy of [microformats tests repo](https://github.com/microformats/t
|
|
212
228
|
To run specs
|
213
229
|
```
|
214
230
|
rake spec
|
215
|
-
```
|
216
231
|
|
217
|
-
###Interactive
|
232
|
+
### Interactive
|
218
233
|
|
219
234
|
You can use the code interacively for testing but running
|
220
235
|
```
|
data/bin/microformats
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'microformats'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
def print_usage
|
7
|
+
puts "Usage: microformats (URL, filepath, or HTML)"
|
8
|
+
end
|
9
|
+
|
10
|
+
def process_html(html)
|
11
|
+
collection = Microformats.parse(html)
|
12
|
+
puts JSON.pretty_generate(JSON[collection.to_json.to_s])
|
13
|
+
end
|
14
|
+
|
15
|
+
if STDIN.tty?
|
16
|
+
unless ARGV[0].nil?
|
17
|
+
process_html(ARGV[0])
|
18
|
+
else
|
19
|
+
print_usage
|
20
|
+
end
|
21
|
+
else
|
22
|
+
html = STDIN.read
|
23
|
+
unless html.nil?
|
24
|
+
process_html(html)
|
25
|
+
else
|
26
|
+
print_usage
|
27
|
+
end
|
28
|
+
end
|
@@ -5,11 +5,12 @@ module Microformats
|
|
5
5
|
def initialize(relative, base: nil)
|
6
6
|
@base = base
|
7
7
|
@relative = relative
|
8
|
-
@base.strip
|
9
|
-
@relative.strip
|
8
|
+
@base = base.strip unless base.nil?
|
9
|
+
@relative = relative.strip unless relative.nil?
|
10
10
|
end
|
11
11
|
|
12
12
|
def absolutize
|
13
|
+
return relative if base.nil?
|
13
14
|
return base if relative.nil? or relative == ""
|
14
15
|
return relative if relative =~ /^https?:\/\//
|
15
16
|
return base + relative if relative =~ /^#/
|
data/lib/microformats/version.rb
CHANGED
data/microformats.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.homepage = "https://github.com/indieweb/microformats-ruby"
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
|
-
gem.executables =
|
16
|
+
gem.executables = ['microformats']
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: microformats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Becker
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-05-
|
13
|
+
date: 2017-05-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -131,7 +131,8 @@ email:
|
|
131
131
|
- veganstraightedge@gmail.com
|
132
132
|
- jlsuttles@gmail.com
|
133
133
|
- ben@thatmustbe.me
|
134
|
-
executables:
|
134
|
+
executables:
|
135
|
+
- microformats
|
135
136
|
extensions: []
|
136
137
|
extra_rdoc_files: []
|
137
138
|
files:
|
@@ -143,6 +144,7 @@ files:
|
|
143
144
|
- LICENSE.md
|
144
145
|
- README.md
|
145
146
|
- Rakefile
|
147
|
+
- bin/microformats
|
146
148
|
- lib/microformats.rb
|
147
149
|
- lib/microformats/absolute_uri.rb
|
148
150
|
- lib/microformats/format_parser.rb
|