ZMediumToMarkdown 2.6.1 → 2.6.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/Parsers/IframeParser.rb +26 -18
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ea5ab4db3ceae4536d0c2cb0e9c84b9def07bf557840d49d5273b0f69cc166c
4
- data.tar.gz: 1aba0d265b1bd8113b8f58d1d16fe676297ffb43b562bbb1c8c0e5131cd8fc03
3
+ metadata.gz: af952c627b793a37b987a22a9a34864b745dc13b53e156f71799007069fee6a0
4
+ data.tar.gz: 80ea4f05a34db4fdf47659f1df438d5f8b791098e452203d892be30146842a56
5
5
  SHA512:
6
- metadata.gz: 040a46e36d28e61c45615798a8f366ec6bd7550be3191cb949fd4c96ed6cd0abbe315f98c6694a856456b710d611535ef99de55150e3e34648cf0e6bfb53deea
7
- data.tar.gz: 1765391b94ebb65031bb315c7afd9761e6d4afec9b9dca47c488bc0f016c5798d93b187c95c0dcba5e010883137c743eccbd6ab77b27f5f7a29be38f9938ca0d
6
+ metadata.gz: 5f26a6a38a6e6dfa61a677b55f245436044cfec90c4b6cf43b5b98f71d3b209fcb32c37b85055b2a22c7218a368c9777be6ea923e7d3bb23d80e1299143a3908
7
+ data.tar.gz: 6195f720d3d4eb9bd0e096de4f8d31249019c406e53aa749c013c4251bf6cd86d28b3c034855365c58cf0bdf9271a1e2e0267fb64aeeadb9be55c70b9ba104c1
@@ -40,27 +40,35 @@ class IframeParser < Parser
40
40
  youtubeURL = URI(URI.decode(url)).query
41
41
  params = URI::decode_www_form(youtubeURL).to_h
42
42
 
43
- if !params["image"].nil? && !params["url"].nil?
43
+ if !params["url"].nil?
44
+ if isForJekyll
45
+ vid = URI.decode_www_form(URI.parse(params["url"]).query || "").to_h
46
+ vid = vid["v"]
44
47
 
45
- fileName = "#{paragraph.name}_#{URI(params["image"]).path.split("/").last}" #21de_default.jpg
46
-
47
- imageURL = params["image"]
48
- imagePathPolicy = PathPolicy.new(pathPolicy.getAbsolutePath(paragraph.postID), pathPolicy.getRelativePath(paragraph.postID))
49
- absolutePath = imagePathPolicy.getAbsolutePath(fileName)
50
- title = paragraph.iframe.title
51
- if title.nil? or title == ""
52
- title = "Youtube"
53
- end
48
+ result = "<iframe class=\"embed-video\" loading=\"lazy\" src=\"https://www.youtube.com/embed/#{vid}\" title=\"#{paragraph.iframe.title}\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen ></iframe>"
49
+ else
50
+ if !params["image"].nil?
51
+ fileName = "#{paragraph.name}_#{URI(params["image"]).path.split("/").last}" #21de_default.jpg
52
+
53
+ imageURL = params["image"]
54
+ imagePathPolicy = PathPolicy.new(pathPolicy.getAbsolutePath(paragraph.postID), pathPolicy.getRelativePath(paragraph.postID))
55
+ absolutePath = imagePathPolicy.getAbsolutePath(fileName)
56
+ title = paragraph.iframe.title
57
+ if title.nil? or title == ""
58
+ title = "Youtube"
59
+ end
54
60
 
55
- if ImageDownloader.download(absolutePath, imageURL)
56
- relativePath = imagePathPolicy.getRelativePath(fileName)
57
- if isForJekyll
58
- result = "\r\n\r\n[![#{title}](/#{relativePath} \"#{title}\")](#{params["url"]})#{jekyllOpen}\r\n\r\n"
59
- else
60
- result = "\r\n\r\n[![#{title}](#{relativePath} \"#{title}\")](#{params["url"]})#{jekyllOpen}\r\n\r\n"
61
+ if ImageDownloader.download(absolutePath, imageURL)
62
+ relativePath = imagePathPolicy.getRelativePath(fileName)
63
+ if isForJekyll
64
+ result = "\r\n\r\n[![#{title}](/#{relativePath} \"#{title}\")](#{params["url"]})#{jekyllOpen}\r\n\r\n"
65
+ else
66
+ result = "\r\n\r\n[![#{title}](#{relativePath} \"#{title}\")](#{params["url"]})#{jekyllOpen}\r\n\r\n"
67
+ end
68
+ else
69
+ result = "\r\n[#{title}](#{params["url"]})#{jekyllOpen}\r\n"
70
+ end
61
71
  end
62
- else
63
- result = "\r\n[#{title}](#{params["url"]})#{jekyllOpen}\r\n"
64
72
  end
65
73
  end
66
74
  else
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ZMediumToMarkdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ZhgChgLi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-22 00:00:00.000000000 Z
10
+ date: 2025-10-10 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: nokogiri