review 3.2.0 → 4.0.0
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/.rubocop.yml +26 -4
- data/.travis.yml +1 -1
- data/NEWS.ja.md +97 -1
- data/NEWS.md +97 -1
- data/bin/review-catalog-converter +1 -1
- data/bin/review-check +5 -5
- data/bin/review-checkdep +1 -1
- data/bin/review-compile +5 -5
- data/bin/review-idgxmlmaker +16 -0
- data/bin/review-index +7 -7
- data/bin/review-preproc +9 -9
- data/bin/review-validate +2 -2
- data/bin/review-vol +5 -5
- data/doc/config.yml.sample +14 -6
- data/doc/config.yml.sample-simple +1 -1
- data/doc/format.ja.md +15 -5
- data/doc/format.md +30 -18
- data/doc/pdfmaker.ja.md +1 -1
- data/doc/pdfmaker.md +1 -1
- data/lib/review/book.rb +1 -1
- data/lib/review/book/base.rb +23 -63
- data/lib/review/book/chapter.rb +18 -3
- data/lib/review/book/compilable.rb +5 -0
- data/lib/review/book/index.rb +26 -65
- data/lib/review/book/index/item.rb +40 -0
- data/lib/review/book/part.rb +22 -2
- data/lib/review/builder.rb +60 -40
- data/lib/review/catalog.rb +12 -15
- data/lib/review/compiler.rb +68 -36
- data/lib/review/configure.rb +10 -7
- data/lib/review/epubmaker.rb +5 -2
- data/lib/review/htmlbuilder.rb +24 -71
- data/lib/review/htmlutils.rb +2 -3
- data/lib/review/i18n.rb +2 -2
- data/lib/review/idgxmlbuilder.rb +101 -55
- data/lib/review/idgxmlmaker.rb +184 -0
- data/lib/review/init-web/finish.html +10 -0
- data/lib/review/init-web/index.html +190 -0
- data/lib/review/init-web/review-layout-design.js +691 -0
- data/lib/review/init.rb +110 -26
- data/lib/review/latexbuilder.rb +76 -54
- data/lib/review/lineinput.rb +1 -1
- data/lib/review/logger.rb +4 -8
- data/lib/review/makerhelper.rb +6 -4
- data/lib/review/markdownbuilder.rb +25 -38
- data/lib/review/md2inaobuilder.rb +3 -5
- data/lib/review/pdfmaker.rb +15 -15
- data/lib/review/plaintextbuilder.rb +67 -76
- data/lib/review/preprocessor.rb +13 -13
- data/lib/review/rstbuilder.rb +31 -31
- data/lib/review/textmaker.rb +13 -3
- data/lib/review/textutils.rb +77 -2
- data/lib/review/tocparser.rb +17 -17
- data/lib/review/tocprinter.rb +8 -8
- data/lib/review/topbuilder.rb +76 -57
- data/lib/review/update.rb +16 -16
- data/lib/review/version.rb +1 -1
- data/lib/review/webmaker.rb +2 -2
- data/lib/review/yamlloader.rb +3 -0
- data/review.gemspec +4 -3
- data/samples/sample-book/README.md +7 -2
- data/samples/sample-book/src/.gitignore +153 -0
- data/samples/sample-book/src/config-jlreq.yml +6 -0
- data/samples/sample-book/src/lib/tasks/review.rake +20 -9
- data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +14 -8
- data/samples/syntax-book/ch03.re +3 -6
- data/samples/syntax-book/config-jlreq.yml +5 -0
- data/samples/syntax-book/lib/tasks/review.rake +7 -7
- data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +14 -8
- data/templates/latex/config.erb +6 -0
- data/templates/latex/layout.tex.erb +1 -0
- data/templates/latex/review-jlreq/review-base.sty +93 -31
- data/templates/latex/review-jlreq/review-jlreq.cls +6 -0
- data/templates/latex/review-jlreq/review-style.sty +3 -0
- data/templates/latex/review-jsbook/README.md +39 -0
- data/templates/latex/review-jsbook/review-base.sty +65 -10
- data/templates/latex/review-jsbook/review-jsbook.cls +4 -0
- data/templates/latex/review-jsbook/review-style.sty +4 -1
- data/test/assets/test_template.tex +11 -3
- data/test/assets/test_template_backmatter.tex +11 -3
- data/test/test_book.rb +65 -19
- data/test/test_catalog.rb +18 -42
- data/test/test_catalog_converter_cmd.rb +1 -1
- data/test/test_epubmaker_cmd.rb +2 -2
- data/test/test_helper.rb +1 -1
- data/test/test_htmlbuilder.rb +144 -55
- data/test/test_i18n.rb +25 -25
- data/test/test_idgxmlbuilder.rb +60 -18
- data/test/test_image_finder.rb +6 -6
- data/test/test_latexbuilder.rb +128 -24
- data/test/test_latexbuilder_v2.rb +23 -23
- data/test/test_logger.rb +14 -1
- data/test/test_makerhelper.rb +3 -3
- data/test/test_markdownbuilder.rb +45 -4
- data/test/test_md2inaobuilder.rb +12 -2
- data/test/test_pdfmaker.rb +1 -1
- data/test/test_pdfmaker_cmd.rb +1 -1
- data/test/test_plaintextbuilder.rb +31 -6
- data/test/test_rstbuilder.rb +33 -4
- data/test/test_textutils.rb +109 -2
- data/test/test_topbuilder.rb +35 -7
- data/test/test_update.rb +17 -8
- data/test/test_yamlloader.rb +13 -0
- metadata +26 -2
data/lib/review/tocprinter.rb
CHANGED
|
@@ -32,8 +32,8 @@ module ReVIEW
|
|
|
32
32
|
|
|
33
33
|
def print_chapter(chap)
|
|
34
34
|
chap_node = TOCParser.chapter_node(chap)
|
|
35
|
-
print_node
|
|
36
|
-
print_children
|
|
35
|
+
print_node(1, chap_node)
|
|
36
|
+
print_children(chap_node)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def print?(level)
|
|
@@ -48,8 +48,8 @@ module ReVIEW
|
|
|
48
48
|
return unless print?(node.level + 1)
|
|
49
49
|
node.each_section_with_index do |section, idx|
|
|
50
50
|
unless section.blank?
|
|
51
|
-
print_node
|
|
52
|
-
print_children
|
|
51
|
+
print_node(idx + 1, section)
|
|
52
|
+
print_children(section)
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
end
|
|
@@ -57,14 +57,14 @@ module ReVIEW
|
|
|
57
57
|
def print_node(number, node)
|
|
58
58
|
if node.chapter?
|
|
59
59
|
vol = node.volume
|
|
60
|
-
@out.printf
|
|
60
|
+
@out.printf("%3s %3dKB %6dC %5dL %s (%s)\n",
|
|
61
61
|
chapnumstr(node.number),
|
|
62
62
|
vol.kbytes, vol.chars, vol.lines,
|
|
63
|
-
node.label, node.chapter_id
|
|
63
|
+
node.label, node.chapter_id)
|
|
64
64
|
else ## for section node
|
|
65
|
-
@out.printf
|
|
65
|
+
@out.printf("%17s %5dL %s\n",
|
|
66
66
|
'', node.estimated_lines,
|
|
67
|
-
" #{' ' * (node.level - 1)}#{number} #{node.label}"
|
|
67
|
+
" #{' ' * (node.level - 1)}#{number} #{node.label}")
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
|
data/lib/review/topbuilder.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2008-
|
|
1
|
+
# Copyright (c) 2008-2019 Minero Aoki, Kenshi Muto
|
|
2
2
|
# 2002-2006 Minero Aoki
|
|
3
3
|
#
|
|
4
4
|
# This program is free software.
|
|
@@ -65,11 +65,11 @@ module ReVIEW
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def ul_item(lines)
|
|
68
|
-
puts "●\t#{lines
|
|
68
|
+
puts "●\t#{join_lines_to_paragraph(lines)}"
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def ol_item(lines, num)
|
|
72
|
-
puts "#{num}\t#{lines
|
|
72
|
+
puts "#{num}\t#{join_lines_to_paragraph(lines)}"
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def dt(line)
|
|
@@ -91,23 +91,32 @@ module ReVIEW
|
|
|
91
91
|
|
|
92
92
|
alias_method :lead, :read
|
|
93
93
|
|
|
94
|
-
def
|
|
94
|
+
def list(lines, id, caption, lang = nil)
|
|
95
95
|
blank
|
|
96
96
|
puts "◆→開始:#{@titles['list']}←◆"
|
|
97
|
+
begin
|
|
98
|
+
list_header(id, caption, lang)
|
|
99
|
+
rescue KeyError
|
|
100
|
+
error "no such list: #{id}"
|
|
101
|
+
end
|
|
102
|
+
blank
|
|
103
|
+
list_body(id, lines, lang)
|
|
104
|
+
puts "◆→終了:#{@titles['list']}←◆"
|
|
105
|
+
blank
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def list_header(id, caption, _lang)
|
|
97
109
|
if get_chap
|
|
98
110
|
puts %Q(#{I18n.t('list')}#{I18n.t('format_number', [get_chap, @chapter.list(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)})
|
|
99
111
|
else
|
|
100
112
|
puts %Q(#{I18n.t('list')}#{I18n.t('format_number_without_chapter', [@chapter.list(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)})
|
|
101
113
|
end
|
|
102
|
-
blank
|
|
103
114
|
end
|
|
104
115
|
|
|
105
116
|
def list_body(_id, lines, _lang)
|
|
106
117
|
lines.each do |line|
|
|
107
118
|
puts detab(line)
|
|
108
119
|
end
|
|
109
|
-
puts "◆→終了:#{@titles['list']}←◆"
|
|
110
|
-
blank
|
|
111
120
|
end
|
|
112
121
|
|
|
113
122
|
def base_block(type, lines, caption = nil)
|
|
@@ -139,12 +148,24 @@ module ReVIEW
|
|
|
139
148
|
blank
|
|
140
149
|
end
|
|
141
150
|
|
|
151
|
+
def listnum(lines, id, caption, lang = nil)
|
|
152
|
+
blank
|
|
153
|
+
puts "◆→開始:#{@titles['list']}←◆"
|
|
154
|
+
begin
|
|
155
|
+
list_header(id, caption, lang)
|
|
156
|
+
rescue KeyError
|
|
157
|
+
error "no such list: #{id}"
|
|
158
|
+
end
|
|
159
|
+
blank
|
|
160
|
+
listnum_body(lines, lang)
|
|
161
|
+
puts "◆→終了:#{@titles['list']}←◆"
|
|
162
|
+
blank
|
|
163
|
+
end
|
|
164
|
+
|
|
142
165
|
def listnum_body(lines, _lang)
|
|
143
166
|
lines.each_with_index do |line, i|
|
|
144
167
|
puts((i + 1).to_s.rjust(2) + ": #{line}")
|
|
145
168
|
end
|
|
146
|
-
puts "◆→終了:#{@titles['list']}←◆"
|
|
147
|
-
blank
|
|
148
169
|
end
|
|
149
170
|
|
|
150
171
|
def image(lines, id, caption, metric = nil)
|
|
@@ -152,13 +173,9 @@ module ReVIEW
|
|
|
152
173
|
metrics = " #{metrics}" if metrics.present?
|
|
153
174
|
blank
|
|
154
175
|
puts "◆→開始:#{@titles['image']}←◆"
|
|
155
|
-
|
|
156
|
-
puts "#{I18n.t('image')}#{I18n.t('format_number', [get_chap, @chapter.image(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
|
157
|
-
else
|
|
158
|
-
puts "#{I18n.t('image')}#{I18n.t('format_number_without_chapter', [@chapter.image(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
|
159
|
-
end
|
|
176
|
+
image_header(id, caption)
|
|
160
177
|
blank
|
|
161
|
-
if @chapter.
|
|
178
|
+
if @chapter.image_bound?(id)
|
|
162
179
|
puts "◆→#{@chapter.image(id).path}#{metrics}←◆"
|
|
163
180
|
else
|
|
164
181
|
warn "image not bound: #{id}"
|
|
@@ -170,9 +187,38 @@ module ReVIEW
|
|
|
170
187
|
blank
|
|
171
188
|
end
|
|
172
189
|
|
|
190
|
+
def image_header(id, caption)
|
|
191
|
+
if get_chap
|
|
192
|
+
puts "#{I18n.t('image')}#{I18n.t('format_number', [get_chap, @chapter.image(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
|
193
|
+
else
|
|
194
|
+
puts "#{I18n.t('image')}#{I18n.t('format_number_without_chapter', [@chapter.image(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
173
198
|
def texequation(lines, id = nil, caption = '')
|
|
174
199
|
blank
|
|
175
200
|
puts "◆→開始:#{@titles['texequation']}←◆"
|
|
201
|
+
texequation_header(id, caption)
|
|
202
|
+
|
|
203
|
+
if @book.config['imgmath']
|
|
204
|
+
fontsize = @book.config['imgmath_options']['fontsize'].to_f
|
|
205
|
+
lineheight = @book.config['imgmath_options']['lineheight'].to_f
|
|
206
|
+
math_str = "\\begin{equation*}\n\\fontsize{#{fontsize}}{#{lineheight}}\\selectfont\n#{lines.join("\n")}\n\\end{equation*}\n"
|
|
207
|
+
key = Digest::SHA256.hexdigest(math_str)
|
|
208
|
+
math_dir = File.join(@book.config['imagedir'], '_review_math_text')
|
|
209
|
+
Dir.mkdir(math_dir) unless Dir.exist?(math_dir)
|
|
210
|
+
img_path = File.join(math_dir, "_gen_#{key}.#{@book.config['imgmath_options']['format']}")
|
|
211
|
+
defer_math_image(math_str, img_path, key)
|
|
212
|
+
puts "◆→math:#{File.basename(img_path)}←◆"
|
|
213
|
+
else
|
|
214
|
+
puts lines.join("\n")
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
puts "◆→終了:#{@titles['texequation']}←◆"
|
|
218
|
+
blank
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def texequation_header(id, caption)
|
|
176
222
|
if id
|
|
177
223
|
if get_chap
|
|
178
224
|
puts "#{I18n.t('equation')}#{I18n.t('format_number', [get_chap, @chapter.equation(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
|
@@ -180,49 +226,14 @@ module ReVIEW
|
|
|
180
226
|
puts "#{I18n.t('equation')}#{I18n.t('format_number_without_chapter', [@chapter.equation(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
|
181
227
|
end
|
|
182
228
|
end
|
|
183
|
-
puts lines.join("\n")
|
|
184
|
-
puts "◆→終了:#{@titles['texequation']}←◆"
|
|
185
|
-
blank
|
|
186
229
|
end
|
|
187
230
|
|
|
188
231
|
def table(lines, id = nil, caption = nil)
|
|
189
|
-
rows = []
|
|
190
|
-
sepidx = nil
|
|
191
|
-
lines.each_with_index do |line, idx|
|
|
192
|
-
if /\A[\=\-]{12}/ =~ line
|
|
193
|
-
# just ignore
|
|
194
|
-
# error "too many table separator" if sepidx
|
|
195
|
-
sepidx ||= idx
|
|
196
|
-
next
|
|
197
|
-
end
|
|
198
|
-
rows.push(line.strip.split(/\t+/).map { |s| s.sub(/\A\./, '') })
|
|
199
|
-
end
|
|
200
|
-
rows = adjust_n_cols(rows)
|
|
201
|
-
error 'no rows in the table' if rows.empty?
|
|
202
|
-
|
|
203
232
|
blank
|
|
204
233
|
puts "◆→開始:#{@titles['table']}←◆"
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
rescue KeyError
|
|
209
|
-
error "no such table: #{id}"
|
|
210
|
-
end
|
|
211
|
-
table_begin rows.first.size
|
|
212
|
-
if sepidx
|
|
213
|
-
sepidx.times do
|
|
214
|
-
tr(rows.shift.map { |s| th(s) })
|
|
215
|
-
end
|
|
216
|
-
rows.each do |cols|
|
|
217
|
-
tr(cols.map { |s| td(s) })
|
|
218
|
-
end
|
|
219
|
-
else
|
|
220
|
-
rows.each do |cols|
|
|
221
|
-
h, *cs = *cols
|
|
222
|
-
tr([th(h)] + cs.map { |s| td(s) })
|
|
223
|
-
end
|
|
224
|
-
end
|
|
225
|
-
table_end
|
|
234
|
+
super(lines, id, caption, true)
|
|
235
|
+
puts "◆→終了:#{@titles['table']}←◆"
|
|
236
|
+
blank
|
|
226
237
|
end
|
|
227
238
|
|
|
228
239
|
def th(str)
|
|
@@ -230,15 +241,13 @@ module ReVIEW
|
|
|
230
241
|
end
|
|
231
242
|
|
|
232
243
|
def table_end
|
|
233
|
-
puts "◆→終了:#{@titles['table']}←◆"
|
|
234
|
-
blank
|
|
235
244
|
end
|
|
236
245
|
|
|
237
246
|
def comment(lines, comment = nil)
|
|
238
247
|
return unless @book.config['draft']
|
|
239
248
|
lines ||= []
|
|
240
249
|
unless comment.blank?
|
|
241
|
-
lines.unshift
|
|
250
|
+
lines.unshift(comment)
|
|
242
251
|
end
|
|
243
252
|
str = lines.join("\n")
|
|
244
253
|
puts "◆→#{str}←◆"
|
|
@@ -359,7 +368,17 @@ module ReVIEW
|
|
|
359
368
|
end
|
|
360
369
|
|
|
361
370
|
def inline_m(str)
|
|
362
|
-
|
|
371
|
+
if @book.config['imgmath']
|
|
372
|
+
math_str = '$' + str + '$'
|
|
373
|
+
key = Digest::SHA256.hexdigest(str)
|
|
374
|
+
math_dir = File.join(@book.config['imagedir'], '_review_math_text')
|
|
375
|
+
Dir.mkdir(math_dir) unless Dir.exist?(math_dir)
|
|
376
|
+
img_path = File.join(math_dir, "_gen_#{key}.#{@book.config['imgmath_options']['format']}")
|
|
377
|
+
defer_math_image(math_str, img_path, key)
|
|
378
|
+
%Q(◆→TeX式ここから←◆◆→math:#{File.basename(img_path)}←◆◆→TeX式ここまで←◆)
|
|
379
|
+
else
|
|
380
|
+
%Q(◆→TeX式ここから←◆#{str}◆→TeX式ここまで←◆)
|
|
381
|
+
end
|
|
363
382
|
end
|
|
364
383
|
|
|
365
384
|
def bibpaper_header(id, caption)
|
data/lib/review/update.rb
CHANGED
|
@@ -20,14 +20,14 @@ module ReVIEW
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
# should be
|
|
23
|
-
TARGET_VERSION = '
|
|
23
|
+
TARGET_VERSION = '4.0'
|
|
24
24
|
EPUB_VERSION = '3'
|
|
25
25
|
HTML_VERSION = '5'
|
|
26
26
|
TEX_DOCUMENTCLASS = ['review-jsbook', 'review-jlreq']
|
|
27
27
|
TEX_DOCUMENTCLASS_BAD = ['jsbook', nil]
|
|
28
28
|
TEX_DOCUMENTCLASS_OPTS = 'media=print,paper=a5'
|
|
29
29
|
TEX_COMMAND = 'uplatex'
|
|
30
|
-
TEX_OPTIONS = '-interaction=nonstopmode -file-line-error'
|
|
30
|
+
TEX_OPTIONS = '-interaction=nonstopmode -file-line-error -halt-on-error'
|
|
31
31
|
DVI_COMMAND = 'dvipdfmx'
|
|
32
32
|
DVI_OPTIONS = '-d 5 -z 9'
|
|
33
33
|
|
|
@@ -126,7 +126,7 @@ module ReVIEW
|
|
|
126
126
|
content = File.read(yml)
|
|
127
127
|
content.gsub!(/^(\s*)#{key}:.*$/, '\1' + "#{key}: #{val}")
|
|
128
128
|
if @backup
|
|
129
|
-
FileUtils.mv
|
|
129
|
+
FileUtils.mv(yml, "#{yml}-old")
|
|
130
130
|
end
|
|
131
131
|
File.write(yml, content)
|
|
132
132
|
end
|
|
@@ -257,7 +257,7 @@ module ReVIEW
|
|
|
257
257
|
def update_rakefile(dir)
|
|
258
258
|
taskdir = File.join(dir, 'lib/tasks')
|
|
259
259
|
unless File.exist?(taskdir)
|
|
260
|
-
FileUtils.mkdir_p
|
|
260
|
+
FileUtils.mkdir_p(taskdir)
|
|
261
261
|
end
|
|
262
262
|
|
|
263
263
|
master_rakefile = File.join(@review_dir, 'samples/sample-book/src/Rakefile')
|
|
@@ -266,13 +266,13 @@ module ReVIEW
|
|
|
266
266
|
if File.exist?(target_rakefile)
|
|
267
267
|
if Digest::SHA256.hexdigest(File.read(target_rakefile)) != Digest::SHA256.hexdigest(File.read(master_rakefile))
|
|
268
268
|
if confirm('%s will be overridden with Re:VIEW version (%s). Do you really proceed?', ['Rakefile', master_rakefile])
|
|
269
|
-
FileUtils.mv
|
|
270
|
-
FileUtils.cp
|
|
269
|
+
FileUtils.mv(target_rakefile, "#{target_rakefile}-old")
|
|
270
|
+
FileUtils.cp(master_rakefile, target_rakefile)
|
|
271
271
|
end
|
|
272
272
|
end
|
|
273
273
|
else
|
|
274
274
|
@logger.info t('new file %s is created.', [target_rakefile]) unless @force
|
|
275
|
-
FileUtils.cp
|
|
275
|
+
FileUtils.cp(master_rakefile, target_rakefile)
|
|
276
276
|
end
|
|
277
277
|
|
|
278
278
|
master_rakefile = File.join(@review_dir, 'samples/sample-book/src/lib/tasks/review.rake')
|
|
@@ -280,13 +280,13 @@ module ReVIEW
|
|
|
280
280
|
if File.exist?(target_rakefile)
|
|
281
281
|
if Digest::SHA256.hexdigest(File.read(target_rakefile)) != Digest::SHA256.hexdigest(File.read(master_rakefile))
|
|
282
282
|
if confirm('%s will be overridden with Re:VIEW version (%s). Do you really proceed?', ['lib/tasks/review.rake', master_rakefile])
|
|
283
|
-
FileUtils.mv
|
|
284
|
-
FileUtils.cp
|
|
283
|
+
FileUtils.mv(target_rakefile, "#{target_rakefile}-old")
|
|
284
|
+
FileUtils.cp(master_rakefile, target_rakefile)
|
|
285
285
|
end
|
|
286
286
|
end
|
|
287
287
|
else
|
|
288
288
|
@logger.info t('new file %s is created.', [target_rakefile]) unless @force
|
|
289
|
-
FileUtils.cp
|
|
289
|
+
FileUtils.cp(master_rakefile, target_rakefile)
|
|
290
290
|
end
|
|
291
291
|
end
|
|
292
292
|
|
|
@@ -469,7 +469,7 @@ module ReVIEW
|
|
|
469
469
|
def update_tex_stys(template, dir)
|
|
470
470
|
texmacrodir = File.join(dir, 'sty')
|
|
471
471
|
unless File.exist?(texmacrodir)
|
|
472
|
-
FileUtils.mkdir
|
|
472
|
+
FileUtils.mkdir(texmacrodir)
|
|
473
473
|
end
|
|
474
474
|
|
|
475
475
|
tdir = File.join(@review_dir, 'templates/latex', template)
|
|
@@ -479,7 +479,7 @@ module ReVIEW
|
|
|
479
479
|
unless File.exist?(target_styfile)
|
|
480
480
|
# just copy
|
|
481
481
|
@logger.info t('new file %s is created.', [target_styfile]) unless @force
|
|
482
|
-
FileUtils.cp
|
|
482
|
+
FileUtils.cp(master_styfile, target_styfile)
|
|
483
483
|
next
|
|
484
484
|
end
|
|
485
485
|
if File.basename(target_styfile) == 'review-custom.sty'
|
|
@@ -492,20 +492,20 @@ module ReVIEW
|
|
|
492
492
|
end
|
|
493
493
|
|
|
494
494
|
if confirm('%s will be overridden with Re:VIEW version (%s). Do you really proceed?', [target_styfile, master_styfile])
|
|
495
|
-
FileUtils.mv
|
|
496
|
-
FileUtils.cp
|
|
495
|
+
FileUtils.mv(target_styfile, "#{target_styfile}-old")
|
|
496
|
+
FileUtils.cp(master_styfile, target_styfile)
|
|
497
497
|
end
|
|
498
498
|
end
|
|
499
499
|
|
|
500
500
|
if template == 'review-jsbook'
|
|
501
501
|
unless File.exist?(File.join(texmacrodir, 'jsbook.cls'))
|
|
502
502
|
@logger.info t('new file %s is created.', [File.join(texmacrodir, 'jsbook.cls')]) unless @force
|
|
503
|
-
FileUtils.cp
|
|
503
|
+
FileUtils.cp(File.join(@review_dir, 'vendor/jsclasses/jsbook.cls'), File.join(texmacrodir, 'jsbook.cls'))
|
|
504
504
|
end
|
|
505
505
|
|
|
506
506
|
unless File.exist?(File.join(texmacrodir, 'gentombow.sty'))
|
|
507
507
|
@logger.info t('new file %s is created.', [File.join(texmacrodir, 'gentombow.sty')]) unless @force
|
|
508
|
-
FileUtils.cp
|
|
508
|
+
FileUtils.cp(File.join(@review_dir, 'vendor/gentombow/gentombow.sty'), File.join(texmacrodir, 'gentombow.sty'))
|
|
509
509
|
end
|
|
510
510
|
end
|
|
511
511
|
end
|
data/lib/review/version.rb
CHANGED
data/lib/review/webmaker.rb
CHANGED
|
@@ -35,12 +35,12 @@ module ReVIEW
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def error(msg)
|
|
38
|
-
@logger.error
|
|
38
|
+
@logger.error msg
|
|
39
39
|
exit 1
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def warn(msg)
|
|
43
|
-
@logger.warn
|
|
43
|
+
@logger.warn msg
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def self.execute(*args)
|
data/lib/review/yamlloader.rb
CHANGED
|
@@ -18,6 +18,9 @@ module ReVIEW
|
|
|
18
18
|
while file_queue.present?
|
|
19
19
|
current_file = file_queue.shift
|
|
20
20
|
current_yaml = YAML.load_file(current_file)
|
|
21
|
+
if current_yaml.class == FalseClass
|
|
22
|
+
raise "#{File.basename(current_file)} is malformed."
|
|
23
|
+
end
|
|
21
24
|
yaml = current_yaml.deep_merge(yaml)
|
|
22
25
|
|
|
23
26
|
if yaml.key?('inherit')
|
data/review.gemspec
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
$LOAD_PATH.push
|
|
1
|
+
$LOAD_PATH.push(File.expand_path('lib', __dir__))
|
|
2
2
|
require 'review/version'
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |gem|
|
|
@@ -11,8 +11,8 @@ Gem::Specification.new do |gem|
|
|
|
11
11
|
gem.homepage = 'http://github.com/kmuto/review'
|
|
12
12
|
gem.summary = 'Re:VIEW: a easy-to-use digital publishing system'
|
|
13
13
|
gem.description = 'Re:VIEW is a digital publishing system for books and ebooks. It supports InDesign, EPUB and LaTeX.'
|
|
14
|
-
gem.required_rubygems_version = Gem::Requirement.new('>= 0') if gem.respond_to?
|
|
15
|
-
gem.date = '2019-
|
|
14
|
+
gem.required_rubygems_version = Gem::Requirement.new('>= 0') if gem.respond_to?(:required_rubygems_version=)
|
|
15
|
+
gem.date = '2019-10-29'
|
|
16
16
|
|
|
17
17
|
gem.files = `git ls-files`.split("\n")
|
|
18
18
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
@@ -29,4 +29,5 @@ Gem::Specification.new do |gem|
|
|
|
29
29
|
gem.add_development_dependency('rubocop-performance')
|
|
30
30
|
gem.add_development_dependency('simplecov')
|
|
31
31
|
gem.add_development_dependency('test-unit')
|
|
32
|
+
gem.add_development_dependency('unicode-eaw')
|
|
32
33
|
end
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Re:VIEW ( http://github.com/kmuto/review )で書籍データを作るためのサンプルファイルです。
|
|
4
4
|
|
|
5
|
-
必要なファイルはsrc
|
|
5
|
+
必要なファイルはsrcディレクトリ内にあります。srcディレクトリで以下のようにして各形式のファイルを生成できます。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- rake pdf: PDF (upLaTeXとdvipdfmxが必要です)
|
|
8
|
+
- rake epub: EPUB
|
|
9
|
+
- rake web: HTML Webページ
|
|
10
|
+
- rake text: テキストファイル
|
|
11
|
+
- rake plaintext: テキストファイル (装飾なし)
|
|
12
|
+
- rake idgxml: InDesign用XMLファイル
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/*.pdf
|
|
2
|
+
/*.epub
|
|
3
|
+
/*.html
|
|
4
|
+
/webroot
|
|
5
|
+
/*-pdf
|
|
6
|
+
/*-epub
|
|
7
|
+
/*-text
|
|
8
|
+
|
|
9
|
+
/vendor
|
|
10
|
+
/.bundle
|
|
11
|
+
|
|
12
|
+
# Created by https://www.gitignore.io/api/vim,linux,macos,emacs,windows
|
|
13
|
+
# Edit at https://www.gitignore.io/?templates=vim,linux,macos,emacs,windows
|
|
14
|
+
|
|
15
|
+
### Emacs ###
|
|
16
|
+
# -*- mode: gitignore; -*-
|
|
17
|
+
*~
|
|
18
|
+
\#*\#
|
|
19
|
+
/.emacs.desktop
|
|
20
|
+
/.emacs.desktop.lock
|
|
21
|
+
*.elc
|
|
22
|
+
auto-save-list
|
|
23
|
+
tramp
|
|
24
|
+
.\#*
|
|
25
|
+
|
|
26
|
+
# Org-mode
|
|
27
|
+
.org-id-locations
|
|
28
|
+
*_archive
|
|
29
|
+
|
|
30
|
+
# flymake-mode
|
|
31
|
+
*_flymake.*
|
|
32
|
+
|
|
33
|
+
# eshell files
|
|
34
|
+
/eshell/history
|
|
35
|
+
/eshell/lastdir
|
|
36
|
+
|
|
37
|
+
# elpa packages
|
|
38
|
+
/elpa/
|
|
39
|
+
|
|
40
|
+
# reftex files
|
|
41
|
+
*.rel
|
|
42
|
+
|
|
43
|
+
# AUCTeX auto folder
|
|
44
|
+
/auto/
|
|
45
|
+
|
|
46
|
+
# cask packages
|
|
47
|
+
.cask/
|
|
48
|
+
dist/
|
|
49
|
+
|
|
50
|
+
# Flycheck
|
|
51
|
+
flycheck_*.el
|
|
52
|
+
|
|
53
|
+
# server auth directory
|
|
54
|
+
/server/
|
|
55
|
+
|
|
56
|
+
# projectiles files
|
|
57
|
+
.projectile
|
|
58
|
+
|
|
59
|
+
# directory configuration
|
|
60
|
+
.dir-locals.el
|
|
61
|
+
|
|
62
|
+
# network security
|
|
63
|
+
/network-security.data
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Linux ###
|
|
67
|
+
|
|
68
|
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
|
69
|
+
.fuse_hidden*
|
|
70
|
+
|
|
71
|
+
# KDE directory preferences
|
|
72
|
+
.directory
|
|
73
|
+
|
|
74
|
+
# Linux trash folder which might appear on any partition or disk
|
|
75
|
+
.Trash-*
|
|
76
|
+
|
|
77
|
+
# .nfs files are created when an open file is removed but is still being accessed
|
|
78
|
+
.nfs*
|
|
79
|
+
|
|
80
|
+
### macOS ###
|
|
81
|
+
# General
|
|
82
|
+
.DS_Store
|
|
83
|
+
.AppleDouble
|
|
84
|
+
.LSOverride
|
|
85
|
+
|
|
86
|
+
# Icon must end with two \r
|
|
87
|
+
Icon
|
|
88
|
+
|
|
89
|
+
# Thumbnails
|
|
90
|
+
._*
|
|
91
|
+
|
|
92
|
+
# Files that might appear in the root of a volume
|
|
93
|
+
.DocumentRevisions-V100
|
|
94
|
+
.fseventsd
|
|
95
|
+
.Spotlight-V100
|
|
96
|
+
.TemporaryItems
|
|
97
|
+
.Trashes
|
|
98
|
+
.VolumeIcon.icns
|
|
99
|
+
.com.apple.timemachine.donotpresent
|
|
100
|
+
|
|
101
|
+
# Directories potentially created on remote AFP share
|
|
102
|
+
.AppleDB
|
|
103
|
+
.AppleDesktop
|
|
104
|
+
Network Trash Folder
|
|
105
|
+
Temporary Items
|
|
106
|
+
.apdisk
|
|
107
|
+
|
|
108
|
+
### Vim ###
|
|
109
|
+
# Swap
|
|
110
|
+
[._]*.s[a-v][a-z]
|
|
111
|
+
[._]*.sw[a-p]
|
|
112
|
+
[._]s[a-rt-v][a-z]
|
|
113
|
+
[._]ss[a-gi-z]
|
|
114
|
+
[._]sw[a-p]
|
|
115
|
+
|
|
116
|
+
# Session
|
|
117
|
+
Session.vim
|
|
118
|
+
Sessionx.vim
|
|
119
|
+
|
|
120
|
+
# Temporary
|
|
121
|
+
.netrwhist
|
|
122
|
+
# Auto-generated tag files
|
|
123
|
+
tags
|
|
124
|
+
# Persistent undo
|
|
125
|
+
[._]*.un~
|
|
126
|
+
|
|
127
|
+
### Windows ###
|
|
128
|
+
# Windows thumbnail cache files
|
|
129
|
+
Thumbs.db
|
|
130
|
+
Thumbs.db:encryptable
|
|
131
|
+
ehthumbs.db
|
|
132
|
+
ehthumbs_vista.db
|
|
133
|
+
|
|
134
|
+
# Dump file
|
|
135
|
+
*.stackdump
|
|
136
|
+
|
|
137
|
+
# Folder config file
|
|
138
|
+
[Dd]esktop.ini
|
|
139
|
+
|
|
140
|
+
# Recycle Bin used on file shares
|
|
141
|
+
$RECYCLE.BIN/
|
|
142
|
+
|
|
143
|
+
# Windows Installer files
|
|
144
|
+
*.cab
|
|
145
|
+
*.msi
|
|
146
|
+
*.msix
|
|
147
|
+
*.msm
|
|
148
|
+
*.msp
|
|
149
|
+
|
|
150
|
+
# Windows shortcuts
|
|
151
|
+
*.lnk
|
|
152
|
+
|
|
153
|
+
# End of https://www.gitignore.io/api/vim,linux,macos,emacs,windows
|