review 5.0.0 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-tex.yml +35 -0
- data/.github/workflows/ruby-win.yml +8 -4
- data/.github/workflows/ruby.yml +6 -2
- data/.rubocop.yml +24 -9
- data/NEWS.ja.md +215 -0
- data/NEWS.md +215 -1
- data/README.md +7 -6
- data/Rakefile +7 -2
- data/bin/review +2 -4
- data/bin/review-catalog-converter +3 -3
- data/bin/review-check +6 -8
- data/bin/review-checkdep +1 -4
- data/bin/review-compile +10 -20
- data/bin/review-epub2html +1 -4
- data/bin/review-epubmaker +3 -4
- data/bin/review-idgxmlmaker +1 -3
- data/bin/review-index +11 -5
- data/bin/review-init +1 -4
- data/bin/review-pdfmaker +1 -3
- data/bin/review-preproc +30 -38
- data/bin/review-textmaker +1 -3
- data/bin/review-update +1 -4
- data/bin/review-validate +3 -3
- data/bin/review-vol +1 -4
- data/bin/review-webmaker +1 -3
- data/doc/config.yml.sample +23 -5
- data/doc/config.yml.sample-simple +1 -1
- data/doc/format.ja.md +49 -12
- data/doc/format.md +52 -12
- data/doc/quickstart.ja.md +11 -1
- data/doc/quickstart.md +11 -2
- data/doc/writing_vertical.ja.md +6 -0
- data/lib/review/book/base.rb +4 -0
- data/lib/review/book/book_unit.rb +15 -2
- data/lib/review/book/chapter.rb +3 -0
- data/lib/review/book/index.rb +5 -1
- data/lib/review/book/volume.rb +1 -0
- data/lib/review/builder.rb +90 -54
- data/lib/review/call_hook.rb +20 -0
- data/lib/review/catalog.rb +2 -0
- data/lib/review/compiler.rb +88 -52
- data/lib/review/configure.rb +64 -7
- data/lib/review/epubmaker/content.rb +113 -0
- data/lib/review/epubmaker/epubcommon.rb +372 -0
- data/lib/review/epubmaker/epubv2.rb +178 -0
- data/lib/review/epubmaker/epubv3.rb +231 -0
- data/lib/review/epubmaker/producer.rb +167 -0
- data/lib/review/epubmaker/reviewheaderlistener.rb +12 -2
- data/lib/review/epubmaker/zip_exporter.rb +84 -0
- data/lib/review/epubmaker.rb +114 -129
- data/lib/review/exception.rb +13 -0
- data/lib/review/htmlbuilder.rb +109 -67
- data/lib/review/htmlutils.rb +1 -1
- data/lib/review/i18n.rb +1 -0
- data/lib/review/i18n.yml +6 -0
- data/lib/review/idgxmlbuilder.rb +72 -48
- data/lib/review/idgxmlmaker.rb +15 -14
- data/lib/review/img_math.rb +239 -0
- data/lib/review/index_builder.rb +90 -32
- data/lib/review/init.rb +4 -4
- data/lib/review/latexbox.rb +58 -0
- data/lib/review/latexbuilder.rb +79 -58
- data/lib/review/latexutils.rb +9 -1
- data/lib/review/lineinput.rb +112 -2
- data/lib/review/loggable.rb +27 -0
- data/lib/review/logger.rb +89 -2
- data/lib/review/makerhelper.rb +7 -206
- data/lib/review/markdownbuilder.rb +44 -4
- data/lib/review/pdfmaker.rb +70 -51
- data/lib/review/plaintextbuilder.rb +20 -11
- data/lib/review/preprocessor/directive.rb +35 -0
- data/lib/review/preprocessor/line.rb +34 -0
- data/lib/review/preprocessor/repository.rb +177 -0
- data/lib/review/preprocessor.rb +105 -301
- data/lib/review/rstbuilder.rb +13 -4
- data/lib/review/sec_counter.rb +1 -0
- data/lib/review/template.rb +11 -1
- data/lib/review/textmaker.rb +23 -20
- data/lib/review/textutils.rb +10 -17
- data/lib/review/tocprinter.rb +93 -71
- data/lib/review/topbuilder.rb +44 -19
- data/lib/review/update.rb +5 -6
- data/lib/review/version.rb +1 -1
- data/lib/review/volumeprinter.rb +11 -12
- data/lib/review/webmaker.rb +31 -27
- data/lib/review/webtocprinter.rb +10 -9
- data/lib/review/yamlloader.rb +2 -1
- data/lib/review.rb +1 -1
- data/review.gemspec +5 -3
- data/samples/sample-book/src/config-epub2.yml +1 -1
- data/samples/sample-book/src/config.yml +1 -1
- data/samples/sample-book/src/lib/tasks/review.rake +19 -1
- data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +2 -1
- data/samples/syntax-book/ch01.re +1 -1
- data/samples/syntax-book/ch02.re +30 -6
- data/samples/syntax-book/ch03.re +1 -1
- data/samples/syntax-book/images/img3-2.png +0 -0
- data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +2 -1
- data/templates/html/_colophon.html.erb +23 -0
- data/templates/html/_colophon_history.html.erb +9 -0
- data/templates/html/_cover.html.erb +10 -0
- data/templates/html/_part_body.html.erb +6 -0
- data/templates/html/_titlepage.html.erb +20 -0
- data/templates/html/layout-html5.html.erb +6 -0
- data/templates/html/layout-xhtml1.html.erb +6 -0
- data/templates/latex/config.erb +11 -0
- data/templates/latex/review-jlreq/review-base.sty +7 -9
- data/templates/latex/review-jlreq/review-jlreq.cls +48 -6
- data/templates/latex/review-jlreq/review-style.sty +6 -1
- data/templates/latex/review-jlreq/review-tcbox.sty +348 -0
- data/templates/latex/review-jlreq/reviewmacro.sty +5 -0
- data/templates/latex/review-jsbook/review-base.sty +13 -9
- data/templates/latex/review-jsbook/review-jsbook.cls +41 -6
- data/templates/latex/review-jsbook/review-style.sty +6 -1
- data/templates/latex/review-jsbook/review-tcbox.sty +348 -0
- data/templates/latex/review-jsbook/reviewmacro.sty +5 -0
- data/templates/opf/epubv2.opf.erb +7 -7
- data/templates/opf/epubv3.opf.erb +7 -7
- data/templates/opf/opf_manifest_epubv2.opf.erb +10 -0
- data/templates/opf/opf_manifest_epubv3.opf.erb +10 -0
- data/templates/opf/opf_metainfo_epubv2.opf.erb +17 -0
- data/templates/opf/opf_metainfo_epubv3.opf.erb +49 -0
- data/templates/opf/opf_tocx_epubv2.opf.erb +9 -0
- data/templates/opf/opf_tocx_epubv3.opf.erb +17 -0
- data/templates/web/html/layout-html5.html.erb +6 -5
- data/templates/web/html/layout-xhtml1.html.erb +6 -0
- data/test/assets/header_listener.html +35 -0
- data/test/assets/img_math/img1.png +0 -0
- data/test/assets/img_math/img2.png +0 -0
- data/test/assets/img_math/img3.png +0 -0
- data/test/assets/syntax_book_index_detail.txt +60 -0
- data/test/assets/test_template.tex +7 -1
- data/test/assets/test_template_backmatter.tex +7 -1
- data/test/run_test.rb +1 -1
- data/test/test_book_chapter.rb +27 -4
- data/test/test_builder.rb +10 -8
- data/test/test_catalog_converter_cmd.rb +1 -1
- data/test/test_epub3maker.rb +168 -124
- data/test/test_epubmaker.rb +248 -131
- data/test/test_epubmaker_cmd.rb +15 -4
- data/test/test_helper.rb +5 -4
- data/test/test_htmlbuilder.rb +170 -31
- data/test/test_idgxmlbuilder.rb +44 -23
- data/test/test_idgxmlmaker_cmd.rb +7 -3
- data/test/test_img_math.rb +111 -0
- data/test/test_index.rb +30 -4
- data/test/test_indexbuilder.rb +5 -5
- data/test/test_latexbuilder.rb +151 -26
- data/test/test_latexbuilder_v2.rb +18 -10
- data/test/test_lineinput.rb +20 -93
- data/test/test_markdownbuilder.rb +42 -0
- data/test/test_pdfmaker.rb +90 -0
- data/test/test_pdfmaker_cmd.rb +2 -2
- data/test/test_plaintextbuilder.rb +56 -40
- data/test/test_preprocessor.rb +188 -1
- data/test/test_reviewheaderlistener.rb +49 -0
- data/test/test_rstbuilder.rb +13 -0
- data/test/test_template.rb +12 -2
- data/test/test_textmaker_cmd.rb +5 -1
- data/test/test_tocprinter.rb +46 -0
- data/test/test_topbuilder.rb +50 -19
- data/test/test_update.rb +34 -34
- data/test/test_zip_exporter.rb +5 -6
- metadata +95 -17
- data/lib/epubmaker/content.rb +0 -111
- data/lib/epubmaker/epubcommon.rb +0 -449
- data/lib/epubmaker/epubv2.rb +0 -142
- data/lib/epubmaker/epubv3.rb +0 -235
- data/lib/epubmaker/producer.rb +0 -375
- data/lib/epubmaker/zip_exporter.rb +0 -81
- data/lib/epubmaker.rb +0 -23
- data/lib/lineinput.rb +0 -155
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
|
|
@@ -24,9 +25,9 @@ module ReVIEW
|
|
24
25
|
def check_id(id)
|
25
26
|
if id
|
26
27
|
if id =~ %r![#%\\{}\[\]~/$'"|*?&<>`\s]!
|
27
|
-
warn "deprecated ID: `#{$&}` in `#{id}`"
|
28
|
+
warn "deprecated ID: `#{$&}` in `#{id}`", location: location
|
28
29
|
elsif id.start_with?('.')
|
29
|
-
warn "deprecated ID: `#{id}` begins from `.`"
|
30
|
+
warn "deprecated ID: `#{id}` begins from `.`", location: location
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
@@ -51,14 +52,18 @@ module ReVIEW
|
|
51
52
|
end
|
52
53
|
|
53
54
|
def builder_init_file
|
54
|
-
|
55
|
-
|
55
|
+
super
|
56
56
|
@headline_stack = []
|
57
|
+
@crossref = {
|
58
|
+
footnote: {},
|
59
|
+
endnote: {}
|
60
|
+
}
|
57
61
|
|
58
62
|
@list_index = ReVIEW::Book::ListIndex.new
|
59
63
|
@table_index = ReVIEW::Book::TableIndex.new
|
60
64
|
@equation_index = ReVIEW::Book::EquationIndex.new
|
61
65
|
@footnote_index = ReVIEW::Book::FootnoteIndex.new
|
66
|
+
@endnote_index = ReVIEW::Book::EndnoteIndex.new
|
62
67
|
@headline_index = ReVIEW::Book::HeadlineIndex.new(@chapter)
|
63
68
|
@column_index = ReVIEW::Book::ColumnIndex.new
|
64
69
|
@chapter_index = ReVIEW::Book::ChapterIndex.new
|
@@ -74,6 +79,14 @@ module ReVIEW
|
|
74
79
|
private :builder_init_file
|
75
80
|
|
76
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
|
+
|
77
90
|
nil
|
78
91
|
end
|
79
92
|
|
@@ -101,6 +114,7 @@ module ReVIEW
|
|
101
114
|
|
102
115
|
item = ReVIEW::Book::Index::Item.new(item_id, @sec_counter.number_list, caption)
|
103
116
|
@headline_index.add_item(item)
|
117
|
+
compile_inline(caption)
|
104
118
|
end
|
105
119
|
|
106
120
|
def nonum_begin(level, label, caption)
|
@@ -248,56 +262,73 @@ module ReVIEW
|
|
248
262
|
|
249
263
|
alias_method :lead, :read
|
250
264
|
|
251
|
-
def list(
|
265
|
+
def list(lines, id, caption, _lang = nil)
|
252
266
|
check_id(id)
|
253
267
|
item = ReVIEW::Book::Index::Item.new(id, @list_index.size + 1)
|
254
268
|
@list_index.add_item(item)
|
269
|
+
compile_inline(caption)
|
270
|
+
lines.each { |line| compile_inline(line) }
|
255
271
|
end
|
256
272
|
|
257
|
-
def source(
|
273
|
+
def source(lines, caption = nil, _lang = nil)
|
274
|
+
compile_inline(caption)
|
275
|
+
lines.each { |line| compile_inline(line) }
|
258
276
|
end
|
259
277
|
|
260
|
-
def listnum(
|
278
|
+
def listnum(lines, id, caption, _lang = nil)
|
261
279
|
check_id(id)
|
262
280
|
item = ReVIEW::Book::Index::Item.new(id, @list_index.size + 1)
|
263
281
|
@list_index.add_item(item)
|
282
|
+
compile_inline(caption)
|
283
|
+
lines.each { |line| compile_inline(line) }
|
264
284
|
end
|
265
285
|
|
266
|
-
def emlist(lines, caption = nil,
|
286
|
+
def emlist(lines, caption = nil, _lang = nil)
|
287
|
+
compile_inline(caption)
|
288
|
+
lines.each { |line| compile_inline(line) }
|
267
289
|
end
|
268
290
|
|
269
|
-
def emlistnum(lines, caption = nil,
|
291
|
+
def emlistnum(lines, caption = nil, _lang = nil)
|
292
|
+
compile_inline(caption)
|
293
|
+
lines.each { |line| compile_inline(line) }
|
270
294
|
end
|
271
295
|
|
272
296
|
def cmd(lines, caption = nil)
|
297
|
+
compile_inline(caption)
|
298
|
+
lines.each { |line| compile_inline(line) }
|
273
299
|
end
|
274
300
|
|
275
301
|
def quote(lines)
|
302
|
+
lines.each { |line| compile_inline(line) }
|
276
303
|
end
|
277
304
|
|
278
305
|
def image(_lines, id, caption, _metric = nil)
|
279
306
|
check_id(id)
|
280
307
|
item = ReVIEW::Book::Index::Item.new(id, @image_index.size + 1, caption)
|
281
308
|
@image_index.add_item(item)
|
309
|
+
compile_inline(caption)
|
282
310
|
end
|
283
311
|
|
284
|
-
def table(
|
312
|
+
def table(lines, id = nil, caption = nil)
|
285
313
|
check_id(id)
|
286
314
|
if id
|
287
315
|
item = ReVIEW::Book::Index::Item.new(id, @table_index.size + 1, caption)
|
288
316
|
@table_index.add_item(item)
|
289
317
|
end
|
318
|
+
compile_inline(caption)
|
319
|
+
lines.each { |line| compile_inline(line) }
|
290
320
|
end
|
291
321
|
|
292
|
-
def emtable(_lines,
|
322
|
+
def emtable(_lines, caption = nil)
|
293
323
|
# item = ReVIEW::Book::TableIndex::Item.new(id, @table_index.size + 1)
|
294
324
|
# @table_index << item
|
325
|
+
compile_inline(caption)
|
295
326
|
end
|
296
327
|
|
297
328
|
def comment(lines, comment = nil)
|
298
329
|
end
|
299
330
|
|
300
|
-
def imgtable(_lines, id,
|
331
|
+
def imgtable(_lines, id, caption = nil, _metric = nil)
|
301
332
|
check_id(id)
|
302
333
|
item = ReVIEW::Book::Index::Item.new(id, @table_index.size + 1)
|
303
334
|
@table_index.add_item(item)
|
@@ -305,24 +336,37 @@ module ReVIEW
|
|
305
336
|
## to find image path
|
306
337
|
item = ReVIEW::Book::Index::Item.new(id, @indepimage_index.size + 1)
|
307
338
|
@indepimage_index.add_item(item)
|
339
|
+
compile_inline(caption)
|
308
340
|
end
|
309
341
|
|
310
342
|
def footnote(id, str)
|
311
343
|
check_id(id)
|
344
|
+
@crossref[:footnote][id] ||= 0
|
312
345
|
item = ReVIEW::Book::Index::Item.new(id, @footnote_index.size + 1, str)
|
313
346
|
@footnote_index.add_item(item)
|
347
|
+
compile_inline(str)
|
314
348
|
end
|
315
349
|
|
316
|
-
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)
|
317
359
|
check_id(id)
|
318
360
|
item = ReVIEW::Book::Index::Item.new(id, @indepimage_index.size + 1)
|
319
361
|
@indepimage_index.add_item(item)
|
362
|
+
compile_inline(caption)
|
320
363
|
end
|
321
364
|
|
322
|
-
def numberlessimage(_lines, id,
|
365
|
+
def numberlessimage(_lines, id, caption = '', _metric = nil)
|
323
366
|
check_id(id)
|
324
367
|
item = ReVIEW::Book::Index::Item.new(id, @indepimage_index.size + 1)
|
325
368
|
@indepimage_index.add_item(item)
|
369
|
+
compile_inline(caption)
|
326
370
|
end
|
327
371
|
|
328
372
|
def hr
|
@@ -335,10 +379,12 @@ module ReVIEW
|
|
335
379
|
def blankline
|
336
380
|
end
|
337
381
|
|
338
|
-
def flushright(
|
382
|
+
def flushright(lines)
|
383
|
+
lines.each { |line| compile_inline(line) }
|
339
384
|
end
|
340
385
|
|
341
386
|
def centering(lines)
|
387
|
+
lines.each { |line| compile_inline(line) }
|
342
388
|
end
|
343
389
|
|
344
390
|
def olnum(_num)
|
@@ -347,12 +393,16 @@ module ReVIEW
|
|
347
393
|
def pagebreak
|
348
394
|
end
|
349
395
|
|
350
|
-
def bpo(
|
396
|
+
def bpo(lines)
|
397
|
+
lines.each { |line| compile_inline(line) }
|
351
398
|
end
|
352
399
|
|
353
400
|
def noindent
|
354
401
|
end
|
355
402
|
|
403
|
+
def printendnotes
|
404
|
+
end
|
405
|
+
|
356
406
|
def compile_inline(s)
|
357
407
|
@compiler.text(s)
|
358
408
|
end
|
@@ -389,7 +439,13 @@ module ReVIEW
|
|
389
439
|
''
|
390
440
|
end
|
391
441
|
|
392
|
-
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
|
393
449
|
''
|
394
450
|
end
|
395
451
|
|
@@ -465,10 +521,12 @@ module ReVIEW
|
|
465
521
|
''
|
466
522
|
end
|
467
523
|
|
468
|
-
def bibpaper(
|
524
|
+
def bibpaper(lines, id, caption)
|
469
525
|
check_id(id)
|
470
526
|
item = ReVIEW::Book::Index::Item.new(id, @bibpaper_index.size + 1, caption)
|
471
527
|
@bibpaper_index.add_item(item)
|
528
|
+
compile_inline(caption)
|
529
|
+
lines.each { |line| compile_inline(line) }
|
472
530
|
end
|
473
531
|
|
474
532
|
def inline_hd(_id)
|
@@ -598,24 +656,18 @@ module ReVIEW
|
|
598
656
|
''
|
599
657
|
end
|
600
658
|
|
601
|
-
|
602
|
-
|
659
|
+
## override
|
660
|
+
def error(msg = nil)
|
661
|
+
# ignore in indexing
|
603
662
|
end
|
604
663
|
|
605
|
-
def
|
606
|
-
if msg =~ /builder does not support command/
|
607
|
-
# ignore
|
608
|
-
return
|
609
|
-
end
|
610
|
-
super
|
611
|
-
end
|
612
|
-
|
613
|
-
def texequation(_lines, id = nil, _caption = '')
|
664
|
+
def texequation(_lines, id = nil, caption = '')
|
614
665
|
check_id(id)
|
615
666
|
if id
|
616
667
|
item = ReVIEW::Book::Index::Item.new(id, @equation_index.size + 1)
|
617
668
|
@equation_index.add_item(item)
|
618
669
|
end
|
670
|
+
compile_inline(caption)
|
619
671
|
end
|
620
672
|
|
621
673
|
def get_chap(_chapter = nil)
|
@@ -626,10 +678,16 @@ module ReVIEW
|
|
626
678
|
''
|
627
679
|
end
|
628
680
|
|
629
|
-
def captionblock(_type,
|
681
|
+
def captionblock(_type, lines, caption, _specialstyle = nil)
|
682
|
+
compile_inline(caption)
|
683
|
+
lines.each { |line| compile_inline(line) }
|
630
684
|
''
|
631
685
|
end
|
632
686
|
|
687
|
+
def graph(lines, id, _command, caption = '')
|
688
|
+
image(lines, id, caption)
|
689
|
+
end
|
690
|
+
|
633
691
|
def tsize(_str)
|
634
692
|
''
|
635
693
|
end
|
data/lib/review/init.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2018-
|
2
|
+
# Copyright (c) 2018-2021 Masanori Kado, Masayoshi Takahashi, Kenshi Muto
|
3
3
|
#
|
4
4
|
# This program is free software.
|
5
5
|
# You can distribute or modify this program under the terms of
|
@@ -209,9 +209,9 @@ EOT
|
|
209
209
|
FileUtils.cp(Dir.glob(File.join(tdir, '*.*')), texmacrodir)
|
210
210
|
|
211
211
|
if @template == 'review-jsbook'
|
212
|
-
# provide jsbook from vendor/. current version is
|
212
|
+
# provide jsbook from vendor/. current version is 2020/10/09
|
213
213
|
FileUtils.cp(File.join(@review_dir, 'vendor/jsclasses/jsbook.cls'), File.join(texmacrodir, 'jsbook.cls'))
|
214
|
-
# provide gentombow from vendor/. current version is
|
214
|
+
# provide gentombow from vendor/. current version is 2019/07/21 v0.9k
|
215
215
|
FileUtils.cp(File.join(@review_dir, 'vendor/gentombow/gentombow.sty'), File.join(texmacrodir, 'gentombow.sty'))
|
216
216
|
end
|
217
217
|
end
|
@@ -286,7 +286,7 @@ EOS
|
|
286
286
|
begin
|
287
287
|
Zip::File.open(filename) do |zip|
|
288
288
|
zip.each do |entry|
|
289
|
-
fname = entry.name.
|
289
|
+
fname = entry.name.tr('\\', '/')
|
290
290
|
if fname =~ /__MACOSX/ || fname =~ /\.DS_Store/
|
291
291
|
next
|
292
292
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Copyright (c) 2021 Kenshi Muto
|
2
|
+
#
|
3
|
+
# This program is free software.
|
4
|
+
# You can distribute or modify this program under the terms of
|
5
|
+
# the GNU LGPL, Lesser General Public License version 2.1.
|
6
|
+
# For details of the GNU LGPL, see the file "COPYING".
|
7
|
+
#
|
8
|
+
require 'review/logger'
|
9
|
+
module ReVIEW
|
10
|
+
class LaTeXBox
|
11
|
+
def initialize
|
12
|
+
@logger = ReVIEW.logger
|
13
|
+
end
|
14
|
+
|
15
|
+
def tcbox(config)
|
16
|
+
ret = ''
|
17
|
+
|
18
|
+
%w[column note memo tip info warning important caution notice].each do |name|
|
19
|
+
if config['pdfmaker'].nil? || config['pdfmaker']['boxsetting'].nil? ||
|
20
|
+
config['pdfmaker']['boxsetting'][name].nil? ||
|
21
|
+
config['pdfmaker']['boxsetting'][name]['style'].nil?
|
22
|
+
next
|
23
|
+
end
|
24
|
+
|
25
|
+
options = '[]'
|
26
|
+
options_with_caption = '[]'
|
27
|
+
if config['pdfmaker']['boxsetting'][name]['options']
|
28
|
+
options = "[#{config['pdfmaker']['boxsetting'][name]['options']}]"
|
29
|
+
options_with_caption = options
|
30
|
+
end
|
31
|
+
|
32
|
+
if config['pdfmaker']['boxsetting'][name]['options_with_caption']
|
33
|
+
options_with_caption = "[#{config['pdfmaker']['boxsetting'][name]['options_with_caption']}]"
|
34
|
+
end
|
35
|
+
|
36
|
+
ret << <<EOT
|
37
|
+
\\renewenvironment{review#{name}}[1][]{%
|
38
|
+
\\csdef{rv@tmp@withcaption}{true}
|
39
|
+
\\notblank{##1}{
|
40
|
+
\\begin{rv@#{config['pdfmaker']['boxsetting'][name]['style']}@caption}{##1}#{options_with_caption}
|
41
|
+
}{
|
42
|
+
\\csundef{rv@tmp@withcaption}
|
43
|
+
\\begin{rv@#{config['pdfmaker']['boxsetting'][name]['style']}@nocaption}#{options}
|
44
|
+
}
|
45
|
+
}{
|
46
|
+
\\ifcsdef{rv@tmp@withcaption}{
|
47
|
+
\\end{rv@#{config['pdfmaker']['boxsetting'][name]['style']}@caption}
|
48
|
+
}{
|
49
|
+
\\end{rv@#{config['pdfmaker']['boxsetting'][name]['style']}@nocaption}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
EOT
|
53
|
+
end
|
54
|
+
|
55
|
+
ret
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|