ZMediumToMarkdown 2.1.2 → 2.1.3
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 +7 -7
- data/lib/ZMediumFetcher.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: ef2cfaaf84fa78546e7a2206881c0e2939d069c5deb2495164ca1c302386f89e
|
4
|
+
data.tar.gz: 815b6ecfa9c52741e17493904697757baeaa5107b276fce63e6641da59381b11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fc077211ea5c2adf6bdec8a1ad685706b2d9ba0a94760d9ad65c6ef4b39a3e8d68a2a5aca441c9ff986006bf91a15e51eb583690268014809014fcd01ee7c88
|
7
|
+
data.tar.gz: d86bb626242e376406b37704efa2204337226ab712786966dba7dfbf5b1c6d6be9017f1dfe4d7bae514f9a69a87bbd8d23a88cad1f05723adbc7b7f41da929fe
|
data/lib/Helper.rb
CHANGED
@@ -99,22 +99,22 @@ class Helper
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def self.createPostInfo(postInfo, isForJekyll)
|
102
|
-
title = postInfo.title
|
103
|
-
title = title
|
102
|
+
title = postInfo.title&.gsub("[","")
|
103
|
+
title = title&.gsub("]","")
|
104
104
|
|
105
105
|
tags = ""
|
106
106
|
if !postInfo.tags.nil? && postInfo.tags.length > 0
|
107
|
-
tags = "\"#{postInfo.tags.map { |tag| tag
|
107
|
+
tags = "\"#{postInfo.tags.map { |tag| tag&.gsub("\"", "\\\"") }.join("\",\"")}\""
|
108
108
|
end
|
109
109
|
|
110
110
|
result = "---\n"
|
111
|
-
result += "title: \"#{title
|
112
|
-
result += "author: \"#{postInfo.creator
|
111
|
+
result += "title: \"#{title&.gsub("\"", "\\\"")}\"\n"
|
112
|
+
result += "author: \"#{postInfo.creator&.gsub("\"", "\\\"")}\"\n"
|
113
113
|
result += "date: #{postInfo.firstPublishedAt.strftime('%Y-%m-%dT%H:%M:%S.%L%z')}\n"
|
114
114
|
result += "last_modified_at: #{postInfo.latestPublishedAt.strftime('%Y-%m-%dT%H:%M:%S.%L%z')}\n"
|
115
|
-
result += "categories: \"#{postInfo.collectionName
|
115
|
+
result += "categories: \"#{postInfo.collectionName&.gsub("\"", "\\\"")}\"\n"
|
116
116
|
result += "tags: [#{tags}]\n"
|
117
|
-
result += "description: \"#{postInfo.description
|
117
|
+
result += "description: \"#{postInfo.description&.gsub("\"", "\\\"")}\"\n"
|
118
118
|
if !postInfo.previewImage.nil?
|
119
119
|
result += "image:\r\n"
|
120
120
|
result += " path: #{postInfo.previewImage}\r\n"
|
data/lib/ZMediumFetcher.rb
CHANGED
@@ -238,7 +238,7 @@ class ZMediumFetcher
|
|
238
238
|
|
239
239
|
if File.file?(absolutePath)
|
240
240
|
lines = File.foreach(absolutePath).first(15)
|
241
|
-
if lines.first
|
241
|
+
if lines.first&.start_with?("---")
|
242
242
|
dateLine = lines.select { |line| line.start_with?("last_modified_at:") }.first
|
243
243
|
if !dateLine.nil?
|
244
244
|
fileLatestPublishedAt = Time.parse(dateLine[/^(last_modified_at:)\s+(\S*)/, 2]).to_i
|