* Wip * Wip * Wip: History * Wip: テストコード作成 * Fix test * Wip * Wip * Wip * Fix test * Wip * Wip * Wip * Wip * なんとか完成、これから動作確認 * spell miss * Change ng rule timings * Fix test * Wip * Fix test * Wip * Fix form * 表示まわりの改善
This commit is contained in:
parent
0779c748a6
commit
7d96d5828e
56 changed files with 2062 additions and 42 deletions
|
@ -8,6 +8,7 @@ class ProcessReferencesService < BaseService
|
|||
|
||||
DOMAIN = ENV['WEB_DOMAIN'] || ENV.fetch('LOCAL_DOMAIN', nil)
|
||||
REFURL_EXP = /(RT|QT|BT|RN|RE)((:|;)?\s+|:|;)(#{URI::DEFAULT_PARSER.make_regexp(%w(http https))})/
|
||||
QUOTEURL_EXP = /(QT|RN|RE)((:|;)?\s+|:|;)(#{URI::DEFAULT_PARSER.make_regexp(%w(http https))})/
|
||||
MAX_REFERENCES = 5
|
||||
|
||||
def call(status, reference_parameters, urls: nil, fetch_remote: true, no_fetch_urls: nil, quote_urls: nil)
|
||||
|
@ -45,8 +46,14 @@ class ProcessReferencesService < BaseService
|
|||
reference_parameters.any? || (urls || []).any? || (quote_urls || []).any? || FormattingHelper.extract_status_plain_text(status).scan(REFURL_EXP).pluck(3).uniq.any?
|
||||
end
|
||||
|
||||
def self.extract_uris(text)
|
||||
text.scan(REFURL_EXP).pluck(3)
|
||||
def self.extract_uris(text, remote: false)
|
||||
return text.scan(REFURL_EXP).pluck(3) unless remote
|
||||
|
||||
PlainTextFormatter.new(text, false).to_s.scan(REFURL_EXP).pluck(3)
|
||||
end
|
||||
|
||||
def self.extract_quote(text)
|
||||
text.scan(QUOTEURL_EXP).pick(3)
|
||||
end
|
||||
|
||||
def self.perform_worker_async(status, reference_parameters, urls, quote_urls)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue