code_terminator 0.4.15 → 0.4.16
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/code_terminator/html.rb +22 -4
- 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: 07d27181d39afffab7a5f87adb4a0675bf38a4fa
|
4
|
+
data.tar.gz: b3a2acfffd34be17ed25a1a726071110a6c93aee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 104a007f586cd4803827afbe0ca4e1078b6a78f0bbfa526bb4dfade4a8a6eb260957a07e9f52b1bc3b7afd6f37a397f1dc4af15f1ac04a3577800de84eccac7c
|
7
|
+
data.tar.gz: aa53f7f5641c2434c6bd29063f0f87d19f00c66f48e7a8ea499bd906bd955dbde6fb8b9b50dc5ba6f63db1f4f51a3803145f77d2549d62a6d185749af0270b50
|
data/lib/code_terminator/html.rb
CHANGED
@@ -289,19 +289,27 @@ class CodeTerminator::Html
|
|
289
289
|
|
290
290
|
elements.each do |e|
|
291
291
|
|
292
|
-
|
292
|
+
# p item = e[:tag]
|
293
293
|
|
294
294
|
if item == "text" or item == "comment"
|
295
295
|
|
296
296
|
# Check the text
|
297
297
|
if !e[:content].nil?
|
298
|
-
|
299
298
|
if code.css(e[:parent]).count < 2
|
300
299
|
if code.css(e[:parent]).class == Nokogiri::XML::NodeSet
|
301
300
|
text_found = false
|
301
|
+
comment_found = false if item == "comment"
|
302
302
|
error330 = nil
|
303
303
|
if code.css(e[:parent]).children.any?
|
304
304
|
code.css(e[:parent]).children.each do |node_child|
|
305
|
+
|
306
|
+
# p "node child " + node_child.class.to_s
|
307
|
+
# p "item " + item
|
308
|
+
|
309
|
+
if item == "comment" && node_child.class == Nokogiri::XML::Comment
|
310
|
+
comment_found = true
|
311
|
+
end
|
312
|
+
|
305
313
|
if node_child.class != Nokogiri::XML::Element
|
306
314
|
#embebed code
|
307
315
|
#if code.css(e[:parent]).text != e[:content]
|
@@ -311,8 +319,6 @@ class CodeTerminator::Html
|
|
311
319
|
# if comment isn't present in the code, mark add tag
|
312
320
|
if e[:content].strip != ""
|
313
321
|
error330 = new_error(element: e, type: 330, description: "The text inside the comment should be #{e[:content]}")
|
314
|
-
else
|
315
|
-
# html_errors << new_error(element: e, type: 404, description: "Remember to add the `<#{e[:tag]}>` tag")
|
316
322
|
end
|
317
323
|
else
|
318
324
|
error330 = new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}")
|
@@ -323,8 +329,17 @@ class CodeTerminator::Html
|
|
323
329
|
#end embebed code
|
324
330
|
end
|
325
331
|
end
|
332
|
+
|
333
|
+
if !(defined? comment_found).nil?
|
334
|
+
if !comment_found
|
335
|
+
html_errors << new_error(element: e, type: 404, description: "Remember to add the `<#{e[:tag]}>` tag")
|
336
|
+
end
|
337
|
+
end
|
326
338
|
#end each
|
327
339
|
else
|
340
|
+
if item == "comment"
|
341
|
+
html_errors << new_error(element: e, type: 404, description: "Remember to add the `<#{e[:tag]}>` tag")
|
342
|
+
end
|
328
343
|
if code.css(e[:parent]).text.strip != e[:content].strip
|
329
344
|
# p "text of node: " + code.css(e[:parent]).text
|
330
345
|
if item == "comment"
|
@@ -337,6 +352,9 @@ class CodeTerminator::Html
|
|
337
352
|
end
|
338
353
|
end
|
339
354
|
#end if parent has children
|
355
|
+
# if !comment_found
|
356
|
+
# html_errors << new_error(element: e, type: 404, description: "Remember to add the `comment` tag")
|
357
|
+
# end
|
340
358
|
|
341
359
|
if !text_found && !error330.nil?
|
342
360
|
html_errors << error330
|