review 2.5.0 → 3.0.0.preview1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +28 -10
  3. data/.travis.yml +11 -2
  4. data/NEWS.ja.md +89 -17
  5. data/NEWS.md +92 -0
  6. data/README.md +1 -1
  7. data/Rakefile +0 -13
  8. data/bin/review-catalog-converter +83 -37
  9. data/bin/review-check +17 -5
  10. data/bin/review-compile +1 -1
  11. data/bin/review-index +6 -0
  12. data/bin/review-init +3 -155
  13. data/bin/review-preproc +0 -5
  14. data/bin/review-validate +21 -7
  15. data/bin/review-vol +13 -5
  16. data/doc/config.yml.sample +12 -7
  17. data/doc/config.yml.sample-simple +1 -1
  18. data/doc/format.ja.md +39 -3
  19. data/doc/format.md +39 -3
  20. data/doc/format_idg.ja.md +0 -4
  21. data/doc/pdfmaker.ja.md +1 -1
  22. data/doc/pdfmaker.md +1 -1
  23. data/doc/sample.css +7 -0
  24. data/lib/epubmaker/content.rb +31 -12
  25. data/lib/epubmaker/epubcommon.rb +10 -3
  26. data/lib/epubmaker/epubv2.rb +11 -3
  27. data/lib/epubmaker/epubv3.rb +11 -3
  28. data/lib/epubmaker/producer.rb +55 -20
  29. data/lib/review/book/base.rb +63 -48
  30. data/lib/review/book/chapter.rb +19 -7
  31. data/lib/review/book/compilable.rb +5 -20
  32. data/lib/review/book/image_finder.rb +10 -3
  33. data/lib/review/book/index.rb +30 -9
  34. data/lib/review/book/part.rb +9 -6
  35. data/lib/review/book.rb +0 -14
  36. data/lib/review/builder.rb +110 -18
  37. data/lib/review/catalog.rb +24 -4
  38. data/lib/review/compiler.rb +3 -1
  39. data/lib/review/configure.rb +43 -9
  40. data/lib/review/epubmaker/reviewheaderlistener.rb +57 -0
  41. data/lib/review/epubmaker.rb +129 -85
  42. data/lib/review/htmlbuilder.rb +76 -58
  43. data/lib/review/htmlutils.rb +20 -13
  44. data/lib/review/i18n.rb +6 -2
  45. data/lib/review/idgxmlbuilder.rb +52 -41
  46. data/lib/review/init.rb +194 -0
  47. data/lib/review/latexbuilder.rb +118 -34
  48. data/lib/review/latexutils.rb +5 -5
  49. data/lib/review/logger.rb +2 -1
  50. data/lib/review/makerhelper.rb +1 -1
  51. data/lib/review/markdownbuilder.rb +66 -6
  52. data/lib/review/md2inaobuilder.rb +2 -2
  53. data/lib/review/pdfmaker.rb +74 -22
  54. data/lib/review/plaintextbuilder.rb +8 -4
  55. data/lib/review/preprocessor.rb +14 -17
  56. data/lib/review/sec_counter.rb +8 -2
  57. data/lib/review/textmaker.rb +2 -2
  58. data/lib/review/textutils.rb +9 -2
  59. data/lib/review/tocparser.rb +7 -4
  60. data/lib/review/tocprinter.rb +3 -1
  61. data/lib/review/version.rb +1 -1
  62. data/lib/review/webmaker.rb +19 -7
  63. data/lib/review/webtocprinter.rb +8 -4
  64. data/review.gemspec +4 -3
  65. data/templates/latex/config.erb +84 -0
  66. data/templates/latex/layout.tex.erb +76 -361
  67. data/templates/latex/review-jlreq/README.md +22 -0
  68. data/templates/latex/review-jlreq/review-base.sty +178 -0
  69. data/templates/latex/review-jlreq/review-custom.sty +1 -0
  70. data/templates/latex/review-jlreq/review-jlreq.cls +141 -0
  71. data/templates/latex/review-jlreq/review-style.sty +149 -0
  72. data/templates/latex/review-jlreq/reviewmacro.sty +8 -0
  73. data/templates/latex/review-jsbook/jumoline.sty +310 -0
  74. data/templates/latex/review-jsbook/plistings.sty +326 -0
  75. data/templates/latex/review-jsbook/review-base.sty +405 -0
  76. data/templates/latex/review-jsbook/review-custom.sty +1 -0
  77. data/templates/latex/review-jsbook/review-style.sty +38 -0
  78. data/templates/latex/review-jsbook/reviewmacro.sty +8 -0
  79. data/templates/latex-compat2/layout.tex.erb +387 -0
  80. data/test/assets/test_template.tex +105 -235
  81. data/test/assets/test_template_backmatter.tex +133 -14
  82. data/test/book_test_helper.rb +1 -1
  83. data/test/run_test.rb +2 -0
  84. data/test/sample-book/src/Rakefile +11 -6
  85. data/test/sample-book/src/config.yml +2 -2
  86. data/test/sample-book/src/sty/reviewmacro.sty +1 -39
  87. data/test/sample-book/src/style.css +6 -0
  88. data/test/syntax-book/config.yml +1 -1
  89. data/test/test_book.rb +13 -16
  90. data/test/test_book_chapter.rb +4 -10
  91. data/test/test_book_part.rb +4 -3
  92. data/test/test_catalog.rb +15 -4
  93. data/test/test_helper.rb +2 -2
  94. data/test/test_htmlbuilder.rb +78 -10
  95. data/test/test_htmlutils.rb +12 -5
  96. data/test/test_idgxmlbuilder.rb +1 -1
  97. data/test/test_latexbuilder.rb +94 -49
  98. data/test/test_latexbuilder_v2.rb +1077 -0
  99. data/test/test_logger.rb +20 -0
  100. data/test/test_markdownbuilder.rb +10 -0
  101. data/test/test_pdfmaker.rb +6 -7
  102. data/test/test_plaintextbuilder.rb +1 -1
  103. data/test/test_review_ext.rb +0 -1
  104. data/test/test_rstbuilder.rb +1 -1
  105. data/test/test_topbuilder.rb +19 -7
  106. data/test/test_webtocprinter.rb +14 -14
  107. data/{test/sample-book/src/vendor → vendor}/jumoline/README +0 -0
  108. data/{test/sample-book/src/vendor → vendor}/jumoline/jumoline.dtx +0 -0
  109. data/{test/sample-book/src/vendor → vendor}/jumoline/jumoline.ins +0 -0
  110. data/{test/sample-book/src/vendor → vendor}/jumoline/lppl.txt +0 -0
  111. data/vendor/plistings/.gitignore +9 -0
  112. data/vendor/plistings/LICENSE +21 -0
  113. data/vendor/plistings/README.md +18 -0
  114. data/vendor/plistings/plistings.sty +326 -0
  115. data/vendor/plistings/test1.tex +174 -0
  116. data/vendor/plistings/test2.tex +54 -0
  117. metadata +48 -19
  118. data/lib/review/unfold.rb +0 -129
  119. data/test/CHAPS +0 -2
  120. data/test/bib.re +0 -13
  121. data/test/test.re +0 -43
