Merge pull request #462 from ZeusWPI/tags-fixed-case

Capitalize tags
This commit is contained in:
FKD13 2021-05-05 13:00:34 +02:00 committed by GitHub
commit 1b717638c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

2
Rules
View file

@ -25,6 +25,8 @@ preprocess do
ignore_old_content('blog', 'events', 'about/verslagen') if development?
update_blog_attributes
convert_tags('Blog')
convert_tags('Events')
create_yearly_items('Blog')
create_yearly_items('Events')
create_tagly_items('Blog')

View file

@ -120,6 +120,16 @@ module PreprocessHelper
end
end
def convert_tags(type)
type = type.to_s
@items.find_all("/#{type.downcase}/*/*").each do |item|
if item.key?(:tags)
item[:tags] = item[:tags]
.map{ |tag| tag.split.map(&:capitalize).join(' ') }
end
end
end
def add_report_metadata
@items.find_all('/about/verslagen/*/*').each do |report|
report[:academic_year] = report.identifier.to_s.split('/')[-2]