mumuki-html-runner 1.13.0 → 1.14.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: c0b835e520d21c71424ff79e5b9446115bdb877e4cf84a1330393e1c22e5c377
4
- data.tar.gz: bcd60454f5b92cca53dedcf268f979a0e1e94a17b59841bba80bf34dfb0e94f2
3
+ metadata.gz: 2bef45a937249aac3b6f295ba3aa9c6ead134902e3dff6fd9f3ab09b33127f20
4
+ data.tar.gz: b3862c3908414db153d931e0806aab02d64defef6d19118a7c395cfb5677e825
5
5
  SHA512:
6
- metadata.gz: aec1c8a3afe218b67519253ecfa82d9c45e5373933ce858dc58dc754934936b86ad677bfc7326c817dfb14dae111fbdac13446d823d7e6a03bc0ea2f906316f6
7
- data.tar.gz: aae7ca5666b136c028ece67538043a91d5ffd3d642e41eb8960a436a1d41c9d3940e5e8de1cf619768149298bcdafa9b45559bbd1044e7ec4f3dadeb3ac99978
6
+ metadata.gz: 18a1ce2ca358b0ae6fffb4611012d4b94b69e80147b33f26f86af6cd298ce9938c6e34f7b8705fbc99d08722b7e84deed0b46df3d386e09a82d05c3c284f1555
7
+ data.tar.gz: '0833cd3ea0fca23e100be82e9b988a6db5a3b763c97fa261238f8f1beb6db71c746ce8a110a3a808f7a897b79f0909ae1b30fb00a7ea03c5304c44a301d9c90a'
data/lib/test_dom_hook.rb CHANGED
@@ -88,11 +88,19 @@ html
88
88
  def build_iframe(content)
89
89
  dom = hexp(content).to_dom
90
90
  <<html
91
- <div class="mu-browser"#{page_title dom}#{page_favicon dom} data-srcdoc="#{content.escape_html}">
91
+ <div class="mu-browser"#{page_title dom}#{page_favicon dom} data-srcdoc="#{transform_content(content)}">
92
92
  </div>
93
93
  html
94
94
  end
95
95
 
96
+ def transform_content(content)
97
+ replace_anchors(content).escape_html
98
+ end
99
+
100
+ def replace_anchors(content)
101
+ content.gsub(/href="#(\w*)"/, 'href="about:srcdoc#\1"')
102
+ end
103
+
96
104
  def compile_content(request)
97
105
  request.extra.presence || request.content
98
106
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module HtmlVersionHook
2
- VERSION = '1.13.0'
2
+ VERSION = '1.14.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.13.0
4
+ version: 1.14.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: 2021-03-25 00:00:00.000000000 Z
11
+ date: 2021-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit