From 4b06c405758a30dd7373a489509312ffe62525f4 Mon Sep 17 00:00:00 2001 From: Francis Date: Tue, 4 May 2021 16:22:20 +0200 Subject: [PATCH] capitalize all required parts --- lib/helpers/archives.rb | 3 ++- lib/helpers/events.rb | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/helpers/archives.rb b/lib/helpers/archives.rb index 5fe64ad..74db314 100644 --- a/lib/helpers/archives.rb +++ b/lib/helpers/archives.rb @@ -18,6 +18,7 @@ module ArchiveHelper Set.new(items .find_all('/blog/*/*') .flat_map { |i| i[:tags] || [] }) + .map{ |y| y.split.map(&:capitalize).join(' ') } .to_a .sort .uniq.map { |y| [y, items["/blog/#{y.gsub(' ', '_')}.html"]]} @@ -35,7 +36,7 @@ module ArchiveHelper def posts_with_tag(tag) items .find_all('/blog/*/*') - .filter{|i| (i[:tags] || []).include? tag } + .filter{|i| (i[:tags] || []).map{ |t| t.split.map(&:capitalize).join(' ') }.include? tag } end def posts_in_year_or_with_tag(item) diff --git a/lib/helpers/events.rb b/lib/helpers/events.rb index 14aadf4..08330dc 100644 --- a/lib/helpers/events.rb +++ b/lib/helpers/events.rb @@ -17,6 +17,7 @@ module EventsHelper Set.new(items .find_all('/events/*/*') .flat_map { |i| i[:tags] || [] }) + .map{ |y| y.split.map(&:capitalize).join(' ') } .to_a .sort .uniq.map { |y| [y, items["/events/#{y.gsub(' ', '_')}.html"]]} @@ -24,7 +25,10 @@ module EventsHelper def all_events_by_tag(tag = nil, soon = nil) @items.find_all('/events/*/*.md') - .filter{|i| (i[:tags] || []).include? tag } + .filter { |i| + (i[:tags] || []) + .map{ |t| t.split.map(&:capitalize).join(' ') } + .include? tag } .select { |x| x[:soon] == soon } .sort_by { |x| x[:time] } end