Skip to content

Commit

Permalink
Collapse gsub
Browse files Browse the repository at this point in the history
  • Loading branch information
pathawks committed Oct 18, 2016
1 parent 53d20bc commit c4a23b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/jekyll/frontmatter_defaults.rb
Expand Up @@ -188,7 +188,7 @@ def sanitize_path(path)
if path.nil? || path.empty?
""
else
path.gsub(%r!\A/!, "").gsub(%r!([^/])\z!, '\1')
path.gsub(%r!\A/|(?<=[^/])\z!, "".freeze)
end
end
end
Expand Down
3 changes: 1 addition & 2 deletions lib/jekyll/readers/data_reader.rb
Expand Up @@ -62,8 +62,7 @@ def read_data_file(path)
end

def sanitize_filename(name)
name.gsub!(%r![^\w\s-]+!, "")
name.gsub!(%r!(^|\b\s)\s+($|\s?\b)!, '\\1\\2')
name.gsub!(%r![^\w\s-]+|(?<=^|\b\s)\s+(?=$|\s?\b)!, "".freeze)
name.gsub(%r!\s+!, "_")
end
end
Expand Down

0 comments on commit c4a23b4

Please sign in to comment.