Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for outdated Jekyll versions #111

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jekyll-webmention_io.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ EOF
s.files = `git ls-files app lib`.split("\n")
s.require_paths = ["lib"]

s.add_runtime_dependency "jekyll", ">= 2.0", "< 4.0"
s.add_runtime_dependency "jekyll", ">= 3.2.0", "< 4.0"
s.add_runtime_dependency "json", "~> 2.0"
s.add_runtime_dependency "http", "~> 2.0"
s.add_runtime_dependency "openssl", "~> 2.0"
Expand Down
3 changes: 3 additions & 0 deletions lib/jekyll/commands/webmention.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ def self.process(_args = [], _options = {})
outgoing.each do |source, targets|
targets.each do |target, response|
next unless response == false

if target.index("//").zero?
target = "http:#{target}"
end
endpoint = WebmentionIO.get_webmention_endpoint(target)
next unless endpoint

response = WebmentionIO.webmention(source, target, endpoint)
next unless response

begin
response = JSON.parse response
rescue JSON::ParserError
Expand Down
13 changes: 5 additions & 8 deletions lib/jekyll/webmention_io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ def self.cache_webmentions(which, webmentions)
end

def self.gather_documents(site)
documents = if Jekyll::VERSION >= "3.0.0"
site.posts.docs.clone
else
site.posts.clone
end
documents = site.posts.docs.clone

if @config.dig("pages") == true
log "info", "Including site pages."
Expand Down Expand Up @@ -140,7 +136,7 @@ def self.get_response(api_params)
end
end

def self.read_lookup_dates()
def self.read_lookup_dates
cache_file = get_cache_file_path "lookups"
load_yaml(cache_file)
end
Expand Down Expand Up @@ -181,7 +177,7 @@ def self.get_timeframe_from_date(time)
break
end
end
timeframe = "older" unless timeframe
timeframe ||= "older"
return timeframe
end

Expand Down Expand Up @@ -214,7 +210,7 @@ def self.get_webmention_endpoint(uri)
begin
endpoint = Webmention::Client.supports_webmention?(uri)
log("info", "Could not find a webmention endpoint at #{uri}") unless endpoint
rescue => e
rescue StandardError => e
log "info", "Endpoint lookup failed for #{uri}: #{e.message}"
endpoint = false
end
Expand Down Expand Up @@ -347,6 +343,7 @@ def self.get_http_response(uri)
def self.uri_is_not_ok(uri)
# Never cache webmention.io in here
return if uri.host == "webmention.io"

cache_file = @cache_files["bad_uris"]
bad_uris = load_yaml(cache_file)
bad_uris[uri.host] = Time.now.to_s
Expand Down
8 changes: 1 addition & 7 deletions lib/jekyll/webmention_io/webmention.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@ def gather_content
end

def markdownify(string)
unless @converter
@converter = if defined? @site.find_converter_instance
@site.find_converter_instance(Jekyll::Converters::Markdown)
else
@site.getConverterImpl(Jekyll::Converters::Markdown)
end
end
@converter ||= @site.find_converter_instance(Jekyll::Converters::Markdown)

if string
string = @converter.convert(string.to_s)
Expand Down