nb_util 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/Gemfile.lock +1 -1
- data/lib/cli.rb +4 -1
- data/lib/nb_util/ipynb2tex.rb +37 -1
- data/lib/nb_util/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b99a51689e15575503bc8b6380f6b03e98aa03efa8065390dd204dad3aa4f9f
|
4
|
+
data.tar.gz: a51b98a4e6ada708d7ed7d1cbf73327e6a814ced06b5b8e183d68be150b143ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5e30af0fbef86b6b13f848dfb895b6d68c76cd12de8afad9be38f30b0e83a26cae3da92ffc163663f3b5fae49ab2e08afccae3a31fef5f92675a5a0034d9c78
|
7
|
+
data.tar.gz: 87bbe47c09c476656542d3b4dad1538d6b2f66b76db47050a2a9d5a1facbd16b02a2b28cbab1bcce69b7225f72f32373e62358507aa123c570e2be9a97407184
|
data/Gemfile.lock
CHANGED
data/lib/cli.rb
CHANGED
@@ -41,11 +41,14 @@ module NbUtil
|
|
41
41
|
NbUtil.getcode(ARGV[1])
|
42
42
|
end
|
43
43
|
|
44
|
-
desc "ipynb2tex [filename]", "convert ipynb to tex's thiesis format" # コマンドの使用例と、概要
|
44
|
+
desc "ipynb2tex [filename] [option]", "convert ipynb to tex's thiesis format" # コマンドの使用例と、概要
|
45
45
|
option :handout, :aliases => '-h', :desc => "convert ipynb to tex's handout format"
|
46
|
+
option :delete, :aliases => '-d', :desc => "delete mk_latex and old folder"
|
46
47
|
def ipynb2tex(argv0) # コマンドはメソッドとして定義する
|
47
48
|
if options[:handout]
|
48
49
|
NbUtil.ipynb2tex_handout(ARGV[1])
|
50
|
+
elsif options[:delete]
|
51
|
+
NbUtil.delete_folder(ARGV[1])
|
49
52
|
else
|
50
53
|
NbUtil.ipynb2tex_thesis(ARGV[1])
|
51
54
|
end
|
data/lib/nb_util/ipynb2tex.rb
CHANGED
@@ -141,6 +141,43 @@ module NbUtil
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
+
def delete_folder(target)
|
145
|
+
loop do
|
146
|
+
print "Are you sure?: "
|
147
|
+
input = STDIN.gets.to_s.chomp
|
148
|
+
if input == 'Y' || input == 'y'
|
149
|
+
|
150
|
+
mk_latex = File.join(File.absolute_path("../", target), '/mk_latex')
|
151
|
+
old = File.join(File.absolute_path("../", target), '/old')
|
152
|
+
if Dir.exist?(mk_latex) && Dir.exist?(old)
|
153
|
+
print "\e[31mdelete: \e[0m"
|
154
|
+
FileUtils.rm_r(mk_latex)
|
155
|
+
puts "\e[31m#{mk_latex}\e[0m"
|
156
|
+
print "\e[31mdelete: \e[0m"
|
157
|
+
FileUtils.rm_r(old)
|
158
|
+
puts "\e[31m#{old}\e[0m"
|
159
|
+
break
|
160
|
+
elsif Dir.exist?(mk_latex)
|
161
|
+
print "\e[31mdelete: \e[0m"
|
162
|
+
FileUtils.rm_r(mk_latex)
|
163
|
+
puts "\e[31m#{mk_latex}\e[0m"
|
164
|
+
break
|
165
|
+
elsif Dir.exist?(old)
|
166
|
+
print "\e[31mdelete: \e[0m"
|
167
|
+
FileUtils.rm_r(old)
|
168
|
+
puts "\e[31m#{old}\e[0m"
|
169
|
+
break
|
170
|
+
else
|
171
|
+
puts "\e[31mNo such file or directory\e[0m"
|
172
|
+
break
|
173
|
+
end
|
174
|
+
elsif input == 'N' || input == 'n'
|
175
|
+
puts
|
176
|
+
break
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
144
181
|
def revise_lines(target)
|
145
182
|
bugs = [['\end{quote}',:chomp]]
|
146
183
|
lines = File.readlines(target)
|
@@ -256,7 +293,6 @@ EOS
|
|
256
293
|
end
|
257
294
|
end
|
258
295
|
|
259
|
-
|
260
296
|
def mk_xbb(target, re_fig)
|
261
297
|
target_parent = File.absolute_path("../..", target)
|
262
298
|
FileUtils.mkdir_p(target_parent + '/figs')
|
data/lib/nb_util/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nb_util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masatoshi Kowaki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|