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/NEWS.md CHANGED
@@ -1,3 +1,120 @@
1
+ # Version 5.5.0
2
+ ## New Features
3
+ * introduced `@<secref>`, `@<sec>`, and `@<sectitle>` as inline op to refer sections ([#1809])
4
+
5
+ ## Bug Fixes
6
+ * fixed test error ([#1804])
7
+ * fixed an error of review-update ([#1807])
8
+
9
+ ## Others
10
+ * added rexml to gemspec ([#1808])
11
+
12
+ [#1804]: https://github.com/kmuto/review/pull/1804
13
+ [#1807]: https://github.com/kmuto/review/pull/1807
14
+ [#1808]: https://github.com/kmuto/review/pull/1808
15
+ [#1809]: https://github.com/kmuto/review/issues/1809
16
+
17
+ # Version 5.4.0
18
+ ## New Features
19
+ * [GitHub Discussions](https://github.com/kmuto/review/discussions) has been opened to answer questions about Re:VIEW
20
+
21
+ ## Breaking Changes
22
+ * EPUBMaker: `manifest/item` in the opf file is now sorted by the dictional order of ID strings ([#1763])
23
+ * TextMaker: the separator line now put between the heading rows and the normal rows of the table. To revert this behavior to old version, set `textmaker/th_bold` parameter to true ([#1789])
24
+ * TextMaker: the output result of the `//indepimage` op has been adjusted to `//image` ([#1790])
25
+ * TextMaker: the output result of the `//imgtable` op has been adjusted to `//image` and `//table` ([#1791])
26
+ * `//source` op is now also not escaped when highlighting is enabled ([#1788])
27
+
28
+ ## Bug Fixes
29
+ * fixed YAML error in Ruby 3.1 and kept backward compatibility ([#1767], [#1775])
30
+ * EPUBMaker: removed `epub:type=cover` from titlepage and colophon ([#1776])
31
+ * removed invalid urnid sample ([#1779])
32
+ * when there is a syntax error in config.yml, exit with proper error message instead of an exception ([#1797])
33
+ * IDGXMLMaker: fixed an error to compile prefaces or postfaces when secttags is enabled ([#1800])
34
+
35
+ ## Enhancements
36
+ * EPUBMaker, WebMaker: use `layout.html.erb` or `layout-web.html.erb` as the base template for cover, titlepage, colophon, and part, just like regular chapters ([#1780])
37
+ * EPUBMaker, WebMaker: cover, titlepage, colophon, and part can now be overwritten with `_cover.html.erb`, `_titlepage.html.erb`, `_colophon.html.erb`, `_colophon_history.html.erb`, and `_part_body.html.erb` ([#1777])
38
+
39
+ ## Docs
40
+ * mentioned GitHub Discussions in README.md ([#1772])
41
+
42
+ ## Others
43
+ * refactor code with RuboCop 1.25.1 ([#1773], [#1782], [#1783], [#1784], [#1792])
44
+
45
+ [#1763]: https://github.com/kmuto/review/pull/1763
46
+ [#1767]: https://github.com/kmuto/review/pull/1767
47
+ [#1772]: https://github.com/kmuto/review/pull/1772
48
+ [#1773]: https://github.com/kmuto/review/pull/1773
49
+ [#1775]: https://github.com/kmuto/review/pull/1775
50
+ [#1776]: https://github.com/kmuto/review/pull/1776
51
+ [#1777]: https://github.com/kmuto/review/issues/1777
52
+ [#1779]: https://github.com/kmuto/review/pull/1779
53
+ [#1780]: https://github.com/kmuto/review/pull/1780
54
+ [#1782]: https://github.com/kmuto/review/pull/1782
55
+ [#1783]: https://github.com/kmuto/review/pull/1783
56
+ [#1784]: https://github.com/kmuto/review/pull/1784
57
+ [#1788]: https://github.com/kmuto/review/pull/1788
58
+ [#1789]: https://github.com/kmuto/review/issues/1789
59
+ [#1790]: https://github.com/kmuto/review/issues/1790
60
+ [#1791]: https://github.com/kmuto/review/issues/1791
61
+ [#1792]: https://github.com/kmuto/review/pull/1792
62
+ [#1797]: https://github.com/kmuto/review/issues/1797
63
+ [#1800]: https://github.com/kmuto/review/pull/1800
64
+
65
+ # Version 5.3.0
66
+ ## New Features
67
+ * add the future of endnote. `//endnote` specifies the content of the endnote, `@<endnote>` specifies the reference to the endnote, and `//printendnotes` places endnotes ([#1724])
68
+
69
+ ## Bug Fixes
70
+ * fixed an error in new jlreq that caused it to become independent of ifthen package ([#1718])
71
+ * fixed an issue with hidden folio being set to all 1 when using review-jsbook with TeXLive 2020 or later ([#1720])
72
+ * fixed an error that occurred when a non-existent file was specified in the coverimage parameter ([#1726], [#1729])
73
+ * it now warns when a non-existent file is specified in the titlefile, creditfile, and profile parameters ([#1730])
74
+ * fixed `@<tcy>` op error in review-jlreq. this op will be expanded into `\reviewtcy` macro ([#1733])
75
+ * fixed exception errors in review-vol and review-index ([#1740])
76
+ * fixed forgetting to copy `__IMGMATH_BODY__.tex` when math compiling error occurs ([#1747])
77
+ * fixed the problem that the position of `//beginchild` and `//endchild` is not displayed when an error occurs ([#1742])
78
+ * fixed a build error when using `//graph` op ([#1744])
79
+ * fixed undefined variable in epubmaker.rb ([#1755])
80
+ * fixed execution error in review-catalog-converter ([#1753])
81
+
82
+ ## Enhancements
83
+ * warnings are now given when footnotes (`//footnote`) and endnotes (`//endnote`) are defined but not referenced (`@<fn>`, `@<endnote>`) ([#1725])
84
+ * `\includefullpagegraphics` macro that pastes an image over the entire page now supports vertical writing ([#1734])
85
+ * try to find plantuml.jar from the working folder, `/usr/share/plantuml`, or `/usr/share/java` ([#1760])
86
+
87
+ ## Docs
88
+ * format.ja.md, format.md: fixed a mistake in the command line for creating SVG formulas ([#1748])
89
+
90
+ ## Others
91
+ * added tests for Ruby 2.7 for Windows ([#1743])
92
+ * refactor code with Rubocop 1.22.1 ([#1759])
93
+
94
+ ## Contributors
95
+ * [@munepi](https://github.com/munepi)
96
+ * [@huideyeren](https://github.com/huideyeren)
97
+
98
+ [#1718]: https://github.com/kmuto/review/issues/1718
99
+ [#1720]: https://github.com/kmuto/review/issues/1720
100
+ [#1724]: https://github.com/kmuto/review/issues/1724
101
+ [#1725]: https://github.com/kmuto/review/issues/1725
102
+ [#1726]: https://github.com/kmuto/review/issues/1726
103
+ [#1729]: https://github.com/kmuto/review/pull/1729
104
+ [#1730]: https://github.com/kmuto/review/pull/1730
105
+ [#1733]: https://github.com/kmuto/review/issues/1733
106
+ [#1734]: https://github.com/kmuto/review/issues/1734
107
+ [#1740]: https://github.com/kmuto/review/pull/1740
108
+ [#1742]: https://github.com/kmuto/review/pull/1742
109
+ [#1743]: https://github.com/kmuto/review/pull/1743
110
+ [#1744]: https://github.com/kmuto/review/issues/1744
111
+ [#1747]: https://github.com/kmuto/review/pull/1747
112
+ [#1748]: https://github.com/kmuto/review/pull/1748
113
+ [#1753]: https://github.com/kmuto/review/issues/1753
114
+ [#1755]: https://github.com/kmuto/review/issues/1755
115
+ [#1759]: https://github.com/kmuto/review/pull/1759
116
+ [#1760]: https://github.com/kmuto/review/pull/1760
117
+
1
118
  # Version 5.2.0
2
119
  ## New Features
3
120
  * EPUBMaker: added `<section>` based on heading level for CSS formatting, when the `epubmaker/use_section` parameter is set to `true` ([#1685])
data/README.md CHANGED
@@ -74,13 +74,14 @@ For further information, see [doc/quickstart.md](https://github.com/kmuto/review
74
74
 
75
75
  ## Resources
76
76
 
77
- | | URL |
78
- |---------|----------------------------------------|
79
- | Home | http://reviewml.org |
80
- | Project | https://github.com/kmuto/review/ |
81
- | Gems | https://rubygems.org/gems/review |
82
- | Wiki | https://github.com/kmuto/review/wiki |
83
- | Bugs | https://github.com/kmuto/review/issues |
77
+ | | URL |
78
+ |---------|---------------------------------------------|
79
+ | Home | http://reviewml.org |
80
+ | Project | https://github.com/kmuto/review/ |
81
+ | Gems | https://rubygems.org/gems/review |
82
+ | Q&A | https://github.com/kmuto/review/discussions |
83
+ | Wiki | https://github.com/kmuto/review/wiki |
84
+ | Bugs | https://github.com/kmuto/review/issues |
84
85
 
85
86
  ### Documents
86
87
 
@@ -116,4 +117,4 @@ Exception:
116
117
 
117
118
  ## Copyright
118
119
 
119
- Copyright (c) 2006-2021 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
120
+ Copyright (c) 2006-2022 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
data/bin/review CHANGED
@@ -58,7 +58,7 @@ unless File.exist?(command_path)
58
58
  usage
59
59
  end
60
60
 
61
- if RUBY_PLATFORM =~ /mswin|bccwin|mingw/
61
+ if RUBY_PLATFORM.match?(/mswin|bccwin|mingw/)
62
62
  cmd = File.join(RbConfig::CONFIG['bindir'],
63
63
  RbConfig::CONFIG['ruby_install_name'])
64
64
  cmd << RbConfig::CONFIG['EXEEXT']
@@ -55,21 +55,21 @@ def main
55
55
  end
56
56
  # chaps and parts
57
57
  if File.exist?("#{dir}/CHAPS")
58
- if File.exist?("#{dir}/PART")
59
- catalog << parse_parts(File.read("#{dir}/PART"),
58
+ catalog << if File.exist?("#{dir}/PART")
59
+ parse_parts(File.read("#{dir}/PART"),
60
60
  File.read("#{dir}/CHAPS"))
61
- else
62
- catalog << parse_chaps(File.read("#{dir}/CHAPS"))
63
- end
61
+ else
62
+ parse_chaps(File.read("#{dir}/CHAPS"))
63
+ end
64
64
  end
65
65
  # postdef
66
66
  if File.exist?("#{dir}/POSTDEF")
67
67
  postdef = File.read("#{dir}/POSTDEF")
68
- if ask_yes?('Do you want to convert POSTDEF into APPENDIX? [y/n]')
69
- catalog << parse_postdef(postdef, true)
70
- else
71
- catalog << parse_postdef(postdef)
72
- end
68
+ catalog << if ask_yes?('Do you want to convert POSTDEF into APPENDIX? [y/n]')
69
+ parse_postdef(postdef, true)
70
+ else
71
+ parse_postdef(postdef)
72
+ end
73
73
  end
74
74
  end
75
75
  end
@@ -99,11 +99,11 @@ def parse_chaps(str)
99
99
  end
100
100
 
101
101
  def parse_postdef(str, to_appendix = false)
102
- if to_appendix
103
- header = "APPENDIX:\n"
104
- else
105
- header = "POSTDEF:\n"
106
- end
102
+ header = if to_appendix
103
+ "APPENDIX:\n"
104
+ else
105
+ "POSTDEF:\n"
106
+ end
107
107
  parse_internal(str, header) + "\n"
108
108
  end
109
109
 
data/bin/review-check CHANGED
@@ -18,7 +18,7 @@ include ReVIEW::TextUtils
18
18
 
19
19
  def sigmain
20
20
  Signal.trap(:INT) { exit 1 }
21
- if RUBY_PLATFORM !~ /mswin(?!ce)|mingw|cygwin|bccwin/
21
+ unless RUBY_PLATFORM.match?(/mswin(?!ce)|mingw|cygwin|bccwin/)
22
22
  Signal.trap(:PIPE, 'IGNORE')
23
23
  end
24
24
  main
@@ -95,7 +95,7 @@ end
95
95
  def find_line(lines, re)
96
96
  # single line?
97
97
  lines.each_with_index do |line, idx|
98
- if re =~ line
98
+ if re&.match?(line)
99
99
  return line.gsub(re, '<<<\&>>>'), idx
100
100
  end
101
101
  end
@@ -104,7 +104,7 @@ def find_line(lines, re)
104
104
  i = 0
105
105
  while i < lines.size - 1
106
106
  str = lines[i] + lines[i + 1]
107
- return str.gsub(re, '<<<\&>>>'), i if re =~ str
107
+ return str.gsub(re, '<<<\&>>>'), i if re&.match?(str)
108
108
 
109
109
  i += 1
110
110
  end
@@ -118,7 +118,7 @@ def words_re(rc)
118
118
  File.foreach(rc) do |line|
119
119
  next if line[0, 1] == '#'
120
120
 
121
- if / !/ =~ line
121
+ if / !/.match?(line)
122
122
  line, n = *line.split('!', 2)
123
123
  nega.push(n.strip)
124
124
  end
@@ -141,7 +141,7 @@ def each_paragraph(f)
141
141
  yield [$1], f.filename, f.lineno
142
142
  when %r<\A//\w.*\{\s*\z>
143
143
  while line = f.gets
144
- break if %r{//\}} === line
144
+ break if %r{//\}}.match?(line)
145
145
  end
146
146
  when /\A=/
147
147
  yield [line.slice(/\A=+(?:\[.*?\])?\s+(.*)/, 1).strip], f.lineno
@@ -150,8 +150,8 @@ def each_paragraph(f)
150
150
  lineno = f.lineno
151
151
  while line = f.gets
152
152
  break if line.strip.empty?
153
- break if %r{\A(?:=|//[\w\}])} =~ line
154
- next if /\A\#@/ =~ line
153
+ break if %r{\A(?:=|//[\w\}])}.match?(line)
154
+ next if /\A\#@/.match?(line)
155
155
 
156
156
  buf.push(line.strip)
157
157
  end
data/bin/review-compile CHANGED
@@ -22,7 +22,7 @@ DEFAULT_CONFIG_FILENAME = 'config.yml'.freeze
22
22
 
23
23
  def main
24
24
  Signal.trap(:INT) { exit 1 }
25
- if RUBY_PLATFORM !~ /mswin(?!ce)|mingw|cygwin|bccwin/
25
+ unless RUBY_PLATFORM.match?(/mswin(?!ce)|mingw|cygwin|bccwin/)
26
26
  Signal.trap(:PIPE, 'IGNORE')
27
27
  end
28
28
  _main
@@ -34,11 +34,9 @@ def _main
34
34
  @logger = ReVIEW.logger
35
35
  @mode = :files
36
36
  @basedir = nil
37
- if File.basename($PROGRAM_NAME).start_with?('review2')
38
- @target = File.basename($PROGRAM_NAME, '.rb').sub('review2', '')
39
- else
40
- @target = nil
41
- end
37
+ @target = if File.basename($PROGRAM_NAME).start_with?('review2')
38
+ File.basename($PROGRAM_NAME, '.rb').sub('review2', '')
39
+ end
42
40
  @check_only = false
43
41
  @output_filename = nil
44
42
 
@@ -52,13 +50,13 @@ def _main
52
50
  error! "#{@config['yaml']} not found." unless File.exist?(@config['yaml'])
53
51
  begin
54
52
  @config.deep_merge!(loader.load_file(@config['yaml']))
55
- rescue => e
53
+ rescue StandardError => e
56
54
  error! "yaml error #{e.message}"
57
55
  end
58
56
  elsif File.exist?(DEFAULT_CONFIG_FILENAME)
59
57
  begin
60
58
  @config.deep_merge!(loader.load_file(DEFAULT_CONFIG_FILENAME))
61
- rescue => e
59
+ rescue StandardError => e
62
60
  error! "yaml error #{e.message}"
63
61
  end
64
62
  end
data/bin/review-index CHANGED
@@ -15,7 +15,7 @@ require 'review/tocprinter'
15
15
 
16
16
  begin
17
17
  Signal.trap(:INT) { exit 1 }
18
- if RUBY_PLATFORM !~ /mswin(?!ce)|mingw|cygwin|bccwin/
18
+ unless RUBY_PLATFORM.match?(/mswin(?!ce)|mingw|cygwin|bccwin/)
19
19
  Signal.trap(:PIPE, 'IGNORE')
20
20
  end
21
21
 
data/bin/review-preproc CHANGED
@@ -26,7 +26,7 @@ include ReVIEW::Loggable
26
26
 
27
27
  def sigmain
28
28
  Signal.trap(:INT) { exit 1 }
29
- if RUBY_PLATFORM !~ /mswin(?!ce)|mingw|cygwin|bccwin/
29
+ unless RUBY_PLATFORM.match?(/mswin(?!ce)|mingw|cygwin|bccwin/)
30
30
  Signal.trap(:PIPE, 'IGNORE')
31
31
  end
32
32
  main
data/bin/review-validate CHANGED
@@ -41,7 +41,7 @@ ARGF.each do |line|
41
41
  unless %w[list emlist listnum emlistnum cmd image table].include?(block)
42
42
  @logger.warn "#{ln}: found '#{$1}' without the head space. Is it correct?"
43
43
  end
44
- elsif line =~ /\A\*\s+/
44
+ elsif /\A\*\s+/.match?(line)
45
45
  # itemize
46
46
  unless %w[list emlist listnum emlistnum cmd image table].include?(block)
47
47
  @logger.warn "#{ln}: found '*' without the head space. Is it correct?"
@@ -53,7 +53,7 @@ ARGF.each do |line|
53
53
  elsif block == 'table'
54
54
  next if line.start_with?('#@')
55
55
 
56
- if line !~ /\A-----/
56
+ unless line.start_with?('-----')
57
57
  # table
58
58
  colcount = line.split("\t").size
59
59
  if maxcolcount == 0
@@ -87,7 +87,7 @@ aut: ["青木峰郎", "武藤健志", "高橋征義", "角征典"]
87
87
  debug: null
88
88
 
89
89
  # 固有IDに使用するドメイン。指定しない場合には、時刻に基づくランダムUUIDが入る
90
- # urnid: urn:uuid:http://example.com/book-title/
90
+ # urnid: urn:uuid:ffffffff-ffff-ffff-ffff-ffffffffffff
91
91
  #
92
92
  # ISBN。省略した場合はurnidが入る
93
93
  # isbn: null
@@ -442,3 +442,9 @@ pdfmaker:
442
442
  # options_with_caption: "colbacktitle=black!25!white"
443
443
  #
444
444
  # pdfmaker:階層を使うものはここまで
445
+ # textmaker:
446
+ # 表見出しの表現の設定
447
+ # nullの場合は区切り線(------------)で見出し行と通常の行を分ける。
448
+ # trueの場合は見出しを★〜☆で囲み(太字と同様)、区切り線を入れない。
449
+ # th_bold: null
450
+ # textmaker:階層を使うものはここまで
@@ -25,7 +25,7 @@ date: 2018-11-11
25
25
  history: [["2012-01-30"],["2016-04-20","2016-05-03"],["2018-11-11"]]
26
26
  rights: (C) 2016-2020 Re:VIEW Commiters, some rights reserved.
27
27
  description: sample config.yml file for Re:VIEW book
28
- urnid: urn:uuid:http://reviewml.org/review-sample-book
28
+ # urnid: urn:uuid:ffffffff-ffff-ffff-ffff-ffffffffffff
29
29
  # isbn: null
30
30
 
31
31
  ## Book Structure
data/doc/format.ja.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Re:VIEW フォーマットの文法について解説します。Re:VIEW フォーマットはアスキー社(現カドカワ)の EWB を基本としながら、一部に RD や各種 Wiki の文法を取り入れて簡素化しています。
4
4
 
5
- このドキュメントは、Re:VIEW 5.1 に基づいています。
5
+ このドキュメントは、Re:VIEW 5.5 に基づいています。
6
6
 
7
7
  ## 段落
8
8
 
@@ -396,7 +396,7 @@ plot sin(x)
396
396
  * Gnuplot ( http://www.gnuplot.info/ ) : `gnuplot` コマンドへのパスを OS に設定すること
397
397
  * Blockdiag ( http://blockdiag.com/ ) : `blockdiag` コマンドへのパスを OS に設定すること。PDF を生成する場合は ReportLab もインストールすること
398
398
  * aafigure ( https://launchpad.net/aafigure ) : `aafigure` コマンドへのパスを OS に設定すること
399
- * PlantUML ( http://plantuml.com/ ) : `java` コマンドへのパスを OS に設定し、`plantuml.jar` が作業フォルダにあること
399
+ * PlantUML ( http://plantuml.com/ ) : `java` コマンドへのパスを OS に設定し、`plantuml.jar` が作業フォルダ、または `/usr/share/plantuml` あるいは `/usr/share/java` フォルダにあること
400
400
 
401
401
  ## 表
402
402
 
@@ -524,6 +524,7 @@ Re:VIEW 5.0 以降では、囲み記事に箇条書きや図表・リストを
524
524
  ```
525
525
  パッケージは本書のサポートサイトから入手できます@<fn>{site}。
526
526
  各自ダウンロードしてインストールしておいてください。
527
+
527
528
  //footnote[site][本書のサポートサイト: http://i.loveruby.net/ja/stdcompiler ]
528
529
  ```
529
530
 
@@ -538,6 +539,31 @@ TeX PDF において、コラム以外の `//note` などの囲み記事の中
538
539
 
539
540
  ただし、通常の脚注(footnote)ではなく、footnotemark と footnotetext を使うため、本文と脚注が別ページに分かれる可能性があるなど、いろいろな制約があります。また、採番が別々になるため、footnote と footnotemark/footnotetext を両立させることはできません。
540
541
 
542
+ ## 後注
543
+
544
+ 後注(最後にまとめて出力される注釈)は、「`//endnote`」を使って記述します。
545
+
546
+ ```
547
+ パッケージは本書のサポートサイトから入手できます@<endnote>{site}。
548
+ 各自ダウンロードしてインストールしておいてください。
549
+
550
+ //endnote[site][本書のサポートサイト: http://i.loveruby.net/ja/stdcompiler ]
551
+ ```
552
+
553
+ 本文中のインライン命令「`@<endnote>{site}`」は後注番号に置換され、「本書のサポートサイト……」という文は後注として内部に保存されます。
554
+
555
+ 保存されている後注を書き出すには、書き出したい箇所(通常は章の末尾)に「`//printendnotes`」を置きます。
556
+
557
+ ```
558
+
559
+
560
+ ==== 注釈
561
+
562
+ //printendnotes
563
+ ```
564
+
565
+ 後注の管理は章 (re ファイル) 単位であり、複数の章にまたがった後注を作ることはできません。
566
+
541
567
  ## 参考文献の定義
542
568
 
543
569
  参考文献は同一ディレクトリ内の `bib.re` ファイルに定義します。
@@ -686,7 +712,7 @@ imgmath_options:
686
712
  math_format: imgmath
687
713
  imgmath_options:
688
714
  format: svg
689
- pdfcrop_pixelize_cmd: "pdftocairo -svg -r 90 -f %p -l %p -singlefile %i %o"
715
+ pdfcrop_pixelize_cmd: "pdftocairo -%t -r 90 -f %p -l %p %i %o"
690
716
  ```
691
717
 
692
718
  デフォルトでは、pdfcrop_pixelize_cmd に指定するコマンドは、1ページあたり1数式からなる複数ページの PDF のファイル名を `%i` プレースホルダで受け取り、`%p` プレースホルダのページ数に基づいて `%o`(拡張子あり)または `%O`(拡張子なし)の画像ファイルに書き出す、という仕組みになっています。
@@ -770,7 +796,7 @@ imgmath_options:
770
796
  @<hd>{preface|はじめに|まずは}
771
797
  ```
772
798
 
773
- 参照先にラベルが設定されている場合は、見出しの代わりに、ラベルで参照します。
799
+ 参照先にラベルが設定されている場合は、見出しの代わりに、ラベルで参照します。複雑な階層をとるときにはラベルを使うことを推奨します。
774
800
 
775
801
  ```
776
802
  =={hajimeni} はじめに
@@ -780,6 +806,10 @@ imgmath_options:
780
806
  @<hd>{hajimeni|まずは}
781
807
  ```
782
808
 
809
+ * `@<hd>{見出しまたはラベル}` あるいは `@<secref>{見出しまたはラベル}` : 『「1.1 まずは」』のように、節項番号とタイトルを含むテキストに置換されます。
810
+ * `@<sec>{見出しまたはラベル}` : 「1.1」のような節項番号に置換されます。番号が付かない箇所の場合はエラーになります。
811
+ * `@<sectitle>{見出しまたはラベル}` : 「まずは」のように、節項のタイトル部に置換されます。
812
+
783
813
  ### コラム見出し参照
784
814
 
785
815
  コラムの見出しの参照は、インライン命令 `@<column>` を使います。
data/doc/format.md CHANGED
@@ -4,7 +4,7 @@ The document is a brief guide for Re:VIEW markup syntax.
4
4
 
5
5
  Re:VIEW is based on EWB of ASCII (now KADOKAWA), influenced RD and other Wiki system's syntax.
6
6
 
7
- This document explains about the format of Re:VIEW 5.1.
7
+ This document explains about the format of Re:VIEW 5.3.
8
8
 
9
9
  ## Paragraph
10
10
 
@@ -423,7 +423,7 @@ Before using these tools, you should installed them and configured path appropri
423
423
  * Gnuplot ( http://www.gnuplot.info/ ) : set path to `gnuplot` command
424
424
  * Blockdiag ( http://blockdiag.com/ ) : set path to `blockdiag` command. Install ReportLab also to make a PDF
425
425
  * aafigure ( https://launchpad.net/aafigure ) : set path to `aafigure` command
426
- * PlantUML ( http://plantuml.com/ ) : set path to `java` command. place `plantuml.jar` on working folder
426
+ * PlantUML ( http://plantuml.com/ ) : set path to `java` command. place `plantuml.jar` on working folder, `/usr/share/plantuml` or `/usr/share/java`.
427
427
 
428
428
  ## Tables
429
429
 
@@ -551,6 +551,7 @@ Usage:
551
551
  ```
552
552
  You can get the packages from support site for the book.@<fn>{site}
553
553
  You should get and install it before reading the book.
554
+
554
555
  //footnote[site][support site of the book: http://i.loveruby.net/ja/stdcompiler ]
555
556
  ```
556
557
 
@@ -572,6 +573,34 @@ Note that with this option, Re:VIEW use footnotemark and footnotetext instead of
572
573
  There are some constraints to use this option.
573
574
  You cannot use footnote and footnotemark/footnotetext at the same time.
574
575
 
576
+ ## Endnotes
577
+
578
+ You can use `//endnote` to write endnotes.
579
+
580
+ Usage:
581
+
582
+ ```
583
+ You can get the packages from support site for the book.@<endnote>{site}
584
+ You should get and install it before reading the book.
585
+
586
+ //endnote[site][support site of the book: http://i.loveruby.net/ja/stdcompiler ]
587
+ ```
588
+
589
+ `@<endnote>{site}` in source are replaced by endnote marks, and the phrase "support site of .."
590
+ is stored for printing later.
591
+
592
+ To print stored endnotes, place "`//printendnotes`" where you want to write down them (usually at the end of the chapter).
593
+
594
+ ```
595
+ ...
596
+
597
+ ==== Endnote
598
+
599
+ //printendnotes
600
+ ```
601
+
602
+ It is not possible to create an endnote that spans multiple chapters.
603
+
575
604
  ## Bibliography
576
605
 
577
606
  When you want to use a bibliography, you should write them in the file `bib.re`.
@@ -719,7 +748,7 @@ For example, to make SVG:
719
748
  math_format: imgmath
720
749
  imgmath_options:
721
750
  format: svg
722
- pdfcrop_pixelize_cmd: "pdftocairo -svg -r 90 -f %p -l %p -singlefile %i %o"
751
+ pdfcrop_pixelize_cmd: "pdftocairo -%t -r 90 -f %p -l %p %i %o"
723
752
  ```
724
753
 
725
754
  By default, the command specified in `pdfcrop_pixelize_cmd` takes the filename of multi-page PDF consisting of one formula per page.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2009-2019 Minero Aoki, Kenshi Muto
2
+ # Copyright (c) 2009-2022 Minero Aoki, Kenshi Muto, Masayoshi Takahashi
3
3
  # 2002-2008 Minero Aoki
4
4
  #
5
5
  # This program is free software.
@@ -214,7 +214,7 @@ module ReVIEW
214
214
  end
215
215
 
216
216
  def load_config(filename)
217
- new_conf = YAML.load_file(filename)
217
+ new_conf = YAMLLoader.safe_load_file(filename)
218
218
  @config.merge!(new_conf)
219
219
  end
220
220
 
@@ -408,7 +408,7 @@ module ReVIEW
408
408
  end
409
409
 
410
410
  def filename_join(*args)
411
- File.join(args.reject(&:nil?))
411
+ File.join(args.compact)
412
412
  end
413
413
  end
414
414
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2009-2017 Minero Aoki, Kenshi Muto
1
+ # Copyright (c) 2009-2021 Minero Aoki, Kenshi Muto
2
2
  # 2002-2008 Minero Aoki
3
3
  #
4
4
  # This program is free software.
@@ -18,7 +18,8 @@ module ReVIEW
18
18
  attr_reader :lines
19
19
  attr_accessor :content
20
20
 
21
- attr_reader :list_index, :table_index, :equation_index, :footnote_index,
21
+ attr_reader :list_index, :table_index, :equation_index,
22
+ :footnote_index, :endnote_index,
22
23
  :numberless_image_index, :image_index, :icon_index, :indepimage_index,
23
24
  :headline_index, :column_index
24
25
 
@@ -56,6 +57,7 @@ module ReVIEW
56
57
  @table_index = @indexes.table_index
57
58
  @equation_index = @indexes.equation_index
58
59
  @footnote_index = @indexes.footnote_index
60
+ @endnote_index = @indexes.endnote_index
59
61
  @headline_index = @indexes.headline_index
60
62
  @column_index = @indexes.column_index
61
63
  if use_bib
@@ -84,7 +86,7 @@ module ReVIEW
84
86
  return @title unless content
85
87
 
86
88
  content.each_line do |line|
87
- if line =~ /\A=+/
89
+ if /\A=+/.match?(line)
88
90
  @title = line.sub(/\A=+(\[.+?\])?(\{.+?\})?/, '').strip
89
91
  break
90
92
  end
@@ -116,6 +118,14 @@ module ReVIEW
116
118
  footnote_index[id]
117
119
  end
118
120
 
121
+ def endnote(id)
122
+ endnote_index[id]
123
+ end
124
+
125
+ def endnotes
126
+ endnote_index
127
+ end
128
+
119
129
  def image(id)
120
130
  return image_index[id] if image_index.key?(id)
121
131
  return icon_index[id] if icon_index.key?(id)
@@ -42,7 +42,7 @@ module ReVIEW
42
42
  if @io
43
43
  begin
44
44
  @content = @io.read
45
- rescue
45
+ rescue StandardError
46
46
  @content = nil
47
47
  end
48
48
  else
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2008-2019 Minero Aoki, Kenshi Muto
1
+ # Copyright (c) 2008-2021 Minero Aoki, Kenshi Muto
2
2
  # 2002-2007 Minero Aoki
3
3
  #
4
4
  # This program is free software.
@@ -45,7 +45,7 @@ module ReVIEW
45
45
 
46
46
  def [](id)
47
47
  @index.fetch(id)
48
- rescue
48
+ rescue StandardError
49
49
  index_keys = @index.keys.map { |i| i.split('|').last }.flatten # unfold all ids
50
50
  if index_keys.each_with_object(Hash.new(0)) { |i, h| h[i] += 1 }. # number of occurrences
51
51
  select { |k, v| k == id && v > 1 }.present? # detect duplicated
@@ -84,14 +84,14 @@ module ReVIEW
84
84
  begin
85
85
  chapter = chapter_item.content
86
86
  chapter.format_number
87
- rescue # part
87
+ rescue StandardError # part
88
88
  I18n.t('part', chapter.number)
89
89
  end
90
90
  end
91
91
 
92
92
  def title(id)
93
93
  @index.fetch(id).content.title
94
- rescue # non-file part
94
+ rescue StandardError # non-file part
95
95
  @index.fetch(id).content.name
96
96
  end
97
97
 
@@ -125,6 +125,9 @@ module ReVIEW
125
125
  class FootnoteIndex < Index
126
126
  end
127
127
 
128
+ class EndnoteIndex < Index
129
+ end
130
+
128
131
  class ImageIndex < Index
129
132
  def self.item_type
130
133
  '(image|graph|imgtable)'