dti_nitf 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dti_nitf}
8
- s.version = "0.2.3"
8
+ s.version = "0.2.4"
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"]
@@ -3,9 +3,9 @@ dir = File.dirname(__FILE__)
3
3
  require File.join(dir, 'dti_nitf/nitf')
4
4
  require File.join(dir, 'dti_nitf/story')
5
5
 
6
- require 'pp'
6
+ # require 'pp'
7
7
  #
8
- # file_contents = File.read('/tmp/02/a1furn 020810.xml')
8
+ # file_contents = File.read('/tmp/02/a1oly-luge 021410.xml')
9
9
  # story = DTI::Story.new(file_contents)
10
10
  #
11
- # pp story
11
+ # pp story.paper
@@ -10,6 +10,7 @@ module DTI
10
10
  self.correction = false
11
11
 
12
12
  cracked = Crack::XML.parse(self.raw_xml)
13
+ cracked.default =""
13
14
 
14
15
  if cracked["nitf"]['head']['original_storyid']
15
16
  self.correction = true
@@ -34,8 +35,8 @@ module DTI
34
35
  self.body = fix_escaped_elements(self.body)
35
36
 
36
37
  if !self.correction?
37
- self.byline = doc_body["body.head"]["byline"]["person"].gsub!(/^By\s/, '').rstrip if doc_body["body.head"]["byline"]
38
- self.paper = doc_body["body.head"]["byline"]["byttl"].rstrip if doc_body["body.head"]["byline"]
38
+ self.byline = doc_body["body.head"]["byline"]["person"].rstrip.gsub(/^By\s/, '') if doc_body["body.head"]["byline"]
39
+ self.paper = doc_body["body.head"]["byline"]["byttl"].rstrip if doc_body["body.head"]["byline"]["byttl"]
39
40
  self.hl1 = doc_body["body.head"]["hedline"]["hl1"].to_s.rstrip if doc_body["body.head"]["hedline"]
40
41
  if doc_body["body.head"]["hedline"] && doc_body["body.head"]["hedline"]["hl2"]
41
42
  self.hl2 = doc_body["body.head"]["hedline"]["hl2"].to_s.lstrip.rstrip
@@ -51,6 +51,56 @@ class TestDtiNitf < Test::Unit::TestCase
51
51
  </body>
52
52
  </nitf>
53
53
  EOT
