jupyter_to_scrapbox 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jupyter_to_scrapbox.rb +19 -1
- data/lib/jupyter_to_scrapbox/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b73710b6759b77ed57157cb8a30fc0d495fe99f
|
4
|
+
data.tar.gz: 92d353994fdc69575fcd63a16dac9f0e2ed200b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35398afc188e81d37ca211af569b3b4cf3bcc607d73e738a0fa221f11fa400083e2ba402e212259e814655d25e455d6fd3a9855662df1640fc1a78b4cb520bf8
|
7
|
+
data.tar.gz: d13592bdd81aea8509806aae4e367e2f30878d361ea12f1bce9eeac10f33b9d6d5b8d665d219c09b2ee36c214f824b582ba076b130bdb0a64b62bfccf092e722
|
data/lib/jupyter_to_scrapbox.rb
CHANGED
@@ -78,6 +78,7 @@ module JupyterToScrapbox
|
|
78
78
|
def initialize(path)
|
79
79
|
@ipynb_path=path
|
80
80
|
@page_title=""
|
81
|
+
@last_modified=nil
|
81
82
|
@sb_json=[]
|
82
83
|
@display_input_numbers=false
|
83
84
|
@prefix_comment="#"
|
@@ -219,6 +220,15 @@ module JupyterToScrapbox
|
|
219
220
|
def parse_ipynb()
|
220
221
|
@texts=""
|
221
222
|
open(@ipynb_path) do |f|
|
223
|
+
case @ipynb_path
|
224
|
+
when %r!^https?://!i, %r!^ftp://!i
|
225
|
+
@last_modified=f.last_modified
|
226
|
+
unless @last_modified
|
227
|
+
@last_modified=Time.now
|
228
|
+
end
|
229
|
+
else
|
230
|
+
@last_modified=f.mtime
|
231
|
+
end
|
222
232
|
@texts=f.read
|
223
233
|
end
|
224
234
|
# vputs texts
|
@@ -243,6 +253,7 @@ module JupyterToScrapbox
|
|
243
253
|
end
|
244
254
|
|
245
255
|
def page()
|
256
|
+
=begin
|
246
257
|
case @ipynb_path
|
247
258
|
when %r!^https?://!i, %r!^ftp://!i
|
248
259
|
uri=URI.parse(@ipynb_path)
|
@@ -251,9 +262,16 @@ module JupyterToScrapbox
|
|
251
262
|
@uri=@ipynb_path
|
252
263
|
end
|
253
264
|
@page_title=File.basename(@uri,".ipynb")
|
265
|
+
=end
|
266
|
+
@page_title=@last_modified.to_s
|
267
|
+
|
268
|
+
@sb_json.unshift("")
|
269
|
+
@sb_json.unshift(@ipynb_path)
|
270
|
+
@sb_json.unshift(@page_title)
|
271
|
+
|
254
272
|
page= {
|
255
273
|
"title": @page_title,
|
256
|
-
"lines": @sb_json
|
274
|
+
"lines": @sb_json
|
257
275
|
}
|
258
276
|
return page
|
259
277
|
end
|