Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elm-city-craftworks/practicing-ru…
Browse files Browse the repository at this point in the history
…by-manuscripts
  • Loading branch information
practicingruby committed Nov 16, 2014
2 parents 763832d + 8c83f75 commit 572782b
Show file tree
Hide file tree
Showing 6 changed files with 468 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
articles-html
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

gem "rake"
gem "kramdown"
gem "coderay"
14 changes: 14 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
GEM
remote: https://rubygems.org/
specs:
coderay (1.1.0)
kramdown (1.4.2)
rake (10.3.2)

PLATFORMS
ruby

DEPENDENCIES
coderay
kramdown
rake
27 changes: 27 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require "kramdown"
require "coderay"
require "fileutils"

MARKDOWN_FILES = Dir.glob("#{__dir__}/articles/**/*.md")

task default: :html_files

desc "Generate HTML files from markdown articles"
task :html_files do
MARKDOWN_FILES.each do |markdown_file|
html_path = markdown_file.sub("/articles/", "/articles-html/").sub(/\.md$/, ".html")
puts "Generating #{html_path}"
FileUtils.mkdir_p(File.dirname(html_path))
File.open(html_path, "w") do |html_file|
filecontent = File.read(markdown_file)
filecontent = filecontent.gsub("\`\`\`", "~~~")
filecontent = Kramdown::Document.new(filecontent, template: "#{__dir__}/templates/default.html.erb")
html_file.write(filecontent.to_html)
end
end
end

desc "Delete all generated HTML files"
task :clean do
FileUtils.rm_rf("#{__dir__}/articles-html")
end
Binary file added assets/images/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 572782b

Please sign in to comment.