ZMediumToMarkdown 1.9.6 → 1.9.7
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 +2 -0
- data/lib/Parsers/CodeBlockParser.rb +1 -7
- data/lib/Parsers/IframeParser.rb +1 -7
- data/lib/Parsers/PREParser.rb +1 -6
- data/lib/Post.rb +2 -1
- data/lib/ZMediumFetcher.rb +3 -3
- 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: 521c7a377c1e9b93996dc31355a8e7d6afb90708d154f69e31f4f20675bed060
|
|
4
|
+
data.tar.gz: 396d663eaf2f302168dde595842f092bd0051094baf2cbf4974018c0b2aaf270
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 57d8f51c5fe1fa5d193e0cdd1e7d11152a5010520867e54966681d064d0f30a7d81b57fb389c765ed8c522f896b4fad4e5ddb3bff9d58f6ae4687172cc381cfd
|
|
7
|
+
data.tar.gz: 9c5dfe1ff916f9f9d6c288c3537fd9b542a664959f34101f573f66dd0ce2655611b930fb78396a7392c1998b8ae2c52bee9276e1250c40861ad7a97f2dce0809
|
data/lib/Helper.rb
CHANGED
|
@@ -109,6 +109,8 @@ class Helper
|
|
|
109
109
|
result += "date: #{postInfo.firstPublishedAt.strftime('%Y-%m-%dT%H:%M:%S.%LZ')}\n"
|
|
110
110
|
result += "categories: #{postInfo.collectionName}\n"
|
|
111
111
|
result += "tags: [#{postInfo.tags.join(",")}]\n"
|
|
112
|
+
result += "description: #{postInfo.description}\n"
|
|
113
|
+
result += "render_with_liquid: false\n"
|
|
112
114
|
result += "---\n"
|
|
113
115
|
result += "\r\n"
|
|
114
116
|
|
|
@@ -25,15 +25,9 @@ class CodeBlockParser < Parser
|
|
|
25
25
|
def parse(paragraph)
|
|
26
26
|
if CodeBlockParser.isCodeBlock(paragraph)
|
|
27
27
|
result = "```\n"
|
|
28
|
-
if isForJekyll
|
|
29
|
-
result += "{% raw %}\n"
|
|
30
|
-
end
|
|
31
28
|
|
|
32
|
-
result += paragraph.text
|
|
29
|
+
result += paragraph.text.chomp
|
|
33
30
|
|
|
34
|
-
if isForJekyll
|
|
35
|
-
result += "\n{% endraw %}"
|
|
36
|
-
end
|
|
37
31
|
result += "\n```"
|
|
38
32
|
else
|
|
39
33
|
if !nextParser.nil?
|
data/lib/Parsers/IframeParser.rb
CHANGED
|
@@ -76,15 +76,9 @@ class IframeParser < Parser
|
|
|
76
76
|
gistRAW = Request.body(Request.URL(a['href']))
|
|
77
77
|
|
|
78
78
|
result = "```#{lang}\n"
|
|
79
|
-
if isForJekyll
|
|
80
|
-
result += "{% raw %}\n"
|
|
81
|
-
end
|
|
82
79
|
|
|
83
|
-
result += gistRAW
|
|
80
|
+
result += gistRAW.chomp
|
|
84
81
|
|
|
85
|
-
if isForJekyll
|
|
86
|
-
result += "\n{% endraw %}"
|
|
87
|
-
end
|
|
88
82
|
result += "\n```"
|
|
89
83
|
end
|
|
90
84
|
end
|
data/lib/Parsers/PREParser.rb
CHANGED
|
@@ -21,17 +21,12 @@ class PREParser < Parser
|
|
|
21
21
|
def parse(paragraph)
|
|
22
22
|
if PREParser.isPRE(paragraph)
|
|
23
23
|
result = "```\n"
|
|
24
|
-
if isForJekyll
|
|
25
|
-
result += "{% raw %}\n"
|
|
26
|
-
end
|
|
27
24
|
|
|
28
25
|
paragraph.text.each_line do |p|
|
|
29
26
|
result += p
|
|
30
27
|
end
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
result += "\n{% endraw %}"
|
|
34
|
-
end
|
|
29
|
+
result = result.chomp
|
|
35
30
|
result += "\n```"
|
|
36
31
|
|
|
37
32
|
result
|
data/lib/Post.rb
CHANGED
|
@@ -9,7 +9,7 @@ require 'date'
|
|
|
9
9
|
class Post
|
|
10
10
|
|
|
11
11
|
class PostInfo
|
|
12
|
-
attr_accessor :title, :tags, :creator, :firstPublishedAt, :latestPublishedAt, :collectionName
|
|
12
|
+
attr_accessor :title, :tags, :creator, :firstPublishedAt, :latestPublishedAt, :collectionName, :description
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def self.getPostIDFromPostURLString(postURLString)
|
|
@@ -60,6 +60,7 @@ class Post
|
|
|
60
60
|
|
|
61
61
|
def self.parsePostInfoFromPostContent(content, postID)
|
|
62
62
|
postInfo = PostInfo.new()
|
|
63
|
+
postInfo.description = content&.dig("Post:#{postID}", "previewContent", "subtitle")
|
|
63
64
|
postInfo.title = content&.dig("Post:#{postID}", "title")
|
|
64
65
|
postInfo.tags = content&.dig("Post:#{postID}", "tags").map{ |tag| tag["__ref"].gsub! 'Tag:', '' }
|
|
65
66
|
|
data/lib/ZMediumFetcher.rb
CHANGED
|
@@ -50,9 +50,9 @@ class ZMediumFetcher
|
|
|
50
50
|
info += "-"
|
|
51
51
|
end
|
|
52
52
|
if !currentPostParagraphIndex.nil? && !totalPostParagraphsLength.nil?
|
|
53
|
-
info += "[#{postPath[0..
|
|
53
|
+
info += "[#{postPath[0..15]}...(#{currentPostParagraphIndex}/#{totalPostParagraphsLength})]"
|
|
54
54
|
else
|
|
55
|
-
info += "[#{postPath[0..
|
|
55
|
+
info += "[#{postPath[0..15]}...]"
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -230,7 +230,7 @@ class ZMediumFetcher
|
|
|
230
230
|
absolutePath = postPathPolicy.getAbsolutePath("#{postWithDatePath}.md")
|
|
231
231
|
|
|
232
232
|
# if markdown file is exists and last modification time is >= latestPublishedAt(last update post time on medium)
|
|
233
|
-
if File.file?(absolutePath) && File.mtime(absolutePath) >= postInfo.latestPublishedAt
|
|
233
|
+
if File.file?(absolutePath) && File.mtime(absolutePath).to_time.to_i >= postInfo.latestPublishedAt.to_i
|
|
234
234
|
# Already downloaded and nothing has changed!, Skip!
|
|
235
235
|
progress.currentPostParagraphIndex = paragraphs.length
|
|
236
236
|
progress.message = "Skip, Post already downloaded and nothing has changed!"
|
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: 1.9.
|
|
4
|
+
version: 1.9.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ZhgChgLi
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-07-
|
|
11
|
+
date: 2022-07-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|