code_terminator 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/code_terminator/html.rb +35 -3
- data/lib/code_terminator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faf6cc227dfcae950f3b8859daa77f889d013a3a
|
4
|
+
data.tar.gz: aa97aee169279e69047dd6efce787c1b2f610fd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8283759f197ed03e986ef09c4da651a2e7423d32d147497f6088cc587b653bc709866067280391bf69a9dd4e4391136336be6d27f2d9095c2e6b4978eec09d08
|
7
|
+
data.tar.gz: 7888f74efbf12ea29444ba50b3383f0b58711ab15fd8897e3324ba9d1d8ea1fc8ea16a13b118b49af3fa13e9445a63de0319e73916103a16af2799a5dfc613a4
|
data/lib/code_terminator/html.rb
CHANGED
@@ -269,9 +269,30 @@ class CodeTerminator::Html
|
|
269
269
|
# Check the text
|
270
270
|
if !e[:content].nil?
|
271
271
|
if code.css(e[:parent]).count < 2
|
272
|
-
|
273
|
-
|
272
|
+
|
273
|
+
#new code
|
274
|
+
if code.css(e[:parent]).class == Nokogiri::XML::NodeSet
|
275
|
+
text_found = false
|
276
|
+
error330 = nil
|
277
|
+
code.css(e[:parent]).children.each do |node_child|
|
278
|
+
if node_child.class != Nokogiri::XML::Element
|
279
|
+
#embebed code
|
280
|
+
#if code.css(e[:parent]).text != e[:content]
|
281
|
+
if node_child.text.strip != e[:content].strip
|
282
|
+
error330 = new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}.")
|
283
|
+
else
|
284
|
+
text_found = true
|
285
|
+
end
|
286
|
+
#end embebed code
|
287
|
+
end
|
288
|
+
end
|
289
|
+
if !text_found && !error330.nil?
|
290
|
+
html_errors << error330
|
291
|
+
error330 = nil
|
292
|
+
end
|
274
293
|
end
|
294
|
+
#new code
|
295
|
+
|
275
296
|
else
|
276
297
|
exist = false
|
277
298
|
code.css(e[:parent]).each do |code_css|
|
@@ -352,6 +373,16 @@ class CodeTerminator::Html
|
|
352
373
|
|
353
374
|
def add_children(parent)
|
354
375
|
parent.children.each do |child|
|
376
|
+
p "children: " + child
|
377
|
+
p "children count = "+ child.children.count.to_s
|
378
|
+
if child.children.count > 1
|
379
|
+
clone = child.clone
|
380
|
+
if clone.class == Nokogiri::XML::Element
|
381
|
+
clone.children.remove
|
382
|
+
p "clone text " + clone
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
355
386
|
if child.attribute_nodes.empty?
|
356
387
|
node = Hash.new
|
357
388
|
node[:parent] = parent.name
|
@@ -361,7 +392,7 @@ class CodeTerminator::Html
|
|
361
392
|
else
|
362
393
|
node[:tag] = child.name
|
363
394
|
end
|
364
|
-
node[:content] = child.text if !child.text.nil?
|
395
|
+
node[:content] = child.text if !child.text.nil? and child.class!=Nokogiri::XML::Element
|
365
396
|
@elements << node
|
366
397
|
else
|
367
398
|
child.attribute_nodes.each do |element_attribute|
|
@@ -380,6 +411,7 @@ class CodeTerminator::Html
|
|
380
411
|
@elements << node
|
381
412
|
end
|
382
413
|
end
|
414
|
+
|
383
415
|
add_children(child) if child.children.any?
|
384
416
|
end
|
385
417
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code_terminator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evelin Ponce
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|