kindleclippings 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -0
- data/lib/kindleclippings/clipping.rb +14 -1
- data/lib/kindleclippings/parser.rb +1 -1
- metadata +4 -4
data/README.markdown
CHANGED
@@ -4,6 +4,9 @@ module KindleClippings
|
|
4
4
|
require 'date'
|
5
5
|
|
6
6
|
attr_accessor :book_title, :author, :type, :location, :added_on, :content, :page
|
7
|
+
DEFAULT_DATE_FORMAT = "%A, %B %d, %Y, %I:%M %p"
|
8
|
+
KINDLE_TOUCH_DATE_FORMAT = "%A, %B %d, %Y %I:%M:%S %p"
|
9
|
+
ALTERNATIVE_DATE_FORMAT = "%A, %d %B %y %H:%M:%S %Z"
|
7
10
|
|
8
11
|
def initialize()
|
9
12
|
end
|
@@ -13,7 +16,17 @@ module KindleClippings
|
|
13
16
|
@author = author
|
14
17
|
@type = type
|
15
18
|
@location = location
|
16
|
-
|
19
|
+
|
20
|
+
[DEFAULT_DATE_FORMAT, KINDLE_TOUCH_DATE_FORMAT, ALTERNATIVE_DATE_FORMAT].each do |format|
|
21
|
+
break if @added_on
|
22
|
+
|
23
|
+
begin
|
24
|
+
@added_on = DateTime.strptime(added_on, format)
|
25
|
+
rescue ArgumentError => e
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
17
30
|
@content = content
|
18
31
|
@page = page.to_i
|
19
32
|
end
|
@@ -37,7 +37,7 @@ module KindleClippings
|
|
37
37
|
end
|
38
38
|
|
39
39
|
first_line = lines[0].strip.scan(/^(.+) \((.+)\)$/i).first
|
40
|
-
second_line = lines[1].strip.scan(
|
40
|
+
second_line = lines[1].strip.scan(/^-\s(?:Your\s)?(\w+) (?:on page (\d+) \| |)Loc(?:ation)?\.? ([0-9-]*?) +\| Added on (.+)$/i).first
|
41
41
|
|
42
42
|
if first_line.nil?
|
43
43
|
title = lines[0].strip
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kindleclippings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-27 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70306233262900 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 1.2.9
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70306233262900
|
25
25
|
description: A gem to parse Kindle's "My Clippings.txt" file into ruby objects.
|
26
26
|
email: georg.boe@gmail.com
|
27
27
|
executables: []
|