Merge pull request #109 from ZeusWPI/browser-post

blog improvements
This commit is contained in:
lorin 2016-10-31 13:51:45 +01:00 committed by GitHub
commit dc16329e32
162 changed files with 64 additions and 31 deletions

1
.author-information Normal file
View file

@ -0,0 +1 @@
Lorin Werthen

13
Rules
View file

@ -18,13 +18,13 @@ preprocess do
@items.delete_if do |item|
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
@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]
academic_year = year_str.to_i
@ -105,15 +105,16 @@ end
#
# POSTS
#
compile '/posts/**/*' do
compile '/blog/*/*' do
layout '/blogpost.md'
filter :kramdown
layout '/blogpost.*'
layout '/blogpost.erb'
layout '/generic.*'
layout '/default.*'
end
compile '/posts/**/*', rep: :text do
compile '/blog/*/*', rep: :text do
filter :kramdown
filter :strip_html
end

View file

@ -11,39 +11,36 @@ def bold_say(str)
end
def bold_ask(str, *args)
ask "<%= color %(#{str}), :bold %>", *args
res = ask "<%= color %(#{str}), :bold %>", *args
puts
res
end
run do |_opts, _args, _cmd|
result_hash = {}
post_directory = 'content/posts'
author_file = '.author-information'
bold_say "Let's make a new post, shall we?"
bold_say('-' * 20)
puts
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
last_entry = "#{post_directory}/#{Dir.entries('content/posts').last}"
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
else
bold_ask 'What is your name?'
end
puts
result_hash['created_at'] = Date.today
result_hash['banner'] = bold_ask 'Supply a link to the banner of the event, please' if type == :event
filename = result_hash['title'].downcase.tr(' ', '-').gsub(/[^0-9A-Za-z-]/, '')
puts result_hash.to_yaml
File.open("#{last_entry}/#{filename}.md", 'w') do |file|
file.write(result_hash.to_yaml + '---')
end
end

View file

@ -4,6 +4,15 @@
}
}
#markdown-toc {
@extend .menu-list;
&, ul {
margin: 0;
list-style: none;
}
}
dl {
dt {
display: inline;

View file

@ -2,6 +2,10 @@
text-align: justify;
}
html, .footer {
background-color: white;
}
.hero {
background-position: center;
background-size: cover;
@ -145,3 +149,7 @@ footer.footer {
padding-right: 5px;
}
}
.fa {
vertical-align: baseline;
}

Some files were not shown because too many files have changed in this diff Show more