241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
# File 'lib/mkbook/make_book.rb', line 241
def markdown2html(regex)
Dir.chdir(@project)
FileUtils.mkdir_p(@dir_html) unless Dir.exist?(@dir_html)
files = File.join("src", regex)
Utils.log_info("Parsing markdown ... #{files}:\n")
Dir["#{files}"].sort.map do |file|
puts "\t\033[32mconvert\033[0m #{file}"
markdown = IO.read(file)
html = IO.popen("pandoc --no-wrap --chapters -f #{@format} -t html", 'w+') do |pipe|
pipe.write(markdown)
pipe.close_write
pipe.read
end
IO.write(File.join(@dir_html, "#{File.basename(file, '.md')}.htm"), html)
end
end
|