ZMediumToMarkdown 3.3.2 → 3.3.3
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/Helper.rb +10 -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: 97751da25df535110c1771b77a009171f82bd761ff74a5948927a349d06358a0
|
|
4
|
+
data.tar.gz: e8063778d0980fc394ff52fb9f0e1caeb59578915e812881da385b8a4f2b0fe3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f53c5d05e53b7ed984f65e908eef65b0fdab7606e740871c8639816eb32422d47d87c75b4f2f368f8aa6e89add6b531a818f977045a1af88e720757c1a386e24
|
|
7
|
+
data.tar.gz: fc8dff70656090f4d5ce5790aadadd4fea82ac2da5989979c1c9c2fe1edb36514b5ea8027652d13dff695ad7ba080e281dab822d3b4078afd4347b457b889b25
|
data/lib/Helper.rb
CHANGED
|
@@ -26,7 +26,16 @@ class Helper
|
|
|
26
26
|
html = Request.html(Request.URL(url))
|
|
27
27
|
return "" unless html
|
|
28
28
|
image = html.search("meta[property='og:image']").first
|
|
29
|
-
|
|
29
|
+
return "" unless image
|
|
30
|
+
content = (image['content'] || '').to_s.strip
|
|
31
|
+
return "" if content.empty?
|
|
32
|
+
# Resolve relative `og:image` paths (e.g. `/assets/og.png`) against the
|
|
33
|
+
# source page so downstream consumers get a usable absolute URL.
|
|
34
|
+
begin
|
|
35
|
+
URI.join(url, content).to_s
|
|
36
|
+
rescue URI::InvalidURIError, ArgumentError
|
|
37
|
+
content
|
|
38
|
+
end
|
|
30
39
|
end
|
|
31
40
|
|
|
32
41
|
# Escape characters that always have inline markdown meaning. Used for
|