review 3.2.0 → 5.1.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 +31 -0
- data/.github/workflows/ruby-win.yml +45 -0
- data/.github/workflows/ruby.yml +27 -0
- data/.rubocop.yml +167 -42
- data/.travis.yml +1 -1
- data/Dockerfile +21 -5
- data/NEWS.ja.md +428 -1
- data/NEWS.md +429 -2
- data/README.md +11 -7
- data/Rakefile +7 -2
- data/appveyor.yml +0 -20
- data/bin/review +2 -4
- data/bin/review-catalog-converter +5 -5
- data/bin/review-check +13 -17
- data/bin/review-checkdep +3 -6
- data/bin/review-compile +13 -22
- data/bin/review-epub2html +1 -4
- data/bin/review-epubmaker +3 -4
- data/bin/review-idgxmlmaker +14 -0
- data/bin/review-index +5 -86
- data/bin/review-init +1 -4
- data/bin/review-pdfmaker +1 -3
- data/bin/review-preproc +11 -13
- data/bin/review-textmaker +1 -3
- data/bin/review-update +1 -4
- data/bin/review-validate +7 -7
- data/bin/review-vol +5 -82
- data/bin/review-webmaker +1 -3
- data/doc/config.yml.sample +67 -16
- data/doc/config.yml.sample-simple +4 -3
- data/doc/format.ja.md +133 -21
- data/doc/format.md +135 -34
- data/doc/makeindex.ja.md +2 -2
- data/doc/pdfmaker.ja.md +43 -1
- data/doc/pdfmaker.md +42 -1
- data/doc/quickstart.ja.md +55 -25
- data/doc/quickstart.md +47 -17
- data/lib/review.rb +1 -1
- data/lib/review/book.rb +2 -2
- data/lib/review/book/base.rb +89 -90
- data/lib/review/book/bib.rb +21 -0
- data/lib/review/book/book_unit.rb +158 -0
- data/lib/review/book/chapter.rb +51 -29
- data/lib/review/book/index.rb +42 -248
- data/lib/review/book/index/item.rb +46 -0
- data/lib/review/book/page_metric.rb +7 -7
- data/lib/review/book/part.rb +45 -10
- data/lib/review/book/volume.rb +5 -5
- data/lib/review/builder.rb +171 -54
- data/lib/review/call_hook.rb +20 -0
- data/lib/review/catalog.rb +15 -17
- data/lib/review/compiler.rb +240 -102
- data/lib/review/configure.rb +101 -12
- data/lib/review/converter.rb +1 -1
- data/lib/review/epub2html.rb +6 -1
- data/lib/review/epubmaker.rb +120 -118
- 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 +168 -0
- data/lib/review/epubmaker/reviewheaderlistener.rb +12 -2
- data/lib/review/epubmaker/zip_exporter.rb +84 -0
- data/lib/review/exception.rb +6 -0
- data/lib/review/extentions/string.rb +0 -4
- data/lib/review/htmlbuilder.rb +147 -149
- data/lib/review/htmlutils.rb +10 -14
- data/lib/review/i18n.rb +4 -3
- data/lib/review/idgxmlbuilder.rb +229 -103
- data/lib/review/idgxmlmaker.rb +188 -0
- data/lib/review/img_math.rb +245 -0
- data/lib/review/index_builder.rb +654 -0
- data/lib/review/init-web/finish.html +10 -0
- data/lib/review/init-web/index.html +190 -0
- data/lib/review/init-web/review-layout-design.js +691 -0
- data/lib/review/init.rb +124 -41
- data/lib/review/latexbox.rb +58 -0
- data/lib/review/latexbuilder.rb +249 -97
- data/lib/review/latexutils.rb +9 -1
- data/lib/review/lineinput.rb +113 -3
- data/lib/review/logger.rb +43 -8
- data/lib/review/makerhelper.rb +13 -186
- data/lib/review/markdownbuilder.rb +75 -39
- data/lib/review/md2inaobuilder.rb +3 -5
- data/lib/review/pdfmaker.rb +88 -83
- data/lib/review/plaintextbuilder.rb +158 -83
- data/lib/review/preprocessor.rb +30 -24
- data/lib/review/rstbuilder.rb +58 -39
- data/lib/review/sec_counter.rb +14 -0
- data/lib/review/template.rb +6 -0
- data/lib/review/textmaker.rb +29 -17
- data/lib/review/textutils.rb +68 -2
- data/lib/review/tocprinter.rb +242 -97
- data/lib/review/topbuilder.rb +147 -61
- data/lib/review/update.rb +27 -28
- data/lib/review/version.rb +1 -1
- data/lib/review/volumeprinter.rb +97 -0
- data/lib/review/webmaker.rb +36 -35
- data/lib/review/webtocprinter.rb +39 -35
- data/lib/review/yamlloader.rb +4 -0
- data/review.gemspec +8 -5
- data/samples/sample-book/README.md +7 -2
- data/samples/sample-book/src/.gitignore +154 -0
- data/samples/sample-book/src/config-ebook.yml +4 -0
- data/samples/sample-book/src/config-epub2.yml +1 -1
- data/samples/sample-book/src/config-jlreq-ebook.yml +4 -0
- data/samples/sample-book/src/config-jlreq.yml +6 -0
- data/samples/sample-book/src/config.yml +3 -3
- data/samples/sample-book/src/lib/tasks/review.rake +45 -14
- data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +14 -8
- data/samples/syntax-book/Gemfile +1 -1
- data/samples/syntax-book/ch01.re +3 -1
- data/samples/syntax-book/ch02.re +28 -21
- data/samples/syntax-book/ch03.re +4 -7
- data/samples/syntax-book/config-jlreq-lualatex.yml +4 -0
- data/samples/syntax-book/config-jlreq.yml +5 -0
- data/samples/syntax-book/config-print.yml +3 -0
- data/samples/syntax-book/config.yml +1 -1
- data/samples/syntax-book/images/img3-2.png +0 -0
- data/samples/syntax-book/lib/tasks/review.rake +30 -15
- data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +14 -8
- 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 +45 -27
- data/templates/latex/layout.tex.erb +1 -0
- data/templates/latex/review-jlreq/README.md +3 -1
- data/templates/latex/review-jlreq/review-base.sty +124 -37
- data/templates/latex/review-jlreq/review-jlreq.cls +29 -22
- data/templates/latex/review-jlreq/review-style.sty +9 -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/README.md +46 -5
- data/templates/latex/review-jsbook/review-base.sty +111 -30
- data/templates/latex/review-jsbook/review-jsbook.cls +16 -2
- data/templates/latex/review-jsbook/review-style.sty +10 -2
- 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 +9 -8
- 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 +58 -0
- data/test/assets/test_template.tex +20 -9
- data/test/assets/test_template_backmatter.tex +20 -9
- data/test/book_test_helper.rb +11 -5
- data/test/run_test.rb +1 -1
- data/test/test_book.rb +123 -78
- data/test/test_book_chapter.rb +99 -56
- data/test/test_book_part.rb +3 -3
- data/test/test_builder.rb +24 -15
- data/test/test_catalog.rb +19 -42
- data/test/test_catalog_converter_cmd.rb +1 -1
- data/test/test_converter.rb +1 -0
- data/test/test_epub3maker.rb +170 -126
- data/test/test_epubmaker.rb +249 -129
- data/test/test_epubmaker_cmd.rb +16 -9
- data/test/test_helper.rb +23 -11
- data/test/test_htmlbuilder.rb +1083 -114
- data/test/test_htmlutils.rb +0 -12
- data/test/test_i18n.rb +37 -37
- data/test/test_idgxmlbuilder.rb +627 -27
- data/test/test_idgxmlmaker_cmd.rb +50 -0
- data/test/test_image_finder.rb +52 -70
- data/test/test_img_math.rb +111 -0
- data/test/test_index.rb +62 -52
- data/test/test_indexbuilder.rb +52 -0
- data/test/test_latexbuilder.rb +1189 -59
- data/test/test_latexbuilder_v2.rb +74 -34
- data/test/test_lineinput.rb +20 -93
- data/test/test_logger.rb +17 -4
- data/test/test_makerhelper.rb +2 -14
- data/test/test_markdownbuilder.rb +77 -4
- data/test/test_md2inaobuilder.rb +12 -2
- data/test/test_pdfmaker.rb +101 -12
- data/test/test_pdfmaker_cmd.rb +102 -8
- data/test/test_plaintextbuilder.rb +562 -31
- data/test/test_review_ext.rb +2 -1
- data/test/test_reviewheaderlistener.rb +49 -0
- data/test/test_rstbuilder.rb +58 -5
- data/test/test_sec_counter.rb +156 -0
- data/test/test_template.rb +12 -2
- data/test/test_textmaker_cmd.rb +58 -0
- data/test/test_textutils.rb +109 -2
- data/test/test_tocprinter.rb +46 -0
- data/test/test_topbuilder.rb +400 -17
- data/test/test_update.rb +53 -44
- data/test/test_webtocprinter.rb +75 -43
- data/test/test_yamlloader.rb +13 -0
- data/test/test_zip_exporter.rb +5 -6
- data/vendor/gentombow/LICENSE +1 -1
- data/vendor/gentombow/Makefile +0 -1
- data/vendor/gentombow/bounddvi-en.pdf +0 -0
- data/vendor/gentombow/bounddvi-en.tex +1 -0
- data/vendor/gentombow/bounddvi.pdf +0 -0
- data/vendor/gentombow/bounddvi.sty +30 -7
- data/vendor/gentombow/bounddvi.tex +1 -0
- data/vendor/gentombow/create_archive.sh +1 -0
- data/vendor/gentombow/gentombow-ja.pdf +0 -0
- data/vendor/gentombow/gentombow-ja.tex +9 -0
- data/vendor/gentombow/gentombow.pdf +0 -0
- data/vendor/gentombow/gentombow.sty +32 -10
- data/vendor/gentombow/gentombow.tex +8 -0
- data/vendor/gentombow/tests/gentombow-01-pdfx.tex +8 -0
- data/vendor/gentombow/tests/gentombow-02-pdfx.tex +8 -0
- data/vendor/jsclasses/LICENSE +1 -1
- data/vendor/jsclasses/Makefile +3 -2
- data/vendor/jsclasses/create_archive.sh +5 -5
- data/vendor/jsclasses/jis/Makefile +3 -2
- data/vendor/jsclasses/jis/jsarticle.cls +74 -31
- data/vendor/jsclasses/jis/jsbook.cls +74 -31
- data/vendor/jsclasses/jis/jsclasses.dtx +176 -36
- data/vendor/jsclasses/jis/jsclasses.ins +15 -5
- data/vendor/jsclasses/jis/jslogo.dtx +4 -4
- data/vendor/jsclasses/jis/jslogo.ins +9 -0
- data/vendor/jsclasses/jis/jslogo.sty +4 -16
- data/vendor/jsclasses/jis/jspf.cls +73 -30
- data/vendor/jsclasses/jis/jsreport.cls +74 -31
- data/vendor/jsclasses/jis/jsverb.ins +9 -0
- data/vendor/jsclasses/jis/jsverb.sty +1 -13
- data/vendor/jsclasses/jis/kiyou.cls +74 -31
- data/vendor/jsclasses/jis/minijs.sty +65 -22
- data/vendor/jsclasses/jis/okumacro.dtx +4 -5
- data/vendor/jsclasses/jis/okumacro.ins +9 -0
- data/vendor/jsclasses/jis/okumacro.sty +4 -17
- data/vendor/jsclasses/jis/okuverb.ins +9 -0
- data/vendor/jsclasses/jis/okuverb.sty +1 -13
- data/vendor/jsclasses/jis/winjis.sty +23 -19
- data/vendor/jsclasses/jsarticle.cls +74 -31
- data/vendor/jsclasses/jsbook.cls +74 -31
- data/vendor/jsclasses/jsclasses.dtx +176 -36
- data/vendor/jsclasses/jsclasses.ins +15 -5
- data/vendor/jsclasses/jsclasses.pdf +0 -0
- data/vendor/jsclasses/jslogo.dtx +4 -4
- data/vendor/jsclasses/jslogo.ins +9 -0
- data/vendor/jsclasses/jslogo.pdf +0 -0
- data/vendor/jsclasses/jslogo.sty +4 -16
- data/vendor/jsclasses/jspf.cls +73 -30
- data/vendor/jsclasses/jsreport.cls +74 -31
- data/vendor/jsclasses/jsverb.ins +9 -0
- data/vendor/jsclasses/jsverb.pdf +0 -0
- data/vendor/jsclasses/jsverb.sty +1 -13
- data/vendor/jsclasses/kiyou.cls +74 -31
- data/vendor/jsclasses/minijs.sty +68 -22
- data/vendor/jsclasses/okumacro.dtx +4 -5
- data/vendor/jsclasses/okumacro.ins +9 -0
- data/vendor/jsclasses/okumacro.pdf +0 -0
- data/vendor/jsclasses/okumacro.sty +4 -17
- data/vendor/jsclasses/okuverb.ins +9 -0
- data/vendor/jsclasses/okuverb.pdf +0 -0
- data/vendor/jsclasses/okuverb.sty +1 -13
- data/vendor/jsclasses/tests/relfont.tex +10 -0
- data/vendor/jsclasses/winjis.sty +23 -19
- metadata +136 -23
- data/.rubocop_todo.yml +0 -7
- data/lib/epubmaker.rb +0 -23
- data/lib/epubmaker/content.rb +0 -110
- data/lib/epubmaker/epubcommon.rb +0 -441
- data/lib/epubmaker/epubv2.rb +0 -143
- data/lib/epubmaker/epubv3.rb +0 -233
- data/lib/epubmaker/producer.rb +0 -375
- data/lib/epubmaker/zip_exporter.rb +0 -81
- data/lib/lineinput.rb +0 -155
- data/lib/review/book/compilable.rb +0 -173
- data/lib/review/tocparser.rb +0 -271
- data/samples/syntax-book/review-ext.rb +0 -14
- data/test/test_tocparser.rb +0 -25
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2018-
|
1
|
+
# Copyright (c) 2018-2020 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,7 +74,26 @@ module ReVIEW
|
|
74
74
|
private :blank
|
75
75
|
|
76
76
|
def result
|
77
|
-
@output.string
|
77
|
+
solve_nest(@output.string)
|
78
|
+
end
|
79
|
+
|
80
|
+
def solve_nest(s)
|
81
|
+
check_nest
|
82
|
+
lines = []
|
83
|
+
clevel = []
|
84
|
+
s.split("\n", -1).each do |l| # -1 means don't omit last "\n"
|
85
|
+
if l =~ /\A\x01→(dl|ul|ol)←\x01/
|
86
|
+
clevel.push($1)
|
87
|
+
lines.push("\x01→END←\x01")
|
88
|
+
elsif l =~ %r{\A\x01→/(dl|ul|ol)←\x01}
|
89
|
+
clevel.pop
|
90
|
+
lines.push("\x01→END←\x01")
|
91
|
+
else
|
92
|
+
lines.push("\t" * clevel.size + l)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
lines.join("\n").gsub(/\n*\x01→END←\x01\n*/, "\n")
|
78
97
|
end
|
79
98
|
|
80
99
|
def headline(level, _label, caption)
|
@@ -87,7 +106,7 @@ module ReVIEW
|
|
87
106
|
end
|
88
107
|
|
89
108
|
def ul_item(lines)
|
90
|
-
puts lines
|
109
|
+
puts join_lines_to_paragraph(lines)
|
91
110
|
end
|
92
111
|
|
93
112
|
def ul_end
|
@@ -100,7 +119,7 @@ module ReVIEW
|
|
100
119
|
end
|
101
120
|
|
102
121
|
def ol_item(lines, num)
|
103
|
-
puts "#{num} #{lines
|
122
|
+
puts "#{num} #{join_lines_to_paragraph(lines)}"
|
104
123
|
end
|
105
124
|
|
106
125
|
def ol_end
|
@@ -118,7 +137,7 @@ module ReVIEW
|
|
118
137
|
|
119
138
|
def dd(lines)
|
120
139
|
split_paragraph(lines).each do |paragraph|
|
121
|
-
puts paragraph.
|
140
|
+
puts paragraph.delete("\n")
|
122
141
|
end
|
123
142
|
end
|
124
143
|
|
@@ -127,7 +146,7 @@ module ReVIEW
|
|
127
146
|
end
|
128
147
|
|
129
148
|
def paragraph(lines)
|
130
|
-
puts lines
|
149
|
+
puts join_lines_to_paragraph(lines)
|
131
150
|
end
|
132
151
|
|
133
152
|
def read(lines)
|
@@ -137,27 +156,47 @@ module ReVIEW
|
|
137
156
|
|
138
157
|
alias_method :lead, :read
|
139
158
|
|
140
|
-
def
|
159
|
+
def list(lines, id, caption, lang = nil)
|
141
160
|
blank
|
161
|
+
begin
|
162
|
+
if caption_top?('list')
|
163
|
+
list_header(id, caption, lang)
|
164
|
+
blank
|
165
|
+
end
|
166
|
+
list_body(id, lines, lang)
|
167
|
+
unless caption_top?('list')
|
168
|
+
blank
|
169
|
+
list_header(id, caption, lang)
|
170
|
+
end
|
171
|
+
rescue KeyError
|
172
|
+
error "no such list: #{id}"
|
173
|
+
end
|
174
|
+
blank
|
175
|
+
end
|
176
|
+
|
177
|
+
def list_header(id, caption, _lang)
|
142
178
|
if get_chap
|
143
179
|
puts %Q(#{I18n.t('list')}#{I18n.t('format_number', [get_chap, @chapter.list(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)})
|
144
180
|
else
|
145
181
|
puts %Q(#{I18n.t('list')}#{I18n.t('format_number_without_chapter', [@chapter.list(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)})
|
146
182
|
end
|
147
|
-
blank
|
148
183
|
end
|
149
184
|
|
150
185
|
def list_body(_id, lines, _lang)
|
151
186
|
lines.each do |line|
|
152
187
|
puts detab(line)
|
153
188
|
end
|
154
|
-
blank
|
155
189
|
end
|
156
190
|
|
157
191
|
def base_block(_type, lines, caption = nil)
|
158
192
|
blank
|
159
|
-
|
193
|
+
if caption_top?('list') && caption.present?
|
194
|
+
puts compile_inline(caption)
|
195
|
+
end
|
160
196
|
puts lines.join("\n")
|
197
|
+
if !caption_top?('list') && caption.present?
|
198
|
+
puts compile_inline(caption)
|
199
|
+
end
|
161
200
|
blank
|
162
201
|
end
|
163
202
|
|
@@ -169,15 +208,38 @@ module ReVIEW
|
|
169
208
|
end
|
170
209
|
|
171
210
|
def emlist(lines, caption = nil, _lang = nil)
|
172
|
-
base_block
|
211
|
+
base_block('emlist', lines, caption)
|
173
212
|
end
|
174
213
|
|
175
214
|
def emlistnum(lines, caption = nil, _lang = nil)
|
176
215
|
blank
|
177
|
-
|
216
|
+
if caption_top?('list')
|
217
|
+
puts compile_inline(caption) if caption.present?
|
218
|
+
end
|
178
219
|
lines.each_with_index do |line, i|
|
179
220
|
puts((i + 1).to_s.rjust(2) + ": #{line}")
|
180
221
|
end
|
222
|
+
unless caption_top?('list')
|
223
|
+
puts compile_inline(caption) if caption.present?
|
224
|
+
end
|
225
|
+
blank
|
226
|
+
end
|
227
|
+
|
228
|
+
def listnum(lines, id, caption, lang = nil)
|
229
|
+
blank
|
230
|
+
begin
|
231
|
+
if caption_top?('list')
|
232
|
+
list_header(id, caption, lang)
|
233
|
+
blank
|
234
|
+
end
|
235
|
+
listnum_body(lines, lang)
|
236
|
+
unless caption_top?('list')
|
237
|
+
blank
|
238
|
+
list_header(id, caption, lang)
|
239
|
+
end
|
240
|
+
rescue KeyError
|
241
|
+
error "no such list: #{id}"
|
242
|
+
end
|
181
243
|
blank
|
182
244
|
end
|
183
245
|
|
@@ -185,15 +247,14 @@ module ReVIEW
|
|
185
247
|
lines.each_with_index do |line, i|
|
186
248
|
puts((i + 1).to_s.rjust(2) + ": #{line}")
|
187
249
|
end
|
188
|
-
blank
|
189
250
|
end
|
190
251
|
|
191
252
|
def cmd(lines, caption = nil)
|
192
|
-
base_block
|
253
|
+
base_block('cmd', lines, caption)
|
193
254
|
end
|
194
255
|
|
195
256
|
def quote(lines)
|
196
|
-
base_parablock
|
257
|
+
base_parablock('quote', lines, nil)
|
197
258
|
end
|
198
259
|
|
199
260
|
def image(_lines, id, caption, _metric = nil)
|
@@ -207,59 +268,35 @@ module ReVIEW
|
|
207
268
|
end
|
208
269
|
|
209
270
|
def texequation(lines, id = nil, caption = '')
|
271
|
+
blank
|
272
|
+
texequation_header(id, caption) if caption_top?('equation')
|
273
|
+
puts lines.join("\n")
|
274
|
+
texequation_header(id, caption) unless caption_top?('equation')
|
275
|
+
blank
|
276
|
+
end
|
277
|
+
|
278
|
+
def texequation_header(id, caption)
|
210
279
|
if id
|
211
|
-
blank
|
212
280
|
if get_chap
|
213
281
|
puts "#{I18n.t('equation')}#{I18n.t('format_number', [get_chap, @chapter.equation(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
214
282
|
else
|
215
283
|
puts "#{I18n.t('equation')}#{I18n.t('format_number_without_chapter', [@chapter.equation(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
216
284
|
end
|
217
285
|
end
|
218
|
-
|
219
|
-
puts lines.join("\n")
|
220
|
-
blank
|
221
286
|
end
|
222
287
|
|
223
|
-
def table(lines, id = nil, caption = nil)
|
224
|
-
|
225
|
-
|
226
|
-
lines.each_with_index do |line, idx|
|
227
|
-
if /\A[\=\-]{12}/ =~ line
|
228
|
-
# just ignore
|
229
|
-
# error "too many table separator" if sepidx
|
230
|
-
sepidx ||= idx
|
231
|
-
next
|
232
|
-
end
|
233
|
-
rows.push(line.strip.split(/\t+/).map { |s| s.sub(/\A\./, '') })
|
234
|
-
end
|
235
|
-
rows = adjust_n_cols(rows)
|
236
|
-
error 'no rows in the table' if rows.empty?
|
237
|
-
|
238
|
-
blank
|
239
|
-
|
240
|
-
begin
|
241
|
-
table_header(id, caption) if caption.present?
|
242
|
-
rescue KeyError
|
243
|
-
error "no such table: #{id}"
|
244
|
-
end
|
245
|
-
table_begin rows.first.size
|
246
|
-
if sepidx
|
247
|
-
sepidx.times do
|
248
|
-
tr(rows.shift.map { |s| th(s) })
|
249
|
-
end
|
250
|
-
rows.each do |cols|
|
251
|
-
tr(cols.map { |s| td(s) })
|
252
|
-
end
|
253
|
-
else
|
254
|
-
rows.each do |cols|
|
255
|
-
h, *cs = *cols
|
256
|
-
tr([th(h)] + cs.map { |s| td(s) })
|
257
|
-
end
|
288
|
+
def table(lines, id = nil, caption = nil, noblank = nil)
|
289
|
+
unless noblank
|
290
|
+
blank
|
258
291
|
end
|
259
|
-
|
292
|
+
super(lines, id, caption)
|
260
293
|
end
|
261
294
|
|
262
295
|
def table_header(id, caption)
|
296
|
+
unless caption_top?('table')
|
297
|
+
blank
|
298
|
+
end
|
299
|
+
|
263
300
|
if id.nil?
|
264
301
|
puts compile_inline(caption)
|
265
302
|
elsif get_chap
|
@@ -267,7 +304,10 @@ module ReVIEW
|
|
267
304
|
else
|
268
305
|
puts "#{I18n.t('table')}#{I18n.t('format_number_without_chapter', [@chapter.table(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
269
306
|
end
|
270
|
-
|
307
|
+
|
308
|
+
if caption_top?('table')
|
309
|
+
blank
|
310
|
+
end
|
271
311
|
end
|
272
312
|
|
273
313
|
def table_begin(_ncols)
|
@@ -345,8 +385,8 @@ module ReVIEW
|
|
345
385
|
end
|
346
386
|
|
347
387
|
def bibpaper(lines, id, caption)
|
348
|
-
bibpaper_header
|
349
|
-
bibpaper_bibpaper
|
388
|
+
bibpaper_header(id, caption)
|
389
|
+
bibpaper_bibpaper(id, caption, lines) unless lines.empty?
|
350
390
|
end
|
351
391
|
|
352
392
|
def bibpaper_header(id, caption)
|
@@ -355,7 +395,7 @@ module ReVIEW
|
|
355
395
|
end
|
356
396
|
|
357
397
|
def bibpaper_bibpaper(_id, _caption, lines)
|
358
|
-
|
398
|
+
puts split_paragraph(lines).join("\n")
|
359
399
|
end
|
360
400
|
|
361
401
|
def inline_bib(id)
|
@@ -472,91 +512,118 @@ module ReVIEW
|
|
472
512
|
end
|
473
513
|
|
474
514
|
def flushright(lines)
|
475
|
-
base_parablock
|
515
|
+
base_parablock('flushright', lines, nil)
|
476
516
|
end
|
477
517
|
|
478
518
|
def centering(lines)
|
479
|
-
base_parablock
|
519
|
+
base_parablock('centering', lines, nil)
|
480
520
|
end
|
481
521
|
|
482
522
|
def note(lines, caption = nil)
|
483
|
-
|
523
|
+
check_nested_minicolumn
|
524
|
+
base_parablock('note', lines, caption)
|
484
525
|
end
|
485
526
|
|
486
527
|
def memo(lines, caption = nil)
|
487
|
-
|
528
|
+
check_nested_minicolumn
|
529
|
+
base_parablock('memo', lines, caption)
|
488
530
|
end
|
489
531
|
|
490
532
|
def tip(lines, caption = nil)
|
491
|
-
|
533
|
+
check_nested_minicolumn
|
534
|
+
base_parablock('tip', lines, caption)
|
492
535
|
end
|
493
536
|
|
494
537
|
def info(lines, caption = nil)
|
495
|
-
|
538
|
+
check_nested_minicolumn
|
539
|
+
base_parablock('info', lines, caption)
|
496
540
|
end
|
497
541
|
|
498
542
|
def planning(lines, caption = nil)
|
499
|
-
base_parablock
|
543
|
+
base_parablock('planning', lines, caption)
|
500
544
|
end
|
501
545
|
|
502
546
|
def best(lines, caption = nil)
|
503
|
-
|
547
|
+
check_nested_minicolumn
|
548
|
+
base_parablock('best', lines, caption)
|
504
549
|
end
|
505
550
|
|
506
551
|
def important(lines, caption = nil)
|
507
|
-
|
552
|
+
check_nested_minicolumn
|
553
|
+
base_parablock('important', lines, caption)
|
508
554
|
end
|
509
555
|
|
510
556
|
def security(lines, caption = nil)
|
511
|
-
base_parablock
|
557
|
+
base_parablock('security', lines, caption)
|
512
558
|
end
|
513
559
|
|
514
560
|
def caution(lines, caption = nil)
|
515
|
-
|
561
|
+
check_nested_minicolumn
|
562
|
+
base_parablock('caution', lines, caption)
|
516
563
|
end
|
517
564
|
|
518
565
|
def term(lines)
|
519
|
-
base_parablock
|
566
|
+
base_parablock('term', lines, nil)
|
520
567
|
end
|
521
568
|
|
522
569
|
def link(lines, caption = nil)
|
523
|
-
base_parablock
|
570
|
+
base_parablock('link', lines, caption)
|
524
571
|
end
|
525
572
|
|
526
573
|
def notice(lines, caption = nil)
|
527
|
-
|
574
|
+
check_nested_minicolumn
|
575
|
+
base_parablock('notice', lines, caption)
|
528
576
|
end
|
529
577
|
|
530
578
|
def point(lines, caption = nil)
|
531
|
-
base_parablock
|
579
|
+
base_parablock('point', lines, caption)
|
532
580
|
end
|
533
581
|
|
534
582
|
def shoot(lines, caption = nil)
|
535
|
-
base_parablock
|
583
|
+
base_parablock('shoot', lines, caption)
|
536
584
|
end
|
537
585
|
|
538
586
|
def reference(lines)
|
539
|
-
base_parablock
|
587
|
+
base_parablock('reference', lines, nil)
|
540
588
|
end
|
541
589
|
|
542
590
|
def practice(lines)
|
543
|
-
base_parablock
|
591
|
+
base_parablock('practice', lines, nil)
|
544
592
|
end
|
545
593
|
|
546
594
|
def expert(lines)
|
547
|
-
base_parablock
|
595
|
+
base_parablock('expert', lines, nil)
|
548
596
|
end
|
549
597
|
|
550
598
|
def insn(lines, caption = nil)
|
551
|
-
base_block
|
599
|
+
base_block('insn', lines, caption)
|
552
600
|
end
|
553
601
|
|
554
602
|
def warning(lines, caption = nil)
|
555
|
-
|
603
|
+
check_nested_minicolumn
|
604
|
+
base_parablock('warning', lines, caption)
|
556
605
|
end
|
557
606
|
|
558
607
|
alias_method :box, :insn
|
559
608
|
|
609
|
+
CAPTION_TITLES.each do |name|
|
610
|
+
class_eval %Q(
|
611
|
+
def #{name}_begin(caption = nil)
|
612
|
+
check_nested_minicolumn
|
613
|
+
@doc_status[:minicolumn] = '#{name}'
|
614
|
+
blank
|
615
|
+
if caption.present?
|
616
|
+
puts compile_inline(caption)
|
617
|
+
end
|
618
|
+
end
|
619
|
+
|
620
|
+
def #{name}_end
|
621
|
+
blank
|
622
|
+
@doc_status[:minicolumn] = nil
|
623
|
+
end
|
624
|
+
), __FILE__, __LINE__ - 14
|
625
|
+
end
|
626
|
+
|
560
627
|
def indepimage(_lines, _id, caption = nil, _metric = nil)
|
561
628
|
blank
|
562
629
|
puts "図 #{compile_inline(caption)}" if caption.present?
|
@@ -573,17 +640,25 @@ module ReVIEW
|
|
573
640
|
end
|
574
641
|
|
575
642
|
def bpo(lines)
|
576
|
-
base_block
|
643
|
+
base_block('bpo', lines, nil)
|
577
644
|
end
|
578
645
|
|
579
646
|
def inline_dtp(_str)
|
580
647
|
''
|
581
648
|
end
|
582
649
|
|
650
|
+
def inline_ins(str)
|
651
|
+
str
|
652
|
+
end
|
653
|
+
|
583
654
|
def inline_del(_str)
|
584
655
|
''
|
585
656
|
end
|
586
657
|
|
658
|
+
def inline_tcy(str)
|
659
|
+
str
|
660
|
+
end
|
661
|
+
|
587
662
|
def inline_br(_str)
|
588
663
|
"\n"
|
589
664
|
end
|
@@ -592,7 +667,7 @@ module ReVIEW
|
|
592
667
|
str
|
593
668
|
end
|
594
669
|
|
595
|
-
def inline_chap(id)
|
670
|
+
def inline_chap(id) # rubocop:disable Lint/UselessMethodDefinition
|
596
671
|
# "「第#{super}章 #{inline_title(id)}」"
|
597
672
|
# "第#{super}章"
|
598
673
|
super
|
@@ -623,7 +698,7 @@ module ReVIEW
|
|
623
698
|
end
|
624
699
|
|
625
700
|
def source(lines, caption = nil, _lang = nil)
|
626
|
-
base_block
|
701
|
+
base_block('source', lines, caption)
|
627
702
|
end
|
628
703
|
|
629
704
|
def inline_labelref(_idref)
|