Merge branch 'docs' of https://github.com/icco/jekyll into icco-docs

This commit is contained in:
Tom Preston-Werner 2013-01-03 22:06:50 -08:00
commit 9328a1a0dd
2 changed files with 17 additions and 3 deletions

View File

@ -57,6 +57,17 @@ module Jekyll
date.xmlschema date.xmlschema
end end
# XML escape a string for use. Replaces any special characters with
# appropriate HTML entity replacements.
#
# input - The String to escape.
#
# Examples
#
# xml_escape('foo "bar" <baz>')
# # => "foo &quot;bar&quot; &lt;baz&gt;"
#
# Returns the escaped String.
def xml_escape(input) def xml_escape(input)
CGI.escapeHTML(input) CGI.escapeHTML(input)
end end

View File

@ -44,8 +44,8 @@ module Jekyll
raise FatalException.new("#{msg} in #{@base}/#{name}") raise FatalException.new("#{msg} in #{@base}/#{name}")
end end
#If we've added a date and time to the yaml, use that instead of the filename date # If we've added a date and time to the yaml, use that instead of the
#Means we'll sort correctly. # filename date Means we'll sort correctly.
if self.data.has_key?('date') if self.data.has_key?('date')
# ensure Time via to_s and reparse # ensure Time via to_s and reparse
self.date = Time.parse(self.data["date"].to_s) self.date = Time.parse(self.data["date"].to_s)
@ -64,7 +64,10 @@ module Jekyll
end end
end end
# Spaceship is based on Post#date, slug # Compares Post objects. First compares the Post date. If the dates are
# equal, it compares the Post slugs.
#
# +other+ is the object we are comparing to.
# #
# Returns -1, 0, 1 # Returns -1, 0, 1
def <=>(other) def <=>(other)