54
+
55
+ @@xml2 = <<-EOT
56
+ <?xml-stylesheet type="text/css" href="bulletin.css"?>
57
+ <!DOCTYPE nitf SYSTEM "nitf-3-2.dtd">
58
+ <nitf>
59
+ <head>
60
+ <tobject tobject.type="news">
61
+ <Keyword name = 'HNS'/><Keyword name = 'LUGE'/><Keyword name = 'OLY'/>
62
+ </tobject>
63
+ <docdata>
64
+ <doc.copyright holder="Western Communications, Inc."/>
65
+ <doc-id id-string="14032641"/>
66
+ <doc-name name-string="a1oly-luge 021410"/>
67
+ </docdata>
68
+ <pubdata name="The Bulletin " position.sequence="8 " position.section="A " date.publication="2010-02-14 "/>
69
+ </head>
70
+ <body>
71
+ <body.head>
72
+ <hedline>
73
+ <hl1><p> Luge: fast, risky and drawing red flags</p></hl1>
74
+ </hedline>
75
+ <byline>
76
+ <person>Houston Chronicle </person>
77
+ </byline>
78
+ </body.head>
79
+ <body.content>
80
+ <p> WHISTLER, British Columbia <!-- 2014(unknown) --> When the sliders gathered Saturday morning at the Whistler Sliding Centre <!-- 2014(unknown) --> ready to take to an Olympic luge run that, not 24 hours earlier, took the life of one of their competitors <!-- 2014(unknown) --> they encountered a course that was shorter, slower, and presumably safer than it had been a day earlier. They sat in a nearly silent starting area, mulling both competition and camaraderie, before launching themselves down the track again. </p><p> On other days, racing would have seemed routine, even at the Olympics. But over the course of an emotional day here, what emerged was the clear idea that athletes who participate in luge do so in part to go fast, risks be damned. Now, racing on a track that caused significant concern even prior to Friday<!-- 2019(unknown) -->s death of 21-year-old Nodar Kumaritashvili, the risks clearly can be fatal, a notion that was inescapable even in the midst of the sport<!-- 2019(unknown) -->s highest level of competition. </p><p> A stunning pall fell over the 2010 Winter Olympics after the Georgian luger was killed in a training run here, and calls are increasing for Olympic officials to ensure it doesn<!-- 2019(unknown) -->t happen again <!-- 2014(unknown) --> even if canceling the competition was the only way to do so. </p><p> But officials announced the competition would continue Saturday, though they shortened the run and made the course wall higher at the point where Kumaritashvili flew off the ice. </p><p> Officials from the International Luge Federation said Saturday they had considered postponing competition or canceling it altogether, but instead they announced they had erected a higher wall in the turn where Kumaritashvili lost control and sailed off the track, crashing into a metal pole. They altered the ice in that same area, another measure aimed at keeping sliders within the confines of the track. And they announced the men<!-- 2019(unknown) -->s event <!-- 2014(unknown) --> which includes two runs Saturday night and the final two runs today <!-- 2014(unknown) --> would begin from the women<!-- 2019(unknown) -->s starting area, shortening the course by more than 500 feet, a move that dropped speeds significantly. </p><p> Even before Friday<!-- 2019(unknown) -->s deadly crash, much of the talk about the luge centered on the threat to sliders presented by the fastest track in the world. </p><p> Safety is the dominant issue, with sliders twisting down the mountain at speeds of more than 90 mph on a 50-pound sled. (Manuel Pfister of Austria was clocked at what would be a world record 95 mph Thursday.) </p><p> The pre-games discussion of whether the $100 million track was safe swelled as sliders arrived. Once they got a taste of the track, lugers thought Curve 11 presented an especially treacherous challenge. That is where the majority of the crashes <!-- 2014(unknown) --> nearly 20 in just a few days of practice runs <!-- 2014(unknown) --> this week have occurred. </p><p> Kumaritashvili lost his life after losing control entering the final straightaway. </p><p> All but a few sliders decided to race, yet each dealt with the death of Kumaritashvili in whatever way he could. The day<!-- 2019(unknown) -->s events <!-- 2014(unknown) --> two training runs followed by the first two runs of competition in the evening <!-- 2014(unknown) --> carried on under a discernible pall, the memories of Friday<!-- 2019(unknown) -->s terrifying accident, shown repeatedly on television, still fresh. </p><p> V, a French-language Canadian television network, showed video of the Friday crash. Kumaritashvili came in high on the final turn, was thrown off his sled, and flew backward and over the left wall where he crashed with amazing force into a steel beam. </p><p> American Tony Benshoof tested the track just before the accident. He struggled through that curve too, but walked off with only a badly bruised toe. He was fortunate. </p><p> <!-- 201c(unknown) -->Because of the physics of the curves, and going at 95 miles per hour, there<!-- 2019(unknown) -->s a really small margin for error,<!-- 201d(unknown) --> Benshoof said. <!-- 201c(unknown) -->You really need to get it right from Curve 9 to get as far as Curve 13, because once you get to Curve 11 and 12, you<!-- 2019(unknown) -->re going too fast to correct yourself.<!-- 201d(unknown) --> </p><p> Many sliders might say anyone who has been anywhere near a luge track would know why it is one of the scariest and most exciting spectator sports at the games. It feeds the nature of those who participate the sport. They love the speed and overcome the fear. </p><p> Mark Grimmette, five-time Olympian and U.S. flag bearer at the opening ceremonies, said he and current luge doubles partner Brian Martin have crashed <!-- 201c(unknown) -->only three or four times<!-- 201d(unknown) --> in some 4,000 runs in training and competition over the past 13 years. </p><p> But after running down the track at Whistler, Grimmette, who says he loves pushing 3-4 Gs at 90 mph, questioned whether the sport had gone too far. <!-- 201c(unknown) -->I think we<!-- 2019(unknown) -->re probably getting close, too close to the edge,<!-- 201d(unknown) --> Grimmette said. <!-- 201c(unknown) -->The track is fast, it certainly is. You have to be on your game from (Curve) 11 down. It<!-- 2019(unknown) -->s something they definitely have to take into account when they design future tracks. </p><p> <!-- 201c(unknown) -->(A track) doesn<!-- 2019(unknown) -->t have to be faster to be tricky.<!-- 201d(unknown) --> </p><p> Luge was held out of the games until 1964 because many considered it too dangerous. Just before that first Olympic luge competition, Polish-born British slider Kazimierz Kay-Skrzypeski was killed in a crash on the Olympic course in Austria. </p><p> The games went on. So did luge. That unfortunate incident happened two weeks before the games began. </p><p> Kumaritashvili, who died while the Olympic torch was being carried through the streets of Vancouver Friday, wasn<!-- 2019(unknown) -->t among the top sliders in the world. He finished 44th in the World Cup standings and has almost no chance of winning a medal here. </p><p> The sport<!-- 2019(unknown) -->s international governing body released a statement late Friday night, about 10 hours after Kumaritashvili died, publicly blaming the 21-year-old for his own death. Athletes were attaining speeds at the Whistler Sliding Centre far exceeding what the track was designed for, but the track was not the problem. It was a user error, the statement implied. Kumaritashvili failed to compensate properly as he entered Curve 16 before he crashed at nearly 90 mph, the federation<!-- 2019(unknown) -->s statement said. It added, <!-- 201c(unknown) -->There was no indication that the accident was caused by deficiencies in the track.<!-- 201d(unknown) --> </p><p> But is inexperience the lone reason for the tragedy? </p><p> Italy<!-- 2019(unknown) -->s Armin Zoeggler, a five-time Olympian who won the gold medal at the last two Olympics, also crashed on Friday. </p><p> The province<!-- 2019(unknown) -->s coroner, the Royal Canadian Mounted Police and federation are all investigating Kumaritashvili<!-- 2019(unknown) -->s death. </p><p> <!-- 201c(unknown) -->It is a nervous situation,<!-- 201d(unknown) --> Atis Strenga, president of the Latvia Luge Federation, said. <!-- 201c(unknown) -->It<!-- 2019(unknown) -->s a big tragedy for all luge. I hope, we all hope, it<!-- 2019(unknown) -->s the first accident and the last accident in this race.<!-- 201d(unknown) --> </p><p> </p>
81
+
82
+
83
+ <media media-type="image">
84
+ <media-id>1939423</media-id>
85
+ <media-name>a1oly-luge-p2 021410</media-name>
86
+ <media-reference height="280" width="420" mime-type="image/jpeg" source="1939423.jpg"/>
87
+ <media-printcaption>Candles and flowers memorialize Nodar Kumaritashvili at Olympic Rings Park in Whistler, British Columbia. The Georgian luger was killed Friday when he lost control of his sled near the end of his training run while traveling about 89.7 mph.</media-printcaption>
88
+ <media-printproducer> New York Times News Service</media-printproducer>
89
+ <media-originalcaption>Candles and flowers comprise a memorial to luge athlete Nodar Kumaritashvili of the Republic of Georgia at Olympic Rings Park in Whistler, British Columbia, on Friday night, Feb. 12, 2010. Kumaritashvili was killed when he lost control of his luge sled near the end of his training run while traveling 144.3 kilometers per hour, or about 89.7 miles an hour. (Doug Mills/The New York Times)
90
+ </media-originalcaption>
91
+ <media-source>NYTNS</media-source>
92
+ <media-byline>DOUG MILLS</media-byline>
93
+ <media-job> </media-job>
94
+ <media-notes>26.19% 3col DWRAY</media-notes>
95
+ <media-status>Worked</media-status>
96
+ </media>
97
+ </body.content>
98
+ <body.end>
99
+ <tagline>The New York Times and The Washington Post contributed to this report. </tagline>
100
+ </body.end>
101
+ </body>
102
+ </nitf>
103
+ EOT
54
104
  context "An NITF Parser instance" do
55
105
  setup do
56
106
  @story = DTI::Story.new(@@xml)
@@ -103,6 +153,7 @@ class TestDtiNitf < Test::Unit::TestCase
103
153
  context "A Story object" do
104
154
  setup do
105
155
  @story = DTI::Story.new(@@xml)
156
+ @story2 = DTI::Story.new(@@xml2)
106
157
  end
107
158
 
108
159
  should "have a doc_id" do
@@ -144,5 +195,9 @@ class TestDtiNitf < Test::Unit::TestCase
144
195
  should "should have a tagline" do
145
196
  assert @story.tagline == "Hillary Borrud can be reached at 541-617-7829 or at hborrud@bendbulletin.com."
146
197
  end
198
+
199
+ should "process correcly if there is no byttl tag" do
200
+ assert_nil @story2.paper
201
+ end
147
202
  end
148
203
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 3
9
- version: 0.2.3
8
+ - 4
9
+ version: 0.2.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark Turner