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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c269c73190cca2fec43711d25d8749662cd802a2
4
- data.tar.gz: 5555309cde779f8f2d174ebca78a5076d2437838
3
+ metadata.gz: 6b73710b6759b77ed57157cb8a30fc0d495fe99f
4
+ data.tar.gz: 92d353994fdc69575fcd63a16dac9f0e2ed200b3
5
5
  SHA512:
6
- metadata.gz: 9e9ad1b54e08e8eddd24e0f38f8880dbe4b2d0ce618da21c0dec09508e6764ffd9eba61d27be4151088575318bb3b652ada39ec32b9a7b50001b991ff1c42872
7
- data.tar.gz: db8a605ec88fd93a193ca18f12db9f96df89b0210b7a025beee13075feae4956ca3140af45a6f42d2c6f5b43cb244c6668e8c207553eda5f41826c3fbf98f1b7
6
+ metadata.gz: 35398afc188e81d37ca211af569b3b4cf3bcc607d73e738a0fa221f11fa400083e2ba402e212259e814655d25e455d6fd3a9855662df1640fc1a78b4cb520bf8
7
+ data.tar.gz: d13592bdd81aea8509806aae4e367e2f30878d361ea12f1bce9eeac10f33b9d6d5b8d665d219c09b2ee36c214f824b582ba076b130bdb0a64b62bfccf092e722
@@ -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.unshift(@ipynb_path)
274
+ "lines": @sb_json
257
275
  }
258
276
  return page
259
277
  end
@@ -1,3 +1,3 @@
1
1
  module JupyterToScrapbox
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jupyter_to_scrapbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroharu Sugawara