ZMediumToMarkdown 2.3.0 → 2.3.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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/Helper.rb +1 -0
  3. data/lib/ZMediumFetcher.rb +10 -5
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 750cb8d03b98519ab3a658de2fff70c102a10d49596f55b0b73b23341f49491d
4
- data.tar.gz: 35efb4e7a54bc21e3d389db3b149fb3f1e251966eed026aa930aff1b3438b1a8
3
+ metadata.gz: fd59f057d165b348b9a34b25c759c6b4d5d781c99fc9fd2533d75e34a458e111
4
+ data.tar.gz: 4affdd30a717a8bde0a8f0815072942c301a6a58bbc0ae09a32882ca84476bdf
5
5
  SHA512:
6
- metadata.gz: bef08bee173b5b344309d6520908240414b49a0a5e63f01ded1d73ad5ddf532cf5e2d2c78454f6a28d4ef0972bfa451a56e3c957ce640efb298178861c17c3d2
7
- data.tar.gz: 26c20d2e0253deb50486a3df54780574f3278895134e589e20809e01a3aaf8dc702f3b17ba0d9e36973e003933f4b1b2cf5a74c372a1d3e486076a9dbc4673b1
6
+ metadata.gz: ab8b9057e4bf01c40684451aad35019566a2e7bce663791c04fd4d696f80c5d474cb88caab489147704264db33babafd1511be88222c942fbdbdf558e91fb211
7
+ data.tar.gz: e694b475c6a2c3eab24cecb387c144a88910e6c324ef8967af9c6e4e79a78bc6ef84e05b9f8824d4a6bdff6514ff267283f0b9743ee6429097d8ae3cd6fff6cd
data/lib/Helper.rb CHANGED
@@ -117,6 +117,7 @@ class Helper
117
117
  end
118
118
  if !postInfo.pinnedByCreatorAt.nil? && pinnedByCreatorAt > 0
119
119
  result += "pin: true\r\n"
120
+ result += "pinned_at: #{postInfo.pinnedByCreatorAt.strftime('%Y-%m-%dT%H:%M:%S.%L%z')}\n"
120
121
  end
121
122
 
122
123
  if isForJekyll
@@ -235,18 +235,23 @@ class ZMediumFetcher
235
235
  absolutePath = URI.decode(postPathPolicy.getAbsolutePath("#{postWithDatePath}")) + ".md"
236
236
 
237
237
  fileLatestPublishedAt = nil
238
-
238
+ filePinnedByCreatorAt = 0
239
239
  if File.file?(absolutePath)
240
240
  lines = File.foreach(absolutePath).first(15)
241
241
  if lines.first&.start_with?("---")
242
- dateLine = lines.select { |line| line.start_with?("last_modified_at:") }.first
243
- if !dateLine.nil?
244
- fileLatestPublishedAt = Time.parse(dateLine[/^(last_modified_at:)\s+(\S*)/, 2]).to_i
242
+ latestPublishedAtLine = lines.select { |line| line.start_with?("last_modified_at:") }.first
243
+ if !latestPublishedAtLine.nil?
244
+ fileLatestPublishedAt = Time.parse(latestPublishedAtLine[/^(last_modified_at:)\s+(\S*)/, 2]).to_i
245
+ end
246
+
247
+ pinnedByCreatorAtLine = lines.select { |line| line.start_with?("pinned_at:") }.first
248
+ if !pinnedByCreatorAtLine.nil?
249
+ filePinnedByCreatorAt = Time.parse(pinnedByCreatorAtLine[/^(pinned_at:)\s+(\S*)/, 2]).to_i
245
250
  end
246
251
  end
247
252
  end
248
253
 
249
- if !fileLatestPublishedAt.nil? && fileLatestPublishedAt >= postInfo.latestPublishedAt.to_i
254
+ if (!fileLatestPublishedAt.nil? && fileLatestPublishedAt >= postInfo.latestPublishedAt.to_i) && filePinnedByCreatorAt == postInfo.pinnedByCreatorAt.to_i
250
255
  # Already downloaded and nothing has changed!, Skip!
251
256
  progress.currentPostParagraphIndex = paragraphs.length
252
257
  progress.message = "Skip, Post already downloaded and nothing has changed!"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ZMediumToMarkdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ZhgChgLi