mumuki-html-runner 1.4.0 → 1.4.1
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/metadata_hook.rb +1 -0
- data/lib/test_hook.rb +10 -4
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c0771033573571fffde2c2d2da99b208dfacbb1e88ad309cf9876a305d9914a
|
4
|
+
data.tar.gz: 9083f8440c43f84e15f11b4f2b38592e3febde3717307da9c5f51a1d630d07c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cebf7fe755a947f300a8881ef2b6079bf89857ef2ad78b0885397623081ba3de3836ef8c3599bacca7e7f5f5ebdcb0839dbbe1f31528c3170a71a69586eeebf
|
7
|
+
data.tar.gz: 0209fb23e352863f542842972464852f761a04f2f3c88687595e81b15c6dfcc85981b1dfb5f7342dfd0a036694bf3e8685897134ecfd2d67a11e4bcf0f03800a
|
data/lib/metadata_hook.rb
CHANGED
data/lib/test_hook.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
require 'mumukit/hook'
|
2
2
|
|
3
|
+
class String
|
4
|
+
def escape_html
|
5
|
+
ERB::Util.html_escape self
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
3
9
|
class HtmlTestHook < Mumukit::Hook
|
4
10
|
def compile(request)
|
5
11
|
request
|
@@ -24,8 +30,8 @@ class HtmlTestHook < Mumukit::Hook
|
|
24
30
|
|
25
31
|
def hexp_without_blanks(content)
|
26
32
|
hexp ["\r", "\n", "\t"]
|
27
|
-
|
28
|
-
|
33
|
+
.reduce(content.strip) { |c, it| c.gsub(it, ' ') }
|
34
|
+
.squeeze(' ')
|
29
35
|
end
|
30
36
|
|
31
37
|
def hexp(squeezed_content)
|
@@ -55,13 +61,13 @@ html
|
|
55
61
|
|
56
62
|
def page_favicon(dom)
|
57
63
|
dom.xpath("//link[@rel='icon' and @href]").first
|
58
|
-
|
64
|
+
.try { |tag| " data-favicon=\"#{tag['href']}\"" }
|
59
65
|
end
|
60
66
|
|
61
67
|
def build_iframe(content)
|
62
68
|
dom = hexp(content).to_dom
|
63
69
|
<<html
|
64
|
-
<div class="mu-browser"#{page_title dom}#{page_favicon dom} data-srcdoc="#{content.
|
70
|
+
<div class="mu-browser"#{page_title dom}#{page_favicon dom} data-srcdoc="#{content.escape_html}">
|
65
71
|
</div>
|
66
72
|
html
|
67
73
|
end
|
data/lib/version.rb
CHANGED
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.4.
|
4
|
+
version: 1.4.1
|
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: 2017-12-
|
11
|
+
date: 2017-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit
|