Skip to content

Commit

Permalink
Sanitize filename work with numbered file Fix #6
Browse files Browse the repository at this point in the history
  • Loading branch information
jbleuzen committed Oct 8, 2015
1 parent 25a6a2d commit ab49463
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions data_page_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ def initialize(site, base, dir, data, name, template)

# strip characters and whitespace to create valid filenames, also lowercase
def sanitize_filename(name)
if(name.is_a? Integer)
return name.to_s
end
return name.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
end
end
Expand Down

0 comments on commit ab49463

Please sign in to comment.