opener-constituent-parser 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/opener/constituent_parser/version.rb +1 -1
- data/lib/opener/constituent_parser/views/index.erb +1 -1
- data/lib/opener/constituent_parser/views/result.erb +15 -0
- data/lib/opener/constituent_parser.rb +1 -2
- data/opener-constituent-parser.gemspec +1 -1
- metadata +7 -7
- data/lib/opener/constituent_parser/error_layer.rb +0 -89
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 900445addaedc623be584b9be095a1a3f4696779
|
4
|
+
data.tar.gz: 33750b70470ebe3b0b9a0fa2f52cc01ecb0575fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a101e547e39f522d477b8ac5a75077b118599f6cc5315c353f4c9ed6420faa84c35d75a3dfb6f742c39746ef87ab6ef6a44e807ae2534f352d4c0a3253f1209
|
7
|
+
data.tar.gz: 4a094713952fe009dd1086fcfddca7f9ff512eed0a664c427c4c388244c42a0a88faa8cfb081357b2ae48dd082de6b76628f8ea94acb044063648fb15813c4e8
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<link type="text/css" rel="stylesheet" charset="UTF-8" href="markdown.css"/>
|
5
|
+
<title>Constituent Parse Webservice</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<h1>Output URL</h1>
|
9
|
+
<p>
|
10
|
+
When ready, you can view the result
|
11
|
+
<a href=<%= output_url %>>here</a>
|
12
|
+
</p>
|
13
|
+
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -5,7 +5,6 @@ require 'opener/constituent_parsers/base'
|
|
5
5
|
|
6
6
|
require_relative 'constituent_parser/version'
|
7
7
|
require_relative 'constituent_parser/cli'
|
8
|
-
require_relative 'constituent_parser/error_layer'
|
9
8
|
|
10
9
|
module Opener
|
11
10
|
##
|
@@ -56,7 +55,7 @@ module Opener
|
|
56
55
|
|
57
56
|
return kernel.run(input)
|
58
57
|
rescue Exception => error
|
59
|
-
return ErrorLayer.new(input, error.message, self.class).add
|
58
|
+
return Opener::Core::ErrorLayer.new(input, error.message, self.class).add
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |gem|
|
|
27
27
|
gem.add_dependency 'nokogiri'
|
28
28
|
gem.add_dependency 'httpclient'
|
29
29
|
gem.add_dependency 'opener-daemons'
|
30
|
-
gem.add_dependency 'opener-core',
|
30
|
+
gem.add_dependency 'opener-core', "~> 1.0"
|
31
31
|
|
32
32
|
gem.add_development_dependency 'rake'
|
33
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opener-constituent-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- development@olery.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opener-webservice
|
@@ -112,14 +112,14 @@ dependencies:
|
|
112
112
|
name: opener-core
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: '1.0'
|
118
118
|
requirement: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- -
|
120
|
+
- - ~>
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
122
|
+
version: '1.0'
|
123
123
|
prerelease: false
|
124
124
|
type: :runtime
|
125
125
|
- !ruby/object:Gem::Dependency
|
@@ -153,11 +153,11 @@ files:
|
|
153
153
|
- exec/constituent-parser.rb
|
154
154
|
- lib/opener/constituent_parser.rb
|
155
155
|
- lib/opener/constituent_parser/cli.rb
|
156
|
-
- lib/opener/constituent_parser/error_layer.rb
|
157
156
|
- lib/opener/constituent_parser/public/markdown.css
|
158
157
|
- lib/opener/constituent_parser/server.rb
|
159
158
|
- lib/opener/constituent_parser/version.rb
|
160
159
|
- lib/opener/constituent_parser/views/index.erb
|
160
|
+
- lib/opener/constituent_parser/views/result.erb
|
161
161
|
- opener-constituent-parser.gemspec
|
162
162
|
homepage:
|
163
163
|
licenses: []
|
@@ -1,89 +0,0 @@
|
|
1
|
-
module Opener
|
2
|
-
class ConstituentParser
|
3
|
-
##
|
4
|
-
# Add Error Layer to KAF file instead of throwing an error.
|
5
|
-
#
|
6
|
-
class ErrorLayer
|
7
|
-
attr_accessor :input, :document, :error, :klass
|
8
|
-
|
9
|
-
def initialize(input, error, klass)
|
10
|
-
@input = input.to_s
|
11
|
-
# Make sure there is always a document, even if it is empty.
|
12
|
-
@document = Nokogiri::XML(input) rescue Nokogiri::XML(nil)
|
13
|
-
@error = error
|
14
|
-
@klass = klass
|
15
|
-
end
|
16
|
-
|
17
|
-
def add
|
18
|
-
if is_xml?
|
19
|
-
unless has_errors_layer?
|
20
|
-
add_errors_layer
|
21
|
-
end
|
22
|
-
else
|
23
|
-
add_root
|
24
|
-
add_text
|
25
|
-
add_errors_layer
|
26
|
-
end
|
27
|
-
add_error
|
28
|
-
|
29
|
-
xml = !!document.encoding ? document.to_xml : document.to_xml(:encoding => "UTF-8")
|
30
|
-
|
31
|
-
return xml
|
32
|
-
end
|
33
|
-
|
34
|
-
##
|
35
|
-
# Check if the document is a valid XML file.
|
36
|
-
#
|
37
|
-
def is_xml?
|
38
|
-
!!document.root
|
39
|
-
end
|
40
|
-
|
41
|
-
##
|
42
|
-
# Add root element to the XML file.
|
43
|
-
#
|
44
|
-
def add_root
|
45
|
-
root = Nokogiri::XML::Node.new "KAF", document
|
46
|
-
document.add_child(root)
|
47
|
-
end
|
48
|
-
|
49
|
-
##
|
50
|
-
# Check if the document already has an errors layer.
|
51
|
-
#
|
52
|
-
def has_errors_layer?
|
53
|
-
!!document.at('errors')
|
54
|
-
end
|
55
|
-
|
56
|
-
##
|
57
|
-
# Add errors element to the XML file.
|
58
|
-
#
|
59
|
-
def add_errors_layer
|
60
|
-
node = Nokogiri::XML::Node.new "errors", document
|
61
|
-
document.root.add_child(node)
|
62
|
-
end
|
63
|
-
|
64
|
-
##
|
65
|
-
# Add the text file incase it is not a valid XML document. More
|
66
|
-
# info for debugging.
|
67
|
-
#
|
68
|
-
def add_text
|
69
|
-
node = Nokogiri::XML::Node.new "raw", document
|
70
|
-
node.inner_html = input
|
71
|
-
document.root.add_child(node)
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
##
|
76
|
-
# Add the actual error to the errors layer.
|
77
|
-
#
|
78
|
-
def add_error
|
79
|
-
node = document.at('errors')
|
80
|
-
error_node = Nokogiri::XML::Node.new "error", node
|
81
|
-
error_node['class'] = klass.to_s
|
82
|
-
error_node['version'] = klass::VERSION
|
83
|
-
error_node.inner_html = error
|
84
|
-
node.add_child(error_node)
|
85
|
-
end
|
86
|
-
|
87
|
-
end # ErrorLayer
|
88
|
-
end # ConstituentParser
|
89
|
-
end # Opener
|