Skip to content

Commit

Permalink
update pinned rule
Browse files Browse the repository at this point in the history
  • Loading branch information
zhgchgli0718 committed Aug 10, 2023
1 parent d003b27 commit a817cfc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ZMediumToMarkdown.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions lib/ZMediumFetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?("---")
Expand All @@ -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
Expand Down

0 comments on commit a817cfc

Please sign in to comment.