mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 17:04:59 +08:00
DEV: Apply syntax_tree formatting to lib/*
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../mixins/git_blob_onebox'
|
||||
require_relative "../mixins/git_blob_onebox"
|
||||
|
||||
module Onebox
|
||||
module Engine
|
||||
class GithubBlobOnebox
|
||||
def self.git_regexp
|
||||
/^https?:\/\/(www\.)?github\.com.*\/blob\//
|
||||
%r{^https?://(www\.)?github\.com.*/blob/}
|
||||
end
|
||||
|
||||
def self.onebox_name
|
||||
@ -16,7 +16,7 @@ module Onebox
|
||||
include Onebox::Mixins::GitBlobOnebox
|
||||
|
||||
def raw_regexp
|
||||
/github\.com\/(?<user>[^\/]+)\/(?<repo>[^\/]+)\/blob\/(?<sha1>[^\/]+)\/(?<file>[^#]+)(#(L(?<from>[^-]*)(-L(?<to>.*))?))?/mi
|
||||
%r{github\.com/(?<user>[^/]+)/(?<repo>[^/]+)/blob/(?<sha1>[^/]+)/(?<file>[^#]+)(#(L(?<from>[^-]*)(-L(?<to>.*))?))?}mi
|
||||
end
|
||||
|
||||
def raw_template(m)
|
||||
@ -24,7 +24,7 @@ module Onebox
|
||||
end
|
||||
|
||||
def title
|
||||
Sanitize.fragment(Onebox::Helpers.uri_unencode(link).sub(/^https?\:\/\/github\.com\//, ''))
|
||||
Sanitize.fragment(Onebox::Helpers.uri_unencode(link).sub(%r{^https?\://github\.com/}, ""))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user