ZMediumToMarkdown 2.1.0 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/Helper.rb +12 -7
- data/lib/Parsers/IframeParser.rb +1 -1
- data/lib/Parsers/MIXTAPEEMBEDParser.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac8a9198b2843cd4002e114216dbca91408e1a5e3023f9abc12fcb837454efdd
|
4
|
+
data.tar.gz: 68e2256efd392b79e52cadca9fcc7fca9e322a69b6687a80f67428c16d2a1b50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d4b1a3342bed05f7f792a76bc576864f2805bed3c6a4c438f4c3ce55277fb12f58add04654879d4b3a3cd38e8f025b714c758347be2827e1f3a4a25389d15e7
|
7
|
+
data.tar.gz: 033fe9bcd71bbe78fbbe0688be810c8b3af4bcb24e62feca8cebd31d7150ab02a9cb089524cf9a4de44c705f3204e37ff0fc51047343f23e4dcaf69e58a12350
|
data/lib/Helper.rb
CHANGED
@@ -102,14 +102,19 @@ class Helper
|
|
102
102
|
title = postInfo.title.gsub("[","")
|
103
103
|
title = title.gsub("]","")
|
104
104
|
|
105
|
+
tags = ""
|
106
|
+
if !postInfo.tags.nil? && postInfo.tags.length > 0
|
107
|
+
tags = "\"#{postInfo.tags.map { |tag| tag.gsub("\"", "\\\"") }.join("\",\"")}\""
|
108
|
+
end
|
109
|
+
|
105
110
|
result = "---\n"
|
106
|
-
result += "title: #{title}\n"
|
107
|
-
result += "author: #{postInfo.creator}\n"
|
111
|
+
result += "title: \"#{title.gsub("\"", "\\\"")}\"\n"
|
112
|
+
result += "author: \"#{postInfo.creator.gsub("\"", "\\\"")}\"\n"
|
108
113
|
result += "date: #{postInfo.firstPublishedAt.strftime('%Y-%m-%dT%H:%M:%S.%L%z')}\n"
|
109
114
|
result += "last_modified_at: #{postInfo.latestPublishedAt.strftime('%Y-%m-%dT%H:%M:%S.%L%z')}\n"
|
110
|
-
result += "categories: #{postInfo.collectionName}\n"
|
111
|
-
result += "tags: [#{
|
112
|
-
result += "description: #{postInfo.description}\n"
|
115
|
+
result += "categories: \"#{postInfo.collectionName.gsub("\"", "\\\"")}\"\n"
|
116
|
+
result += "tags: [#{tags}]\n"
|
117
|
+
result += "description: \"#{postInfo.description.gsub("\"", "\\\"")}\"\n"
|
113
118
|
if !postInfo.previewImage.nil?
|
114
119
|
result += "image:\r\n"
|
115
120
|
result += " path: #{postInfo.previewImage}\r\n"
|
@@ -196,9 +201,9 @@ class Helper
|
|
196
201
|
end
|
197
202
|
|
198
203
|
text = "\r\n\r\n\r\n"
|
199
|
-
text += "
|
204
|
+
text += "_[Post](#{postURL})#{jekyllOpen} converted from Medium by [ZMediumToMarkdown](https://github.com/ZhgChgLi/ZMediumToMarkdown)#{jekyllOpen}._"
|
200
205
|
text += "\r\n"
|
201
206
|
|
202
207
|
text
|
203
208
|
end
|
204
|
-
end
|
209
|
+
end
|
data/lib/Parsers/IframeParser.rb
CHANGED
@@ -71,7 +71,7 @@ class IframeParser < Parser
|
|
71
71
|
result = nil
|
72
72
|
if !srce.to_s[/^(https\:\/\/gist\.github\.com)/].nil?
|
73
73
|
# is gist
|
74
|
-
gist = Request.body(Request.URL(
|
74
|
+
gist = Request.body(Request.URL(srce)).scan(/(document\.write\('){1}(.*)(\)){1}/)[1][1]
|
75
75
|
gist.gsub! '\n', ''
|
76
76
|
gist.gsub! '\"', '"'
|
77
77
|
gist.gsub! '<\/', '</'
|
@@ -15,7 +15,7 @@ class MIXTAPEEMBEDParser < Parser
|
|
15
15
|
if paragraph.type == 'MIXTAPE_EMBED'
|
16
16
|
if !paragraph.mixtapeMetadata.nil? && !paragraph.mixtapeMetadata.href.nil?
|
17
17
|
ogImageURL = Helper.fetchOGImage(paragraph.mixtapeMetadata.href)
|
18
|
-
if !ogImageURL.nil?
|
18
|
+
if !ogImageURL.nil? && ogImageURL != ""
|
19
19
|
jekyllOpen = ""
|
20
20
|
if isForJekyll
|
21
21
|
jekyllOpen = "{:target=\"_blank\"}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ZMediumToMarkdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ZhgChgLi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|