code_terminator 0.4.12 → 0.4.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exercises/issue14.html +1 -6
- data/exercises/issue15.html +8 -0
- data/lib/code_terminator/css.rb +3 -3
- data/lib/code_terminator/html.rb +17 -11
- data/lib/code_terminator/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90f23c0e4a035e4741481aebf08e71007a81a971
|
4
|
+
data.tar.gz: 98ee0c111af3c96fa3ab1fbb4b7be74babdad246
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a5808da66e6b65ca44eff751efa33574362421c22cff26885b8dd55c773554672695f4b07af99736e4bb736bf7a73e97b15dafc77cd0115c05391ce666776e0
|
7
|
+
data.tar.gz: 5f108da2b3010f8c7eb8f46bf6546b1e09be1426d91a359f2860c3cf8fd98540d15793c2b3a21f4e2c88939b962bb4797e12d018da7a831bd087557c0edee85b
|
data/exercises/issue14.html
CHANGED
data/lib/code_terminator/css.rb
CHANGED
@@ -218,18 +218,18 @@ class CodeTerminator::Css
|
|
218
218
|
if e[:value]==""
|
219
219
|
property = e[:property] + ": "
|
220
220
|
if parser_property.empty? { |s| s.include?(property) }
|
221
|
-
css_errors << new_error(element: e, type: 111, description: "Make sure the property _#{property}_ is in the selector **#{item}
|
221
|
+
css_errors << new_error(element: e, type: 111, description: "Make sure the property _#{property}_ is in the selector **#{item}**")
|
222
222
|
end
|
223
223
|
else
|
224
224
|
property = e[:property] + ": " + e[:value]
|
225
225
|
if !parser_property.include?(property)
|
226
|
-
css_errors << new_error(element: e, type: 111, description: "Make sure the property _#{property}_ is in the selector **#{item}
|
226
|
+
css_errors << new_error(element: e, type: 111, description: "Make sure the property _#{property}_ is in the selector **#{item}**")
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
230
230
|
else
|
231
231
|
node = Hash.new
|
232
|
-
css_errors << new_error(element: e, type: 101, description: "Add _#{property}_ inside **#{item}
|
232
|
+
css_errors << new_error(element: e, type: 101, description: "Add _#{property}_ inside **#{item}**")
|
233
233
|
end
|
234
234
|
end
|
235
235
|
end
|
data/lib/code_terminator/html.rb
CHANGED
@@ -90,7 +90,7 @@ class CodeTerminator::Html
|
|
90
90
|
node = Hash.new
|
91
91
|
node[:parent] = "head"
|
92
92
|
node[:tag] = child.name
|
93
|
-
node[:content] = child.text if !child.text.nil?
|
93
|
+
node[:content] = child.text if !child.text.nil? or child.comment?
|
94
94
|
@elements << node
|
95
95
|
else
|
96
96
|
child.attribute_nodes.each do |element_attribute|
|
@@ -120,7 +120,7 @@ class CodeTerminator::Html
|
|
120
120
|
node = Hash.new
|
121
121
|
node[:parent] = "body"
|
122
122
|
node[:tag] = child.name
|
123
|
-
node[:content] = child.text if child.text?
|
123
|
+
node[:content] = child.text if child.text? or child.comment?
|
124
124
|
@elements << node
|
125
125
|
else
|
126
126
|
child.attribute_nodes.each do |element_attribute|
|
@@ -249,6 +249,8 @@ class CodeTerminator::Html
|
|
249
249
|
text << " in " + child[:parent] if !child[:parent].nil?
|
250
250
|
text << " with an attribute '" + child[:attribute] + "' " if !child[:attribute].nil?
|
251
251
|
text << " with value '" + child[:value] + "' " if !child[:value].nil?
|
252
|
+
elsif child[:tag] == "comment"
|
253
|
+
text << " In " + child[:tag]+ " add the text '" + child[:content] + "' " if !child[:content].nil?
|
252
254
|
else
|
253
255
|
text << " In " + child[:parent]+ " add the text '" + child[:content] + "' " if !child[:content].nil?
|
254
256
|
end
|
@@ -289,7 +291,7 @@ class CodeTerminator::Html
|
|
289
291
|
|
290
292
|
item = e[:tag]
|
291
293
|
|
292
|
-
if item=="text"
|
294
|
+
if item == "text" or item == "comment"
|
293
295
|
|
294
296
|
# Check the text
|
295
297
|
if !e[:content].nil?
|
@@ -305,7 +307,7 @@ class CodeTerminator::Html
|
|
305
307
|
#embebed code
|
306
308
|
#if code.css(e[:parent]).text != e[:content]
|
307
309
|
if node_child.text.strip != e[:content].strip
|
308
|
-
|
310
|
+
error330 = new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}")
|
309
311
|
else
|
310
312
|
text_found = true
|
311
313
|
end
|
@@ -315,7 +317,11 @@ class CodeTerminator::Html
|
|
315
317
|
else
|
316
318
|
if code.css(e[:parent]).text.strip != e[:content].strip
|
317
319
|
p "text of node: " + code.css(e[:parent]).text
|
318
|
-
|
320
|
+
if item == "comment"
|
321
|
+
error330 = new_error(element: e, type: 330, description: "The text inside the comment should be #{e[:content]}")
|
322
|
+
else
|
323
|
+
error330 = new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}")
|
324
|
+
end
|
319
325
|
else
|
320
326
|
text_found = true
|
321
327
|
end
|
@@ -339,7 +345,7 @@ class CodeTerminator::Html
|
|
339
345
|
#end
|
340
346
|
end
|
341
347
|
if !exist
|
342
|
-
html_errors << new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}
|
348
|
+
html_errors << new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}")
|
343
349
|
end
|
344
350
|
end
|
345
351
|
end
|
@@ -353,11 +359,11 @@ class CodeTerminator::Html
|
|
353
359
|
if !e[:attribute].nil?
|
354
360
|
# Check the tag's attributes
|
355
361
|
if tag.attribute(e[:attribute]).nil?
|
356
|
-
html_errors << new_error(element: e, type: 334, description: "`<#{e[:tag]}>` should have an attribute named #{e[:attribute]}
|
362
|
+
html_errors << new_error(element: e, type: 334, description: "`<#{e[:tag]}>` should have an attribute named #{e[:attribute]}")
|
357
363
|
else
|
358
364
|
if tag.attribute(e[:attribute]).value != e[:value]
|
359
365
|
exist_in_body << false
|
360
|
-
error333 = new_error(element: e, type: 333, description: "Make sure that the attribute #{e[:attribute]} in `<#{e[:tag]}>` has the value #{e[:value]}
|
366
|
+
error333 = new_error(element: e, type: 333, description: "Make sure that the attribute #{e[:attribute]} in `<#{e[:tag]}>` has the value #{e[:value]}")
|
361
367
|
else
|
362
368
|
exist_in_body << true
|
363
369
|
end
|
@@ -370,7 +376,7 @@ class CodeTerminator::Html
|
|
370
376
|
|
371
377
|
if tag.count < 2 && !tag.first.nil?
|
372
378
|
if tag.first.parent.name != e[:parent]
|
373
|
-
html_errors << new_error(element: e, type: 440, description: "Remember to add the `<#{e[:tag]}>` tag inside `<#{e[:parent]}
|
379
|
+
html_errors << new_error(element: e, type: 440, description: "Remember to add the `<#{e[:tag]}>` tag inside `<#{e[:parent]}>`")
|
374
380
|
end
|
375
381
|
else
|
376
382
|
exist_in_parent = false
|
@@ -380,7 +386,7 @@ class CodeTerminator::Html
|
|
380
386
|
end
|
381
387
|
end
|
382
388
|
if !exist_in_parent
|
383
|
-
html_errors << new_error(element: e, type: 440, description: "Remember to add the `<#{e[:tag]}>` tag inside `<#{e[:parent]}
|
389
|
+
html_errors << new_error(element: e, type: 440, description: "Remember to add the `<#{e[:tag]}>` tag inside `<#{e[:parent]}>`")
|
384
390
|
end
|
385
391
|
end
|
386
392
|
end
|
@@ -389,7 +395,7 @@ class CodeTerminator::Html
|
|
389
395
|
else
|
390
396
|
# Check that the tag is present
|
391
397
|
if code.at_css(e[:tag]).nil?
|
392
|
-
html_errors << new_error(element: e, type: 404, description: "Remember to add the `<#{e[:tag]}>` tag
|
398
|
+
html_errors << new_error(element: e, type: 404, description: "Remember to add the `<#{e[:tag]}>` tag")
|
393
399
|
end
|
394
400
|
end
|
395
401
|
|
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.13
|
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-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- exercises/issue12.html
|
160
160
|
- exercises/issue13.html
|
161
161
|
- exercises/issue14.html
|
162
|
+
- exercises/issue15.html
|
162
163
|
- exercises/new.html
|
163
164
|
- exercises/new2.html
|
164
165
|
- exercises/test.css
|