review 5.2.0 → 5.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-tex.yml +1 -1
  3. data/.github/workflows/ruby-win.yml +1 -1
  4. data/.github/workflows/ruby.yml +1 -1
  5. data/.rubocop.yml +1 -319
  6. data/NEWS.ja.md +116 -0
  7. data/NEWS.md +117 -0
  8. data/README.md +9 -8
  9. data/bin/review +1 -1
  10. data/bin/review-catalog-converter +15 -15
  11. data/bin/review-check +7 -7
  12. data/bin/review-compile +6 -8
  13. data/bin/review-index +1 -1
  14. data/bin/review-preproc +1 -1
  15. data/bin/review-validate +2 -2
  16. data/doc/config.yml.sample +7 -1
  17. data/doc/config.yml.sample-simple +1 -1
  18. data/doc/format.ja.md +34 -4
  19. data/doc/format.md +32 -3
  20. data/lib/review/book/base.rb +3 -3
  21. data/lib/review/book/book_unit.rb +13 -3
  22. data/lib/review/book/chapter.rb +1 -1
  23. data/lib/review/book/index.rb +7 -4
  24. data/lib/review/book/part.rb +12 -13
  25. data/lib/review/book/volume.rb +1 -1
  26. data/lib/review/builder.rb +82 -28
  27. data/lib/review/catalog.rb +6 -5
  28. data/lib/review/compiler.rb +20 -14
  29. data/lib/review/configure.rb +5 -2
  30. data/lib/review/epub2html.rb +12 -12
  31. data/lib/review/epubmaker/content.rb +1 -1
  32. data/lib/review/epubmaker/epubcommon.rb +47 -45
  33. data/lib/review/epubmaker/epubv2.rb +2 -1
  34. data/lib/review/epubmaker/epubv3.rb +5 -4
  35. data/lib/review/epubmaker/producer.rb +3 -3
  36. data/lib/review/epubmaker/reviewheaderlistener.rb +1 -1
  37. data/lib/review/epubmaker.rb +35 -32
  38. data/lib/review/extentions/string.rb +1 -1
  39. data/lib/review/htmlbuilder.rb +65 -15
  40. data/lib/review/htmlutils.rb +17 -17
  41. data/lib/review/i18n.rb +3 -3
  42. data/lib/review/i18n.yml +6 -0
  43. data/lib/review/idgxmlbuilder.rb +42 -21
  44. data/lib/review/idgxmlmaker.rb +15 -13
  45. data/lib/review/img_math.rb +1 -0
  46. data/lib/review/index_builder.rb +100 -38
  47. data/lib/review/init.rb +4 -4
  48. data/lib/review/latexbuilder.rb +69 -34
  49. data/lib/review/lineinput.rb +3 -3
  50. data/lib/review/location.rb +1 -1
  51. data/lib/review/logger.rb +21 -21
  52. data/lib/review/makerhelper.rb +3 -3
  53. data/lib/review/markdownbuilder.rb +16 -8
  54. data/lib/review/pdfmaker.rb +40 -21
  55. data/lib/review/plaintextbuilder.rb +8 -7
  56. data/lib/review/preprocessor/repository.rb +1 -1
  57. data/lib/review/preprocessor.rb +5 -5
  58. data/lib/review/rstbuilder.rb +11 -2
  59. data/lib/review/textmaker.rb +20 -18
  60. data/lib/review/textutils.rb +5 -6
  61. data/lib/review/tocprinter.rb +11 -6
  62. data/lib/review/topbuilder.rb +89 -12
  63. data/lib/review/update.rb +16 -8
  64. data/lib/review/version.rb +1 -1
  65. data/lib/review/volumeprinter.rb +9 -9
  66. data/lib/review/webmaker.rb +32 -32
  67. data/lib/review/webtocprinter.rb +10 -10
  68. data/lib/review/yamlloader.rb +36 -2
  69. data/review.gemspec +2 -0
  70. data/samples/sample-book/src/config.yml +0 -1
  71. data/samples/syntax-book/ch02.re +16 -1
  72. data/templates/html/_titlepage.html.erb +9 -17
  73. data/templates/latex/config.erb +3 -0
  74. data/templates/latex/review-jlreq/review-base.sty +2 -1
  75. data/templates/latex/review-jlreq/review-jlreq.cls +36 -3
  76. data/templates/latex/review-jsbook/review-base.sty +7 -1
  77. data/templates/latex/review-jsbook/review-jsbook.cls +31 -4
  78. data/templates/opf/opf_manifest_epubv2.opf.erb +1 -1
  79. data/templates/opf/opf_manifest_epubv3.opf.erb +1 -1
  80. data/test/assets/syntax_book_index_detail.txt +10 -8
  81. data/test/assets/test_template.tex +4 -1
  82. data/test/assets/test_template_backmatter.tex +4 -1
  83. data/test/book_test_helper.rb +10 -10
  84. data/test/test_book_chapter.rb +25 -2
  85. data/test/test_builder.rb +5 -3
  86. data/test/test_epub3maker.rb +3 -3
  87. data/test/test_epubmaker.rb +14 -29
  88. data/test/test_epubmaker_cmd.rb +2 -2
  89. data/test/test_htmlbuilder.rb +80 -8
  90. data/test/test_idgxmlbuilder.rb +13 -13
  91. data/test/test_idgxmlmaker_cmd.rb +1 -1
  92. data/test/test_img_math.rb +11 -2
  93. data/test/test_index.rb +30 -4
  94. data/test/test_latexbuilder.rb +53 -6
  95. data/test/test_markdownbuilder.rb +45 -0
  96. data/test/test_pdfmaker.rb +19 -0
  97. data/test/test_pdfmaker_cmd.rb +10 -10
  98. data/test/test_plaintextbuilder.rb +45 -4
  99. data/test/test_rstbuilder.rb +13 -0
  100. data/test/test_textmaker_cmd.rb +1 -1
  101. data/test/test_topbuilder.rb +169 -11
  102. data/test/test_yamlloader.rb +28 -42
  103. metadata +19 -4
data/lib/review/update.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2018-2020 Kenshi Muto
2
+ # Copyright (c) 2018-2022 Kenshi Muto
3
3
  #
4
4
  # This program is free software.
5
5
  # You can distribute or modify this program under the terms of
@@ -165,7 +165,7 @@ module ReVIEW
165
165
 
166
166
  Dir.glob(File.join(dir, '*.yml')).sort.each do |yml|
167
167
  begin
168
- config = YAML.load_file(yml)
168
+ config = YAMLLoader.safe_load_file(yml)
169
169
  if config['language'].present?
170
170
  language = config['language']
171
171
  end
@@ -226,9 +226,11 @@ module ReVIEW
226
226
 
227
227
  def check_own_files(dir)
228
228
  if File.exist?(File.join(dir, 'layouts/layout.tex.erb'))
229
+ # rubocop:disable Style/SoleNestedConditional
229
230
  unless confirm('** There is custom layouts/layout.tex.erb file. Updating may break to make PDF until you fix layout.tex.erb. Do you really proceed to update? **', [], nil)
230
231
  raise ApplicationError
231
232
  end
233
+ # rubocop:enable Style/SoleNestedConditional
232
234
  end
233
235
 
234
236
  if File.exist?(File.join(dir, 'review-ext.rb'))
@@ -238,7 +240,7 @@ module ReVIEW
238
240
 
239
241
  def update_version
240
242
  @config_ymls.each do |yml|
241
- config = YAML.load_file(yml)
243
+ config = YAMLLoader.safe_load_file(yml)
242
244
  if config['review_version'].to_f.round(1) == TARGET_VERSION.to_f.round(1)
243
245
  next
244
246
  end
@@ -265,10 +267,12 @@ module ReVIEW
265
267
  target_rakefile = File.join(dir, 'Rakefile')
266
268
  if File.exist?(target_rakefile)
267
269
  if Digest::SHA256.hexdigest(File.read(target_rakefile)) != Digest::SHA256.hexdigest(File.read(master_rakefile))
270
+ # rubocop:disable Style/SoleNestedConditional
268
271
  if confirm('%s will be overridden with Re:VIEW version (%s). Do you really proceed?', ['Rakefile', master_rakefile])
269
272
  FileUtils.mv(target_rakefile, "#{target_rakefile}-old")
270
273
  FileUtils.cp(master_rakefile, target_rakefile)
271
274
  end
275
+ # rubocop:enable Style/SoleNestedConditional
272
276
  end
273
277
  else
274
278
  @logger.info t('new file %s is created.', [target_rakefile]) unless @force
@@ -278,12 +282,14 @@ module ReVIEW
278
282
  master_rakefile = File.join(@review_dir, 'samples/sample-book/src/lib/tasks/review.rake')
279
283
  target_rakefile = File.join(taskdir, 'review.rake')
280
284
  if File.exist?(target_rakefile)
285
+ # rubocop:disable Style/SoleNestedConditional
281
286
  if Digest::SHA256.hexdigest(File.read(target_rakefile)) != Digest::SHA256.hexdigest(File.read(master_rakefile))
282
287
  if confirm('%s will be overridden with Re:VIEW version (%s). Do you really proceed?', ['lib/tasks/review.rake', master_rakefile])
283
288
  FileUtils.mv(target_rakefile, "#{target_rakefile}-old")
284
289
  FileUtils.cp(master_rakefile, target_rakefile)
285
290
  end
286
291
  end
292
+ # rubocop:enable Style/SoleNestedConditional
287
293
  else
288
294
  @logger.info t('new file %s is created.', [target_rakefile]) unless @force
289
295
  FileUtils.cp(master_rakefile, target_rakefile)
@@ -292,11 +298,13 @@ module ReVIEW
292
298
 
293
299
  def update_epub_version
294
300
  @epub_ymls.each do |yml|
295
- config = YAML.load_file(yml)
301
+ config = YAMLLoader.safe_load_file(yml)
296
302
  if config['epubversion'].present? && config['epubversion'].to_f < EPUB_VERSION.to_f
303
+ # rubocop:disable Style/SoleNestedConditional
297
304
  if confirm("%s: Update '%s' to '%s' from '%s'?", [File.basename(yml), 'epubversion', EPUB_VERSION, config['epubversion']])
298
305
  rewrite_yml(yml, 'epubversion', EPUB_VERSION)
299
306
  end
307
+ # rubocop:enable Style/SoleNestedConditional
300
308
  end
301
309
  if !config['htmlversion'].present? || config['htmlversion'].to_f >= HTML_VERSION.to_f
302
310
  next
@@ -310,7 +318,7 @@ module ReVIEW
310
318
 
311
319
  def update_locale
312
320
  @locale_ymls.each do |yml|
313
- config = YAML.load_file(yml)
321
+ config = YAMLLoader.safe_load_file(yml)
314
322
  if !config['chapter_quote'].present? || config['chapter_quote'].scan('%s').size != 1
315
323
  next
316
324
  end
@@ -324,7 +332,7 @@ module ReVIEW
324
332
 
325
333
  def update_tex_parameters
326
334
  @tex_ymls.each do |yml|
327
- config = YAML.load_file(yml)
335
+ config = YAMLLoader.safe_load_file(yml)
328
336
  unless config['texdocumentclass']
329
337
  next
330
338
  end
@@ -510,7 +518,7 @@ module ReVIEW
510
518
 
511
519
  def update_tex_command
512
520
  @tex_ymls.each do |yml|
513
- config = YAML.load_file(yml)
521
+ config = YAMLLoader.safe_load_file(yml)
514
522
  if !config['texcommand'] || config['texcommand'] !~ /\s+-/
515
523
  next
516
524
  end
@@ -535,7 +543,7 @@ module ReVIEW
535
543
 
536
544
  def update_dvi_command
537
545
  @tex_ymls.each do |yml|
538
- config = YAML.load_file(yml)
546
+ config = YAMLLoader.safe_load_file(yml)
539
547
  if !config['dvicommand'] || config['dvicommand'] !~ /\s+-/
540
548
  next
541
549
  end
@@ -1,3 +1,3 @@
1
1
  module ReVIEW
2
- VERSION = '5.2.0'.freeze
2
+ VERSION = '5.5.0'.freeze
3
3
  end
@@ -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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2016-2021 Masayoshi Takahashi, Masanori Kado, Kenshi Muto
1
+ # Copyright (c) 2016-2022 Masayoshi Takahashi, Masanori Kado, Kenshi Muto
2
2
  #
3
3
  # This program is free software.
4
4
  # You can distribute or modify this program under the terms of
@@ -78,9 +78,13 @@ module ReVIEW
78
78
  cmd_config, yamlfile = parse_opts(args)
79
79
  error! "#{yamlfile} not found." unless File.exist?(yamlfile)
80
80
 
81
- @config = ReVIEW::Configure.create(maker: 'webmaker',
82
- yamlfile: yamlfile,
83
- config: cmd_config)
81
+ begin
82
+ @config = ReVIEW::Configure.create(maker: 'webmaker',
83
+ yamlfile: yamlfile,
84
+ config: cmd_config)
85
+ rescue ReVIEW::ConfigError => e
86
+ error! e.message
87
+ end
84
88
 
85
89
  @config['htmlext'] = 'html'
86
90
  @img_math = ReVIEW::ImgMath.new(@config)
@@ -97,7 +101,7 @@ module ReVIEW
97
101
  end
98
102
 
99
103
  def generate_html_files(yamlfile)
100
- @basedir = File.dirname(yamlfile)
104
+ @basedir = File.absolute_path(File.dirname(yamlfile))
101
105
  @path = build_path
102
106
  remove_old_files(@path)
103
107
  Dir.mkdir(@path)
@@ -146,19 +150,27 @@ module ReVIEW
146
150
  def build_part(part, basetmpdir, htmlfile)
147
151
  @title = h("#{ReVIEW::I18n.t('part', part.number)} #{part.name.strip}")
148
152
  File.open("#{basetmpdir}/#{htmlfile}", 'w') do |f|
149
- @body = ''
150
- @body << %Q(<div class="part">\n)
151
- @body << %Q(<h1 class="part-number">#{ReVIEW::I18n.t('part', part.number)}</h1>\n)
152
- @body << %Q(<h2 class="part-title">#{part.name.strip}</h2>\n) if part.name.strip.present?
153
- @body << "</div>\n"
154
-
153
+ @part_number = part.number
154
+ @part_title = part.name.strip
155
+ @body = ReVIEW::Template.generate(path: template_name(localfile: '_part_body.html.erb', systemfile: 'html/_part_body.html.erb'), binding: binding)
155
156
  @language = @config['language']
156
157
  @stylesheets = @config['stylesheet']
157
158
  f.write ReVIEW::Template.generate(path: template_name, binding: binding)
158
159
  end
159
160
  end
160
161
 
161
- def template_name
162
+ def template_name(localfile: 'layout-web.html.erb', systemfile: nil)
163
+ if @basedir
164
+ layoutfile = File.join(@basedir, 'layouts', localfile)
165
+ if File.exist?(layoutfile)
166
+ return layoutfile
167
+ end
168
+ end
169
+
170
+ if systemfile
171
+ return systemfile
172
+ end
173
+
162
174
  if @config['htmlversion'].to_i == 5
163
175
  'web/html/layout-html5.html.erb'
164
176
  else
@@ -167,13 +179,11 @@ module ReVIEW
167
179
  end
168
180
 
169
181
  def build_chap(chap, base_path, basetmpdir, ispart)
170
- filename = ''
171
-
172
- if ispart.present?
173
- filename = chap.path
174
- else
175
- filename = Pathname.new(chap.path).relative_path_from(base_path).to_s
176
- end
182
+ filename = if ispart.present?
183
+ chap.path
184
+ else
185
+ Pathname.new(chap.path).relative_path_from(base_path).to_s
186
+ end
177
187
  id = File.basename(filename).sub(/\.re\Z/, '')
178
188
 
179
189
  if @buildonly && !@buildonly.include?(id)
@@ -219,7 +229,7 @@ module ReVIEW
219
229
 
220
230
  if FileTest.directory?("#{resdir}/#{fname}")
221
231
  recursive_copy_files("#{resdir}/#{fname}", "#{destdir}/#{fname}", allow_exts)
222
- elsif fname =~ /\.(#{allow_exts.join('|')})\Z/i
232
+ elsif /\.(#{allow_exts.join('|')})\Z/i.match?(fname)
223
233
  FileUtils.mkdir_p(destdir)
224
234
  FileUtils.cp("#{resdir}/#{fname}", destdir)
225
235
  end
@@ -274,18 +284,8 @@ module ReVIEW
274
284
 
275
285
  def build_titlepage(basetmpdir, htmlfile)
276
286
  @title = h('titlepage')
277
- File.open("#{basetmpdir}/#{htmlfile}", 'w') do |f|
278
- @body = ''
279
- @body << %Q(<div class="titlepage">)
280
- @body << %Q(<h1 class="tp-title">#{h(@config.name_of('booktitle'))}</h1>)
281
- if @config['aut']
282
- @body << %Q(<h2 class="tp-author">#{join_with_separator(@config.names_of('aut'), ReVIEW::I18n.t('names_splitter'))}</h2>)
283
- end
284
- if @config['pbl']
285
- @body << %Q(<h3 class="tp-publisher">#{join_with_separator(@config.names_of('pbl'), ReVIEW::I18n.t('names_splitter'))}</h3>)
286
- end
287
- @body << '</div>'
288
-
287
+ File.open(File.join(basetmpdir, htmlfile), 'w') do |f|
288
+ @body = ReVIEW::Template.generate(path: template_name(localfile: '_titlepage.html.erb', systemfile: 'html/_titlepage.html.erb'), binding: binding)
289
289
  @language = @config['language']
290
290
  @stylesheets = @config['stylesheet']
291
291
  f.write ReVIEW::Template.generate(path: template_name, binding: binding)
@@ -41,16 +41,16 @@ EOT
41
41
  next
42
42
  end
43
43
 
44
- if path.start_with?('.')
45
- content << "<li>#{escape(result.headline)}"
46
- else
47
- content << %Q(<li><a href="#{path}">#{escape(result.headline)}</a>)
48
- end
49
- if result.level == 0
50
- content << "\n<ul>" # part
51
- else
52
- content << "</li>\n"
53
- end
44
+ content << if path.start_with?('.')
45
+ "<li>#{escape(result.headline)}"
46
+ else
47
+ %Q(<li><a href="#{path}">#{escape(result.headline)}</a>)
48
+ end
49
+ content << if result.level == 0
50
+ "\n<ul>" # part
51
+ else
52
+ "</li>\n"
53
+ end
54
54
  end
55
55
  content << "</ul>\n"
56
56
  end
@@ -1,7 +1,41 @@
1
1
  require 'yaml'
2
+ require 'date'
2
3
 
3
4
  module ReVIEW
4
5
  class YAMLLoader
6
+ def self.safe_load_file(file)
7
+ if YAML.respond_to?(:safe_load_file)
8
+ YAML.safe_load_file(file, aliases: true, permitted_classes: [Date])
9
+ else
10
+ File.open(file, 'rt:bom|utf-8') do |f|
11
+ begin
12
+ # < Ruby 3.1
13
+ YAML.safe_load(f, filename: file, aliases: true, permitted_classes: [Date])
14
+ rescue ArgumentError
15
+ # < Ruby 2.7
16
+ YAML.safe_load(f, [Date])
17
+ rescue Psych::DisallowedClass
18
+ # < Ruby 2.5
19
+ YAML.safe_load(File.read(file), [Date])
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ def self.safe_load(s)
26
+ if YAML.respond_to?(:safe_load_file)
27
+ YAML.safe_load(s, aliases: true, permitted_classes: [Date])
28
+ else
29
+ begin
30
+ # < Ruby 3.1
31
+ YAML.safe_load(s, aliases: true, permitted_classes: [Date])
32
+ rescue ArgumentError, Psych::DisallowedClass
33
+ # < Ruby 2.7
34
+ YAML.safe_load(s, [Date])
35
+ end
36
+ end
37
+ end
38
+
5
39
  def initialize
6
40
  end
7
41
 
@@ -17,8 +51,8 @@ module ReVIEW
17
51
 
18
52
  while file_queue.present?
19
53
  current_file = file_queue.shift
20
- current_yaml = YAML.load_file(current_file)
21
- if current_yaml.instance_of?(FalseClass)
54
+ current_yaml = YAMLLoader.safe_load_file(current_file)
55
+ if current_yaml.instance_of?(FalseClass) || current_yaml.nil?
22
56
  raise "#{File.basename(current_file)} is malformed."
23
57
  end
24
58
 
data/review.gemspec CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |gem|
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
14
  gem.required_rubygems_version = Gem::Requirement.new('>= 0') if gem.respond_to?(:required_rubygems_version=)
15
+ gem.metadata = { 'rubygems_mfa_required' => 'true' }
15
16
 
16
17
  gem.files = `git ls-files`.split("\n")
17
18
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -20,6 +21,7 @@ Gem::Specification.new do |gem|
20
21
  gem.require_paths = ['lib']
21
22
 
22
23
  gem.add_dependency('image_size')
24
+ gem.add_dependency('rexml')
23
25
  gem.add_dependency('rouge')
24
26
  gem.add_dependency('rubyzip')
25
27
  gem.add_dependency('tty-logger')
@@ -3,7 +3,6 @@ review_version: 5.0
3
3
  bookname: book
4
4
  language: ja
5
5
  booktitle: Re:VIEWサンプル書籍
6
- urnid: urn:uuid:http://reviewml.com/books/review-sample-book/
7
6
  # isbn: null
8
7
  aut: Re:VIEW Writers
9
8
  pbl: Re:VIEW Publishers
@@ -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
 
@@ -326,10 +332,16 @@ a_{m1} & \cdots & a_{mn}
326
332
  * 章題:@<title>{ch01}、@<title>{part2}、@<title>{appA}、@<title>{bib}
327
333
  * 章番号+題:@<chapref>{ch02}、@<chapref>{part2}、@<chapref>{appA}、@<chapref>{bib}
328
334
 
329
- 節や項への参照はhdを使います。
335
+ 節や項への参照はhdまたはsecを使います。
330
336
 
331
337
  * @<hd>{ch02|ブロック命令}の@<hd>{ch02|ブロック命令|図}
332
338
  * @<hd>{ch02|crossref}
339
+ * @<secref>{ch02|ブロック命令}の@<secref>{ch02|ブロック命令|図}
340
+ * @<secref>{ch02|crossref}
341
+ * @<sec>{ch02|ブロック命令}の@<sec>{ch02|ブロック命令|図}
342
+ * @<sec>{ch02|crossref}
343
+ * @<sectitle>{ch02|ブロック命令}の@<sectitle>{ch02|ブロック命令|図}
344
+ * @<sectitle>{ch02|crossref}
333
345
  * コラム参照 @<column>{ch03|column2}
334
346
 
335
347
  他章への図表リスト参照の例です(@<list>{pre01|main1}、@<img>{pre01|fractal}、@<table>{pre01|tbl1}、@<list>{appA|lista-1}、@<img>{appA|puzzle}、@<table>{appA|taba-1})。
@@ -361,3 +373,6 @@ labelで定義したラベルへの参照の例です。EPUBだと@<href>{#inlin
361
373
  @<hidx>{|}@<hidx>{{}@<hidx>$}$
362
374
 
363
375
  idx, hidxいずれも=見出しの中には入れないようにし、後続の段落先頭にhidxで入れるように注意します(入れてしまうと目次などがおかしくなります)。
376
+
377
+ ==== 後注
378
+ //printendnotes
@@ -1,20 +1,12 @@
1
- <h1 class="tp-title"><%= @title_str %></h1>
2
- <% if @subtitle_str %>
3
- <h2 class="tp-subtitle"><%= h(@subtitle_str) %></h2>
1
+ <div class="titlepage">
2
+ <h1 class="tp-title"><%= h(@config.name_of('booktitle')) %></h1>
3
+ <% if @config['subtitle'] %>
4
+ <h2 class="tp-subtitle"><%= h(@config.name_of('subtitle')) %></h2>
4
5
  <% end %>
5
- <% if @author_str %>
6
- <p>
7
- <br />
8
- <br />
9
- </p>
10
- <h2 class="tp-author"><%= h(@author_str) %></h2>
6
+ <% if @config['aut'] %>
7
+ <h2 class="tp-author"><%= h(@config.names_of('aut').join(ReVIEW::I18n.t('names_splitter'))) %></h2>
11
8
  <% end %>
12
- <% if @publisher_str %>
13
- <p>
14
- <br />
15
- <br />
16
- <br />
17
- <br />
18
- </p>
19
- <h3 class="tp-publisher"><%= h(@publisher_str) %></h3>
9
+ <% if @config['pbl'] %>
10
+ <h3 class="tp-publisher"><%= h(@config.names_of('pbl').join(ReVIEW::I18n.t('names_splitter'))) %></h3>
20
11
  <% end %>
12
+ </div>
@@ -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/28]
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
@@ -21,7 +21,7 @@
21
21
 
22
22
  \IfFileExists{plautopatch.sty}{\RequirePackage{plautopatch}}{}
23
23
  \NeedsTeXFormat{LaTeX2e}
24
- \ProvidesClass{review-jlreq}[2021/06/28 Re:VIEW 5.2 upLaTeX/LuaLaTeX class modified for jlreq.cls]
24
+ \ProvidesClass{review-jlreq}[2021/09/07 Re:VIEW 5.3 upLaTeX/LuaLaTeX class modified for jlreq.cls]
25
25
 
26
26
  %% hook at end of reviewmacro
27
27
  \let\@endofreviewmacrohook\@empty
@@ -32,12 +32,15 @@
32
32
  \RequirePackage{fix-cm}%%\RequirePackage{fix-cm,exscale}
33
33
  \IfFileExists{latexrelease.sty}{}{\RequirePackage{fixltx2e}}
34
34
 
35
+ %% amsmath: override \@ifstar with \new@ifnextchar in amsgen.sty
36
+ \let\ltx@ifstar\@ifstar%%as \@ifstar of LaTeX kernel
37
+
35
38
  %% graphicx: added nosetpagesize
36
39
  \IfFileExists{platexrelease.sty}{%% is bundled in TL16 or higher release version
37
40
  \PassOptionsToPackage{nosetpagesize}{graphicx}%%for TL16 or higher version
38
41
  }{}
39
42
 
40
- \RequirePackage{xkeyval,everypage}
43
+ \RequirePackage{xkeyval,everypage,ifthen}
41
44
 
42
45
  %% useful helpers
43
46
  \newcommand\recls@get@p@[2]{%
@@ -226,12 +229,29 @@
226
229
  \edef\grnchry@gutter{\evensidemargin}
227
230
  \newcommand*\includefullpagegraphics{%
228
231
  \clearpage
229
- \@ifstar
232
+ \ltx@ifstar
230
233
  {\@includefullpagegraphics}%
231
234
  {\thispagestyle{empty}\@includefullpagegraphics}
232
235
  }
233
236
 
234
237
  \newcommand*\@includefullpagegraphics[2][]{%
238
+ \if@tate
239
+ \vbox to \textheight{%
240
+ \ifodd\c@page
241
+ \vskip-\dimexpr\evensidemargin - \topskip + 1in\relax
242
+ \else
243
+ \vskip-\dimexpr\oddsidemargin - \topskip + 1in\relax
244
+ \fi
245
+ \vbox to \paperwidth{\vss
246
+ \hbox to \textwidth{%
247
+ \hskip-\grnchry@head\relax
248
+ \hbox to \paperheight{\hss
249
+ \rotatebox{90}{\includegraphics[#1]{#2}}%
250
+ \hss}%
251
+ \hss}%
252
+ \vss}%
253
+ \vss}%
254
+ \else
235
255
  \vbox to \textheight{%
236
256
  \vskip-\grnchry@head
237
257
  \vbox to \paperheight{\vss
@@ -247,6 +267,7 @@
247
267
  \hss}%
248
268
  \vss}%
249
269
  \vss}%
270
+ \fi
250
271
  \clearpage
251
272
  }
252
273
 
@@ -342,5 +363,17 @@
342
363
  \def\reviewleftcurlybrace{\{}
343
364
  \def\reviewrightcurlybrace{\}}
344
365
 
366
+ %% 後注を見出しではなくchapter前にし、endnoteカウンタを新規に用意する
367
+ \jlreqsetup{endnote_position=_chapter}
368
+ \newcounter{reclsendnote}
369
+ \setcounter{reclsendnote}{0}
370
+ \if@tate
371
+ \renewcommand*{\thereclsendnote}{\jlreq@open@bracket@before@space\inhibitglue(\tatechuyoko{\@arabic\c@reclsendnote})\inhibitglue}
372
+ \else
373
+ \renewcommand*{\thereclsendnote}{(\arabic{reclsendnote}\hbox{})\inhibitglue}
374
+ \fi
375
+ \def\jlreq@endnotecounter{reclsendnote}
376
+ \ifthenelse{\equal{\jlreq@article@type}{article}}{}{\@addtoreset{reclsendnote}{chapter}}
377
+
345
378
  \listfiles
346
379
  \endinput
@@ -1,4 +1,4 @@
1
- \ProvidesClass{review-base}[2021/06/04]
1
+ \ProvidesClass{review-base}[2021/09/06]
2
2
  \RequirePackage{ifthen}
3
3
  \@ifundefined{Hy@Info}{% for jsbook.cls
4
4
  \RequirePackage[dvipdfmx,bookmarks=true,bookmarksnumbered=true]{hyperref}
@@ -40,6 +40,9 @@
40
40
  \RequirePackage{amsthm}
41
41
  \RequirePackage{bm}
42
42
  \RequirePackage{tabularx}
43
+ \RequirePackage{endnotesj}
44
+
45
+ \def\enoteheading{}% endnotesj.styの後注前見出しおよび空行の出力を抑制
43
46
 
44
47
  %% if you use @<u>{} (underline), use jumoline.sty
45
48
  \IfFileExists{jumoline.sty}{
@@ -65,9 +68,12 @@
65
68
  \rubysetup{J}}{%
66
69
  \rubysetup{g}}
67
70
 
71
+ \DeclareRobustCommand{\reviewtcy}[1]{\PackageError{review-base}{\reviewtcy is not allowed in yoko mode}{}}
72
+
68
73
  \ifthenelse{\equal{\review@documentclass}{utbook} \OR \equal{\review@documentclass}{tbook}}{%
69
74
  \newcommand{\headfont}{\gtfamily\sffamily\bfseries}
70
75
  \RequirePackage{plext}
76
+ \DeclareRobustCommand{\reviewtcy}[1]{\rensuji{#1}}
71
77
  }{%
72
78
  }
73
79
 
@@ -22,7 +22,7 @@
22
22
  \IfFileExists{plautopatch.sty}{\RequirePackage{plautopatch}}{}
23
23
  \NeedsTeXFormat{pLaTeX2e}
24
24
  \ProvidesClass{review-jsbook}
25
- [2021/01/12 v5.1 Re:VIEW pLaTeX class modified for jsbook.cls]
25
+ [2021/08/23 v5.3 Re:VIEW pLaTeX class modified for jsbook.cls]
26
26
 
27
27
  \def\recls@error{\ClassError{review-jsbook}}
28
28
  \def\recls@warning{\ClassWarning{review-jsbook}}
@@ -39,12 +39,18 @@
39
39
  \RequirePackage{fix-cm}%%\RequirePackage{fix-cm,exscale}
40
40
  \IfFileExists{latexrelease.sty}{}{\RequirePackage{fixltx2e}}
41
41
 
42
+ %% amsmath: override \@ifstar with \new@ifnextchar in amsgen.sty
43
+ \let\ltx@ifstar\@ifstar%%as \@ifstar of LaTeX kernel
44
+
42
45
  %% graphicx: added nosetpagesize
43
46
  \IfFileExists{platexrelease.sty}{%% is bundled in TL16 or higher release version
44
47
  \PassOptionsToPackage{nosetpagesize}{graphicx}%%for TL16 or higher version
45
48
  }{}
46
49
 
47
- \RequirePackage{xkeyval,everypage}%%,etoolbox
50
+ \RequirePackage{xkeyval}%%,etoolbox
51
+ \IfFileExists{everypage-1x.sty}{% is bundled in TL20 or higher
52
+ \RequirePackage{everypage-1x}
53
+ }{\RequirePackage{everypage}}
48
54
 
49
55
  %% useful helpers
50
56
  \newcommand\recls@get@p@[2]{%
@@ -149,7 +155,7 @@
149
155
  \xdef#1{\ifx\recls@hiddenfolio\@empty tombo,\fi#1}}
150
156
 
151
157
  %% \recls@set@hiddenfolio{<preset>}
152
- %% <preset>: default, marusho-ink (丸正インキ), nikko-pc (日光企画),
158
+ %% <preset>: default, marusho-ink (丸正インキ), nikko-pc (日光企画),
153
159
  %% shippo (ねこのしっぽ)
154
160
  \def\recls@set@hiddenfolio#1{\ifx#1\@empty\else
155
161
  \@ifundefined{@makehiddenfolio@#1}{%
@@ -284,6 +290,9 @@
284
290
  % \typeout{!!! magscale: \jsc@magscale}
285
291
  % \typeout{!!! mag: \the\mag}%%=> 1000 -> OK
286
292
 
293
+ %% compatibility for jlreq.cls
294
+ \let\if@tate\iftdir
295
+
287
296
  %% override papersize with custom papersize
288
297
  \ifx\recls@paperwidth\@empty\else\ifx\recls@paperheight\@empty\else
289
298
  \setlength{\paperwidth}{\recls@paperwidth}
@@ -398,12 +407,29 @@
398
407
  \let\grnchry@gutter\recls@gutter
399
408
  \newcommand*\includefullpagegraphics{%
400
409
  \clearpage
401
- \@ifstar
410
+ \ltx@ifstar
402
411
  {\@includefullpagegraphics}%
403
412
  {\thispagestyle{empty}\@includefullpagegraphics}
404
413
  }
405
414
 
406
415
  \newcommand*\@includefullpagegraphics[2][]{%
416
+ \if@tate
417
+ \vbox to \textheight{%
418
+ \ifodd\c@page
419
+ \vskip-\dimexpr\evensidemargin - \topskip + 1in\relax
420
+ \else
421
+ \vskip-\dimexpr\oddsidemargin - \topskip + 1in\relax
422
+ \fi
423
+ \vbox to \paperwidth{\vss
424
+ \hbox to \textwidth{%
425
+ \hskip-\grnchry@head\relax
426
+ \hbox to \paperheight{\hss
427
+ \rotatebox{90}{\includegraphics[#1]{#2}}%
428
+ \hss}%
429
+ \hss}%
430
+ \vss}%
431
+ \vss}%
432
+ \else
407
433
  \vbox to \textheight{%
408
434
  \vskip-\grnchry@head
409
435
  \vbox to \paperheight{\vss
@@ -419,6 +445,7 @@
419
445
  \hss}%
420
446
  \vss}%
421
447
  \vss}%
448
+ \fi
422
449
  \clearpage
423
450
  }
424
451
 
@@ -4,7 +4,7 @@
4
4
  <% if @config['toc'] && @config['mytoc'] %>
5
5
  <item id="toc" href="<%= @config['bookname'] %>-toc.<%= @config['htmlext'] %>" media-type="application/xhtml+xml"/>
6
6
  <% end %>
7
- <% @items.each do |item| %>
7
+ <% @items.sort_by { |x| x.id }.each do |item| %>
8
8
  <item id="<%= item.id %>" href="<%= item.file %>" media-type="<%= item.media %>"/>
9
9
  <% end %>
10
10
  </manifest>