obp-access 0.1.6 → 0.1.7
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 +4 -4
- data/lib/obp/access/grammar_parser.rb +17 -12
- data/lib/obp/access/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a3173c5c6ed7666dd3c49b0c9c9b1b14ac72a4793468c38a29e764724177cd23
|
|
4
|
+
data.tar.gz: 63d5ad292c7699f0bfd21e8bccba6bf5aec61298879a94b4bea65a1c26f61340
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 49872cd725a4badbd4a9700b870f939efd7286c12efdc4160b3f6ad4ad8953655a13fa52b020e41048d2430595fdb0c8f9e1c2bc56505934afbe5c3598b2fd0c
|
|
7
|
+
data.tar.gz: 485f51e78bfefd1e84e8def0160045795fe9071567761872eb33866a588da21662c1433985d70648e35c5fe70c8c260197a7eae8a3facd7af60cc7b5aa275581
|
|
@@ -117,23 +117,28 @@ module Obp
|
|
|
117
117
|
|
|
118
118
|
def parse_segments(html)
|
|
119
119
|
segments = []
|
|
120
|
-
remaining = html
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if match
|
|
125
|
-
segments << { text: match[1], bold: false } if match[1].length.positive?
|
|
126
|
-
segments << { text: match[3], bold: true }
|
|
127
|
-
remaining = match[4]
|
|
128
|
-
else
|
|
129
|
-
segments << { text: remaining, bold: false }
|
|
130
|
-
break
|
|
131
|
-
end
|
|
120
|
+
remaining = html
|
|
121
|
+
|
|
122
|
+
until remaining.nil? || remaining.empty?
|
|
123
|
+
remaining = consume_segment(remaining, segments)
|
|
132
124
|
end
|
|
133
125
|
|
|
134
126
|
segments
|
|
135
127
|
end
|
|
136
128
|
|
|
129
|
+
def consume_segment(remaining, segments)
|
|
130
|
+
open = remaining.index("<b>")
|
|
131
|
+
close = open && remaining.index("</b>", open + 3)
|
|
132
|
+
if open.nil? || close.nil?
|
|
133
|
+
segments << { text: remaining, bold: false }
|
|
134
|
+
return ""
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
segments << { text: remaining[0, open], bold: false } if open.positive?
|
|
138
|
+
segments << { text: remaining[(open + 3)...close], bold: true }
|
|
139
|
+
remaining[(close + 4)..] || ""
|
|
140
|
+
end
|
|
141
|
+
|
|
137
142
|
def clean_term(parts)
|
|
138
143
|
combined = parts.join
|
|
139
144
|
combined = combined.gsub(/,\s*\z/, "")
|
data/lib/obp/access/version.rb
CHANGED