Sha256: 8a37774a78a6a767a9b3035bcc062fdf4f579feb1bf460bc8649289f2624a7fe
Contents?: true
Size: 620 Bytes
Versions: 1
Compression:
Stored size: 620 Bytes
Contents
# encoding: utf-8 require "open3" module Nanoc::Filters class NBConvert < Nanoc::Filter identifier :nbconvert def run(content, params={}) nbconvert = <<'END' import sys from IPython.nbconvert import HTMLExporter exportor = HTMLExporter(template_file="basic") body, _ = exportor.from_file(sys.stdin) sys.stdout.write(body) END python_bin = params[:python_bin] || 'python' o, e, s = Open3.capture3("#{python_bin} -c '#{nbconvert}'", :stdin_data=>content.to_s) if !s.success? raise "nbconvert fails: #{e}" end o end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nanoc-nbconvert-0.1.0 | lib/nanoc/filters/nbconvert.rb |