Skip to content

Commit

Permalink
#66 titles
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Nov 27, 2018
1 parent db75aaf commit 9e3acc1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
20 changes: 14 additions & 6 deletions Rakefile
Expand Up @@ -3,6 +3,15 @@
require 'open3'
require 'rainbow'

titles = {
'wp' => 'Zold White Paper',
'executive-summary' => 'Zerocracy Executive Summary',
'zerocracy-deck' => 'Zerocracy Pitch Deck',
'freelance-deck' => 'Freelance vs Outsourcing Comparison Deck',
'feature-deck' => 'Zerocracy Features',
'green-paper' => 'Zold Green Paper'
}

def run(cmd)
print "#{cmd} "
out = ''
Expand Down Expand Up @@ -35,16 +44,15 @@ task :html => [:pdf, :thumbs] do
FileUtils.cp(f, f.gsub(/^html\//, 'target/'))
end
Dir.chdir('target') do
File.write(
IO.write(
'index.html',
File.read('index.html').gsub(
IO.read('index.html').gsub(
'PDFs',
Dir['*.pdf'].sort.map do |p|
name = File.basename(p, '.pdf')
title = name.tr('-', ' ').split
.map(&:capitalize)
.map { |w| w.length < 4 ? w.upcase : w }
.join(' ')
puts name
title = titles[name]
next unless title
"<li class='thumb'><a href='#{p}'><img src='#{name}.png'/></a><br/>#{title}</li>"
end.join
)
Expand Down
3 changes: 2 additions & 1 deletion html/index.html
Expand Up @@ -39,7 +39,8 @@
}
.thumb {
display: inline-block;
margin: 1em !important;
margin: 1em 0;
width: 50%;
}
.thumb img {
width: 150px;
Expand Down

0 comments on commit 9e3acc1

Please sign in to comment.