commit
dc16329e32
162 changed files with 64 additions and 31 deletions
1
.author-information
Normal file
1
.author-information
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Lorin Werthen
|
13
Rules
13
Rules
|
@ -18,13 +18,13 @@ preprocess do
|
||||||
@items.delete_if do |item|
|
@items.delete_if do |item|
|
||||||
ident = item.identifier.to_s
|
ident = item.identifier.to_s
|
||||||
|
|
||||||
next unless ident.to_s.start_with?('/posts/')
|
next unless ident.to_s.start_with?('/blog/')
|
||||||
|
|
||||||
!ident.start_with?('/posts/16-17/')
|
!ident.start_with?('/blog/16-17/')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@items.find_all('/posts/**/*').each do |i|
|
@items.find_all('/blog/**/*').each do |i|
|
||||||
year_str = %r{/(\d\d)-\d\d/}.match(i.identifier).captures[0]
|
year_str = %r{/(\d\d)-\d\d/}.match(i.identifier).captures[0]
|
||||||
academic_year = year_str.to_i
|
academic_year = year_str.to_i
|
||||||
|
|
||||||
|
@ -105,15 +105,16 @@ end
|
||||||
#
|
#
|
||||||
# POSTS
|
# POSTS
|
||||||
#
|
#
|
||||||
compile '/posts/**/*' do
|
compile '/blog/*/*' do
|
||||||
|
layout '/blogpost.md'
|
||||||
filter :kramdown
|
filter :kramdown
|
||||||
|
|
||||||
layout '/blogpost.*'
|
layout '/blogpost.erb'
|
||||||
layout '/generic.*'
|
layout '/generic.*'
|
||||||
layout '/default.*'
|
layout '/default.*'
|
||||||
end
|
end
|
||||||
|
|
||||||
compile '/posts/**/*', rep: :text do
|
compile '/blog/*/*', rep: :text do
|
||||||
filter :kramdown
|
filter :kramdown
|
||||||
filter :strip_html
|
filter :strip_html
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,39 +11,36 @@ def bold_say(str)
|
||||||
end
|
end
|
||||||
|
|
||||||
def bold_ask(str, *args)
|
def bold_ask(str, *args)
|
||||||
ask "<%= color %(#{str}), :bold %>", *args
|
res = ask "<%= color %(#{str}), :bold %>", *args
|
||||||
|
puts
|
||||||
|
res
|
||||||
end
|
end
|
||||||
|
|
||||||
run do |_opts, _args, _cmd|
|
run do |_opts, _args, _cmd|
|
||||||
result_hash = {}
|
result_hash = {}
|
||||||
|
post_directory = 'content/posts'
|
||||||
|
author_file = '.author-information'
|
||||||
|
|
||||||
bold_say "Let's make a new post, shall we?"
|
bold_say "Let's make a new post, shall we?"
|
||||||
bold_say('-' * 20)
|
bold_say('-' * 20)
|
||||||
|
|
||||||
puts
|
last_entry = "#{post_directory}/#{Dir.entries('content/posts').last}"
|
||||||
|
|
||||||
bold_say 'What kind of post will it be?'
|
|
||||||
|
|
||||||
type = choose do |menu|
|
|
||||||
default = :event
|
|
||||||
|
|
||||||
menu.prompt = "(default #{default})"
|
|
||||||
menu.choice :blog
|
|
||||||
menu.choice :event
|
|
||||||
menu.default = default
|
|
||||||
end
|
|
||||||
|
|
||||||
puts
|
|
||||||
|
|
||||||
result_hash['title'] = bold_ask 'What will the title be?'
|
result_hash['title'] = bold_ask 'What will the title be?'
|
||||||
|
|
||||||
puts
|
result_hash['description'] = bold_ask 'Give a description of the event'
|
||||||
|
|
||||||
result_hash['time'] = bold_ask 'When will the event take place?', Date
|
result_hash['author'] = if File.exist? author_file
|
||||||
|
File.read(author_file).chomp
|
||||||
puts
|
else
|
||||||
|
bold_ask 'What is your name?'
|
||||||
result_hash['banner'] = bold_ask 'Supply a link to the banner of the event, please' if type == :event
|
end
|
||||||
|
|
||||||
puts result_hash.to_yaml
|
result_hash['created_at'] = Date.today
|
||||||
|
|
||||||
|
filename = result_hash['title'].downcase.tr(' ', '-').gsub(/[^0-9A-Za-z-]/, '')
|
||||||
|
|
||||||
|
File.open("#{last_entry}/#{filename}.md", 'w') do |file|
|
||||||
|
file.write(result_hash.to_yaml + '---')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#markdown-toc {
|
||||||
|
@extend .menu-list;
|
||||||
|
|
||||||
|
&, ul {
|
||||||
|
margin: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dl {
|
dl {
|
||||||
dt {
|
dt {
|
||||||
display: inline;
|
display: inline;
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
text-align: justify;
|
text-align: justify;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html, .footer {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
.hero {
|
.hero {
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
|
@ -145,3 +149,7 @@ footer.footer {
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fa {
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue