mumuki-html-runner 1.8.0 → 1.9.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 745db41402dbb39adee5699159f786c4d190a10d2a4b0aeaac2241f6e197e9db
4
- data.tar.gz: 58e82903357fdb43a4b9effeccb44459cac84cc58bfb279cb6f33229c9c1ab14
3
+ metadata.gz: 102f93e38e19ee0595a6d2deb43b9b0d7a66d95f4480dcfd4a5af5521a62f5bd
4
+ data.tar.gz: 229476d0f83168d0423cb8c91627fdeb418475f1c2e9f86dbcf2bfd7d45bc2d7
5
5
  SHA512:
6
- metadata.gz: 5bc8bfa5b6411fa761ed9366424022aae0d3abf36c022c0a15068603397f5be33750c584d901fdfc72de50cdac3e1f53d19902a394e91975af4fedf9a5888c33
7
- data.tar.gz: 4b5ad09dfeeb179ff8547217684430a769ae5f94649285d70db5e7b7e8a332cfe4905d90a93052e906a8f2ecf3bdd03fd0c43c831fc02e37e05dbbd7099882c3
6
+ metadata.gz: 1d0a8f9cd6dedf9bda569c85223e881e776226e1871f9ef7c474e3470944a6966de409431a7013ac7a8ee5cc08b817707344adfff499fed0f37e4fd16687391d
7
+ data.tar.gz: 87635fd6e2bfc1925f6e3910384dcb1fac651cb3b01702211e791b509109e6a2813451167c3323ee9740c938db2046f9ef501dede94a0f707fb54e0ff53bbbb6
data/lib/html_runner.rb CHANGED
@@ -8,7 +8,7 @@ I18n.load_translations_path File.join(__dir__, 'locales', '*.yml')
8
8
 
9
9
  Mumukit.runner_name = 'html'
10
10
  Mumukit.configure do |config|
11
- config.docker_image = 'mumuki/mumuki-html-worker:1.3'
11
+ config.docker_image = 'mumuki/mumuki-html-worker:1.4'
12
12
  config.content_type = 'html'
13
13
  config.process_expectations_on_empty_content = true
14
14
  config.run_test_hook_on_empty_test = true
data/lib/test_dom_hook.rb CHANGED
@@ -1,3 +1,9 @@
1
+ class Hexp::Node
2
+ def flat_map_children(&blk)
3
+ H[tag, attributes, children.flat_map(&blk)]
4
+ end
5
+ end
6
+
1
7
  class HtmlTestDomHook < Mumukit::Hook
2
8
  def compile(request)
3
9
  request
@@ -28,34 +34,29 @@ class HtmlTestDomHook < Mumukit::Hook
28
34
  end
29
35
 
30
36
  def comparable_hexp(content, options)
31
- html = transform_content content, options
32
-
33
- hexp_without_blanks html
34
- end
35
-
36
- def transform_content(content, options)
37
- return content unless options.present?
38
- exp = hexp_without_blanks content
39
-
40
- if options['output_ignore_scripts']
41
- exp = exp.replace('script') { [] }
37
+ content = squeeze_inner_whitespaces content unless options['keep_inner_whitespaces']
38
+ exp = hexp content
39
+ exp = exp.replace('script') { [] } if options['output_ignore_scripts']
40
+ exp = exp.replace('style') { [] } if options['output_ignore_styles']
41
+ exp = remove_outer_whitespaces exp unless options['keep_outer_whitespaces']
42
+ exp
43
+ end
44
+
45
+ def remove_outer_whitespaces(hexp)
46
+ hexp.flat_map_children do |node|
47
+ next remove_outer_whitespaces(node) unless node.text?
48
+ [node.strip.presence].compact
42
49
  end
43
-
44
- if options['output_ignore_styles']
45
- exp = exp.replace('style') { [] }
46
- end
47
-
48
- exp.to_html
49
50
  end
50
51
 
51
- def hexp_without_blanks(content)
52
- hexp %W(\r \n \t)
53
- .reduce(content.strip) { |c, it| c.gsub(it, ' ') }
54
- .squeeze(' ')
52
+ def squeeze_inner_whitespaces(content)
53
+ %W(\r \n \t)
54
+ .reduce(content.strip) { |c, it| c.gsub(it, ' ') }
55
+ .squeeze(' ')
55
56
  end
56
57
 
57
- def hexp(squeezed_content)
58
- Hexp.parse("<html>#{squeezed_content}</html>")
58
+ def hexp(content)
59
+ Hexp.parse("<html>#{content}</html>")
59
60
  end
60
61
 
61
62
  def render_html(actual)
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module HtmlVersionHook
2
- VERSION = '1.8.0'
2
+ VERSION = '1.9.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-html-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-21 00:00:00.000000000 Z
11
+ date: 2019-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '3.0'
131
+ version: '3.8'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '3.0'
138
+ version: '3.8'
139
139
  description:
140
140
  email:
141
141
  - franco@mumuki.org
@@ -176,8 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  - !ruby/object:Gem::Version
177
177
  version: '0'
178
178
  requirements: []
179
- rubyforge_project:
180
- rubygems_version: 2.7.8
179
+ rubygems_version: 3.0.2
181
180
  signing_key:
182
181
  specification_version: 4
183
182
  summary: HTML Runner for Mumuki