dti_nitf 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/dti_nitf.gemspec +2 -2
- data/lib/dti_nitf.rb +1 -1
- data/lib/dti_nitf/story.rb +6 -17
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/dti_nitf.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dti_nitf}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mark Turner"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-25}
|
13
13
|
s.description = %q{Helps you processes the 'XML' (Quotes intentional) from DTI's XML export into valid NITF documents or Story & Media objects}
|
14
14
|
s.email = %q{mark@amerine.net}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/dti_nitf.rb
CHANGED
data/lib/dti_nitf/story.rb
CHANGED
@@ -10,7 +10,6 @@ module DTI
|
|
10
10
|
self.correction = false
|
11
11
|
|
12
12
|
cracked = Crack::XML.parse(self.raw_xml)
|
13
|
-
#pp cracked
|
14
13
|
|
15
14
|
if cracked["nitf"]['head']['original_storyid']
|
16
15
|
self.correction = true
|
@@ -31,8 +30,8 @@ module DTI
|
|
31
30
|
self.pub_date = pub_data["date.publication"].rstrip
|
32
31
|
self.page = pub_data["position.sequence"].rstrip.to_i
|
33
32
|
|
34
|
-
self.body =
|
35
|
-
self.body =
|
33
|
+
self.body = doc_body["body.content"]["p"].collect{|d| "<p>#{d}</p>"}.join
|
34
|
+
self.body = fix_escaped_elements(self.body)
|
36
35
|
|
37
36
|
if !self.correction?
|
38
37
|
self.byline = doc_body["body.head"]["byline"]["person"].gsub!(/^By\s/, '').rstrip if doc_body["body.head"]["byline"]
|
@@ -49,20 +48,10 @@ module DTI
|
|
49
48
|
self.correction
|
50
49
|
end
|
51
50
|
|
52
|
-
def
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}
|
57
|
-
return hash_string
|
58
|
-
end
|
59
|
-
|
60
|
-
def fix_quotes(string)
|
61
|
-
string.gsub! "\342\200\230", "'"
|
62
|
-
string.gsub! "\342\200\231", "'"
|
63
|
-
string.gsub! "\342\200\234", '"'
|
64
|
-
string.gsub! "\342\200\235", '"'
|
65
|
-
string
|
51
|
+
def fix_escaped_elements(string)
|
52
|
+
return_string = string
|
53
|
+
return_string.gsub! /\342\200[\230\231]/, "'"
|
54
|
+
return_string.gsub! /\342\200[\234\235]/, '"'
|
66
55
|
end
|
67
56
|
end
|
68
57
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 3
|
9
|
+
version: 0.2.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mark Turner
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-02-
|
17
|
+
date: 2010-02-25 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|