Sha256: ec1c684ef51cdca0670e1ba567d94e786b5527ab172133f50ba79795b7043c33
Contents?: true
Size: 625 Bytes
Versions: 1
Compression:
Stored size: 625 Bytes
Contents
# encoding: utf-8 module Nanoc::Filters class NBConvert < Nanoc::Filter require "open3" 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.1 | lib/nanoc/filters/nbconvert.rb |