Merge pull request #4917 from pathawks/pr/normalize_whitespace

Merge pull request 4917
This commit is contained in:
jekyllbot
2016-06-14 14:03:05 -07:00
committed by GitHub
3 changed files with 44 additions and 0 deletions

View File

@@ -150,6 +150,15 @@ module Jekyll
URI.escape(input)
end
# Replace any whitespace in the input string with a single space
#
# input - The String on which to operate.
#
# Returns the formatted String
def normalize_whitespace(input)
input.to_s.gsub(/\s+/, " ").strip
end
# Count the number of words in the input string.
#
# input - The String on which to operate.