review 3.0.0.preview3 → 3.0.0.preview4

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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS.ja.md +26 -0
  3. data/NEWS.md +26 -0
  4. data/bin/review +2 -0
  5. data/bin/review-update +19 -0
  6. data/doc/format.ja.md +11 -0
  7. data/doc/format.md +11 -1
  8. data/doc/format_idg.ja.md +2 -4
  9. data/lib/review/book/chapter.rb +1 -0
  10. data/lib/review/book/compilable.rb +9 -0
  11. data/lib/review/book/index.rb +7 -1
  12. data/lib/review/builder.rb +29 -3
  13. data/lib/review/compiler.rb +2 -1
  14. data/lib/review/htmlbuilder.rb +40 -28
  15. data/lib/review/i18n.rb +8 -0
  16. data/lib/review/i18n.yml +22 -1
  17. data/lib/review/idgxmlbuilder.rb +42 -36
  18. data/lib/review/init.rb +2 -2
  19. data/lib/review/latexbuilder.rb +27 -1
  20. data/lib/review/makerhelper.rb +2 -1
  21. data/lib/review/plaintextbuilder.rb +27 -41
  22. data/lib/review/rstbuilder.rb +9 -1
  23. data/lib/review/topbuilder.rb +9 -1
  24. data/lib/review/update.rb +527 -0
  25. data/lib/review/version.rb +1 -1
  26. data/review.gemspec +1 -1
  27. data/samples/sample-book/README.md +1 -1
  28. data/samples/sample-book/src/Rakefile +2 -112
  29. data/samples/sample-book/src/config.yml +3 -1
  30. data/samples/sample-book/src/lib/tasks/review.rake +113 -0
  31. data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +17 -0
  32. data/samples/sample-book/src/sty/reviewmacro.sty +15 -1
  33. data/samples/syntax-book/Rakefile +2 -87
  34. data/samples/syntax-book/ch02.re +6 -1
  35. data/samples/syntax-book/config.yml +7 -4
  36. data/samples/syntax-book/images/cover-b5.ai +5735 -15
  37. data/samples/syntax-book/lib/tasks/review.rake +113 -0
  38. data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +17 -0
  39. data/samples/syntax-book/sty/reviewmacro.sty +11 -35
  40. data/templates/latex/config.erb +1 -0
  41. data/templates/latex/review-jlreq/review-base.sty +4 -0
  42. data/templates/latex/review-jlreq/review-jlreq.cls +56 -2
  43. data/templates/latex/review-jlreq/review-style.sty +0 -6
  44. data/templates/latex/review-jsbook/review-base.sty +5 -0
  45. data/test/assets/test_template.tex +2 -1
  46. data/test/assets/test_template_backmatter.tex +2 -1
  47. data/test/test_htmlbuilder.rb +39 -1
  48. data/test/test_idgxmlbuilder.rb +24 -0
  49. data/test/test_latexbuilder.rb +39 -0
  50. data/test/test_pdfmaker_cmd.rb +1 -1
  51. data/test/test_plaintextbuilder.rb +19 -0
  52. data/test/test_topbuilder.rb +21 -0
  53. data/test/test_update.rb +450 -0
  54. metadata +12 -2
