review 5.2.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-win.yml +1 -1
- data/.rubocop.yml +3 -0
- data/NEWS.ja.md +53 -0
- data/NEWS.md +53 -0
- data/doc/format.ja.md +29 -3
- data/doc/format.md +32 -3
- data/lib/review/book/book_unit.rb +12 -2
- data/lib/review/book/index.rb +4 -1
- data/lib/review/builder.rb +51 -16
- data/lib/review/catalog.rb +1 -0
- data/lib/review/compiler.rb +4 -1
- data/lib/review/epubmaker/epubcommon.rb +4 -4
- data/lib/review/epubmaker.rb +3 -1
- data/lib/review/htmlbuilder.rb +24 -0
- data/lib/review/i18n.yml +6 -0
- data/lib/review/idgxmlbuilder.rb +21 -1
- data/lib/review/img_math.rb +1 -0
- data/lib/review/index_builder.rb +84 -18
- data/lib/review/latexbuilder.rb +16 -1
- data/lib/review/markdownbuilder.rb +10 -2
- data/lib/review/pdfmaker.rb +18 -3
- data/lib/review/plaintextbuilder.rb +3 -2
- data/lib/review/rstbuilder.rb +11 -2
- data/lib/review/textutils.rb +8 -7
- data/lib/review/tocprinter.rb +11 -6
- data/lib/review/topbuilder.rb +19 -1
- data/lib/review/version.rb +1 -1
- data/lib/review/volumeprinter.rb +9 -9
- data/samples/syntax-book/ch02.re +9 -0
- data/templates/latex/config.erb +3 -0
- data/templates/latex/review-jlreq/review-base.sty +2 -1
- data/templates/latex/review-jlreq/review-jlreq.cls +36 -3
- data/templates/latex/review-jsbook/review-base.sty +7 -1
- data/templates/latex/review-jsbook/review-jsbook.cls +31 -4
- data/test/assets/syntax_book_index_detail.txt +10 -8
- data/test/assets/test_template.tex +4 -1
- data/test/assets/test_template_backmatter.tex +4 -1
- data/test/test_book_chapter.rb +25 -2
- data/test/test_builder.rb +5 -3
- data/test/test_htmlbuilder.rb +42 -3
- data/test/test_idgxmlbuilder.rb +3 -3
- data/test/test_index.rb +30 -4
- data/test/test_latexbuilder.rb +17 -3
- data/test/test_markdownbuilder.rb +13 -0
- data/test/test_pdfmaker.rb +19 -0
- data/test/test_plaintextbuilder.rb +20 -4
- data/test/test_rstbuilder.rb +13 -0
- data/test/test_topbuilder.rb +18 -0
- metadata +2 -2
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
\IfFileExists{plautopatch.sty}{\RequirePackage{plautopatch}}{}
|
23
23
|
\NeedsTeXFormat{LaTeX2e}
|
24
|
-
\ProvidesClass{review-jlreq}[2021/
|
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
|
-
|
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
|
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/
|
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
|
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
|
-
|
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
|
|
@@ -26,7 +26,7 @@
|
|
26
26
|
-----------------------------
|
27
27
|
169C 2L 0.2P 第II部 部見出し■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
|
28
28
|
=============================
|
29
|
-
|
29
|
+
5796C 180L 11P ch02
|
30
30
|
-----------------------------
|
31
31
|
52C 1L 0.0P 第2章 長い章見出し■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
|
32
32
|
10C 1L 0.0P 2.1 ブロック命令
|
@@ -34,13 +34,15 @@
|
|
34
34
|
338C 8L 0.5P 2.1.2 図
|
35
35
|
709C 22L 1.3P 2.1.3 表
|
36
36
|
1154C 56L 2.8P 2.1.4 囲み記事
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
110C 2L 0.2P 2.2 後注
|
38
|
+
523C 14L 0.8P 2.3 LaTeX式
|
39
|
+
11C 1L 0.0P 2.4 インライン命令
|
40
|
+
967C 17L 1.3P 2.4.1 書体
|
41
|
+
74C 1L 0.0P 2.4.2 見出し内 BOLD,ITALIC,TT,STRONG,EM,CODE,TTB,TTI,AMI,BOU,KW,UNDERLINE,INS、
|
42
|
+
797C 22L 1.3P 2.4.3 参照
|
43
|
+
39C 2L 0.1P 2.4.4 参考文献
|
44
|
+
194C 3L 0.3P 2.4.5 索引
|
45
|
+
34C 3L 0.1P 2.4.5.1 後注
|
44
46
|
=============================
|
45
47
|
2255C 38L 4P ch03
|
46
48
|
-----------------------------
|
@@ -1,6 +1,6 @@
|
|
1
1
|
\documentclass[dvipdfmx]{review-jsbook}
|
2
2
|
\makeatletter
|
3
|
-
\def\review@reviewversion{5.
|
3
|
+
\def\review@reviewversion{5.3.0}
|
4
4
|
\def\review@texcompiler{uplatex}
|
5
5
|
\def\review@documentclass{review-jsbook}
|
6
6
|
|
@@ -61,6 +61,9 @@
|
|
61
61
|
\ifdefined\reviewchapref\else% for 5.1.0 compatibility
|
62
62
|
\newcommand{\reviewchapref}[2]{\hyperref[##2]{##1}}
|
63
63
|
\fi
|
64
|
+
\ifdefined\reviewtcy\else% for 5.3.0 compatibility
|
65
|
+
\DeclareRobustCommand{\reviewtcy}[1]{\rensuji{##1}}
|
66
|
+
\fi
|
64
67
|
}
|
65
68
|
|
66
69
|
\makeatother
|
@@ -1,6 +1,6 @@
|
|
1
1
|
\documentclass[dvipdfmx]{review-jsbook}
|
2
2
|
\makeatletter
|
3
|
-
\def\review@reviewversion{5.
|
3
|
+
\def\review@reviewversion{5.3.0}
|
4
4
|
\def\review@texcompiler{uplatex}
|
5
5
|
\def\review@documentclass{review-jsbook}
|
6
6
|
|
@@ -72,6 +72,9 @@ some ad content
|
|
72
72
|
\ifdefined\reviewchapref\else% for 5.1.0 compatibility
|
73
73
|
\newcommand{\reviewchapref}[2]{\hyperref[##2]{##1}}
|
74
74
|
\fi
|
75
|
+
\ifdefined\reviewtcy\else% for 5.3.0 compatibility
|
76
|
+
\DeclareRobustCommand{\reviewtcy}[1]{\rensuji{##1}}
|
77
|
+
\fi
|
75
78
|
}
|
76
79
|
|
77
80
|
\makeatother
|
data/test/test_book_chapter.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'book_test_helper'
|
2
|
+
|
2
3
|
class ChapterTest < Test::Unit::TestCase
|
3
4
|
include BookTestHelper
|
4
5
|
|
@@ -41,12 +42,12 @@ class ChapterTest < Test::Unit::TestCase
|
|
41
42
|
|
42
43
|
def test_size
|
43
44
|
ch = Book::Chapter.new(nil, nil, nil, __FILE__, :io)
|
44
|
-
filesize =
|
45
|
+
filesize = File.read(__FILE__, mode: 'rt:BOM|utf-8').size
|
45
46
|
assert_equal filesize, ch.size
|
46
47
|
|
47
48
|
File.open(__FILE__, 'r') do |i|
|
48
49
|
ch = Book::Chapter.new(nil, nil, nil, nil, i)
|
49
|
-
filesize =
|
50
|
+
filesize = File.read(__FILE__, mode: 'rt:BOM|utf-8').size
|
50
51
|
assert_equal filesize, ch.size
|
51
52
|
end
|
52
53
|
end
|
@@ -174,6 +175,7 @@ E
|
|
174
175
|
|
175
176
|
def test_footnote_index
|
176
177
|
content = <<E
|
178
|
+
@<fn>{abc}@<fn>{def}@<fn>{xyz}
|
177
179
|
//footnote[abc][textabc...]
|
178
180
|
//footnote[def][textdef...]
|
179
181
|
//footnote[xyz][textxyz...]
|
@@ -189,6 +191,27 @@ E
|
|
189
191
|
end
|
190
192
|
end
|
191
193
|
|
194
|
+
def test_endnote_index
|
195
|
+
content = <<E
|
196
|
+
@<fn>{abc}@<fn>{def}@<fn>{xyz}@<endnote>{abc}@<endnote>{def}@<endnote>{xyz}
|
197
|
+
//footnote[abc][textabc...]
|
198
|
+
//footnote[def][textdef...]
|
199
|
+
//footnote[xyz][textxyz...]
|
200
|
+
//endnote[abc][textabc...]
|
201
|
+
//endnote[def][textdef...]
|
202
|
+
//endnote[xyz][textxyz...]
|
203
|
+
//list[def][def-list]{
|
204
|
+
//}
|
205
|
+
//list[others][others-list]{
|
206
|
+
//}
|
207
|
+
E
|
208
|
+
do_test_index(content, Book::EndnoteIndex, :endnote_index, :endnote) do |ch|
|
209
|
+
assert_raises ReVIEW::KeyError do
|
210
|
+
ch.endnote('xyz2')
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
192
215
|
def test_bibpaper
|
193
216
|
do_test_index(<<E, Book::BibpaperIndex, :bibpaper_index, :bibpaper, filename: 'bib.re')
|
194
217
|
//bibpaper[abc][text...]
|
data/test/test_builder.rb
CHANGED
@@ -94,6 +94,8 @@ class BuidlerTest < Test::Unit::TestCase
|
|
94
94
|
assert_equal 'unknown column: unknown|column1', e.message
|
95
95
|
e = assert_raises(ReVIEW::ApplicationError) { b.inline_fn('unknown|footnote1') }
|
96
96
|
assert_equal 'unknown footnote: unknown|footnote1', e.message
|
97
|
+
e = assert_raises(ReVIEW::ApplicationError) { b.inline_endnote('endnote1') }
|
98
|
+
assert_equal 'unknown endnote: endnote1', e.message
|
97
99
|
end
|
98
100
|
|
99
101
|
def test_nest_error
|
@@ -102,16 +104,16 @@ class BuidlerTest < Test::Unit::TestCase
|
|
102
104
|
assert_equal '', b.solve_nest('')
|
103
105
|
b.children = ['dl']
|
104
106
|
e = assert_raises(ReVIEW::ApplicationError) { b.solve_nest('') }
|
105
|
-
assert_equal '//beginchild of dl misses //endchild', e.message
|
107
|
+
assert_equal ': //beginchild of dl misses //endchild', e.message
|
106
108
|
b.children = ['ul', 'dl', 'ol']
|
107
109
|
e = assert_raises(ReVIEW::ApplicationError) { b.solve_nest('') }
|
108
|
-
assert_equal '//beginchild of ol,dl,ul misses //endchild', e.message
|
110
|
+
assert_equal ': //beginchild of ol,dl,ul misses //endchild', e.message
|
109
111
|
|
110
112
|
assert_equal "\u0001→/ol←\u0001", b.endchild
|
111
113
|
assert_equal "\u0001→/dl←\u0001", b.endchild
|
112
114
|
assert_equal "\u0001→/ul←\u0001", b.endchild
|
113
115
|
e = assert_raises(ReVIEW::ApplicationError) { b.endchild }
|
114
|
-
assert_equal "//endchild is shown, but any opened //beginchild doesn't exist", e.message
|
116
|
+
assert_equal ": //endchild is shown, but any opened //beginchild doesn't exist", e.message
|
115
117
|
end
|
116
118
|
|
117
119
|
class XBuilder < Builder
|
data/test/test_htmlbuilder.rb
CHANGED
@@ -2322,6 +2322,43 @@ EOS
|
|
2322
2322
|
assert_equal expected, fn
|
2323
2323
|
end
|
2324
2324
|
|
2325
|
+
def test_endnote
|
2326
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("//endnote[foo][bar]\n\n@<endnote>{foo}\n") }
|
2327
|
+
assert_equal ':4: //endnote is found but //printendnotes is not found.', e.message
|
2328
|
+
|
2329
|
+
actual = compile_block("@<endnote>{foo}\n//endnote[foo][bar]\n//printendnotes\n")
|
2330
|
+
expected = <<-'EOS'
|
2331
|
+
<p><a id="endnoteb-foo" href="#endnote-foo" class="noteref" epub:type="noteref">(1)</a></p>
|
2332
|
+
<div class="endnotes">
|
2333
|
+
<div class="endnote" id="endnote-foo"><p class="endnote">(1) bar</p></div>
|
2334
|
+
</div>
|
2335
|
+
EOS
|
2336
|
+
assert_equal expected, actual
|
2337
|
+
|
2338
|
+
@book.config['epubmaker'] ||= {}
|
2339
|
+
@book.config['epubmaker']['back_footnote'] = true
|
2340
|
+
actual = compile_block("@<endnote>{foo}\n//endnote[foo][bar]\n//printendnotes\n")
|
2341
|
+
expected = <<-'EOS'
|
2342
|
+
<p><a id="endnoteb-foo" href="#endnote-foo" class="noteref" epub:type="noteref">(1)</a></p>
|
2343
|
+
<div class="endnotes">
|
2344
|
+
<div class="endnote" id="endnote-foo"><p class="endnote"><a href="#endnoteb-foo">⏎</a>(1) bar</p></div>
|
2345
|
+
</div>
|
2346
|
+
EOS
|
2347
|
+
assert_equal expected, actual
|
2348
|
+
|
2349
|
+
I18n.set('html_endnote_textmark', '+%s:')
|
2350
|
+
I18n.set('html_endnote_refmark', '+%s:')
|
2351
|
+
I18n.set('html_footnote_backmark', '←')
|
2352
|
+
actual = compile_block("@<endnote>{foo}\n//endnote[foo][bar]\n//printendnotes\n")
|
2353
|
+
expected = <<-'EOS'
|
2354
|
+
<p><a id="endnoteb-foo" href="#endnote-foo" class="noteref" epub:type="noteref">+1:</a></p>
|
2355
|
+
<div class="endnotes">
|
2356
|
+
<div class="endnote" id="endnote-foo"><p class="endnote"><a href="#endnoteb-foo">←</a>+1:bar</p></div>
|
2357
|
+
</div>
|
2358
|
+
EOS
|
2359
|
+
assert_equal expected, actual
|
2360
|
+
end
|
2361
|
+
|
2325
2362
|
def test_inline_hd
|
2326
2363
|
book = ReVIEW::Book::Base.new
|
2327
2364
|
book.catalog = ReVIEW::Catalog.new('CHAPS' => %w[ch1.re ch2.re])
|
@@ -2868,6 +2905,8 @@ EOB
|
|
2868
2905
|
assert_match(/unknown image: n/, @log_io.string)
|
2869
2906
|
assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
|
2870
2907
|
assert_match(/unknown footnote: n/, @log_io.string)
|
2908
|
+
assert_raises(ReVIEW::ApplicationError) { compile_block("@<endnote>{n}\n") }
|
2909
|
+
assert_match(/unknown endnote: n/, @log_io.string)
|
2871
2910
|
assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
|
2872
2911
|
assert_match(/unknown headline: n/, @log_io.string)
|
2873
2912
|
%w[list table column].each do |name|
|
@@ -2951,7 +2990,7 @@ EOS
|
|
2951
2990
|
//beginchild
|
2952
2991
|
EOS
|
2953
2992
|
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
2954
|
-
assert_equal "//beginchild is shown, but previous element isn't ul, ol, or dl", e.message
|
2993
|
+
assert_equal ":1: //beginchild is shown, but previous element isn't ul, ol, or dl", e.message
|
2955
2994
|
end
|
2956
2995
|
|
2957
2996
|
def test_nest_error_close2
|
@@ -2969,7 +3008,7 @@ EOS
|
|
2969
3008
|
//beginchild
|
2970
3009
|
EOS
|
2971
3010
|
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
2972
|
-
assert_equal '//beginchild of dl,ol,ul misses //endchild', e.message
|
3011
|
+
assert_equal ':12: //beginchild of dl,ol,ul misses //endchild', e.message
|
2973
3012
|
end
|
2974
3013
|
|
2975
3014
|
def test_nest_error_close3
|
@@ -2989,7 +3028,7 @@ EOS
|
|
2989
3028
|
//endchild
|
2990
3029
|
EOS
|
2991
3030
|
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
2992
|
-
assert_equal '//beginchild of ol,ul misses //endchild', e.message
|
3031
|
+
assert_equal ':14: //beginchild of ol,ul misses //endchild', e.message
|
2993
3032
|
end
|
2994
3033
|
|
2995
3034
|
def test_nest_ul
|
data/test/test_idgxmlbuilder.rb
CHANGED
@@ -1291,7 +1291,7 @@ EOS
|
|
1291
1291
|
//beginchild
|
1292
1292
|
EOS
|
1293
1293
|
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
1294
|
-
assert_equal "//beginchild is shown, but previous element isn't ul, ol, or dl", e.message
|
1294
|
+
assert_equal ":1: //beginchild is shown, but previous element isn't ul, ol, or dl", e.message
|
1295
1295
|
end
|
1296
1296
|
|
1297
1297
|
def test_nest_error_close2
|
@@ -1309,7 +1309,7 @@ EOS
|
|
1309
1309
|
//beginchild
|
1310
1310
|
EOS
|
1311
1311
|
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
1312
|
-
assert_equal '//beginchild of dl,ol,ul misses //endchild', e.message
|
1312
|
+
assert_equal ':12: //beginchild of dl,ol,ul misses //endchild', e.message
|
1313
1313
|
end
|
1314
1314
|
|
1315
1315
|
def test_nest_error_close3
|
@@ -1329,7 +1329,7 @@ EOS
|
|
1329
1329
|
//endchild
|
1330
1330
|
EOS
|
1331
1331
|
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
1332
|
-
assert_equal '//beginchild of ol,ul misses //endchild', e.message
|
1332
|
+
assert_equal ':14: //beginchild of ol,ul misses //endchild', e.message
|
1333
1333
|
end
|
1334
1334
|
|
1335
1335
|
def test_nest_ul
|
data/test/test_index.rb
CHANGED
@@ -12,6 +12,8 @@ class IndexTest < Test::Unit::TestCase
|
|
12
12
|
@builder = TOPBuilder.new
|
13
13
|
@config = ReVIEW::Configure.create(config: { 'secnolevel' => 2, 'language' => 'ja' })
|
14
14
|
@book = Book::Base.new(config: @config)
|
15
|
+
@log_io = StringIO.new
|
16
|
+
ReVIEW.logger = ReVIEW::Logger.new(@log_io)
|
15
17
|
@compiler = ReVIEW::Compiler.new(@builder)
|
16
18
|
@chapter = Book::Chapter.new(@book, 1, '-', nil, StringIO.new)
|
17
19
|
location = Location.new(nil, nil)
|
@@ -21,16 +23,19 @@ class IndexTest < Test::Unit::TestCase
|
|
21
23
|
end
|
22
24
|
|
23
25
|
def test_footnote_index
|
24
|
-
compile_block("//footnote[foo][bar]\n")
|
26
|
+
compile_block("@<fn>{foo}\n//footnote[foo][bar]\n")
|
25
27
|
fn = @chapter.footnote_index
|
26
28
|
items = fn.to_a
|
27
29
|
item = items[0]
|
28
30
|
assert_equal 'foo', item.id
|
29
31
|
assert_equal 'bar', item.content
|
32
|
+
|
33
|
+
compile_block("//footnote[foo][bar]\n")
|
34
|
+
assert_match(/ID foo is not referred/, @log_io.string)
|
30
35
|
end
|
31
36
|
|
32
37
|
def test_footnote_index_with_escape
|
33
|
-
compile_block('//footnote[foo][bar[\]buz]' + "\n")
|
38
|
+
compile_block("@<fn>{foo}\n" + '//footnote[foo][bar[\]buz]' + "\n")
|
34
39
|
fn = @chapter.footnote_index
|
35
40
|
items = fn.to_a
|
36
41
|
item = items[0]
|
@@ -39,7 +44,7 @@ class IndexTest < Test::Unit::TestCase
|
|
39
44
|
end
|
40
45
|
|
41
46
|
def test_footnote_index_with_escape2
|
42
|
-
compile_block('//footnote[foo][bar\\a\\$buz]' + "\n")
|
47
|
+
compile_block("@<fn>{foo}\n" + '//footnote[foo][bar\\a\\$buz]' + "\n")
|
43
48
|
fn = @chapter.footnote_index
|
44
49
|
items = fn.to_a
|
45
50
|
item = items[0]
|
@@ -48,7 +53,7 @@ class IndexTest < Test::Unit::TestCase
|
|
48
53
|
end
|
49
54
|
|
50
55
|
def test_footnote_index_key?
|
51
|
-
compile_block('//footnote[foo][bar]' + "\n")
|
56
|
+
compile_block("@<fn>{foo}\n" + '//footnote[foo][bar]' + "\n")
|
52
57
|
fn = @chapter.footnote_index
|
53
58
|
assert_equal true, fn.key?('foo')
|
54
59
|
|
@@ -58,6 +63,27 @@ class IndexTest < Test::Unit::TestCase
|
|
58
63
|
# rubocop:enable Style/PreferredHashMethods
|
59
64
|
end
|
60
65
|
|
66
|
+
def test_endnote_index
|
67
|
+
compile_block("@<endnote>{foo}\n//endnote[foo][bar]\n//printendnotes\n")
|
68
|
+
endnote = @chapter.endnote_index
|
69
|
+
items = endnote.to_a
|
70
|
+
item = items[0]
|
71
|
+
assert_equal 'foo', item.id
|
72
|
+
assert_equal 'bar', item.content
|
73
|
+
assert_equal true, endnote.key?('foo')
|
74
|
+
# rubocop:disable Style/PreferredHashMethods
|
75
|
+
assert_equal true, endnote.has_key?('foo')
|
76
|
+
# rubocop:enable Style/PreferredHashMethods
|
77
|
+
|
78
|
+
e = assert_raises(ReVIEW::ApplicationError) do
|
79
|
+
compile_block("@<endnote>{foo}\n//endnote[foo][bar]\n")
|
80
|
+
end
|
81
|
+
assert_equal ':3: //endnote is found but //printendnotes is not found.', e.message
|
82
|
+
|
83
|
+
compile_block("//endnote[foo][bar]\n//printendnotes\n")
|
84
|
+
assert_match(/ID foo is not referred/, @log_io.string)
|
85
|
+
end
|
86
|
+
|
61
87
|
def test_headline_index
|
62
88
|
src = <<-EOB
|
63
89
|
= chap1
|
data/test/test_latexbuilder.rb
CHANGED
@@ -257,6 +257,20 @@ EOS
|
|
257
257
|
assert_equal 'test \\reviewttb{inline test} test2', actual
|
258
258
|
end
|
259
259
|
|
260
|
+
def test_endnote
|
261
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("//endnote[foo][bar]\n\n@<endnote>{foo}\n") }
|
262
|
+
assert_equal ':4: //endnote is found but //printendnotes is not found.', e.message
|
263
|
+
|
264
|
+
actual = compile_block("@<endnote>{foo}\n//endnote[foo][bar]\n//printendnotes\n")
|
265
|
+
expected = <<-'EOS'
|
266
|
+
|
267
|
+
\endnote{bar}
|
268
|
+
|
269
|
+
\theendnotes
|
270
|
+
EOS
|
271
|
+
assert_equal expected, actual
|
272
|
+
end
|
273
|
+
|
260
274
|
def test_inline_hd_chap
|
261
275
|
def @chapter.headline_index
|
262
276
|
item = Book::Index::Item.new('chap1|test', [1, 1], 'te_st')
|
@@ -2596,7 +2610,7 @@ EOS
|
|
2596
2610
|
//beginchild
|
2597
2611
|
EOS
|
2598
2612
|
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
2599
|
-
assert_equal "//beginchild is shown, but previous element isn't ul, ol, or dl", e.message
|
2613
|
+
assert_equal ":1: //beginchild is shown, but previous element isn't ul, ol, or dl", e.message
|
2600
2614
|
end
|
2601
2615
|
|
2602
2616
|
def test_nest_error_close2
|
@@ -2614,7 +2628,7 @@ EOS
|
|
2614
2628
|
//beginchild
|
2615
2629
|
EOS
|
2616
2630
|
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
2617
|
-
assert_equal '//beginchild of dl,ol,ul misses //endchild', e.message
|
2631
|
+
assert_equal ':12: //beginchild of dl,ol,ul misses //endchild', e.message
|
2618
2632
|
end
|
2619
2633
|
|
2620
2634
|
def test_nest_error_close3
|
@@ -2634,7 +2648,7 @@ EOS
|
|
2634
2648
|
//endchild
|
2635
2649
|
EOS
|
2636
2650
|
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
2637
|
-
assert_equal '//beginchild of ol,ul misses //endchild', e.message
|
2651
|
+
assert_equal ':14: //beginchild of ol,ul misses //endchild', e.message
|
2638
2652
|
end
|
2639
2653
|
|
2640
2654
|
def test_nest_ul
|
@@ -106,6 +106,19 @@ EOS
|
|
106
106
|
assert_equal %Q(test <span class="red">コメント</span> test2), actual
|
107
107
|
end
|
108
108
|
|
109
|
+
def test_endnote
|
110
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("//endnote[foo][bar]\n\n@<endnote>{foo}\n") }
|
111
|
+
assert_equal ':4: //endnote is found but //printendnotes is not found.', e.message
|
112
|
+
|
113
|
+
actual = compile_block("@<endnote>{foo}\n//endnote[foo][bar]\n//printendnotes\n")
|
114
|
+
expected = <<-'EOS'
|
115
|
+
<sup>(1)</sup>
|
116
|
+
|
117
|
+
(1) bar
|
118
|
+
EOS
|
119
|
+
assert_equal expected, actual
|
120
|
+
end
|
121
|
+
|
109
122
|
def test_inline_hd_chap
|
110
123
|
def @chapter.headline_index
|
111
124
|
item = Book::Index::Item.new('chap1|test', [1, 1], 'te_st')
|
data/test/test_pdfmaker.rb
CHANGED
@@ -167,6 +167,25 @@ class PDFMakerTest < Test::Unit::TestCase
|
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
170
|
+
def test_template_content_with_invalid_localconfig
|
171
|
+
Dir.mktmpdir do |dir|
|
172
|
+
Dir.chdir(dir) do
|
173
|
+
Dir.mkdir('layouts')
|
174
|
+
File.write(File.join('layouts', 'config-local.tex.erb'), %q(<%= not_existed_method %>\n))
|
175
|
+
@maker.basedir = Dir.pwd
|
176
|
+
@maker.erb_config
|
177
|
+
@maker.instance_eval do
|
178
|
+
def error!(msg)
|
179
|
+
msg
|
180
|
+
end
|
181
|
+
end
|
182
|
+
error_msg = @maker.template_content
|
183
|
+
assert_match(/template or configuration error:/, error_msg)
|
184
|
+
assert_match(/undefined local variable or method `not_existed_method'/, error_msg)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
170
189
|
def test_gettemplate_with_backmatter
|
171
190
|
@config.merge!(
|
172
191
|
'backcover' => 'backcover.tex',
|