@@ -1,262 +1,132 @@
1
1
  \documentclass[dvipdfmx,uplatex,oneside]{jsbook}
2
- % %% fixes to LaTeX2e
3
- % \usepackage{fix-cm}[2006/09/13 v1.1m]
4
- % \usepackage{fixltx2e}[2006/09/13 v1.1m]
5
-
6
- \usepackage[deluxe,uplatex]{otf}
7
- \usepackage{caption}
8
- \usepackage{suffix}
9
- \usepackage[T1]{fontenc}\usepackage{textcomp}%T1/TS1
10
- \usepackage{lmodern}
11
- \usepackage[dvipdfmx]{graphicx}
12
- \usepackage[dvipdfmx,table]{xcolor}%requires colortbl, array
13
- \usepackage{framed}
14
- \usepackage{wrapfig}
15
- \definecolor{shadecolor}{gray}{0.9}
16
- \definecolor{shadecolorb}{gray}{0.1}
17
- \definecolor{reviewgreen}{rgb}{0,0.4,0}
18
- \definecolor{reviewblue}{rgb}{0.2,0.2,0.4}
19
- \definecolor{reviewred}{rgb}{0.7,0,0}
20
- \definecolor{reviewdarkred}{rgb}{0.3,0,0}
21
- \usepackage[utf8]{inputenc}
22
- \usepackage{ascmac}
23
- \usepackage{float}
24
- \usepackage{alltt}
25
- \usepackage{amsmath}
26
-
27
- %% if you use @<u>{} (underline), use jumoline.sty
28
- \IfFileExists{jumoline.sty}{
29
- \usepackage{jumoline}
30
- }
31
-
32
- \newenvironment{shadedb}{%
33
- \def\FrameCommand{\fboxsep=\FrameSep \colorbox{shadecolorb}}%
34
- \MakeFramed {\FrameRestore}}%
35
- {\endMakeFramed}
36
-
37
- \usepackage[top=10zw,bottom=12zw,left=10zw,right=10zw]{geometry}
38
- %\usepackage[top=5zw,bottom=5zw,left=1zw,right=1zw]{geometry}
39
-
40
- \newcommand{\parasep}{\vspace*{3zh}}
41
- \setlength{\footskip}{30pt}
42
-
43
- %% Bookmarkの文字化け対策(日本語向け)
44
- \usepackage[dvipdfmx,bookmarks=true,bookmarksnumbered=true,colorlinks=true,%
45
- pdftitle={Re:VIEW Sample Book},%
46
- pdfauthor={}]{hyperref}
47
- \usepackage[dvipdfmx]{pxjahyper}
48
-
49
-
50
-
51
- \newenvironment{reviewimage}{%
52
- \begin{figure}[H]
53
- \begin{center}}{%
54
- \end{center}
55
- \end{figure}}
56
-
57
- \newenvironment{reviewdummyimage}{%
58
- \begin{figure}[H]
59
- \begin{center}\begin{alltt}}{%
60
- \end{alltt}\end{center}
61
- \end{figure}}
62
-
63
- \newenvironment{reviewemlist}{%
64
- \medskip\small\begin{shaded}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{%
65
- \end{alltt}\end{shaded}}
66
-
67
- \newenvironment{reviewlist}{%
68
- \begin{shaded}\small\setlength{\baselineskip}{1.3zw}\begin{alltt}}{%
69
- \end{alltt}\end{shaded}\par\vspace*{0.5zw}}
70
-
71
- \newenvironment{reviewsource}{%
72
- \begin{shaded}\small\setlength{\baselineskip}{1.3zw}\begin{alltt}}{%
73
- \end{alltt}\end{shaded}\par\vspace*{0.5zw}}
74
-
75
- \newenvironment{reviewcmd}{%
76
- \color{white}\medskip\small\begin{shadedb}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{%
77
- \end{alltt}\end{shadedb}}
78
-
79
- \newenvironment{reviewbox}{%
80
- \medskip\small\begin{framed}\setlength{\baselineskip}{1.3zw}\begin{alltt}}{%
81
- \end{alltt}\end{framed}}
82
-
83
- \newenvironment{reviewtable}[1]{%
84
- \begin{center}\small\setlength{\baselineskip}{1.2zw}
85
- \begin{tabular}{#1}}{%
86
- \end{tabular}
87
- \end{center}}
88
-
89
- \newenvironment{reviewcolumn}{%
90
- \begin{framed}
91
- }{%
92
- \end{framed}
93
- \vspace{2zw}}
94
-
95
- \newcommand{\reviewcolumnhead}[2]{%
96
- {\noindent\large ■コラム: #2}}
97
-
98
- \newcommand{\reviewtablecaption}[1]{%
99
- \caption{#1}}
100
-
101
- \WithSuffix\newcommand\reviewtablecaption*[1]{%
102
- \caption*{#1}}
103
-
104
- \newcommand{\reviewimgtablecaption}[1]{%
105
- \caption{#1}\vspace{-3mm}}
106
-
107
- \newcommand{\reviewbackslash}[0]{%
108
- \textbackslash{}}
109
-
110
- \newcommand{\reviewlistcaption}[1]{%
111
- \medskip{\small\noindent #1}\vspace*{-1.3zw}}
112
-
113
- \newcommand{\reviewemlistcaption}[1]{%
114
- \medskip{\small\noindent #1}\vspace*{-1.3zw}}
115
-
116
- \newcommand{\reviewsourcecaption}[1]{%
117
- \medskip{\small\noindent #1}\vspace*{-1.3zw}}
118
-
119
- \newcommand{\reviewcmdcaption}[1]{%
120
- \medskip{\small\noindent #1}\vspace*{-1.3zw}}
121
-
122
- \newcommand{\reviewindepimagecaption}[1]{%
123
- \begin{center}#1\end{center}}
124
-
125
- \newcommand{\reviewboxcaption}[1]{%
126
- \medskip{\small\noindent #1}\vspace*{-1.3zw}}
127
-
128
- \newcommand{\reviewimageref}[2]{図 #1}
129
- \newcommand{\reviewtableref}[2]{表 #1}
130
- \newcommand{\reviewlistref}[1]{リスト #1}
131
- \newcommand{\reviewbibref}[2]{#1}
132
- \newcommand{\reviewcolumnref}[2]{コラム #1}
133
- \newcommand{\reviewsecref}[2]{#1}
134
-
135
- \newcommand{\reviewminicolumntitle}[1]{%
136
- {\large ■メモ: #1}\\}
137
-
138
- \renewcommand{\contentsname}{目次}
139
-
140
- \newenvironment{reviewminicolumn}{%
141
- \vspace{1.5zw}\begin{screen}}{%
142
- \end{screen}\vspace{2zw}}
143
-
144
- \newcommand{\reviewkw}[1]{\textbf{\textgt{#1}}}
145
- \newcommand{\reviewami}[1]{\mask{#1}{A}}
146
- \newcommand{\reviewem}[1]{\textbf{#1}}
147
- \newcommand{\reviewstrong}[1]{\textbf{#1}}
148
- \newcommand{\reviewunderline}{\Underline}
149
-
150
- %% @<del> is ignored in LaTeX with default style
151
- \newcommand{\reviewstrike}[1]{#1}
152
-
153
- %%%% for ulem.sty:
154
- %%\renewcommand{\reviewstrike}[1]{\sout{#1}}
155
- %%
156
- %%%% for jumoline.sty:
157
- %%\renewcommand{\reviewstrike}[1]{\Middleline{#1}}
158
-
159
- \newcommand{\reviewth}[1]{\textgt{#1}}
160
- \newcommand{\reviewtitlefont}[0]{\usefont{T1}{phv}{b}{n}\gtfamily}
161
- \newcommand{\reviewmainfont}[0]{}
162
- \newcommand{\reviewcolophon}[0]{\clearpage}
163
- \newcommand{\reviewappendix}[0]{\appendix}
164
-
165
- \newcommand{\reviewprepartname}{第}
166
- \newcommand{\reviewpostpartname}{部}
167
- \newcommand{\reviewprechaptername}{第}
168
- \newcommand{\reviewpostchaptername}{章}
169
- \newcommand{\reviewfigurename}{図}
170
- \newcommand{\reviewtablename}{表}
171
- \newcommand{\reviewappendixname}{付録}
172
-
173
- \ifdefined\prepartname
174
- \renewcommand{\prepartname}{\reviewprepartname}
175
- \fi
176
- \ifdefined\postpartname
177
- \renewcommand{\postpartname}{\reviewpostpartname}
178
- \fi
179
- \ifdefined\prechaptername
180
- \renewcommand{\prechaptername}{\reviewprechaptername}
181
- \fi
182
- \ifdefined\postchaptername
183
- \renewcommand{\postchaptername}{\reviewpostchaptername}
184
- \fi
185
- \ifdefined\figurename
186
- \renewcommand{\figurename}{\reviewfigurename}
187
- \fi
188
- \ifdefined\tablename
189
- \renewcommand{\tablename}{\reviewtablename}
190
- \fi
191
- \ifdefined\appendixname
192
- \renewcommand{\appendixname}{\reviewappendixname}
193
- \fi
194
-
195
-
196
2
  \makeatletter
197
- %% maxwidth is the original width if it is less than linewidth
198
- %% otherwise use linewidth (to make sure the graphics do not exceed the margin)
199
- \def\maxwidth{%
200
- \ifdim\Gin@nat@width>\linewidth
201
- \linewidth
202
- \else
203
- \Gin@nat@width
204
- \fi
205
- }
3
+ \def\review@texcompiler{uplatex}
4
+ \def\review@documentclass{jsbook}
5
+ \def\review@booktitlename{Re:VIEW Sample Book}
6
+ \def\review@autnames{}
7
+ \def\review@titlepageauthors{}
8
+ \def\review@date{2011{-}01{-}01}
9
+ \def\review@language{ja}
10
+ \def\review@intn@list{リスト}
11
+ \def\review@intn@columnhead{■コラム}
12
+ \def\review@intn@image{図}
13
+ \def\review@intn@table{表}
14
+ \def\review@intn@columnname{コラム}
15
+ \def\review@intn@memohead{■メモ}
16
+ \def\review@intn@edition{版}
17
+ \def\review@intn@publishedby{ 発行}
18
+ \def\review@intn@captionprefix{ }
19
+ \def\review@toctitle{目次}
20
+ \def\review@prepartname{第}
21
+ \def\review@postpartname{部}
22
+ \def\review@prechaptername{第}
23
+ \def\review@postchaptername{章}
24
+ \def\review@figurename{図}
25
+ \def\review@tablename{表}
26
+ \def\review@appendixname{付録}
27
+ \def\review@titlepage{true}
28
+
29
+ \def\review@pubhistories{2011年1月1日 発行}
30
+ \def\review@colophonnames{}
31
+
32
+ \def\reviewprefacefiles{}
33
+ \def\reviewchapterfiles{}
34
+ \def\reviewappendixfiles{}
35
+ \def\reviewpostdeffiles{}
36
+
206
37
  \makeatother
207
38
 
208
39
 
209
40
  \begin{document}
210
41
 
211
- \reviewmainfont
42
+ %% coverpage
43
+ \ifdefined\reviewcoverpagecont
44
+ \reviewcoverpagecont
45
+ \fi
212
46
 
213
- \begin{titlepage}
214
- \thispagestyle{empty}
215
- \begin{center}%
216
- \mbox{} \vskip5zw
217
- \reviewtitlefont%
218
- {\Huge Re:VIEW Sample Book \par}%
219
- \vskip 15em%
220
- {\huge
221
- \lineskip .75em
222
- \begin{tabular}[t]{c}%
223
-
224
- \end{tabular}\par}%
225
- \vfill
226
- {\large 2011{-}01{-}01 版\hspace{2zw} 発行\par}%
227
- \vskip4zw\mbox{}
228
- \end{center}%
229
- \end{titlepage}
47
+ %% title page
48
+ \ifdefined\reviewtitlepagecont
49
+ \reviewtitlepagecont
50
+ \fi
230
51
 
231
- \renewcommand{\chaptermark}[1]{{}}
232
- \frontmatter
52
+ %% frontmatter hook
53
+ \ifdefined\reviewfrontmatterhook
54
+ \reviewfrontmatterhook
55
+ \fi
233
56
 
234
- %%% originaltitle
57
+ %% originaltitle
58
+ \ifdefined\revieworiginaltitlepagecont
59
+ \revieworiginaltitlepagecont
60
+ \fi
235
61
 
236
- %%% credit
62
+ %% credit
63
+ \ifdefined\reviewcreditfilecont
64
+ \reviewcreditfilecont
65
+ \fi
237
66
 
238
67
  %% preface
68
+ \ifdefined\reviewprefacefiles
69
+ \reviewprefacefiles
70
+ \fi
239
71
 
72
+ %% toc
73
+ \ifdefined\reviewtableofcontents
74
+ \reviewtableofcontents
75
+ \fi
240
76
 
77
+ %% mainmatter hook
78
+ \ifdefined\reviewmainmatterhook
79
+ \reviewmainmatterhook
80
+ \fi
241
81
 
242
- \renewcommand{\chaptermark}[1]{\markboth{\prechaptername\thechapter\postchaptername~#1}{}}
243
- \mainmatter
82
+ %% chapters body
83
+ \ifdefined\reviewchapterfiles
84
+ \reviewchapterfiles
85
+ \fi
244
86
 
245
- \renewcommand{\chaptermark}[1]{\markboth{\appendixname\thechapter~#1}{}}
246
- \reviewappendix
87
+ %% appendix hook
88
+ \ifdefined\reviewappendixhook
89
+ \reviewappendixhook
90
+ \fi
247
91
 
92
+ %% appendix body
93
+ \ifdefined\reviewappendixfiles
94
+ \reviewappendixfiles
95
+ \fi
248
96
 
249
- %% backmatter begins
250
- \backmatter
97
+ %% backmatter hook
98
+ \ifdefined\reviewbackmatterhook
99
+ \reviewbackmatterhook
100
+ \fi
251
101
 
102
+ %% postdef body
103
+ \ifdefined\reviewpostdeffiles
104
+ \reviewpostdeffiles
105
+ \fi
252
106
 
107
+ %% index page
108
+ \ifdefined\reviewprintindex
109
+ \reviewprintindex
110
+ \fi
253
111
 
254
- %%% profile
112
+ %% profile page
113
+ \ifdefined\reviewprofilepagecont
114
+ \reviewprofilepagecont
115
+ \fi
255
116
 
256
- %%% advfile
117
+ %% advfile page
118
+ \ifdefined\reviewadvfilepagecont
119
+ \reviewadvfilepagecont
120
+ \fi
257
121
 
258
- %%% colophon
122
+ %%% colophon page
123
+ \ifdefined\reviewcolophonpagecont
124
+ \reviewcolophonpagecont
125
+ \fi
259
126
 
260
- %%% backcover
127
+ %%% backcover page
128
+ \ifdefined\reviewbackcovercont
129
+ \reviewbackcovercont
130
+ \fi
261
131
 
262
132
  \end{document}
@@ -1,24 +1,143 @@
1
- \backmatter
1
+ \documentclass[dvipdfmx,uplatex,oneside]{jsbook}
2
+ \makeatletter
3
+ \def\review@texcompiler{uplatex}
4
+ \def\review@documentclass{jsbook}
5
+ \def\review@booktitlename{Re:VIEW Sample Book}
6
+ \def\review@autnames{}
7
+ \def\review@titlepageauthors{}
8
+ \def\review@date{2011{-}01{-}01}
9
+ \def\review@language{ja}
10
+ \def\review@intn@list{リスト}
11
+ \def\review@intn@columnhead{■コラム}
12
+ \def\review@intn@image{図}
13
+ \def\review@intn@table{表}
14
+ \def\review@intn@columnname{コラム}
15
+ \def\review@intn@memohead{■メモ}
16
+ \def\review@intn@edition{版}
17
+ \def\review@intn@publishedby{ 発行}
18
+ \def\review@intn@captionprefix{ }
19
+ \def\review@toctitle{目次}
20
+ \def\review@prepartname{第}
21
+ \def\review@postpartname{部}
22
+ \def\review@prechaptername{第}
23
+ \def\review@postchaptername{章}
24
+ \def\review@figurename{図}
25
+ \def\review@tablename{表}
26
+ \def\review@appendixname{付録}
27
+ \def\review@titlepage{true}
28
+ \def\reviewprofilepagecont{\thispagestyle{empty}\chapter*{Profile}
29
+ some profile
30
+ }
31
+ \def\reviewadvfilepagecont{\thispagestyle{empty}\chapter*{Ad}
32
+ some ad content
33
+ }
34
+ \def\reviewbackcovercont{\clearpage
35
+ \thispagestyle{empty}\AddToShipoutPictureBG{%
36
+ \AtPageLowerLeft{\includegraphics[width=\paperwidth,height=\paperheight]{images/backcover.png}}
37
+ }
38
+ \null}
2
39
 
40
+ \def\review@pubhistories{2011年1月1日 発行}
41
+ \def\review@colophonnames{}
3
42
 
43
+ \def\reviewprefacefiles{}
44
+ \def\reviewchapterfiles{}
45
+ \def\reviewappendixfiles{}
46
+ \def\reviewpostdeffiles{}
4
47
 
5
- %%% profile
6
- \thispagestyle{empty}\chapter*{Profile}
7
- some profile
48
+ \makeatother
8
49
 
9
50
 
10
- %%% advfile
11
- \thispagestyle{empty}\chapter*{Ad}
12
- some ad content
51
+ \begin{document}
13
52
 
53
+ %% coverpage
54
+ \ifdefined\reviewcoverpagecont
55
+ \reviewcoverpagecont
56
+ \fi
14
57
 
15
- %%% colophon
58
+ %% title page
59
+ \ifdefined\reviewtitlepagecont
60
+ \reviewtitlepagecont
61
+ \fi
16
62
 
17
- %%% backcover
18
- \clearpage
19
- \thispagestyle{empty}\AddToShipoutPictureBG{%
20
- \AtPageLowerLeft{\includegraphics[width=\paperwidth,height=\paperheight]{images/backcover.png}}
21
- }
22
- \null
63
+ %% frontmatter hook
64
+ \ifdefined\reviewfrontmatterhook
65
+ \reviewfrontmatterhook
66
+ \fi
67
+
68
+ %% originaltitle
69
+ \ifdefined\revieworiginaltitlepagecont
70
+ \revieworiginaltitlepagecont
71
+ \fi
72
+
73
+ %% credit
74
+ \ifdefined\reviewcreditfilecont
75
+ \reviewcreditfilecont
76
+ \fi
77
+
78
+ %% preface
79
+ \ifdefined\reviewprefacefiles
80
+ \reviewprefacefiles
81
+ \fi
82
+
83
+ %% toc
84
+ \ifdefined\reviewtableofcontents
85
+ \reviewtableofcontents
86
+ \fi
87
+
88
+ %% mainmatter hook
89
+ \ifdefined\reviewmainmatterhook
90
+ \reviewmainmatterhook
91
+ \fi
92
+
93
+ %% chapters body
94
+ \ifdefined\reviewchapterfiles
95
+ \reviewchapterfiles
96
+ \fi
97
+
98
+ %% appendix hook
99
+ \ifdefined\reviewappendixhook
100
+ \reviewappendixhook
101
+ \fi
102
+
103
+ %% appendix body
104
+ \ifdefined\reviewappendixfiles
105
+ \reviewappendixfiles
106
+ \fi
107
+
108
+ %% backmatter hook
109
+ \ifdefined\reviewbackmatterhook
110
+ \reviewbackmatterhook
111
+ \fi
112
+
113
+ %% postdef body
114
+ \ifdefined\reviewpostdeffiles
115
+ \reviewpostdeffiles
116
+ \fi
117
+
118
+ %% index page
119
+ \ifdefined\reviewprintindex
120
+ \reviewprintindex
121
+ \fi
122
+
123
+ %% profile page
124
+ \ifdefined\reviewprofilepagecont
125
+ \reviewprofilepagecont
126
+ \fi
127
+
128
+ %% advfile page
129
+ \ifdefined\reviewadvfilepagecont
130
+ \reviewadvfilepagecont
131
+ \fi
132
+
133
+ %%% colophon page
134
+ \ifdefined\reviewcolophonpagecont
135
+ \reviewcolophonpagecont
136
+ \fi
137
+
138
+ %%% backcover page
139
+ \ifdefined\reviewbackcovercont
140
+ \reviewbackcovercont
141
+ \fi
23
142
 
24
143
  \end{document}
@@ -1,5 +1,4 @@
1
1
  require 'test_helper'
2
- require 'book_test_helper'
3
2
  require 'review/book'
4
3
 
5
4
  require 'stringio'
@@ -20,6 +19,7 @@ module BookTestHelper
20
19
  created_files[basename] = path
21
20
  end
22
21
  book = Book::Base.load(dir)
22
+ book.config = ReVIEW::Configure.values
23
23
  yield(dir, book, created_files)
24
24
  end
25
25
  end
data/test/run_test.rb CHANGED
@@ -4,6 +4,8 @@ test_dir = File.join(base_dir, 'test')
4
4
 
5
5
  $LOAD_PATH.unshift(lib_dir)
6
6
 
7
+ require 'simplecov'
8
+ SimpleCov.start
7
9
  require 'test/unit'
8
10
 
9
11
  argv = ARGV || ['--max-diff-target-string-size=10000']
@@ -1,11 +1,12 @@
1
1
  require 'fileutils'
2
2
  require 'rake/clean'
3
3
 
4
- BOOK = 'book'
4
+ BOOK = ENV['REVIEW_BOOK'] || 'book'
5
5
  BOOK_PDF = BOOK + '.pdf'
6
6
  BOOK_EPUB = BOOK + '.epub'
7
- CONFIG_FILE = 'config.yml'
8
- WEBROOT = 'webroot'
7
+ CONFIG_FILE = ENV['REVIEW_CONFIG_FILE'] || 'config.yml'
8
+ CATALOG_FILE = ENV['REVIEW_CATALOG_FILE'] || 'catalog.yml'
9
+ WEBROOT = ENV['REVIEW_WEBROOT'] || 'webroot'
9
10
  TEXTROOT = BOOK + '-text'
10
11
  TOPROOT = BOOK + '-text'
11
12
 
@@ -64,14 +65,18 @@ end
64
65
  desc 'generate EPUB file'
65
66
  task epub: BOOK_EPUB
66
67
 
67
- SRC = FileList['*.re'] + [CONFIG_FILE]
68
+ IMAGES = FileList['images/**/*']
69
+ OTHERS = ENV['REVIEW_DEPS'] || []
70
+ SRC = FileList['./**/*.re', '*.rb'] + [CONFIG_FILE, CATALOG_FILE] + IMAGES + FileList[OTHERS]
71
+ SRC_EPUB = FileList['*.css']
72
+ SRC_PDF = FileList['layouts/*.erb', 'sty/**/*.sty']
68
73
 
69
- file BOOK_PDF => SRC do
74
+ file BOOK_PDF => SRC + SRC_PDF do
70
75
  FileUtils.rm_rf [BOOK_PDF, BOOK, BOOK + '-pdf']
71
76
  sh "review-pdfmaker #{CONFIG_FILE}"
72
77
  end
73
78
 
74
- file BOOK_EPUB => SRC do
79
+ file BOOK_EPUB => SRC + SRC_EPUB do
75
80
  FileUtils.rm_rf [BOOK_EPUB, BOOK, BOOK + '-epub']
76
81
  sh "review-epubmaker #{CONFIG_FILE}"
77
82
  end
@@ -1,5 +1,5 @@
1
1
  ## config.yml for sample book
2
-
2
+ review_version: 3.0
3
3
  bookname: book
4
4
  language: ja
5
5
  booktitle: Re:VIEWサンプル書籍
@@ -54,7 +54,7 @@ epubmaker:
54
54
  # externallink: true
55
55
 
56
56
  pdfmaker:
57
- texstyle: reviewmacro
57
+ texstyle: ["reviewmacro"]
58
58
  # texdocumentclass: ["jsbook", "uplatex,oneside"]
59
59
  # texcommand: "uplatex"
60
60
  # texoptions: null
@@ -1,39 +1 @@
1
- %% from review-pdfmaker
2
- \usepackage{fancyhdr}
3
- \pagestyle{fancy}
4
- \lhead{\gtfamily\sffamily\bfseries\upshape \leftmark}
5
- \chead{}
6
- \rhead{\gtfamily\sffamily\bfseries\upshape \rightmark}
7
- \renewcommand{\sectionmark}[1]{\markright{\thesection~#1}{}}
8
- \renewcommand{\chaptermark}[1]{\markboth{\prechaptername\ \thechapter\ \postchaptername~#1}{}}
9
- \renewcommand{\headfont}{\gtfamily\sffamily\bfseries}
10
-
11
- \fancypagestyle{plainhead}{%
12
- \fancyhead{}
13
- \fancyfoot{} % clear all header and footer fields
14
- \fancyfoot[CE,CO]{\thepage}
15
- \renewcommand{\headrulewidth}{0pt}
16
- \renewcommand{\footrulewidth}{0pt}}
17
-
18
- %% using Helvetica as sans-serif
19
- \renewcommand{\sfdefault}{phv}
20
-
21
- %% for listings
22
- %\renewcommand{\lstlistingname}{List}
23
- %\lstset{%
24
- % breaklines=true,%
25
- % breakautoindent=false,%
26
- % breakindent=0pt,%
27
- % fontadjust=true,%
28
- % backgroundcolor=\color{shadecolor},%
29
- % frame=single,%
30
- % framerule=0pt,%
31
- % basicstyle=\ttfamily\scriptsize,%
32
- % commentstyle=\color{reviewgreen},%
33
- % identifierstyle=\color{reviewblue},%
34
- % stringstyle=\color{reviewred},%
35
- % keywordstyle=\bfseries\color{reviewdarkred},%
36
- %}
37
-
38
-
39
- \sloppy
1
+ %
@@ -249,6 +249,12 @@ strong{
249
249
  em {
250
250
  font-style: italic;
251
251
  }
252
+ span.balloon {
253
+ font-size: 0.9em;
254
+ }
255
+ span.balloon:before {
256
+ content: "←";
257
+ }
252
258
 
253
259
  /**
254
260
  * from Rouge
@@ -1,4 +1,4 @@
1
- review_version: 2.0
1
+ review_version: 3.0
2
2
  bookname: syntax-book
3
3
  language: ja
4
4
  booktitle: {name: "Re:VIEW文法使用例", file-as: "リビューブンポウシヨウレイ"}
data/test/test_book.rb CHANGED
@@ -10,27 +10,13 @@ class BookTest < Test::Unit::TestCase
10
10
  assert_equal ex_path, re_path, *options
11
11
  end
12
12
 
13
- def test_s_update_rubyenv
14
- save_load_path = $LOAD_PATH.dup
15
-
16
- Dir.mktmpdir do |dir|
17
- Book.update_rubyenv(dir)
18
- assert_equal save_load_path, $LOAD_PATH
19
- end
20
-
21
- Dir.mktmpdir do |dir|
22
- local_lib_path = File.join(dir, 'lib')
23
- Dir.mkdir(local_lib_path)
24
- Book.update_rubyenv(dir)
25
- assert_equal save_load_path, $LOAD_PATH
26
- end
27
-
13
+ def test_update_rubyenv
28
14
  num = rand(99999)
29
15
  test_const = "ReVIEW__BOOK__TEST__#{num}"
30
16
  begin
31
17
  Dir.mktmpdir do |dir|
32
18
  File.open(File.join(dir, 'review-ext.rb'), 'w') { |o| o.puts "#{test_const} = #{num}" }
33
- Book.update_rubyenv(dir)
19
+ Book::Base.load(dir)
34
20
  assert_equal num, (Object.class_eval { const_get(test_const) })
35
21
  end
36
22
  ensure
@@ -519,6 +505,17 @@ EOC
519
505
  end
520
506
  end
521
507
 
508
+ def test_contentdir
509
+ mktmpbookdir('config.yml' => "contentdir: content\n", 'catalog.yml' => "CHAPS:\n - ch01.re\n") do |dir, _book, _files|
510
+ Dir.mkdir('content')
511
+ File.open('content/ch01.re', 'w') { |f| f.puts "foo\n" }
512
+ book = Book::Base.new(dir)
513
+ config_file = File.join(dir, 'config.yml')
514
+ book.load_config(config_file)
515
+ assert_equal "foo\n", book.chapters[0].content
516
+ end
517
+ end
518
+
522
519
  def test_page_metric
523
520
  Dir.mktmpdir do |dir|
524
521
  book = Book::Base.new(dir)