Module: Jekyll::Filters
- Defined in:
- lib/jekyll/filters.rb
Instance Method Summary collapse
- #array_to_sentence_string(array) ⇒ Object
- #cgi_escape(input) ⇒ Object
- #date_to_long_string(date) ⇒ Object
- #date_to_string(date) ⇒ Object
- #date_to_utc(date) ⇒ Object
- #date_to_xmlschema(date) ⇒ Object
- #number_of_words(input) ⇒ Object
- #textilize(input) ⇒ Object
- #xml_escape(input) ⇒ Object
Instance Method Details
#array_to_sentence_string(array) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/jekyll/filters.rb', line 36 def array_to_sentence_string(array) connector = "and" case array.length when 0 "" when 1 array[0].to_s when 2 "#{array[0]} #{connector} #{array[1]}" else "#{array[0...-1].join(', ')}, #{connector} #{array[-1]}" end end |
#cgi_escape(input) ⇒ Object
28 29 30 |
# File 'lib/jekyll/filters.rb', line 28 def cgi_escape(input) CGI::escape(input) end |
#date_to_long_string(date) ⇒ Object
12 13 14 |
# File 'lib/jekyll/filters.rb', line 12 def date_to_long_string(date) date.strftime("%d %B %Y") end |
#date_to_string(date) ⇒ Object
8 9 10 |
# File 'lib/jekyll/filters.rb', line 8 def date_to_string(date) date.strftime("%d %b %Y") end |
#date_to_utc(date) ⇒ Object
20 21 22 |
# File 'lib/jekyll/filters.rb', line 20 def date_to_utc(date) date.utc end |
#date_to_xmlschema(date) ⇒ Object
16 17 18 |
# File 'lib/jekyll/filters.rb', line 16 def date_to_xmlschema(date) date.xmlschema end |
#number_of_words(input) ⇒ Object
32 33 34 |
# File 'lib/jekyll/filters.rb', line 32 def number_of_words(input) input.split.length end |
#textilize(input) ⇒ Object
4 5 6 |
# File 'lib/jekyll/filters.rb', line 4 def textilize(input) RedCloth.new(input).to_html end |
#xml_escape(input) ⇒ Object
24 25 26 |
# File 'lib/jekyll/filters.rb', line 24 def xml_escape(input) CGI.escapeHTML(input) end |