code_terminator 0.5.4 → 0.5.5
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 +15 -14
- data/lib/code_terminator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69aeb452b012e5dc968c16d8c681cbf4fecf7f66
|
4
|
+
data.tar.gz: 46ee19a648f0e36810939a865a720e9c26398d68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aff1e3b6f3dda1b7334d8cdc58eff28429f4c32b221a144113a8687c17c95f8d155cb112a7e81e2e9732934f070b2ebb048baabbcb58b346114620fe10007ef1
|
7
|
+
data.tar.gz: 0cf2eb1b7efb088d79856de00f72d05133b5d8c0d6062f366e06c1910b1709aad9b3591b7067d468235ca71c722c54aa1490f51167b59b63a0f411571b0673b8
|
data/lib/code_terminator/html.rb
CHANGED
@@ -378,22 +378,22 @@ class CodeTerminator::Html
|
|
378
378
|
# if tag_element
|
379
379
|
if e[:attribute]
|
380
380
|
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
381
|
+
# p "e --- " + e[:tag].to_s
|
382
|
+
# p "e pt--- " + e[:pointer].to_s
|
383
|
+
# p "e parent pt--- " + e[:parent_pointer].to_s
|
384
|
+
# p "e attribute --- " + e[:attribute].to_s
|
385
385
|
|
386
386
|
|
387
387
|
# if tag.attribute(e[:attribute])
|
388
388
|
# p "elements count = " + css_code_checked.to_s
|
389
389
|
tag_element = css_code_checked.select {|element| element[:pointer].to_s == tag.pointer_id.to_s && element[:original_pointer] == e[:pointer] }.first
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
390
|
+
# p "tag --" + tag.name.to_s
|
391
|
+
# p "tag --" + tag.to_s
|
392
|
+
# p "tag parent -- " + tag.parent.name.to_s
|
393
|
+
# p "tag pointer -- " + tag.pointer_id.to_s
|
394
|
+
# p "tag parent pointer -- " + tag.parent.pointer_id.to_s
|
395
|
+
# p "tag attribute -- " + tag.attribute(e[:attribute]).to_s
|
396
|
+
# p "parent_element --- " + tag_element.to_s
|
397
397
|
# else
|
398
398
|
# end
|
399
399
|
|
@@ -403,7 +403,7 @@ class CodeTerminator::Html
|
|
403
403
|
# p "attribute element " + e[:attribute].to_s
|
404
404
|
# p "attribute tag " + tag.attribute(e[:attribute]).name.to_s
|
405
405
|
# if e[:attribute] != tag.attribute(e[:attribute]).name
|
406
|
-
|
406
|
+
html_errors << new_error(element: e, type: 334, description: "`<#{e[:tag]}>` should have an attribute named #{e[:attribute]}")
|
407
407
|
# end
|
408
408
|
end
|
409
409
|
else
|
@@ -470,7 +470,8 @@ class CodeTerminator::Html
|
|
470
470
|
# tag_count = code.css(x[:tag]).length
|
471
471
|
tag_count = elements.select {|element| element[:parent_pointer].to_s == x[:parent_pointer].to_s && element[:tag].to_s == x[:tag]}.count
|
472
472
|
# p x[:tag]!="body"
|
473
|
-
if tag_count >= 1 && !(x[:tag]=="body" || x[:tag]=="head" || x[:tag]=="text" || x[:tag]=="comment")
|
473
|
+
if tag_count >= 1 && !(x[:tag]=="body" || x[:tag]=="head" || x[:tag]=="text" || x[:tag]=="comment" || x[:tag]=="img")
|
474
|
+
# if tag_count >= 1 && !(x[:tag]!="div")
|
474
475
|
if x[:count] < tag_count
|
475
476
|
html_errors << new_error(element: x[:tag], type: 404, description: "Remember to add the `<#{x[:tag]}>` tag")
|
476
477
|
end
|
@@ -590,7 +591,7 @@ class CodeTerminator::Html
|
|
590
591
|
#@e, node_child
|
591
592
|
#save a error330, text_found
|
592
593
|
#return true (flag)
|
593
|
-
if node_child.class == Nokogiri::XML::Text && e[:
|
594
|
+
if node_child.class == Nokogiri::XML::Text && e[:tag] != "comment"
|
594
595
|
node_child.text.strip != e[:content].strip ? error330 = new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}") : text_found = true
|
595
596
|
end
|
596
597
|
end #each
|