Autofix Rubocop Regex Style rules (#23690)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
9a653899e9
commit
c66250abf1
22 changed files with 46 additions and 92 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue