review 5.2.0 → 5.3.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/.github/workflows/ruby-win.yml +1 -1
- data/.rubocop.yml +3 -0
- data/NEWS.ja.md +53 -0
- data/NEWS.md +53 -0
- data/doc/format.ja.md +29 -3
- data/doc/format.md +32 -3
- data/lib/review/book/book_unit.rb +12 -2
- data/lib/review/book/index.rb +4 -1
- data/lib/review/builder.rb +51 -16
- data/lib/review/catalog.rb +1 -0
- data/lib/review/compiler.rb +4 -1
- data/lib/review/epubmaker/epubcommon.rb +4 -4
- data/lib/review/epubmaker.rb +3 -1
- data/lib/review/htmlbuilder.rb +24 -0
- data/lib/review/i18n.yml +6 -0
- data/lib/review/idgxmlbuilder.rb +21 -1
- data/lib/review/img_math.rb +1 -0
- data/lib/review/index_builder.rb +84 -18
- data/lib/review/latexbuilder.rb +16 -1
- data/lib/review/markdownbuilder.rb +10 -2
- data/lib/review/pdfmaker.rb +18 -3
- data/lib/review/plaintextbuilder.rb +3 -2
- data/lib/review/rstbuilder.rb +11 -2
- data/lib/review/textutils.rb +8 -7
- data/lib/review/tocprinter.rb +11 -6
- data/lib/review/topbuilder.rb +19 -1
- data/lib/review/version.rb +1 -1
- data/lib/review/volumeprinter.rb +9 -9
- data/samples/syntax-book/ch02.re +9 -0
- data/templates/latex/config.erb +3 -0
- data/templates/latex/review-jlreq/review-base.sty +2 -1
- data/templates/latex/review-jlreq/review-jlreq.cls +36 -3
- data/templates/latex/review-jsbook/review-base.sty +7 -1
- data/templates/latex/review-jsbook/review-jsbook.cls +31 -4
- data/test/assets/syntax_book_index_detail.txt +10 -8
- data/test/assets/test_template.tex +4 -1
- data/test/assets/test_template_backmatter.tex +4 -1
- data/test/test_book_chapter.rb +25 -2
- data/test/test_builder.rb +5 -3
- data/test/test_htmlbuilder.rb +42 -3
- data/test/test_idgxmlbuilder.rb +3 -3
- data/test/test_index.rb +30 -4
- data/test/test_latexbuilder.rb +17 -3
- data/test/test_markdownbuilder.rb +13 -0
- data/test/test_pdfmaker.rb +19 -0
- data/test/test_plaintextbuilder.rb +20 -4
- data/test/test_rstbuilder.rb +13 -0
- data/test/test_topbuilder.rb +18 -0
- metadata +2 -2
data/lib/review/index_builder.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2008-
|
|
1
|
+
# Copyright (c) 2008-2021 Minero Aoki, Kenshi Muto, Masayoshi Takahashi,
|
|
2
2
|
# KADO Masanori
|
|
3
3
|
#
|
|
4
4
|
# This program is free software.
|
|
@@ -13,7 +13,8 @@ require 'review/sec_counter'
|
|
|
13
13
|
|
|
14
14
|
module ReVIEW
|
|
15
15
|
class IndexBuilder < Builder
|
|
16
|
-
attr_reader :list_index, :table_index, :equation_index,
|
|
16
|
+
attr_reader :list_index, :table_index, :equation_index,
|
|
17
|
+
:footnote_index, :endnote_index,
|
|
17
18
|
:numberless_image_index, :image_index, :icon_index, :indepimage_index,
|
|
18
19
|
:headline_index, :column_index, :bibpaper_index
|
|
19
20
|
|
|
@@ -53,11 +54,16 @@ module ReVIEW
|
|
|
53
54
|
def builder_init_file
|
|
54
55
|
super
|
|
55
56
|
@headline_stack = []
|
|
57
|
+
@crossref = {
|
|
58
|
+
footnote: {},
|
|
59
|
+
endnote: {}
|
|
60
|
+
}
|
|
56
61
|
|
|
57
62
|
@list_index = ReVIEW::Book::ListIndex.new
|
|
58
63
|
@table_index = ReVIEW::Book::TableIndex.new
|
|
59
64
|
@equation_index = ReVIEW::Book::EquationIndex.new
|
|
60
65
|
@footnote_index = ReVIEW::Book::FootnoteIndex.new
|
|
66
|
+
@endnote_index = ReVIEW::Book::EndnoteIndex.new
|
|
61
67
|
@headline_index = ReVIEW::Book::HeadlineIndex.new(@chapter)
|
|
62
68
|
@column_index = ReVIEW::Book::ColumnIndex.new
|
|
63
69
|
@chapter_index = ReVIEW::Book::ChapterIndex.new
|
|
@@ -73,6 +79,14 @@ module ReVIEW
|
|
|
73
79
|
private :builder_init_file
|
|
74
80
|
|
|
75
81
|
def result
|
|
82
|
+
%i[footnote endnote].each do |name|
|
|
83
|
+
@crossref[name].each_pair do |k, v|
|
|
84
|
+
if v == 0
|
|
85
|
+
warn "#{@chapter.basename}: #{name} ID #{k} is not referred."
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
76
90
|
nil
|
|
77
91
|
end
|
|
78
92
|
|
|
@@ -100,6 +114,7 @@ module ReVIEW
|
|
|
100
114
|
|
|
101
115
|
item = ReVIEW::Book::Index::Item.new(item_id, @sec_counter.number_list, caption)
|
|
102
116
|
@headline_index.add_item(item)
|
|
117
|
+
compile_inline(caption)
|
|
103
118
|
end
|
|
104
119
|
|
|
105
120
|
def nonum_begin(level, label, caption)
|
|
@@ -247,56 +262,73 @@ module ReVIEW
|
|
|
247
262
|
|
|
248
263
|
alias_method :lead, :read
|
|
249
264
|
|
|
250
|
-
def list(
|
|
265
|
+
def list(lines, id, caption, _lang = nil)
|
|
251
266
|
check_id(id)
|
|
252
267
|
item = ReVIEW::Book::Index::Item.new(id, @list_index.size + 1)
|
|
253
268
|
@list_index.add_item(item)
|
|
269
|
+
compile_inline(caption)
|
|
270
|
+
lines.each { |line| compile_inline(line) }
|
|
254
271
|
end
|
|
255
272
|
|
|
256
|
-
def source(
|
|
273
|
+
def source(lines, caption = nil, _lang = nil)
|
|
274
|
+
compile_inline(caption)
|
|
275
|
+
lines.each { |line| compile_inline(line) }
|
|
257
276
|
end
|
|
258
277
|
|
|
259
|
-
def listnum(
|
|
278
|
+
def listnum(lines, id, caption, _lang = nil)
|
|
260
279
|
check_id(id)
|
|
261
280
|
item = ReVIEW::Book::Index::Item.new(id, @list_index.size + 1)
|
|
262
281
|
@list_index.add_item(item)
|
|
282
|
+
compile_inline(caption)
|
|
283
|
+
lines.each { |line| compile_inline(line) }
|
|
263
284
|
end
|
|
264
285
|
|
|
265
|
-
def emlist(lines, caption = nil,
|
|
286
|
+
def emlist(lines, caption = nil, _lang = nil)
|
|
287
|
+
compile_inline(caption)
|
|
288
|
+
lines.each { |line| compile_inline(line) }
|
|
266
289
|
end
|
|
267
290
|
|
|
268
|
-
def emlistnum(lines, caption = nil,
|
|
291
|
+
def emlistnum(lines, caption = nil, _lang = nil)
|
|
292
|
+
compile_inline(caption)
|
|
293
|
+
lines.each { |line| compile_inline(line) }
|
|
269
294
|
end
|
|
270
295
|
|
|
271
296
|
def cmd(lines, caption = nil)
|
|
297
|
+
compile_inline(caption)
|
|
298
|
+
lines.each { |line| compile_inline(line) }
|
|
272
299
|
end
|
|
273
300
|
|
|
274
301
|
def quote(lines)
|
|
302
|
+
lines.each { |line| compile_inline(line) }
|
|
275
303
|
end
|
|
276
304
|
|
|
277
305
|
def image(_lines, id, caption, _metric = nil)
|
|
278
306
|
check_id(id)
|
|
279
307
|
item = ReVIEW::Book::Index::Item.new(id, @image_index.size + 1, caption)
|
|
280
308
|
@image_index.add_item(item)
|
|
309
|
+
compile_inline(caption)
|
|
281
310
|
end
|
|
282
311
|
|
|
283
|
-
def table(
|
|
312
|
+
def table(lines, id = nil, caption = nil)
|
|
284
313
|
check_id(id)
|
|
285
314
|
if id
|
|
286
315
|
item = ReVIEW::Book::Index::Item.new(id, @table_index.size + 1, caption)
|
|
287
316
|
@table_index.add_item(item)
|
|
288
317
|
end
|
|
318
|
+
compile_inline(caption)
|
|
319
|
+
lines.each { |line| compile_inline(line) }
|
|
289
320
|
end
|
|
290
321
|
|
|
291
|
-
def emtable(_lines,
|
|
322
|
+
def emtable(_lines, caption = nil)
|
|
292
323
|
# item = ReVIEW::Book::TableIndex::Item.new(id, @table_index.size + 1)
|
|
293
324
|
# @table_index << item
|
|
325
|
+
compile_inline(caption)
|
|
294
326
|
end
|
|
295
327
|
|
|
296
328
|
def comment(lines, comment = nil)
|
|
297
329
|
end
|
|
298
330
|
|
|
299
|
-
def imgtable(_lines, id,
|
|
331
|
+
def imgtable(_lines, id, caption = nil, _metric = nil)
|
|
300
332
|
check_id(id)
|
|
301
333
|
item = ReVIEW::Book::Index::Item.new(id, @table_index.size + 1)
|
|
302
334
|
@table_index.add_item(item)
|
|
@@ -304,24 +336,37 @@ module ReVIEW
|
|
|
304
336
|
## to find image path
|
|
305
337
|
item = ReVIEW::Book::Index::Item.new(id, @indepimage_index.size + 1)
|
|
306
338
|
@indepimage_index.add_item(item)
|
|
339
|
+
compile_inline(caption)
|
|
307
340
|
end
|
|
308
341
|
|
|
309
342
|
def footnote(id, str)
|
|
310
343
|
check_id(id)
|
|
344
|
+
@crossref[:footnote][id] ||= 0
|
|
311
345
|
item = ReVIEW::Book::Index::Item.new(id, @footnote_index.size + 1, str)
|
|
312
346
|
@footnote_index.add_item(item)
|
|
347
|
+
compile_inline(str)
|
|
313
348
|
end
|
|
314
349
|
|
|
315
|
-
def
|
|
350
|
+
def endnote(id, str)
|
|
351
|
+
check_id(id)
|
|
352
|
+
@crossref[:endnote][id] ||= 0
|
|
353
|
+
item = ReVIEW::Book::Index::Item.new(id, @endnote_index.size + 1, str)
|
|
354
|
+
@endnote_index.add_item(item)
|
|
355
|
+
compile_inline(str)
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def indepimage(_lines, id, caption = '', _metric = nil)
|
|
316
359
|
check_id(id)
|
|
317
360
|
item = ReVIEW::Book::Index::Item.new(id, @indepimage_index.size + 1)
|
|
318
361
|
@indepimage_index.add_item(item)
|
|
362
|
+
compile_inline(caption)
|
|
319
363
|
end
|
|
320
364
|
|
|
321
|
-
def numberlessimage(_lines, id,
|
|
365
|
+
def numberlessimage(_lines, id, caption = '', _metric = nil)
|
|
322
366
|
check_id(id)
|
|
323
367
|
item = ReVIEW::Book::Index::Item.new(id, @indepimage_index.size + 1)
|
|
324
368
|
@indepimage_index.add_item(item)
|
|
369
|
+
compile_inline(caption)
|
|
325
370
|
end
|
|
326
371
|
|
|
327
372
|
def hr
|
|
@@ -334,10 +379,12 @@ module ReVIEW
|
|
|
334
379
|
def blankline
|
|
335
380
|
end
|
|
336
381
|
|
|
337
|
-
def flushright(
|
|
382
|
+
def flushright(lines)
|
|
383
|
+
lines.each { |line| compile_inline(line) }
|
|
338
384
|
end
|
|
339
385
|
|
|
340
386
|
def centering(lines)
|
|
387
|
+
lines.each { |line| compile_inline(line) }
|
|
341
388
|
end
|
|
342
389
|
|
|
343
390
|
def olnum(_num)
|
|
@@ -346,12 +393,16 @@ module ReVIEW
|
|
|
346
393
|
def pagebreak
|
|
347
394
|
end
|
|
348
395
|
|
|
349
|
-
def bpo(
|
|
396
|
+
def bpo(lines)
|
|
397
|
+
lines.each { |line| compile_inline(line) }
|
|
350
398
|
end
|
|
351
399
|
|
|
352
400
|
def noindent
|
|
353
401
|
end
|
|
354
402
|
|
|
403
|
+
def printendnotes
|
|
404
|
+
end
|
|
405
|
+
|
|
355
406
|
def compile_inline(s)
|
|
356
407
|
@compiler.text(s)
|
|
357
408
|
end
|
|
@@ -388,7 +439,13 @@ module ReVIEW
|
|
|
388
439
|
''
|
|
389
440
|
end
|
|
390
441
|
|
|
391
|
-
def inline_fn(
|
|
442
|
+
def inline_fn(id)
|
|
443
|
+
@crossref[:footnote][id] = @crossref[:footnote][id] ? @crossref[:footnote][id] + 1 : 1
|
|
444
|
+
''
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
def inline_endnote(id)
|
|
448
|
+
@crossref[:endnote][id] = @crossref[:endnote][id] ? @crossref[:endnote][id] + 1 : 1
|
|
392
449
|
''
|
|
393
450
|
end
|
|
394
451
|
|
|
@@ -464,10 +521,12 @@ module ReVIEW
|
|
|
464
521
|
''
|
|
465
522
|
end
|
|
466
523
|
|
|
467
|
-
def bibpaper(
|
|
524
|
+
def bibpaper(lines, id, caption)
|
|
468
525
|
check_id(id)
|
|
469
526
|
item = ReVIEW::Book::Index::Item.new(id, @bibpaper_index.size + 1, caption)
|
|
470
527
|
@bibpaper_index.add_item(item)
|
|
528
|
+
compile_inline(caption)
|
|
529
|
+
lines.each { |line| compile_inline(line) }
|
|
471
530
|
end
|
|
472
531
|
|
|
473
532
|
def inline_hd(_id)
|
|
@@ -602,12 +661,13 @@ module ReVIEW
|
|
|
602
661
|
# ignore in indexing
|
|
603
662
|
end
|
|
604
663
|
|
|
605
|
-
def texequation(_lines, id = nil,
|
|
664
|
+
def texequation(_lines, id = nil, caption = '')
|
|
606
665
|
check_id(id)
|
|
607
666
|
if id
|
|
608
667
|
item = ReVIEW::Book::Index::Item.new(id, @equation_index.size + 1)
|
|
609
668
|
@equation_index.add_item(item)
|
|
610
669
|
end
|
|
670
|
+
compile_inline(caption)
|
|
611
671
|
end
|
|
612
672
|
|
|
613
673
|
def get_chap(_chapter = nil)
|
|
@@ -618,10 +678,16 @@ module ReVIEW
|
|
|
618
678
|
''
|
|
619
679
|
end
|
|
620
680
|
|
|
621
|
-
def captionblock(_type,
|
|
681
|
+
def captionblock(_type, lines, caption, _specialstyle = nil)
|
|
682
|
+
compile_inline(caption)
|
|
683
|
+
lines.each { |line| compile_inline(line) }
|
|
622
684
|
''
|
|
623
685
|
end
|
|
624
686
|
|
|
687
|
+
def graph(lines, id, _command, caption = '')
|
|
688
|
+
image(lines, id, caption)
|
|
689
|
+
end
|
|
690
|
+
|
|
625
691
|
def tsize(_str)
|
|
626
692
|
''
|
|
627
693
|
end
|
data/lib/review/latexbuilder.rb
CHANGED
|
@@ -98,6 +98,8 @@ module ReVIEW
|
|
|
98
98
|
private :puts
|
|
99
99
|
|
|
100
100
|
def result
|
|
101
|
+
check_printendnotes
|
|
102
|
+
|
|
101
103
|
if @chapter.is_a?(ReVIEW::Book::Part) && !@book.config.check_version('2', exception: false)
|
|
102
104
|
puts '\end{reviewpart}'
|
|
103
105
|
end
|
|
@@ -1151,6 +1153,19 @@ module ReVIEW
|
|
|
1151
1153
|
app_error "unknown footnote: #{id}"
|
|
1152
1154
|
end
|
|
1153
1155
|
|
|
1156
|
+
def inline_endnote(id)
|
|
1157
|
+
macro('endnote', compile_inline(@chapter.endnote(id).content.strip))
|
|
1158
|
+
rescue KeyError
|
|
1159
|
+
app_error "unknown footnote: #{id}"
|
|
1160
|
+
end
|
|
1161
|
+
|
|
1162
|
+
def printendnotes
|
|
1163
|
+
@shown_endnotes = true
|
|
1164
|
+
blank
|
|
1165
|
+
puts '\theendnotes'
|
|
1166
|
+
blank
|
|
1167
|
+
end
|
|
1168
|
+
|
|
1154
1169
|
BOUTEN = '・'.freeze
|
|
1155
1170
|
|
|
1156
1171
|
def inline_bou(str)
|
|
@@ -1345,7 +1360,7 @@ module ReVIEW
|
|
|
1345
1360
|
end
|
|
1346
1361
|
|
|
1347
1362
|
def inline_tcy(str)
|
|
1348
|
-
macro('
|
|
1363
|
+
macro('reviewtcy', escape(str))
|
|
1349
1364
|
end
|
|
1350
1365
|
|
|
1351
1366
|
def inline_balloon(str)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2013-
|
|
1
|
+
# Copyright (c) 2013-2021 KADO Masanori, Masayoshi Takahashi, Kenshi Muto
|
|
2
2
|
#
|
|
3
3
|
# This program is free software.
|
|
4
4
|
# You can distribute or modify this program under the terms of
|
|
@@ -98,7 +98,7 @@ module ReVIEW
|
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
def ul_item_begin(lines)
|
|
101
|
-
puts ' ' * (@ul_indent - 1) + '* ' + join_lines_to_paragraph(lines)
|
|
101
|
+
puts (' ' * (@ul_indent - 1)) + '* ' + join_lines_to_paragraph(lines)
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
def ul_item_end
|
|
@@ -361,6 +361,14 @@ module ReVIEW
|
|
|
361
361
|
"[^#{id}]"
|
|
362
362
|
end
|
|
363
363
|
|
|
364
|
+
def inline_endnote(id)
|
|
365
|
+
"<sup>#{I18n.t('html_endnote_refmark', @chapter.endnote(id).number)}</sup>"
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
def endnote_item(id)
|
|
369
|
+
puts "#{I18n.t('html_endnote_textmark', @chapter.endnote(id).number)}#{compile_inline(@chapter.endnote(id).content)}"
|
|
370
|
+
end
|
|
371
|
+
|
|
364
372
|
def inline_br(_str)
|
|
365
373
|
"\n"
|
|
366
374
|
end
|
data/lib/review/pdfmaker.rb
CHANGED
|
@@ -318,12 +318,16 @@ module ReVIEW
|
|
|
318
318
|
end
|
|
319
319
|
|
|
320
320
|
def make_custom_page(file)
|
|
321
|
+
if file.nil?
|
|
322
|
+
return nil
|
|
323
|
+
end
|
|
324
|
+
|
|
321
325
|
file_sty = file.to_s.sub(/\.[^.]+\Z/, '.tex')
|
|
322
326
|
if File.exist?(file_sty)
|
|
323
|
-
|
|
327
|
+
File.read(file_sty)
|
|
328
|
+
else
|
|
329
|
+
warn "File #{file_sty} is not found."
|
|
324
330
|
end
|
|
325
|
-
|
|
326
|
-
nil
|
|
327
331
|
end
|
|
328
332
|
|
|
329
333
|
def join_with_separator(value, sep)
|
|
@@ -442,6 +446,10 @@ module ReVIEW
|
|
|
442
446
|
end
|
|
443
447
|
end
|
|
444
448
|
|
|
449
|
+
if @config['coverimage'] && !File.exist?(File.join(@config['imagedir'], @config['coverimage']))
|
|
450
|
+
raise ReVIEW::ConfigError, "coverimage #{@config['coverimage']} is not found."
|
|
451
|
+
end
|
|
452
|
+
|
|
445
453
|
@locale_latex = {}
|
|
446
454
|
part_tuple = I18n.get('part').split(/%[A-Za-z]{1,3}/, 2)
|
|
447
455
|
chapter_tuple = I18n.get('chapter').split(/%[A-Za-z]{1,3}/, 2)
|
|
@@ -486,6 +494,13 @@ module ReVIEW
|
|
|
486
494
|
template_path = 'layouts/layout.tex.erb'
|
|
487
495
|
end
|
|
488
496
|
ReVIEW::Template.generate(path: template_path, mode: '-', binding: binding, template_dir: template_dir)
|
|
497
|
+
rescue => e
|
|
498
|
+
if defined?(e.full_message)
|
|
499
|
+
error! "template or configuration error: #{e.full_message(highlight: false)}"
|
|
500
|
+
else
|
|
501
|
+
# <= Ruby 2.4
|
|
502
|
+
error! "template or configuration error: #{e.message}"
|
|
503
|
+
end
|
|
489
504
|
end
|
|
490
505
|
|
|
491
506
|
def copy_sty(dirname, copybase, extname = 'sty')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2018-
|
|
1
|
+
# Copyright (c) 2018-2021 Kenshi Muto
|
|
2
2
|
#
|
|
3
3
|
# This program is free software.
|
|
4
4
|
# You can distribute or modify this program under the terms of
|
|
@@ -74,6 +74,7 @@ module ReVIEW
|
|
|
74
74
|
private :blank
|
|
75
75
|
|
|
76
76
|
def result
|
|
77
|
+
check_printendnotes
|
|
77
78
|
solve_nest(@output.string)
|
|
78
79
|
end
|
|
79
80
|
|
|
@@ -89,7 +90,7 @@ module ReVIEW
|
|
|
89
90
|
clevel.pop
|
|
90
91
|
lines.push("\x01→END←\x01")
|
|
91
92
|
else
|
|
92
|
-
lines.push("\t" * clevel.size + l)
|
|
93
|
+
lines.push(("\t" * clevel.size) + l)
|
|
93
94
|
end
|
|
94
95
|
end
|
|
95
96
|
|
data/lib/review/rstbuilder.rb
CHANGED
|
@@ -86,6 +86,7 @@ module ReVIEW
|
|
|
86
86
|
private :blank
|
|
87
87
|
|
|
88
88
|
def result
|
|
89
|
+
check_printendnotes
|
|
89
90
|
solve_nest(@output.string)
|
|
90
91
|
end
|
|
91
92
|
|
|
@@ -124,7 +125,7 @@ module ReVIEW
|
|
|
124
125
|
end
|
|
125
126
|
|
|
126
127
|
def ul_item(lines)
|
|
127
|
-
puts ' ' * (@ul_indent - 1) + "* #{join_lines_to_paragraph(lines)}"
|
|
128
|
+
puts (' ' * (@ul_indent - 1)) + "* #{join_lines_to_paragraph(lines)}"
|
|
128
129
|
end
|
|
129
130
|
|
|
130
131
|
def ul_end
|
|
@@ -138,7 +139,7 @@ module ReVIEW
|
|
|
138
139
|
end
|
|
139
140
|
|
|
140
141
|
def ol_item(lines, _num)
|
|
141
|
-
puts ' ' * (@ol_indent - 1) + "#. #{join_lines_to_paragraph(lines)}"
|
|
142
|
+
puts (' ' * (@ol_indent - 1)) + "#. #{join_lines_to_paragraph(lines)}"
|
|
142
143
|
end
|
|
143
144
|
|
|
144
145
|
def ol_end
|
|
@@ -367,6 +368,14 @@ module ReVIEW
|
|
|
367
368
|
" [##{id.sub(' ', '_')}]_ "
|
|
368
369
|
end
|
|
369
370
|
|
|
371
|
+
def inline_endnote(id)
|
|
372
|
+
" [(#{@chapter.endnote(id).number})]_ "
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
def endnote_item(id)
|
|
376
|
+
puts ".. [(#{@chapter.endnote(id).number})] #{compile_inline(@chapter.endnote(id).content)}"
|
|
377
|
+
end
|
|
378
|
+
|
|
370
379
|
def compile_ruby(base, ruby)
|
|
371
380
|
" :ruby:`#{base}`<#{ruby}>`_ "
|
|
372
381
|
end
|
data/lib/review/textutils.rb
CHANGED
|
@@ -15,7 +15,7 @@ module ReVIEW
|
|
|
15
15
|
add = 0
|
|
16
16
|
len = nil
|
|
17
17
|
str.gsub("\t") do
|
|
18
|
-
len = ts - ($`.size + add) % ts
|
|
18
|
+
len = ts - (($`.size + add) % ts)
|
|
19
19
|
add += len - 1
|
|
20
20
|
' ' * len
|
|
21
21
|
end
|
|
@@ -72,12 +72,13 @@ module ReVIEW
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
# lazy than rule 3, but it looks better
|
|
75
|
-
if lazy
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
if lazy
|
|
76
|
+
if (%i[F W H].include?(Unicode::Eaw.property(tail)) &&
|
|
77
|
+
tail !~ /\p{Hangul}/) ||
|
|
78
|
+
(%i[F W H].include?(Unicode::Eaw.property(head)) &&
|
|
79
|
+
head !~ /\p{Hangul}/)
|
|
80
|
+
space = nil
|
|
81
|
+
end
|
|
81
82
|
end
|
|
82
83
|
end
|
|
83
84
|
space
|
data/lib/review/tocprinter.rb
CHANGED
|
@@ -69,12 +69,17 @@ module ReVIEW
|
|
|
69
69
|
|
|
70
70
|
def execute(*args)
|
|
71
71
|
parse_options(args)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
begin
|
|
73
|
+
@config = ReVIEW::Configure.create(yamlfile: @yamlfile)
|
|
74
|
+
@book = ReVIEW::Book::Base.new('.', config: @config)
|
|
75
|
+
unless File.readable?(@yamlfile)
|
|
76
|
+
raise ReVIEW::FileNotFound, "No such fiile or can't open #{@yamlfile}."
|
|
77
|
+
end
|
|
78
|
+
rescue ReVIEW::ConfigError, ReVIEW::FileNotFound, ReVIEW::CompileError, ReVIEW::ApplicationError => e
|
|
79
|
+
@logger.error e.message
|
|
76
80
|
exit 1
|
|
77
81
|
end
|
|
82
|
+
|
|
78
83
|
I18n.setup(@config['language'])
|
|
79
84
|
|
|
80
85
|
if @detail
|
|
@@ -226,9 +231,9 @@ module ReVIEW
|
|
|
226
231
|
|
|
227
232
|
case mode
|
|
228
233
|
when :list
|
|
229
|
-
(calc_linesize(line) - 1) / @book.page_metric.list.n_columns + 1
|
|
234
|
+
((calc_linesize(line) - 1) / @book.page_metric.list.n_columns) + 1
|
|
230
235
|
else # mode == :text
|
|
231
|
-
(calc_linesize(line) - 1) / @book.page_metric.text.n_columns + 1
|
|
236
|
+
((calc_linesize(line) - 1) / @book.page_metric.text.n_columns) + 1
|
|
232
237
|
end
|
|
233
238
|
end
|
|
234
239
|
|
data/lib/review/topbuilder.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2008-
|
|
1
|
+
# Copyright (c) 2008-2021 Minero Aoki, Kenshi Muto
|
|
2
2
|
# 2002-2006 Minero Aoki
|
|
3
3
|
#
|
|
4
4
|
# This program is free software.
|
|
@@ -290,6 +290,24 @@ module ReVIEW
|
|
|
290
290
|
app_error "unknown footnote: #{id}"
|
|
291
291
|
end
|
|
292
292
|
|
|
293
|
+
def inline_endnote(id)
|
|
294
|
+
"【後注#{@chapter.endnote(id).number}】"
|
|
295
|
+
rescue KeyError
|
|
296
|
+
app_error "unknown endnote: #{id}"
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
def endnote_begin
|
|
300
|
+
puts '◆→開始:後注←◆'
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
def endnote_end
|
|
304
|
+
puts '◆→終了:後注←◆'
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
def endnote_item(id)
|
|
308
|
+
puts "【後注#{@chapter.endnote(id).number}】#{compile_inline(@chapter.endnote(id).content)}"
|
|
309
|
+
end
|
|
310
|
+
|
|
293
311
|
def compile_ruby(base, ruby)
|
|
294
312
|
"#{base}◆→DTP連絡:「#{base}」に「#{ruby}」とルビ←◆"
|
|
295
313
|
end
|
data/lib/review/version.rb
CHANGED
data/lib/review/volumeprinter.rb
CHANGED
|
@@ -27,15 +27,15 @@ module ReVIEW
|
|
|
27
27
|
|
|
28
28
|
def execute(*args)
|
|
29
29
|
parse_options(args)
|
|
30
|
-
@config = ReVIEW::Configure.create(yamlfile: @yamlfile)
|
|
31
|
-
@book = ReVIEW::Book::Base.new('.', config: @config)
|
|
32
|
-
unless File.readable?(@yamlfile)
|
|
33
|
-
@logger.error("No such fiile or can't open #{@yamlfile}.")
|
|
34
|
-
exit 1
|
|
35
|
-
end
|
|
36
|
-
I18n.setup(@book.config['language'])
|
|
37
|
-
|
|
38
30
|
begin
|
|
31
|
+
@config = ReVIEW::Configure.create(yamlfile: @yamlfile)
|
|
32
|
+
@book = ReVIEW::Book::Base.new('.', config: @config)
|
|
33
|
+
unless File.readable?(@yamlfile)
|
|
34
|
+
raise ReVIEW::FileNotFound, "No such fiile or can't open #{@yamlfile}."
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
I18n.setup(@book.config['language'])
|
|
38
|
+
|
|
39
39
|
@book.each_part do |part|
|
|
40
40
|
if part.number
|
|
41
41
|
print_chapter_volume(part)
|
|
@@ -44,7 +44,7 @@ module ReVIEW
|
|
|
44
44
|
print_chapter_volume(chap)
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
|
-
rescue ReVIEW::FileNotFound, ReVIEW::CompileError, ReVIEW::ApplicationError => e
|
|
47
|
+
rescue ReVIEW::ConfigError, ReVIEW::FileNotFound, ReVIEW::CompileError, ReVIEW::ApplicationError => e
|
|
48
48
|
@logger.error e.message
|
|
49
49
|
exit 1
|
|
50
50
|
end
|
data/samples/syntax-book/ch02.re
CHANGED
|
@@ -254,6 +254,12 @@ Tips。@<b>{太字bold}@<i>{italicイタ}@<tt>{等幅code}
|
|
|
254
254
|
|
|
255
255
|
#@# doorquote、bpo、talk、graph、address、box、linebreak、pagebreak、hr、comment、abbr、acronym、dfn、kbd、q、samp、var、big、small、del、ins、recipe、dtp、raw、embed、include
|
|
256
256
|
|
|
257
|
+
== 後注
|
|
258
|
+
後注は脚注と同様の書式で、@<tt>{//endnote}で内容@<endnote>{end1}、@<tt>{@}@<tt>{<endnote>}で参照します@<endnote>{end2}。後注は@<tt>{//printendnotes}を書いた箇所にまとめて書き出されます。ここではファイル末尾に置いています。
|
|
259
|
+
|
|
260
|
+
//endnote[end1][後注その1です。]
|
|
261
|
+
//endnote[end2][後注その2です。]
|
|
262
|
+
|
|
257
263
|
== LaTeX式
|
|
258
264
|
LaTeX式はTeX紙面以外は保証されません。EPUBではMathML(@<tt>{math_format: mathml})を使えますが、表現や互換性が不足しており、LaTeXをバックエンドとして画像化する@<tt>{math_format: imgmath}のほうがよさそうです。
|
|
259
265
|
|
|
@@ -361,3 +367,6 @@ labelで定義したラベルへの参照の例です。EPUBだと@<href>{#inlin
|
|
|
361
367
|
@<hidx>{|}@<hidx>{{}@<hidx>$}$
|
|
362
368
|
|
|
363
369
|
idx, hidxいずれも=見出しの中には入れないようにし、後続の段落先頭にhidxで入れるように注意します(入れてしまうと目次などがおかしくなります)。
|
|
370
|
+
|
|
371
|
+
==== 後注
|
|
372
|
+
//printendnotes
|
data/templates/latex/config.erb
CHANGED
|
@@ -124,6 +124,9 @@
|
|
|
124
124
|
\ifdefined\reviewchapref\else% for 5.1.0 compatibility
|
|
125
125
|
\newcommand{\reviewchapref}[2]{\hyperref[##2]{##1}}
|
|
126
126
|
\fi
|
|
127
|
+
\ifdefined\reviewtcy\else% for 5.3.0 compatibility
|
|
128
|
+
\DeclareRobustCommand{\reviewtcy}[1]{\rensuji{##1}}
|
|
129
|
+
\fi
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
\makeatother
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
\ProvidesClass{review-base}[2021/06
|
|
1
|
+
\ProvidesClass{review-base}[2021/09/06]
|
|
2
2
|
% jlreq用基本設定
|
|
3
3
|
\def\recls@tmp{luatex}\ifx\recls@tmp\recls@driver
|
|
4
4
|
\hypersetup{
|
|
@@ -186,6 +186,7 @@
|
|
|
186
186
|
\DeclareRobustCommand{\reviewunderline}[1]{\underline{#1}}% ulemかjumolineで上書き。デフォルトはulemにしている
|
|
187
187
|
\DeclareRobustCommand{\reviewit}[1]{\textit{#1}}
|
|
188
188
|
\DeclareRobustCommand{\reviewbold}[1]{\textbf{#1}}
|
|
189
|
+
\DeclareRobustCommand{\reviewtcy}[1]{\tatechuyoko{#1}}
|
|
189
190
|
|
|
190
191
|
% allow break line in tt
|
|
191
192
|
% contributed by @zr_tex8r
|