code_terminator 0.4.15 → 0.4.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a74c3589fc1cce252bdc6c1f1cfbbc8c39610cf
4
- data.tar.gz: f500e2e20044cba091c042b3788108b36d6a022f
3
+ metadata.gz: 07d27181d39afffab7a5f87adb4a0675bf38a4fa
4
+ data.tar.gz: b3a2acfffd34be17ed25a1a726071110a6c93aee
5
5
  SHA512:
6
- metadata.gz: 5aeedd345f4b1976d3d4c31c74734ab3f677df087e54c925da3db2b5c9c21ab9976b155a82d2901e04d0b1cd8d7c89adcec4c55d8316bce25b43c3f4dce0cd61
7
- data.tar.gz: 58701c448eda38a40ef722c6bc22ea276ee57e5f0bddad29f4c069c1b2de36d73a332f70cf1e0648f3069c0bbbff853ac416ba1a6c1b14e22e09d23a0e434157
6
+ metadata.gz: 104a007f586cd4803827afbe0ca4e1078b6a78f0bbfa526bb4dfade4a8a6eb260957a07e9f52b1bc3b7afd6f37a397f1dc4af15f1ac04a3577800de84eccac7c
7
+ data.tar.gz: aa53f7f5641c2434c6bd29063f0f87d19f00c66f48e7a8ea499bd906bd955dbde6fb8b9b50dc5ba6f63db1f4f51a3803145f77d2549d62a6d185749af0270b50
@@ -289,19 +289,27 @@ class CodeTerminator::Html
289
289
 
290
290
  elements.each do |e|
291
291
 
292
- item = e[:tag]
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
@@ -1,3 +1,3 @@
1
1
  module CodeTerminator
2
- VERSION = "0.4.15"
2
+ VERSION = "0.4.16"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_terminator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.15
4
+ version: 0.4.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evelin Ponce