kindleclippings 1.3.2 → 1.3.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9e8734a0ac60027035e21064083ec4afd6a2127a
4
+ data.tar.gz: 33d91eaea39e65d600a415833d377ada86a89a80
5
+ SHA512:
6
+ metadata.gz: 0627951bcb03fcdaece90e63f6c92ea746c1ed71c0b2cf13f77f2c6d24f2afdc87acdf358b46df3b1a5d0d9de0b142901d03d9cffeec9c9dc0bb556d3a47a114
7
+ data.tar.gz: 63d26b37d95d4eaa4beb8ad198305b11176700bdfc853a81c568fdf4101e7f403fab0de3f54f9056752bf8d09895f05e1f84d101d1f7372fd792988ae0f88344
data/README.markdown CHANGED
@@ -75,3 +75,4 @@ You can filter the results by author, book title or date by using the methods `b
75
75
  * fboucheros
76
76
  * David Ramalho
77
77
  * Kenrick [aka Ken] Chien
78
+ * Christophe Philemotte
@@ -1,44 +1,44 @@
1
1
  # encoding: utf-8
2
2
  module KindleClippings
3
-
3
+
4
4
  class Parser
5
-
5
+
6
6
  def parse_file(path)
7
7
  file_content = open(path, 'r:utf-8').read
8
-
8
+
9
9
  parse(file_content)
10
10
  end
11
-
11
+
12
12
  def parse(filecontent)
13
13
  @clippings = ClippingResult.new
14
-
14
+
15
15
  filecontent.split("=" * 10).each do |clipping|
16
-
16
+
17
17
  a_clipping = parse_clipping(clipping)
18
-
18
+
19
19
  if a_clipping
20
20
  @clippings << a_clipping
21
21
  end
22
-
23
-
22
+
23
+
24
24
  end
25
25
  @clippings
26
26
  end
27
-
27
+
28
28
  private
29
-
29
+
30
30
  def parse_clipping(clipping)
31
31
  clipping.lstrip!
32
-
32
+
33
33
  lines = clipping.lines.to_a
34
-
34
+
35
35
  if lines.length < 4
36
36
  return nil
37
37
  end
38
-
38
+
39
39
  first_line = lines[0].strip.scan(/^(.+) \((.+)\)$/i).first
40
- second_line = lines[1].strip.scan(/^-\s(?:Your\s)?(\w+) (?:on page (\d+) \| |)Loc(?:ation)?\.? ([0-9-]*?) +\| Added on (.+)$/i).first
41
-
40
+ second_line = lines[1].strip.scan(/^-\s(?:Your\s)?(\w+) (?:on page ([0-9-]*?) \| )?(?:Loc(?:ation|\.) ([0-9-]*?) +\| )?Added on (.*)$/i).first
41
+
42
42
  if first_line.nil?
43
43
  title = lines[0].strip
44
44
  author = ""
@@ -46,9 +46,9 @@ module KindleClippings
46
46
  title, author = *first_line
47
47
  end
48
48
  type, page, location, date = *second_line
49
-
49
+
50
50
  content = lines[3..-1].join("")
51
-
51
+
52
52
  Clipping.new(title, author, type.to_sym, location, date, content.strip, page)
53
53
  end
54
54
  end
metadata CHANGED
@@ -1,27 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kindleclippings
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
5
- prerelease:
4
+ version: 1.3.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Georg Alexander Boe
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-09-27 00:00:00.000000000Z
11
+ date: 2013-12-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
- requirement: &70306233262900 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 1.2.9
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *70306233262900
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.2.9
27
+ - !ruby/object:Gem::Dependency
28
+ name: mocha
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
25
41
  description: A gem to parse Kindle's "My Clippings.txt" file into ruby objects.
26
42
  email: georg.boe@gmail.com
27
43
  executables: []
@@ -40,26 +56,25 @@ files:
40
56
  - README.markdown
41
57
  homepage: http://github.com/georgboe/kindleclippings
42
58
  licenses: []
59
+ metadata: {}
43
60
  post_install_message:
44
61
  rdoc_options: []
45
62
  require_paths:
46
63
  - lib
47
64
  required_ruby_version: !ruby/object:Gem::Requirement
48
- none: false
49
65
  requirements:
50
- - - ! '>='
66
+ - - '>='
51
67
  - !ruby/object:Gem::Version
52
68
  version: '0'
53
69
  required_rubygems_version: !ruby/object:Gem::Requirement
54
- none: false
55
70
  requirements:
56
- - - ! '>='
71
+ - - '>='
57
72
  - !ruby/object:Gem::Version
58
73
  version: '0'
59
74
  requirements: []
60
75
  rubyforge_project:
61
- rubygems_version: 1.8.7
76
+ rubygems_version: 2.0.3
62
77
  signing_key:
63
- specification_version: 3
78
+ specification_version: 4
64
79
  summary: A gem to parse Kindle's "My Clippings.txt" file into ruby objects.
65
80
  test_files: []