@@ -0,0 +1,113 @@
1
+ # Copyright (c) 2006-2018 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'fileutils'
22
+ require 'rake/clean'
23
+
24
+ BOOK = ENV['REVIEW_BOOK'] || 'book'
25
+ BOOK_PDF = BOOK + '.pdf'
26
+ BOOK_EPUB = BOOK + '.epub'
27
+ CONFIG_FILE = ENV['REVIEW_CONFIG_FILE'] || 'config.yml'
28
+ CATALOG_FILE = ENV['REVIEW_CATALOG_FILE'] || 'catalog.yml'
29
+ WEBROOT = ENV['REVIEW_WEBROOT'] || 'webroot'
30
+ TEXTROOT = BOOK + '-text'
31
+ TOPROOT = BOOK + '-text'
32
+
33
+ def build(mode, chapter)
34
+ sh "review-compile --target=#{mode} --footnotetext --stylesheet=style.css #{chapter} > tmp"
35
+ mode_ext = { 'html' => 'html', 'latex' => 'tex', 'idgxml' => 'xml', 'top' => 'txt', 'plaintext' => 'txt' }
36
+ FileUtils.mv 'tmp', chapter.gsub(/re\z/, mode_ext[mode])
37
+ end
38
+
39
+ def build_all(mode)
40
+ sh "review-compile --target=#{mode} --footnotetext --stylesheet=style.css"
41
+ end
42
+
43
+ task default: :html_all
44
+
45
+ desc 'build html (Usage: rake build re=target.re)'
46
+ task :html do
47
+ if ENV['re'].nil?
48
+ puts 'Usage: rake build re=target.re'
49
+ exit
50
+ end
51
+ build('html', ENV['re'])
52
+ end
53
+
54
+ desc 'build all html'
55
+ task :html_all do
56
+ build_all('html')
57
+ end
58
+
59
+ desc 'preproc all'
60
+ task :preproc do
61
+ Dir.glob('*.re').each do |file|
62
+ sh "review-preproc --replace #{file}"
63
+ end
64
+ end
65
+
66
+ desc 'generate PDF and EPUB file'
67
+ task all: %i[pdf epub]
68
+
69
+ desc 'generate PDF file'
70
+ task pdf: BOOK_PDF
71
+
72
+ desc 'generate static HTML file for web'
73
+ task web: WEBROOT
74
+
75
+ desc 'generate text file (without decoration)'
76
+ task plaintext: TEXTROOT do
77
+ sh "review-textmaker -n #{CONFIG_FILE}"
78
+ end
79
+
80
+ desc 'generate (decorated) text file'
81
+ task text: TOPROOT do
82
+ sh "review-textmaker #{CONFIG_FILE}"
83
+ end
84
+
85
+ desc 'generate EPUB file'
86
+ task epub: BOOK_EPUB
87
+
88
+ IMAGES = FileList['images/**/*']
89
+ OTHERS = ENV['REVIEW_DEPS'] || []
90
+ SRC = FileList['./**/*.re', '*.rb'] + [CONFIG_FILE, CATALOG_FILE] + IMAGES + FileList[OTHERS]
91
+ SRC_EPUB = FileList['*.css']
92
+ SRC_PDF = FileList['layouts/*.erb', 'sty/**/*.sty']
93
+
94
+ file BOOK_PDF => SRC + SRC_PDF do
95
+ FileUtils.rm_rf [BOOK_PDF, BOOK, BOOK + '-pdf']
96
+ sh "review-pdfmaker #{CONFIG_FILE}"
97
+ end
98
+
99
+ file BOOK_EPUB => SRC + SRC_EPUB do
100
+ FileUtils.rm_rf [BOOK_EPUB, BOOK, BOOK + '-epub']
101
+ sh "review-epubmaker #{CONFIG_FILE}"
102
+ end
103
+
104
+ file WEBROOT => SRC do
105
+ FileUtils.rm_rf [WEBROOT]
106
+ sh "review-webmaker #{CONFIG_FILE}"
107
+ end
108
+
109
+ file TEXTROOT => SRC do
110
+ FileUtils.rm_rf [TEXTROOT]
111
+ end
112
+
113
+ CLEAN.include([BOOK, BOOK_PDF, BOOK_EPUB, BOOK + '-pdf', BOOK + '-epub', WEBROOT, 'images/_review_math', TEXTROOT])
@@ -0,0 +1,17 @@
1
+ desc 'copy sty/* files from current Re:VIEW source code (in git repos)'
2
+ task :copy_sty do
3
+ review_rootdir = '../..'
4
+ jsbook_dir = File.join(review_rootdir, 'templates/latex/review-jsbook')
5
+ gentombow_dir = File.join(review_rootdir, 'vendor/gentombow')
6
+ Dir.glob(File.join(jsbook_dir, '*.cls')) do |file|
7
+ FileUtils.cp file, 'sty'
8
+ end
9
+ Dir.glob(File.join(jsbook_dir, 'review-*.sty')) do |file|
10
+ FileUtils.cp file, 'sty'
11
+ end
12
+ FileUtils.cp File.join(gentombow_dir, 'gentombow.sty'), 'sty/gentombow09j.sty'
13
+ end
14
+
15
+ CLEAN.include([Dir.glob('sty/review-*.sty'), 'sty/review-jsbook.cls', 'sty/gentombow09j.sty'])
16
+
17
+ Rake::Task[BOOK_PDF].enhance([:copy_sty])
@@ -1,39 +1,15 @@
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}
1
+ % Re:VIEW 2互換のlayout.tex.erb記載相当の内容
2
+ \RequirePackage{review-base}
10
3
 
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}}
4
+ % Re:VIEW 2互換のreviewmacro.sty(装飾カスタマイズ)内容
5
+ \RequirePackage{review-style}
17
6
 
