Sha256: b1464cf7319ae5d7336395ed7c09081b0fab862416d00ebce2ef02a7edc64d90
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require "tmpdir" module JekyllJupyterNotebook class Tag < Liquid::Tag Liquid::Template.register_tag("jupyter_notebook", self) def initialize(tag_name, markup, tokens) super @notebook_path = markup.strip end def syntax_example "{% #{@tag_name} filename.ipynb %}" end def render(context) notebook_html_path = "#{@notebook_path}.html" <<-HTML <div class="jupyter-notebook" style="position: relative; width: 100%; margin: 0 auto;"> <div class="jupyter-notebook-iframe-container"> <iframe src="#{CGI.escapeHTML(notebook_html_path)}" style="position: absolute; top: 0; left: 0; border-style: none;" width="100%" height="100%" onload="this.parentElement.style.paddingBottom = (this.contentWindow.document.documentElement.scrollHeight + 10) + 'px'"></iframe> </div> </div> HTML end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-jupyter-notebook-0.0.3 | lib/jekyll-jupyter-notebook/tag.rb |