motyl

Opinionated blog-aware static site generator written in Ruby
Log | Files | Refs | README | LICENSE

commit 25b7e2e5f026b630c96349b4d7a107d5a2be3d4c
parent 0319a1148a8844f770864fc0233a81a917bac7cd
Author: Frederic Cambus <fred@statdns.com>
Date:   Tue, 13 Mar 2018 11:57:56 +0100

Sort arrays in place

Diffstat:
Msrc/motyl.rb | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/motyl.rb b/src/motyl.rb @@ -89,7 +89,7 @@ Dir.mkdir("public") unless Dir.exist?("public") render("posts", templates, data) # Sort post archives -data["site"]["posts"] = data["site"]["posts"].sort { |a,b| b["date"] <=> a["date"] } +data["site"]["posts"].sort! { |a,b| b["date"] <=> a["date"] } # Renger pages render("pages", templates, data) @@ -107,7 +107,7 @@ Dir.mkdir("public/categories") unless Dir.exist?("public/categories") data["site"]["categories"].keys.each do |category| categoryURL = data["site"]["categoryMap"][category] + "/" - data["site"]["categories"][category] = data["site"]["categories"][category].sort { |a,b| b["date"] <=> a["date"] } + data["site"]["categories"][category].sort! { |a,b| b["date"] <=> a["date"] } data["page"]["title"] = category data["page"]["url"] = "categories/" + categoryURL data["site"]["posts"] = data["site"]["categories"][category]