jekyll-jupyter-notebook 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +27 -0
- data/Rakefile +0 -10
- data/doc/text/news.md +23 -0
- data/jekyll-jupyter-notebook.gemspec +0 -2
- data/lib/jekyll-jupyter-notebook/converter.rb +11 -8
- data/lib/jekyll-jupyter-notebook/generator.rb +35 -13
- data/lib/jekyll-jupyter-notebook/version.rb +1 -1
- metadata +3 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bab18fecb1e9b9614f39547d0567f2cbf2077ecc2f3d9c0b6c9fd3338480c7b6
|
4
|
+
data.tar.gz: 44832784b374c9b572d9c517612c939dfe80283dbd6d7d722d211c510e83a7d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61c75285f0a349d5d7459750505167b21a6c73f415ff053be2bb98016ba373c3f88676f08dec282cfd285e3a74f69da50f7f7461924665c40f94fdda167d8590
|
7
|
+
data.tar.gz: d0b52e4a9827731f7f8f2b4980448d551c3fe597cbd1430d82f43ba614184a12fb9d2989be4857fb520be1f4214816d0ccaef8230d1887cbabafb06ed58fad78
|
data/README.md
CHANGED
@@ -53,6 +53,33 @@ If you use kramdown as Markdown parser and get strange result, try to surround `
|
|
53
53
|
{:/nomarkdown}
|
54
54
|
```
|
55
55
|
|
56
|
+
## Configurations
|
57
|
+
|
58
|
+
You can customize `.ipynb` to `.html` conversion by `jupyter_notebook` in `_config.yml`:
|
59
|
+
|
60
|
+
```yaml
|
61
|
+
jupyter_notebook:
|
62
|
+
# ...
|
63
|
+
```
|
64
|
+
|
65
|
+
### `prompt`
|
66
|
+
|
67
|
+
You can control whether a converted `.html` includes `In [N]`/`Out[N]` prompts or not by `prompt`:
|
68
|
+
|
69
|
+
```yaml
|
70
|
+
jupyter_notebook:
|
71
|
+
prompt: true
|
72
|
+
```
|
73
|
+
|
74
|
+
The default value is `true`. It means that `In [N]`/`Out[N]` are shown.
|
75
|
+
|
76
|
+
You can remove them by using `false`:
|
77
|
+
|
78
|
+
```yaml
|
79
|
+
jupyter_notebook:
|
80
|
+
prompt: false
|
81
|
+
```
|
82
|
+
|
56
83
|
## Authors
|
57
84
|
|
58
85
|
* Kouhei Sutou \<kou@clear-code.com\>
|
data/Rakefile
CHANGED
@@ -12,9 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
require "rubygems"
|
16
15
|
require "bundler/gem_helper"
|
17
|
-
require "packnga"
|
18
16
|
|
19
17
|
base_dir = File.join(File.dirname(__FILE__))
|
20
18
|
|
@@ -26,14 +24,6 @@ end
|
|
26
24
|
helper.install
|
27
25
|
spec = helper.gemspec
|
28
26
|
|
29
|
-
Packnga::DocumentTask.new(spec) do |task|
|
30
|
-
task.original_language = "en"
|
31
|
-
task.translate_language = "ja"
|
32
|
-
end
|
33
|
-
|
34
|
-
Packnga::ReleaseTask.new(spec) do
|
35
|
-
end
|
36
|
-
|
37
27
|
# desc "Run tests"
|
38
28
|
# task :test do
|
39
29
|
# ruby("test/run-test.rb")
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 0.0.6 - 2024-04-08
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* Added `prompt` option that controls whether `In [N]`/`Out[N]` prompts are shown or not.
|
8
|
+
* GH-9
|
9
|
+
* Reported by Julian Hatzky
|
10
|
+
|
11
|
+
### Thanks
|
12
|
+
|
13
|
+
* Julian Hatzky
|
14
|
+
|
15
|
+
## 0.0.5 - 2022-08-20
|
16
|
+
|
17
|
+
### Improvements
|
18
|
+
|
19
|
+
* Added support for collection.
|
20
|
+
[GitHub#8][Reported by Jeremy Lloyd Conlin]
|
21
|
+
|
22
|
+
### Thanks
|
23
|
+
|
24
|
+
* Jeremy Lloyd Conlin
|
25
|
+
|
3
26
|
## 0.0.4 - 2018-08-08
|
4
27
|
|
5
28
|
### Improvements
|
@@ -43,7 +43,5 @@ Gem::Specification.new do |spec|
|
|
43
43
|
|
44
44
|
spec.add_development_dependency("bundler")
|
45
45
|
spec.add_development_dependency("rake")
|
46
|
-
spec.add_development_dependency("test-unit")
|
47
|
-
spec.add_development_dependency("packnga")
|
48
46
|
spec.add_development_dependency("kramdown")
|
49
47
|
end
|
@@ -25,7 +25,7 @@ module JekyllJupyterNotebook
|
|
25
25
|
def convert(content)
|
26
26
|
config = @config["jupyter_notebook"] || {}
|
27
27
|
|
28
|
-
html = convert_notebook(content)
|
28
|
+
html = convert_notebook(content, config)
|
29
29
|
html.sub!(/<link.+?href="custom.css">/, "")
|
30
30
|
case config["content"] || "html"
|
31
31
|
when "html"
|
@@ -42,17 +42,20 @@ module JekyllJupyterNotebook
|
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
45
|
-
def convert_notebook(content)
|
45
|
+
def convert_notebook(content, config)
|
46
46
|
notebook = Tempfile.new(["jekyll-jupyter-notebook", ".ipynb"])
|
47
47
|
notebook.print(content)
|
48
48
|
notebook.close
|
49
49
|
IO.pipe do |input, output|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
50
|
+
command_line = [
|
51
|
+
"jupyter",
|
52
|
+
"nbconvert",
|
53
|
+
"--to", "html",
|
54
|
+
"--stdout",
|
55
|
+
]
|
56
|
+
command_line << "--no-prompt" unless config.fetch("prompt", true)
|
57
|
+
command_line << notebook.path
|
58
|
+
pid = spawn(*command_line, out: output)
|
56
59
|
begin
|
57
60
|
output.close
|
58
61
|
html = nil
|
@@ -11,26 +11,48 @@
|
|
11
11
|
# limitations under the License.
|
12
12
|
|
13
13
|
module JekyllJupyterNotebook
|
14
|
-
module
|
14
|
+
module IFramable
|
15
15
|
def output_ext
|
16
|
-
|
16
|
+
extname + super
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
class Generator < Jekyll::Generator
|
21
21
|
def generate(site)
|
22
|
+
generate_site_static_files(site)
|
23
|
+
site.collections.each_value do |collection|
|
24
|
+
generate_collection_filtered_entries(collection)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
def generate_site_static_files(site)
|
22
30
|
site.static_files.reject! do |static_file|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
next false unless static_file.extname == ".ipynb"
|
32
|
+
|
33
|
+
base = static_file.instance_variable_get(:@base)
|
34
|
+
dir = static_file.instance_variable_get(:@dir)
|
35
|
+
name = static_file.name
|
36
|
+
page = Jekyll::Page.new(site, base, dir, name)
|
37
|
+
page.extend(IFramable)
|
38
|
+
site.pages << page
|
39
|
+
true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def generate_collection_filtered_entries(collection)
|
44
|
+
collection.filtered_entries.reject! do |file_path|
|
45
|
+
full_path = collection.collection_dir(file_path)
|
46
|
+
next false unless File.extname(file_path) == ".ipynb"
|
47
|
+
next false if Jekyll::Utils.has_yaml_header?(full_path)
|
48
|
+
|
49
|
+
document = Jekyll::Document.new(full_path,
|
50
|
+
site: collection.site,
|
51
|
+
collection: collection)
|
52
|
+
document.extend(IFramable)
|
53
|
+
document.read
|
54
|
+
collection.docs << document
|
55
|
+
true
|
34
56
|
end
|
35
57
|
end
|
36
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-jupyter-notebook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2024-04-07 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: jekyll
|
@@ -52,34 +51,6 @@ dependencies:
|
|
52
51
|
- - ">="
|
53
52
|
- !ruby/object:Gem::Version
|
54
53
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: test-unit
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: packnga
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
54
|
- !ruby/object:Gem::Dependency
|
84
55
|
name: kramdown
|
85
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,7 +88,6 @@ homepage: https://github.com/red-data-tools/jekyll-jupyter-notebook
|
|
117
88
|
licenses:
|
118
89
|
- Apache-2.0
|
119
90
|
metadata: {}
|
120
|
-
post_install_message:
|
121
91
|
rdoc_options: []
|
122
92
|
require_paths:
|
123
93
|
- lib
|
@@ -132,9 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
102
|
- !ruby/object:Gem::Version
|
133
103
|
version: '0'
|
134
104
|
requirements: []
|
135
|
-
|
136
|
-
rubygems_version: 3.0.0.beta1
|
137
|
-
signing_key:
|
105
|
+
rubygems_version: 3.6.0.dev
|
138
106
|
specification_version: 4
|
139
107
|
summary: Jekyll Jupyter Notebook plugin adds [Jupyter](http://jupyter.org/) Notebook
|
140
108
|
support to Jekyll. You can embed Jupyter Notebooks into your texts.
|