csvkit 0.1.3 → 0.1.4
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 +8 -1
- data/lib/csvkit/csvkit.rb +3 -2
- data/lib/csvkit/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee7e6df336489a1a6b12050de1fe2f6d8f9ff5c3
|
4
|
+
data.tar.gz: 81fe43d6349b30e6003b332eb2720490865bd0a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf510f9de514b4c3b10fdbb0d9e424beaaf890f13860d5c65db98b82c383ed6cc013188c03932a3a9a7d441087116e0d74d048e0645282384faad67636bc8a1d
|
7
|
+
data.tar.gz: f1eab932711204457e19affaa015c7b4a551470c3e2d44f1c723177844aee252db8c50d87b78206cf39a6a575fcb5071051e93b595ef103b2e02a5320dbc0c90
|
data/README.md
CHANGED
@@ -18,7 +18,14 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
Add into application.rb
|
22
|
+
|
23
|
+
require 'csvkit'
|
24
|
+
config.middleware.use CSVKit::Middleware, {}#, :only => [%r[^/thing], %r[^/other_thing]]
|
25
|
+
|
26
|
+
Options:
|
27
|
+
|
28
|
+
show_link: shows url as opposed to an <a> link's text content.
|
22
29
|
|
23
30
|
## Contributing
|
24
31
|
|
data/lib/csvkit/csvkit.rb
CHANGED
@@ -7,9 +7,10 @@ class CSVKit
|
|
7
7
|
attr_reader :options
|
8
8
|
|
9
9
|
def initialize(body_content, options = {})
|
10
|
+
@options = {:show_link => false}.merge options
|
11
|
+
|
10
12
|
@content = body_content
|
11
13
|
|
12
|
-
@options = options
|
13
14
|
end
|
14
15
|
|
15
16
|
def to_csv
|
@@ -23,7 +24,7 @@ class CSVKit
|
|
23
24
|
repeat = header_with_colspan?(cell) ? cell['colspan'].to_i : 1
|
24
25
|
repeat.times do
|
25
26
|
# if a link show href instead of text.
|
26
|
-
if a_link = cell.search('a').first
|
27
|
+
if (a_link = cell.search('a').first) && options[:show_link]
|
27
28
|
text = a_link['href']
|
28
29
|
else
|
29
30
|
text = cell.text
|
data/lib/csvkit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csvkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathew Hartley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.0.
|
65
|
+
rubygems_version: 2.0.3
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: Inspired by PDFKit, allows a html page (with a <table>) to be converted to
|