0
0
Fork 0

Autofix Rubocop Regex Style rules (#23690)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Nick Schonning 2023-06-06 08:50:51 -04:00 committed by GitHub
parent 9a653899e9
commit c66250abf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 46 additions and 92 deletions

View file

@ -7,15 +7,15 @@ class LinkDetailsExtractor
# Some publications wrap their JSON-LD data in their <script> tags
# in commented-out CDATA blocks, they need to be removed before
# attempting to parse JSON
CDATA_JUNK_PATTERN = %r{^[\s]*(
(/\*[\s]*<!\[CDATA\[[\s]*\*/) # Block comment style opening
CDATA_JUNK_PATTERN = %r{^\s*(
(/\*\s*<!\[CDATA\[\s*\*/) # Block comment style opening
|
(//[\s]*<!\[CDATA\[) # Single-line comment style opening
(//\s*<!\[CDATA\[) # Single-line comment style opening
|
(/\*[\s]*\]\]>[\s]*\*/) # Block comment style closing
(/\*\s*\]\]>\s*\*/) # Block comment style closing
|
(//[\s]*\]\]>) # Single-line comment style closing
)[\s]*$}x
(//\s*\]\]>) # Single-line comment style closing
)\s*$}x
class StructuredData
SUPPORTED_TYPES = %w(
@ -204,7 +204,7 @@ class LinkDetailsExtractor
def host_to_url(str)
return if str.blank?
str.start_with?(/https?:\/\//) ? str : "http://#{str}"
str.start_with?(%r{https?://}) ? str : "http://#{str}"
end
def valid_url_or_nil(str, same_origin_only: false)