Merge pull request #1702 from ndbroadbent/fix_code
Tidy up some code in category_generator.rb
This commit is contained in:
commit
c811040d45
@ -153,16 +153,7 @@ ERR
|
||||
# Returns string
|
||||
#
|
||||
def category_links(categories)
|
||||
categories = categories.sort!.map { |c| category_link c }
|
||||
|
||||
case categories.length
|
||||
when 0
|
||||
""
|
||||
when 1
|
||||
categories[0].to_s
|
||||
else
|
||||
"#{categories[0...-1].join(', ')}, #{categories[-1]}"
|
||||
end
|
||||
categories.sort.map { |c| category_link c }.join(', ')
|
||||
end
|
||||
|
||||
# Outputs a single category as an <a> link.
|
||||
@ -183,8 +174,8 @@ ERR
|
||||
# Returns string
|
||||
def date_to_html_string(date)
|
||||
result = '<span class="month">' + date.strftime('%b').upcase + '</span> '
|
||||
result += date.strftime('<span class="day">%d</span> ')
|
||||
result += date.strftime('<span class="year">%Y</span> ')
|
||||
result << date.strftime('<span class="day">%d</span> ')
|
||||
result << date.strftime('<span class="year">%Y</span> ')
|
||||
result
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user