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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/trmnlp/testing/inline_stylesheets.rb +6 -3
- data/lib/trmnlp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 835368508a529b50bb30de82e6a0170a9d5c14f6edebeb4ffdd2afc774273e58
|
|
4
|
+
data.tar.gz: 7cf9003dde78b9688674ff48fe0e0fa7decd50ee36204de9196078141ae3defa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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 |
|
|
20
|
-
|
|
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>" :
|
|
25
|
+
css ? "<style data-href=\"#{url}\">#{css}</style>" : tag
|
|
23
26
|
end
|
|
24
27
|
end
|
|
25
28
|
|
data/lib/trmnlp/version.rb
CHANGED