trmnl_preview 0.17.1 → 0.17.2

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: 11b638751da7a7a5437bf05fbd1adee2ce1742c2d242771e8f571a9d2de1bd17
4
- data.tar.gz: 2f73f065e6c5b364750b03eb7ac9a78657e0049110a79b48b80f989a23e5ef80
3
+ metadata.gz: 835368508a529b50bb30de82e6a0170a9d5c14f6edebeb4ffdd2afc774273e58
4
+ data.tar.gz: 7cf9003dde78b9688674ff48fe0e0fa7decd50ee36204de9196078141ae3defa
5
5
  SHA512:
6
- metadata.gz: 168a16980daa6baf259a11ee7b38660eeb44a564f1bb82121698b4d1666059afe58889ee6415a8accdaaff63e70bd35e7b87ab15b1b64ecfadb592f93c475f8e
7
- data.tar.gz: 0b472dbdd29f34fad3390f6bf7413f89e9f819dbaf6cea1bc1ac4ce3a00fe034218a76fefd47de74f39f8519926e90254b092a2e29aeef63fa5efe0813b4ac21
6
+ metadata.gz: 339f9c574ee307ebc59ed949d6b12bcdb7c58aaa6191564f0b8b6d5b91c675322e2f329055b2630f6d29db3ca341386e09aded2f02e928c129f297890584fbb4
7
+ data.tar.gz: 3d5c286313c7a75f2b6beaba417917fdc932a51dd8e4e9f3953065111f1accec23d3480164f47588547b6bcc2b482abbe534368328c8107e034308f354197dfd
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
 
2
2
  # Changelog
3
3
 
4
+ ## 0.17.2
5
+
6
+ - `trmnlp test` no longer inlines a stylesheet link inside a script's string, such as a CDN fallback written with `document.write`. It broke the script, and every render came out blank. (#174)
7
+
4
8
  ## 0.17.1
5
9
 
6
10
  - `trmnlp test --report` writes its images readable by everyone, and `--update` its snapshots. They kept the 0600 mode of the screen's temp file, so under the `trmnl/trmnlp` image, which runs as root, the init workflow could not upload the report. (#171)
@@ -10,16 +10,19 @@ module TRMNLP
10
10
  # measures text (a layout solver, say) raced them and drew a different board from run to run.
11
11
  module InlineStylesheets
12
12
  LINK = /<link\b[^>]*\brel=["']stylesheet["'][^>]*>/i
13
+ SCRIPT = %r{<script\b.*?</script>}im
13
14
  HREF = /\bhref=["'](https?:[^"']+)["']/i
14
15
  CSS_URL = /url\(\s*(['"]?)(?!data:|https?:|#)([^'")]+)\1\s*\)/i
15
16
 
16
17
  module_function
17
18
 
18
19
  def call(html)
19
- html.gsub(LINK) do |link|
20
- url = link[HREF, 1]
20
+ html.gsub(Regexp.union(SCRIPT, LINK)) do |tag|
21
+ next tag if tag.match?(/\A<script/i)
22
+
23
+ url = tag[HREF, 1]
21
24
  css = url && stylesheet(url)
22
- css ? "<style data-href=\"#{url}\">#{css}</style>" : link
25
+ css ? "<style data-href=\"#{url}\">#{css}</style>" : tag
23
26
  end
24
27
  end
25
28
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TRMNLP
4
- VERSION = '0.17.1'
4
+ VERSION = '0.17.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trmnl_preview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.1
4
+ version: 0.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rockwell Schrock