18
- %% using Helvetica as sans-serif
19
- \renewcommand{\sfdefault}{phv}
7
+ % ユーザー固有の定義
8
+ \RequirePackage{review-custom}
20
9
 
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
- %}
10
+ %% run \@endofreviewmacrohook at the end of reviewmacro style
11
+ \@ifundefined{@endofreviewmacrohook}{}{%
12
+ \let\AtEndOfReVIEWMacro\@firstofone
13
+ \@endofreviewmacrohook}
37
14
 
38
-
39
- \sloppy
15
+ \endinput
@@ -31,6 +31,7 @@
31
31
  \def\review@intn@columnhead{<%= escape_latex(I18n.t('column_head')) %>}
32
32
  \def\review@intn@image{<%= escape_latex(I18n.t('image')) %>}
33
33
  \def\review@intn@table{<%= escape_latex(I18n.t('table')) %>}
34
+ \def\review@intn@equation{<%= escape_latex(I18n.t('equation')) %>}
34
35
  \def\review@intn@columnname{<%= escape_latex(I18n.t('columnname')) %>}
35
36
  \def\review@intn@memohead{<%= escape_latex(I18n.t('memo_head')) %>}
36
37
  \def\review@intn@edition{<%= escape_latex(I18n.t('edition')) %>}
