nb_util 0.4.1 → 0.4.2
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/README.ipynb +283 -0
- data/README.md +120 -4
- data/lib/.DS_Store +0 -0
- data/lib/data/handout_pieces/usepackage.tex +1 -1
- data/lib/data/thesis_pieces/usepackage.tex +1 -1
- data/lib/nb_util/ipynb2tex.rb +8 -4
- data/lib/nb_util/version.rb +1 -1
- metadata +3 -3
- data/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96283e9f1428196837bfde61a5c9c657634146f590329cfdb2d3d56489fed4bf
|
4
|
+
data.tar.gz: 8546b8dba97d3cbb2a6f3782b8ec22e35380f62807aa7a7e935ec66d7d8c07fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66e503066118034cf82fb80f3fe61d7726dc8d03e7d185a862f54a0c16da0823c2cb5afc7ef2476c93eab68d51e7398cf9132c143ad8e060f99ac7f80661df8c
|
7
|
+
data.tar.gz: 7e22b98079e7868904212c7fc00a7cc5c2179ceaa6e90d702751405da46a258e0cacaf3de73848aafda005e9372a4a6dc4823e997f70087b79e46e565299fab9
|
data/Gemfile.lock
CHANGED
data/README.ipynb
ADDED
@@ -0,0 +1,283 @@
|
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "markdown",
|
5
|
+
"metadata": {
|
6
|
+
"toc": true
|
7
|
+
},
|
8
|
+
"source": [
|
9
|
+
"<h1>Table of Contents<span class=\"tocSkip\"></span></h1>\n",
|
10
|
+
"<div class=\"toc\" style=\"margin-top: 1em;\"><ul class=\"toc-item\"><li><span><a href=\"#Name\" data-toc-modified-id=\"Name-1\"><span class=\"toc-item-num\">1 </span>Name</a></span></li><li><span><a href=\"#Summary\" data-toc-modified-id=\"Summary-2\"><span class=\"toc-item-num\">2 </span>Summary</a></span></li><li><span><a href=\"#Installation\" data-toc-modified-id=\"Installation-3\"><span class=\"toc-item-num\">3 </span>Installation</a></span></li><li><span><a href=\"#Usage\" data-toc-modified-id=\"Usage-4\"><span class=\"toc-item-num\">4 </span>Usage</a></span></li><li><span><a href=\"#Uninstall\" data-toc-modified-id=\"Uninstall-5\"><span class=\"toc-item-num\">5 </span>Uninstall</a></span></li><li><span><a href=\"#Development\" data-toc-modified-id=\"Development-6\"><span class=\"toc-item-num\">6 </span>Development</a></span></li><li><span><a href=\"#Contributing\" data-toc-modified-id=\"Contributing-7\"><span class=\"toc-item-num\">7 </span>Contributing</a></span></li><li><span><a href=\"#License\" data-toc-modified-id=\"License-8\"><span class=\"toc-item-num\">8 </span>License</a></span></li><li><span><a href=\"#Code-of-Conduct\" data-toc-modified-id=\"Code-of-Conduct-9\"><span class=\"toc-item-num\">9 </span>Code of Conduct</a></span></li></ul></div>"
|
11
|
+
]
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"cell_type": "markdown",
|
15
|
+
"metadata": {},
|
16
|
+
"source": [
|
17
|
+
"# Name"
|
18
|
+
]
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"cell_type": "markdown",
|
22
|
+
"metadata": {},
|
23
|
+
"source": [
|
24
|
+
"nb_util"
|
25
|
+
]
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"cell_type": "markdown",
|
29
|
+
"metadata": {},
|
30
|
+
"source": [
|
31
|
+
"# Summary"
|
32
|
+
]
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"cell_type": "markdown",
|
36
|
+
"metadata": {},
|
37
|
+
"source": [
|
38
|
+
"nb_util allows you to generate latex(tex) format from your jupyter notebook(ipynb) format."
|
39
|
+
]
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"cell_type": "markdown",
|
43
|
+
"metadata": {},
|
44
|
+
"source": [
|
45
|
+
"This gem supplies to help when you use jupyter notebook. \n",
|
46
|
+
"\n",
|
47
|
+
"what can it help me?\n",
|
48
|
+
"\n",
|
49
|
+
"1. Convert [my_help](https://github.com/daddygongon/my_help) to jupyter notebook(ipynb)\n",
|
50
|
+
"1. Combine multiple jupyter notebook into one jupyter note book\n",
|
51
|
+
"1. Extract data from jupyter notebook, then convert to the file format you extracted data.\n",
|
52
|
+
"1. To see jupyter notbook's contents\n",
|
53
|
+
"1. Convert jupyter notebook(ipynb) to latex(tex) format(thesis and handout(A4))\n"
|
54
|
+
]
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"cell_type": "markdown",
|
58
|
+
"metadata": {},
|
59
|
+
"source": [
|
60
|
+
"# Installation"
|
61
|
+
]
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"cell_type": "markdown",
|
65
|
+
"metadata": {},
|
66
|
+
"source": [
|
67
|
+
"Add this line to your application's Gemfile:\n",
|
68
|
+
"\n",
|
69
|
+
"```ruby\n",
|
70
|
+
"gem 'nb_util'\n",
|
71
|
+
"```\n",
|
72
|
+
"\n",
|
73
|
+
"And then execute:\n",
|
74
|
+
"\n",
|
75
|
+
" $ bundle\n",
|
76
|
+
"\n",
|
77
|
+
"Or install it yourself as:\n",
|
78
|
+
"\n",
|
79
|
+
" $ gem install nb_util\n",
|
80
|
+
" \n",
|
81
|
+
"To use this library:\n",
|
82
|
+
"\n",
|
83
|
+
"```ruby\n",
|
84
|
+
"require 'nb_util'\n",
|
85
|
+
"```\n",
|
86
|
+
"\n",
|
87
|
+
"On your local system, run the following in your command line: \n",
|
88
|
+
"\n",
|
89
|
+
" $ git clone git@github.com:EAGLE12/nb_util.git\n",
|
90
|
+
" $ cd nb_util\n",
|
91
|
+
" $ bundle update\n",
|
92
|
+
" \n",
|
93
|
+
"Run the following in your command line:\n",
|
94
|
+
"\n",
|
95
|
+
" $ bundle exec exe/nb_util\n",
|
96
|
+
"\n",
|
97
|
+
"```ruby\n",
|
98
|
+
"nb_util says hello, EAGLE !!\n",
|
99
|
+
"Commands:\n",
|
100
|
+
" nb_util combine [input file1] [input file2] [output filename] # combine file1 and file2\n",
|
101
|
+
" nb_util getcode [filename] # save in ruby format\n",
|
102
|
+
" nb_util help [COMMAND] # Describe available commands or one specific command\n",
|
103
|
+
" nb_util iputs [filename] # display ipynb file contents\n",
|
104
|
+
" nb_util ipynb2tex [filename] [option] # convert ipynb to tex's thiesis format\n",
|
105
|
+
" nb_util red WORD [OPTION] # red words print.\n",
|
106
|
+
" nb_util yaml2ipynb [input filename] # convert yaml to ipynb\n",
|
107
|
+
"```\n",
|
108
|
+
"\n",
|
109
|
+
"Have a good life with nb_util!"
|
110
|
+
]
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"cell_type": "markdown",
|
114
|
+
"metadata": {},
|
115
|
+
"source": [
|
116
|
+
"# Usage"
|
117
|
+
]
|
118
|
+
},
|
119
|
+
{
|
120
|
+
"cell_type": "markdown",
|
121
|
+
"metadata": {},
|
122
|
+
"source": [
|
123
|
+
"```\n",
|
124
|
+
"$ nb_util\n",
|
125
|
+
"```\n",
|
126
|
+
"\n",
|
127
|
+
"```ruby\n",
|
128
|
+
"nb_util says hello, EAGLE !!\n",
|
129
|
+
"Commands:\n",
|
130
|
+
" nb_util combine [input file1] [input file2] [output filename] # combine file1 and file2\n",
|
131
|
+
" nb_util getcode [filename] # save in ruby format\n",
|
132
|
+
" nb_util help [COMMAND] # Describe available commands or one specific command\n",
|
133
|
+
" nb_util iputs [filename] # display ipynb file contents\n",
|
134
|
+
" nb_util ipynb2tex [filename] [option] # convert ipynb to tex's thiesis format\n",
|
135
|
+
" nb_util red WORD [OPTION] # red words print.\n",
|
136
|
+
" nb_util yaml2ipynb [input filename] # convert yaml to ipynb\n",
|
137
|
+
"```"
|
138
|
+
]
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"cell_type": "markdown",
|
142
|
+
"metadata": {},
|
143
|
+
"source": [
|
144
|
+
"# Uninstall"
|
145
|
+
]
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"cell_type": "markdown",
|
149
|
+
"metadata": {
|
150
|
+
"cell_style": "center"
|
151
|
+
},
|
152
|
+
"source": [
|
153
|
+
"```\n",
|
154
|
+
"$ gem uninstall nb_util\n",
|
155
|
+
"```\n",
|
156
|
+
"And then\n",
|
157
|
+
"\n",
|
158
|
+
"You want to uninstall by filling number on it\n",
|
159
|
+
"\n",
|
160
|
+
"```ruby\n",
|
161
|
+
"Select gem to uninstall:\n",
|
162
|
+
" 1. nb_util-0.3.4\n",
|
163
|
+
" 2. nb_util-0.3.5\n",
|
164
|
+
" 3. nb_util-0.3.6\n",
|
165
|
+
" 4. nb_util-0.3.7\n",
|
166
|
+
" 5. nb_util-0.3.8\n",
|
167
|
+
" 6. nb_util-0.4.0\n",
|
168
|
+
" 7. All versions\n",
|
169
|
+
"> 7\n",
|
170
|
+
"Successfully uninstalled nb_util-0.3.4\n",
|
171
|
+
"Successfully uninstalled nb_util-0.3.5\n",
|
172
|
+
"Successfully uninstalled nb_util-0.3.6\n",
|
173
|
+
"Successfully uninstalled nb_util-0.3.7\n",
|
174
|
+
"Successfully uninstalled nb_util-0.3.8\n",
|
175
|
+
"Remove executables:\n",
|
176
|
+
"\tnb_util\n",
|
177
|
+
"\n",
|
178
|
+
"in addition to the gem? [Yn] y\n",
|
179
|
+
"Removing nb_util\n",
|
180
|
+
"Successfully uninstalled nb_util-0.4.0\n",
|
181
|
+
"```\n",
|
182
|
+
" "
|
183
|
+
]
|
184
|
+
},
|
185
|
+
{
|
186
|
+
"cell_type": "markdown",
|
187
|
+
"metadata": {},
|
188
|
+
"source": [
|
189
|
+
"# Development"
|
190
|
+
]
|
191
|
+
},
|
192
|
+
{
|
193
|
+
"cell_type": "markdown",
|
194
|
+
"metadata": {},
|
195
|
+
"source": [
|
196
|
+
"After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n",
|
197
|
+
"\n",
|
198
|
+
"To install this gem onto your local machine, run `bundle exec rake install`. \n",
|
199
|
+
"To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org/gems/nb_util)."
|
200
|
+
]
|
201
|
+
},
|
202
|
+
{
|
203
|
+
"cell_type": "markdown",
|
204
|
+
"metadata": {},
|
205
|
+
"source": [
|
206
|
+
"# Contributing"
|
207
|
+
]
|
208
|
+
},
|
209
|
+
{
|
210
|
+
"cell_type": "markdown",
|
211
|
+
"metadata": {},
|
212
|
+
"source": [
|
213
|
+
"Bug reports and pull requests are welcome on GitHub at https://github.com/EAGLE12/nb_util. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n",
|
214
|
+
"\n",
|
215
|
+
"1. Fork it (https://github.com/EAGLE12/nb_util/fork)\n",
|
216
|
+
"1. Create your feature branch (git checkout -b my-new-feature)\n",
|
217
|
+
"1. Commit your changes (git commit -am 'Added some feature')\n",
|
218
|
+
"1. Push to the branch (git push origin my-new-feature)\n",
|
219
|
+
"1. Create new Pull Request"
|
220
|
+
]
|
221
|
+
},
|
222
|
+
{
|
223
|
+
"cell_type": "markdown",
|
224
|
+
"metadata": {},
|
225
|
+
"source": [
|
226
|
+
"# License"
|
227
|
+
]
|
228
|
+
},
|
229
|
+
{
|
230
|
+
"cell_type": "markdown",
|
231
|
+
"metadata": {},
|
232
|
+
"source": [
|
233
|
+
"The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT)."
|
234
|
+
]
|
235
|
+
},
|
236
|
+
{
|
237
|
+
"cell_type": "markdown",
|
238
|
+
"metadata": {},
|
239
|
+
"source": [
|
240
|
+
"# Code of Conduct"
|
241
|
+
]
|
242
|
+
},
|
243
|
+
{
|
244
|
+
"cell_type": "markdown",
|
245
|
+
"metadata": {},
|
246
|
+
"source": [
|
247
|
+
"Everyone interacting in the NbUtil project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/EAGLE12/nb_util/blob/master/CODE_OF_CONDUCT.md)."
|
248
|
+
]
|
249
|
+
},
|
250
|
+
{
|
251
|
+
"cell_type": "code",
|
252
|
+
"execution_count": null,
|
253
|
+
"metadata": {},
|
254
|
+
"outputs": [],
|
255
|
+
"source": []
|
256
|
+
}
|
257
|
+
],
|
258
|
+
"metadata": {
|
259
|
+
"kernelspec": {
|
260
|
+
"display_name": "Ruby 2.4.1",
|
261
|
+
"language": "ruby",
|
262
|
+
"name": "ruby"
|
263
|
+
},
|
264
|
+
"language_info": {
|
265
|
+
"file_extension": ".rb",
|
266
|
+
"mimetype": "application/x-ruby",
|
267
|
+
"name": "ruby",
|
268
|
+
"version": "2.4.2"
|
269
|
+
},
|
270
|
+
"toc": {
|
271
|
+
"nav_menu": {},
|
272
|
+
"number_sections": true,
|
273
|
+
"sideBar": true,
|
274
|
+
"skip_h1_title": false,
|
275
|
+
"toc_cell": true,
|
276
|
+
"toc_position": {},
|
277
|
+
"toc_section_display": "block",
|
278
|
+
"toc_window_display": true
|
279
|
+
}
|
280
|
+
},
|
281
|
+
"nbformat": 4,
|
282
|
+
"nbformat_minor": 2
|
283
|
+
}
|
data/README.md
CHANGED
@@ -1,10 +1,38 @@
|
|
1
|
+
Table of contents
|
2
|
+
=================
|
3
|
+
|
4
|
+
- [Name](#name)
|
5
|
+
- [Summary](#summary)
|
6
|
+
- [Installation](#installation)
|
7
|
+
- [Usage](#usage)
|
8
|
+
- [Uninstall](#uninstall)
|
9
|
+
- [Development](#development)
|
10
|
+
- [Contributing](#contributing)
|
11
|
+
- [License](#license)
|
12
|
+
- [Code of Conduct](#code-of-conduct)
|
13
|
+
|
1
14
|
# Name
|
2
|
-
|
15
|
+
|
16
|
+
nb_util
|
3
17
|
|
4
18
|
# Summary
|
5
|
-
This gem makes and supplies user specific helps, emulating CUI(CLI) help usage.
|
6
19
|
|
7
|
-
|
20
|
+
nb_util allows you to generate latex(tex) format from your jupyter notebook(ipynb) format.
|
21
|
+
|
22
|
+
This gem supplies to help when you use jupyter notebook.
|
23
|
+
|
24
|
+
what can it help me?
|
25
|
+
|
26
|
+
1. Convert [my_help](https://github.com/daddygongon/my_help) to jupyter notebook(ipynb)
|
27
|
+
1. Combine multiple jupyter notebook into one jupyter note book
|
28
|
+
1. Extract data from jupyter notebook, then convert to the file format you extracted data.
|
29
|
+
1. To see jupyter notbook's contents
|
30
|
+
1. Convert jupyter notebook(ipynb) to latex(tex) format(thesis and handout(A4))
|
31
|
+
|
32
|
+
|
33
|
+
# Installation
|
34
|
+
|
35
|
+
Add this line to your application's Gemfile:
|
8
36
|
|
9
37
|
```ruby
|
10
38
|
gem 'nb_util'
|
@@ -17,18 +45,105 @@ And then execute:
|
|
17
45
|
Or install it yourself as:
|
18
46
|
|
19
47
|
$ gem install nb_util
|
48
|
+
|
49
|
+
To use this library:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
require 'nb_util'
|
53
|
+
```
|
54
|
+
|
55
|
+
On your local system, run the following in your command line:
|
56
|
+
|
57
|
+
$ git clone git@github.com:EAGLE12/nb_util.git
|
58
|
+
$ cd nb_util
|
59
|
+
$ bundle update
|
60
|
+
|
61
|
+
Run the following in your command line:
|
62
|
+
|
63
|
+
$ bundle exec exe/nb_util
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
nb_util says hello, EAGLE !!
|
67
|
+
Commands:
|
68
|
+
nb_util combine [input file1] [input file2] [output filename] # combine file1 and file2
|
69
|
+
nb_util getcode [filename] # save in ruby format
|
70
|
+
nb_util help [COMMAND] # Describe available commands or one specific command
|
71
|
+
nb_util iputs [filename] # display ipynb file contents
|
72
|
+
nb_util ipynb2tex [filename] [option] # convert ipynb to tex's thiesis format
|
73
|
+
nb_util red WORD [OPTION] # red words print.
|
74
|
+
nb_util yaml2ipynb [input filename] # convert yaml to ipynb
|
75
|
+
```
|
20
76
|
|
77
|
+
Have a good life with nb_util!
|
78
|
+
|
79
|
+
# Usage
|
80
|
+
|
81
|
+
```
|
82
|
+
$ nb_util
|
83
|
+
```
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
nb_util says hello, EAGLE !!
|
87
|
+
Commands:
|
88
|
+
nb_util combine [input file1] [input file2] [output filename] # combine file1 and file2
|
89
|
+
nb_util getcode [filename] # save in ruby format
|
90
|
+
nb_util help [COMMAND] # Describe available commands or one specific command
|
91
|
+
nb_util iputs [filename] # display ipynb file contents
|
92
|
+
nb_util ipynb2tex [filename] [option] # convert ipynb to tex's thiesis format
|
93
|
+
nb_util red WORD [OPTION] # red words print.
|
94
|
+
nb_util yaml2ipynb [input filename] # convert yaml to ipynb
|
95
|
+
```
|
96
|
+
|
97
|
+
# Uninstall
|
98
|
+
|
99
|
+
```
|
100
|
+
$ gem uninstall nb_util
|
101
|
+
```
|
102
|
+
And then
|
103
|
+
|
104
|
+
You want to uninstall by filling number on it
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
Select gem to uninstall:
|
108
|
+
1. nb_util-0.3.4
|
109
|
+
2. nb_util-0.3.5
|
110
|
+
3. nb_util-0.3.6
|
111
|
+
4. nb_util-0.3.7
|
112
|
+
5. nb_util-0.3.8
|
113
|
+
6. nb_util-0.4.0
|
114
|
+
7. All versions
|
115
|
+
> 7
|
116
|
+
Successfully uninstalled nb_util-0.3.4
|
117
|
+
Successfully uninstalled nb_util-0.3.5
|
118
|
+
Successfully uninstalled nb_util-0.3.6
|
119
|
+
Successfully uninstalled nb_util-0.3.7
|
120
|
+
Successfully uninstalled nb_util-0.3.8
|
121
|
+
Remove executables:
|
122
|
+
nb_util
|
123
|
+
|
124
|
+
in addition to the gem? [Yn] y
|
125
|
+
Removing nb_util
|
126
|
+
Successfully uninstalled nb_util-0.4.0
|
127
|
+
```
|
128
|
+
|
21
129
|
|
22
130
|
# Development
|
23
131
|
|
24
132
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
25
133
|
|
26
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
134
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
135
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org/gems/nb_util).
|
27
136
|
|
28
137
|
# Contributing
|
29
138
|
|
30
139
|
Bug reports and pull requests are welcome on GitHub at https://github.com/EAGLE12/nb_util. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
31
140
|
|
141
|
+
1. Fork it (https://github.com/EAGLE12/nb_util/fork)
|
142
|
+
1. Create your feature branch (git checkout -b my-new-feature)
|
143
|
+
1. Commit your changes (git commit -am 'Added some feature')
|
144
|
+
1. Push to the branch (git push origin my-new-feature)
|
145
|
+
1. Create new Pull Request
|
146
|
+
|
32
147
|
# License
|
33
148
|
|
34
149
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -36,3 +151,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
36
151
|
# Code of Conduct
|
37
152
|
|
38
153
|
Everyone interacting in the NbUtil project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/EAGLE12/nb_util/blob/master/CODE_OF_CONDUCT.md).
|
154
|
+
|
data/lib/.DS_Store
CHANGED
Binary file
|
data/lib/nb_util/ipynb2tex.rb
CHANGED
@@ -199,9 +199,10 @@ module NbUtil
|
|
199
199
|
target_parent = File.absolute_path("../..", target)
|
200
200
|
ipynb = JSON.parse(File.read(input_ipynb))
|
201
201
|
pickup_ipynb = ipynb["cells"].to_s.split(",")
|
202
|
-
chapter = pickup_ipynb.grep(/"# /).map{ |i| i.gsub(/.*# /, '').gsub(/".*/, '') }
|
202
|
+
chapter = pickup_ipynb.grep(/"# /).map{ |i| i.gsub(/.*# /, '').gsub(/".*/, '').gsub(/\\n/, '') }
|
203
203
|
if thesis_or_handout == "thesis"
|
204
204
|
chapter_size = chapter.size
|
205
|
+
p chapter
|
205
206
|
for num in 0..chapter_size-1 do
|
206
207
|
splitters = [ ["\\section{#{chapter[num]}}", target_parent + "/chapter#{num}.tex", FileUtils.mkdir_p(target_parent + "/split_files/chapter#{num}")],
|
207
208
|
["\\begin{Verbatim}", target_parent + '/tmp.tex', FileUtils.mkdir_p(target_parent + '/split_files/tmp')]]
|
@@ -216,7 +217,7 @@ module NbUtil
|
|
216
217
|
File.open(splitter[1], 'w') do |f|
|
217
218
|
f.print splitter[0].gsub!(/section/, 'chapter')
|
218
219
|
if num+1 != chapter_size
|
219
|
-
f.print split[1].sub!(
|
220
|
+
f.print split[1].sub!(/\\section{#{chapter[num+1]}}\\label.*/m, '')
|
220
221
|
end
|
221
222
|
if num+1 == chapter_size
|
222
223
|
f.print split[1]
|
@@ -269,7 +270,7 @@ module NbUtil
|
|
269
270
|
if thesis_or_handout == "thesis"
|
270
271
|
thesis_wrap_figs = <<"EOS"
|
271
272
|
\\begin{center}
|
272
|
-
\\includegraphics[width
|
273
|
+
\\includegraphics[width=150mm]{../../#{file_name}}
|
273
274
|
\\end{center}
|
274
275
|
#{caption}
|
275
276
|
\\label{fig:#{label}}
|
@@ -284,12 +285,15 @@ EOS
|
|
284
285
|
\\label{fig:#{label}}
|
285
286
|
EOS
|
286
287
|
end
|
288
|
+
lines[i]
|
287
289
|
lines[i] = thesis_wrap_figs
|
288
290
|
lines.delete_at(i + 1) # if no caption, comment out here
|
289
291
|
end
|
290
292
|
end
|
291
293
|
File.open(target, 'w') do |f|
|
292
|
-
lines.each
|
294
|
+
lines.each do |line|
|
295
|
+
f.print line.to_s.gsub(/begin{figure}/, "begin{figure}[H]")
|
296
|
+
end
|
293
297
|
end
|
294
298
|
end
|
295
299
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masatoshi Kowaki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -74,7 +74,6 @@ executables:
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- ".DS_Store"
|
78
77
|
- ".gitignore"
|
79
78
|
- ".rspec"
|
80
79
|
- ".rspec_status"
|
@@ -82,6 +81,7 @@ files:
|
|
82
81
|
- Gemfile
|
83
82
|
- Gemfile.lock
|
84
83
|
- LICENSE.txt
|
84
|
+
- README.ipynb
|
85
85
|
- README.md
|
86
86
|
- Rakefile
|
87
87
|
- bin/console
|
data/.DS_Store
DELETED
Binary file
|