From a817cfc17999f86be8e36eb7e87a0cdf0dc0cfd5 Mon Sep 17 00:00:00 2001 From: zhgchgli Date: Thu, 10 Aug 2023 22:41:39 +0800 Subject: [PATCH] update pinned rule --- ZMediumToMarkdown.gemspec | 2 +- lib/ZMediumFetcher.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ZMediumToMarkdown.gemspec b/ZMediumToMarkdown.gemspec index 6d586d5..9d5c531 100644 --- a/ZMediumToMarkdown.gemspec +++ b/ZMediumToMarkdown.gemspec @@ -6,7 +6,7 @@ Gem::Specification.new do |gem| gem.files = Dir['lib/**/*.*'] gem.executables = ['ZMediumToMarkdown'] gem.name = 'ZMediumToMarkdown' - gem.version = '2.3.1' + gem.version = '2.3.2' gem.license = "MIT" diff --git a/lib/ZMediumFetcher.rb b/lib/ZMediumFetcher.rb index 31c8661..338fd71 100644 --- a/lib/ZMediumFetcher.rb +++ b/lib/ZMediumFetcher.rb @@ -235,7 +235,7 @@ def downloadPost(postURL, pathPolicy) absolutePath = URI.decode(postPathPolicy.getAbsolutePath("#{postWithDatePath}")) + ".md" fileLatestPublishedAt = nil - filePinnedByCreatorAt = nil + filePinnedByCreatorAt = 0 if File.file?(absolutePath) lines = File.foreach(absolutePath).first(15) if lines.first&.start_with?("---") @@ -245,7 +245,7 @@ def downloadPost(postURL, pathPolicy) end pinnedByCreatorAtLine = lines.select { |line| line.start_with?("pinned_at:") }.first - if !dateLine.nil? + if !pinnedByCreatorAtLine.nil? filePinnedByCreatorAt = Time.parse(pinnedByCreatorAtLine[/^(pinned_at:)\s+(\S*)/, 2]).to_i end end