@@ -93,9 +93,13 @@
93
93
  \newcommand{\reviewcmdcaption}[1]{\review@commoncaption{}{#1}}
94
94
  \newenvironment{reviewlistblock}{\list{}{\topsep.5\baselineskip \leftmargin\z@ \itemindent\z@}\item\relax}{\endlist}% 上下アキ0.5
95
95
 
96
+ \newcommand{\reviewequationcaption}[1]{\review@commoncaption{}{#1}}
97
+ \newenvironment{reviewequationblock}{}{}
98
+
96
99
  \newcommand{\reviewimageref}[2]{\review@intn@image #1}
97
100
  \newcommand{\reviewtableref}[2]{\review@intn@table #1}
98
101
  \newcommand{\reviewlistref}[1]{\review@intn@list #1}
102
+ \newcommand{\reviewequationref}[1]{\review@intn@equation #1}
99
103
  \newcommand{\reviewbibref}[2]{#1}
100
104
  \newcommand{\reviewcolumnref}[2]{\review@intn@columnname #1}
101
105
  \newcommand{\reviewsecref}[2]{#1}
@@ -37,7 +37,7 @@ cls]
37
37
  \PassOptionsToPackage{nosetpagesize}{graphicx}%%for TL16 or higher version
38
38
  }{}
39
39
 
40
- \RequirePackage{xkeyval}
40
+ \RequirePackage{xkeyval,everypage}
41
41
 
42
42
  %% useful helpers
43
43
  \newcommand\recls@get@p@[2]{%
@@ -57,6 +57,52 @@ cls]
57
57
  \ClassError{recls}{The option #1 should have no value}{\@ehc}}%
58
58
  #2}}
59
59
 
60
+ %% \recls@set@hiddenfolio{<preset>}
61
+ %% <preset>: default, marusho-ink (丸正インキ), nikko-pc (日光企画),
62
+ %% shippo (ねこのしっぽ)
63
+ \def\recls@set@hiddenfolio#1{\ifx#1\@empty\else
64
+ \@ifundefined{@makehiddenfolio@#1}{%
65
+ \recls@error{Not define such hiddenfolio: #1}}\relax
66
+ %% set hiddenfolio preset
67
+ \expandafter\let\expandafter\@makehiddenfolio\csname @makehiddenfolio@#1\endcsname
68
+ %% redefine to output \@makehiddenfolio for every page
69
+ \@bannertoken{\hskip-5mm\smash{\hiddenfolio@font\@makehiddenfolio}}%
70
+ \AddEverypageHook{\maketombowbox}%
71
+ \fi}
72
+
73
+ \def\hiddenfolio@font{\reset@font
74
+ \scriptsize\sffamily\baselineskip.8\baselineskip}
75
+
76
+ %% hiddenfolio=default
77
+ \@namedef{@makehiddenfolio@default}{%
78
+ \ifodd\c@page
79
+ \llap{\thepage\hspace{\dimexpr\recls@tombobleed}}%
80
+ \else
81
+ \rlap{\hspace{\dimexpr\paperwidth+\recls@tombobleed}\thepage}%
82
+ \fi}
83
+
84
+ %% hiddenfolio=marusho-ink
85
+ \@namedef{@makehiddenfolio@marusho-ink}{%
86
+ \gdef\recls@tombobleed{5mm}%
87
+ \@nameuse{@makehiddenfolio@nikko-pc}}
88
+
89
+ %% hiddenfolio=nikko-pc
90
+ \@namedef{@makehiddenfolio@nikko-pc}{%
91
+ \def\recls@hiddfolio{%
92
+ \edef\recls@tmp{\thepage}%
93
+ \lower\dimexpr4pt+\recls@tombobleed+.5\paperheight+5\p@\hbox{%
94
+ \vbox{\expandafter\@tfor\expandafter\recls@x\expandafter:\expandafter=\recls@tmp\do{%
95
+ \hbox to 1zw{\hss\recls@x\hss}}}}}%
96
+ \ifodd\c@page
97
+ \rlap{\recls@hiddfolio}%
98
+ \else
99
+ \llap{\recls@hiddfolio\hspace{-\paperwidth}}%
100
+ \fi}
101
+
102
+ %% hiddenfolio=shippo
103
+ \@namedef{@makehiddenfolio@shippo}{%
104
+ \@nameuse{@makehiddenfolio@nikko-pc}}
105
+
60
106
  %% cameraready=print,ebook,preview
61
107
  \newif\if@cameraready \@camerareadyfalse
62
108
  \newif\if@pdfhyperlink \@pdfhyperlinkfalse
@@ -70,10 +116,13 @@ cls]
70
116
  \DeclareOptionX{startpage}[1]{\gdef\recls@startpage{\numexpr #1-1\relax}}
71
117
  \DeclareOptionX{serial_pagination}[false]{\csname recls@serialpage#1\endcsname}
72
118
 
119
+ %% 隠しノンブルプリセット
120
+ \DeclareOptionX{hiddenfolio}{\gdef\recls@hiddenfolio{#1}}%%default: (none)
121
+
73
122
  % jlreqのオプションについては https://github.com/abenori/jlreq/blob/master/README-ja.md を参照
74
123
  \PassOptionsToClass{book,paper=a5}{jlreq}% クラスで必ず使うオプションの指定。デフォルトをA5にしておく
75
124
  \DeclareOptionX*{\PassOptionsToClass{\CurrentOption}{jlreq}}%
76
- \ExecuteOptionsX{cameraready,tombopaper,bleed_margin,cover,startpage,serial_pagination}
125
+ \ExecuteOptionsX{cameraready,tombopaper,bleed_margin,cover,startpage,serial_pagination,hiddenfolio}
77
126
  \ProcessOptionsX\relax
78
127
 
79
128
  \def\recls@tmp{preview}\ifx\recls@cameraready\recls@tmp
@@ -99,6 +148,11 @@ cls]
99
148
  % トンボ設定
100
149
  \if@pdftombo
101
150
  \RequirePackage[trimmarks_paper=\recls@tombopaper,bleed_margin=\recls@tombobleed]{jlreq-trimmarks}
151
+ % https://github.com/abenori/jlreq/blob/master/jlreq-trimmarks-ja.md を参照
152
+ \jlreqtrimmarkssetup{banner={}}
153
+ % 隠しノンブル
154
+ \AtEndOfClass{%
155
+ \recls@set@hiddenfolio{\recls@hiddenfolio}}
102
156
  \fi
103
157
 
104
158
  % エンジンとドライバの情報。jlreq-trimmarksが定義されていればそっちから持ってくる。
@@ -33,9 +33,3 @@
33
33
  % 図表フロートの配置
34
34
  \floatplacement{figure}{H}
35
35
  \floatplacement{table}{H}
36
-
37
- % トンボ情報
38
- \if@pdftombo
39
- % https://github.com/abenori/jlreq/blob/master/jlreq-trimmarks-ja.md を参照
40
- \jlreqtrimmarkssetup{banner={}}
41
- \fi
@@ -110,6 +110,10 @@
110
110
  \end{alltt}\end{center}
111
111
  \end{figure}}
112
112
 
113
+ \newcommand{\reviewequationcaption}[1]{%
114
+ \medskip{\small\noindent #1}}
115
+ \newenvironment{reviewequationblock}{}{}
116
+
113
117
  \newenvironment{reviewlistblock}{}{}
114
118
 
115
119
  \newenvironment{reviewemlist}{%
@@ -181,6 +185,7 @@
181
185
  \newcommand{\reviewimageref}[2]{\review@intn@image #1}
182
186
  \newcommand{\reviewtableref}[2]{\review@intn@table #1}
183
187
  \newcommand{\reviewlistref}[1]{\review@intn@list #1}
188
+ \newcommand{\reviewequationref}[1]{\review@intn@equation #1}
184
189
  \newcommand{\reviewbibref}[2]{#1}
185
190
  \newcommand{\reviewcolumnref}[2]{\review@intn@columnname #1}
186
191
  \newcommand{\reviewsecref}[2]{#1}
@@ -1,6 +1,6 @@
1
1
  \documentclass[dvipdfmx]{review-jsbook}
2
2
  \makeatletter
3
- \def\review@reviewversion{3.0.0.preview2}
3
+ \def\review@reviewversion{3.0.0.preview3}
4
4
  \def\review@texcompiler{uplatex}
5
5
  \def\review@documentclass{review-jsbook}
6
6
 
@@ -19,6 +19,7 @@
19
19
  \def\review@intn@columnhead{■コラム}
20
20
  \def\review@intn@image{図}
21
21
  \def\review@intn@table{表}
22
+ \def\review@intn@equation{式}
22
23
  \def\review@intn@columnname{コラム}
23
24
  \def\review@intn@memohead{■メモ}
24
25
  \def\review@intn@edition{版}
@@ -1,6 +1,6 @@
1
1
  \documentclass[dvipdfmx]{review-jsbook}
2
2
  \makeatletter
3
- \def\review@reviewversion{3.0.0.preview2}
3
+ \def\review@reviewversion{3.0.0.preview3}
4
4
  \def\review@texcompiler{uplatex}
5
5
  \def\review@documentclass{review-jsbook}
6
6
 
@@ -19,6 +19,7 @@
19
19
  \def\review@intn@columnhead{■コラム}
20
20
  \def\review@intn@image{図}
21
21
  \def\review@intn@table{表}
22
+ \def\review@intn@equation{式}
22
23
  \def\review@intn@columnname{コラム}
23
24
  \def\review@intn@memohead{■メモ}
24
25
  \def\review@intn@edition{版}
@@ -1080,7 +1080,7 @@ EOS
1080
1080
  FileUtils.mkdir_p(File.join(dir, 'images'))
1081
1081
  expected = <<-EOB
1082
1082
  <div class=\"equation\">
1083
- <img src=\"images/_review_math/_gen_XXX.png\" class=\"math_gen_255609d0624d30ecd7b33bfbf069fa39965e221476aeb507f48766d9f216b9eb\" alt="p \\land \\bm{P} q" />
1083
+ <img src=\"images/_review_math/_gen_XXX.png\" class=\"math_gen_84291054a12d278ea05694c20fbbc8e974ec66fc13be801c01dca764faeecccb\" alt="p \\land \\bm{P} q" />
1084
1084
  </div>
1085
1085
  EOB
1086
1086
  tmpio = $stderr
@@ -1778,4 +1778,42 @@ EOB
1778
1778
  assert_equal ':1: error: key not found: "n"', e.message
1779
1779
  end
1780
1780
  end
1781
+
1782
+ def test_texequation_plain
1783
+ src = <<-EOS
1784
+ //texequation{
1785
+ e=mc^2
1786
+ //}
1787
+ EOS
1788
+ expected = <<-EOS
1789
+ <div class="equation">
1790
+ <pre>e=mc^2
1791
+ </pre>
1792
+ </div>
1793
+ EOS
1794
+ actual = compile_block(src)
1795
+ assert_equal expected, actual
1796
+ end
1797
+
1798
+ def test_texequation_with_caption
1799
+ src = <<-EOS
1800
+ @<eq>{emc2}
1801
+
1802
+ //texequation[emc2][The Equivalence of Mass @<i>{and} Energy]{
1803
+ e=mc^2
1804
+ //}
1805
+ EOS
1806
+ expected = <<-EOS
1807
+ <p><span class="eqref">式1.1</span></p>
1808
+ <div id="emc2" class="caption-equation">
1809
+ <p class="caption">式1.1: The Equivalence of Mass <i>and</i> Energy</p>
1810
+ <div class="equation">
1811
+ <pre>e=mc^2
1812
+ </pre>
1813
+ </div>
1814
+ </div>
1815
+ EOS
1816
+ actual = compile_block(src)
1817
+ assert_equal expected, actual
1818
+ end
1781
1819
  end
@@ -735,4 +735,28 @@ EOS
735
735
  actual = compile_inline('test @<comment>{コメント} test2')
736
736
  assert_equal 'test <msg>コメント</msg> test2', actual
737
737
  end
738
+
739
+ def test_texequation
740
+ src = <<-EOS
741
+ //texequation{
742
+ e=mc^2
743
+ //}
744
+ EOS
745
+ expected = %Q(<replace idref="texblock-1"><pre>e=mc^2</pre></replace>)
746
+ actual = compile_block(src)
747
+ assert_equal expected, actual
748
+ end
749
+
750
+ def test_texequation_with_caption
751
+ src = <<-EOS
752
+ @<eq>{emc2}
753
+
754
+ //texequation[emc2][The Equivalence of Mass @<i>{and} Energy]{
755
+ e=mc^2
756
+ //}
757
+ EOS
758
+ expected = %Q(<p><span type='eq'>式1.1</span></p><equationblock><caption>式1.1 The Equivalence of Mass <i>and</i> Energy</caption><replace idref="texblock-1"><pre>e=mc^2</pre></replace></equationblock>)
759
+ actual = compile_block(src)
760
+ assert_equal expected, actual
761
+ end
738
762
  end
@@ -1116,6 +1116,45 @@ EOS
1116
1116
  \\caption{FOO}
1117
1117
  \\label{image:chap1:sampleimg}
1118
1118
  \\end{reviewimage}
1119
+ EOS
1120
+ actual = compile_block(src)
1121
+ assert_equal expected, actual
1122
+ end
1123
+
1124
+ def test_texequation
1125
+ src = <<-EOS
1126
+ //texequation{
1127
+ e=mc^2
1128
+ //}
1129
+ EOS
1130
+ expected = <<-EOS
1131
+
1132
+ \\begin{equation*}
1133
+ e=mc^2
1134
+ \\end{equation*}
1135
+ EOS
1136
+ actual = compile_block(src)
1137
+ assert_equal expected, actual
1138
+ end
1139
+
1140
+ def test_texequation_with_caption
1141
+ src = <<-EOS
1142
+ @<eq>{emc2}
1143
+
1144
+ //texequation[emc2][The Equivalence of Mass @<i>{and} Energy]{
1145
+ e=mc^2
1146
+ //}
1147
+ EOS
1148
+ expected = <<-EOS
1149
+
1150
+ \\reviewequationref{1.1}
1151
+
1152
+ \\begin{reviewequationblock}
1153
+ \\reviewequationcaption{式1.1: The Equivalence of Mass \\reviewit{and} Energy}
1154
+ \\begin{equation*}
1155
+ e=mc^2
1156
+ \\end{equation*}
1157
+ \\end{reviewequationblock}
1119
1158
  EOS
1120
1159
  actual = compile_block(src)
1121
1160
  assert_equal expected, actual