Skip to content

Commit

Permalink
Add make-process to create HTML files
Browse files Browse the repository at this point in the history
The markdown files are converted to Markdown via kramdown, using
a GitHub-like CSS. The resulting HTML files are placed under
./articles-html
  • Loading branch information
Jonas Mueller committed Oct 31, 2014
1 parent b17ad0d commit 76c4675
Show file tree
Hide file tree
Showing 6 changed files with 465 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
articles-html
3 changes: 3 additions & 0 deletions Gemfile
@@ -0,0 +1,3 @@
gem "rake"
gem "kramdown"
gem "coderay"
13 changes: 13 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,13 @@
GEM
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
@@ -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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 76c4675

Please sign in to comment.