review 5.0.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-tex.yml +35 -0
- data/.github/workflows/ruby-win.yml +8 -4
- data/.github/workflows/ruby.yml +6 -2
- data/.rubocop.yml +24 -9
- data/NEWS.ja.md +215 -0
- data/NEWS.md +215 -1
- data/README.md +7 -6
- data/Rakefile +7 -2
- data/bin/review +2 -4
- data/bin/review-catalog-converter +3 -3
- data/bin/review-check +6 -8
- data/bin/review-checkdep +1 -4
- data/bin/review-compile +10 -20
- data/bin/review-epub2html +1 -4
- data/bin/review-epubmaker +3 -4
- data/bin/review-idgxmlmaker +1 -3
- data/bin/review-index +11 -5
- data/bin/review-init +1 -4
- data/bin/review-pdfmaker +1 -3
- data/bin/review-preproc +30 -38
- data/bin/review-textmaker +1 -3
- data/bin/review-update +1 -4
- data/bin/review-validate +3 -3
- data/bin/review-vol +1 -4
- data/bin/review-webmaker +1 -3
- data/doc/config.yml.sample +23 -5
- data/doc/config.yml.sample-simple +1 -1
- data/doc/format.ja.md +49 -12
- data/doc/format.md +52 -12
- data/doc/quickstart.ja.md +11 -1
- data/doc/quickstart.md +11 -2
- data/doc/writing_vertical.ja.md +6 -0
- data/lib/review/book/base.rb +4 -0
- data/lib/review/book/book_unit.rb +15 -2
- data/lib/review/book/chapter.rb +3 -0
- data/lib/review/book/index.rb +5 -1
- data/lib/review/book/volume.rb +1 -0
- data/lib/review/builder.rb +90 -54
- data/lib/review/call_hook.rb +20 -0
- data/lib/review/catalog.rb +2 -0
- data/lib/review/compiler.rb +88 -52
- data/lib/review/configure.rb +64 -7
- 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 +167 -0
- data/lib/review/epubmaker/reviewheaderlistener.rb +12 -2
- data/lib/review/epubmaker/zip_exporter.rb +84 -0
- data/lib/review/epubmaker.rb +114 -129
- data/lib/review/exception.rb +13 -0
- data/lib/review/htmlbuilder.rb +109 -67
- data/lib/review/htmlutils.rb +1 -1
- data/lib/review/i18n.rb +1 -0
- data/lib/review/i18n.yml +6 -0
- data/lib/review/idgxmlbuilder.rb +72 -48
- data/lib/review/idgxmlmaker.rb +15 -14
- data/lib/review/img_math.rb +239 -0
- data/lib/review/index_builder.rb +90 -32
- data/lib/review/init.rb +4 -4
- data/lib/review/latexbox.rb +58 -0
- data/lib/review/latexbuilder.rb +79 -58
- data/lib/review/latexutils.rb +9 -1
- data/lib/review/lineinput.rb +112 -2
- data/lib/review/loggable.rb +27 -0
- data/lib/review/logger.rb +89 -2
- data/lib/review/makerhelper.rb +7 -206
- data/lib/review/markdownbuilder.rb +44 -4
- data/lib/review/pdfmaker.rb +70 -51
- data/lib/review/plaintextbuilder.rb +20 -11
- data/lib/review/preprocessor/directive.rb +35 -0
- data/lib/review/preprocessor/line.rb +34 -0
- data/lib/review/preprocessor/repository.rb +177 -0
- data/lib/review/preprocessor.rb +105 -301
- data/lib/review/rstbuilder.rb +13 -4
- data/lib/review/sec_counter.rb +1 -0
- data/lib/review/template.rb +11 -1
- data/lib/review/textmaker.rb +23 -20
- data/lib/review/textutils.rb +10 -17
- data/lib/review/tocprinter.rb +93 -71
- data/lib/review/topbuilder.rb +44 -19
- data/lib/review/update.rb +5 -6
- data/lib/review/version.rb +1 -1
- data/lib/review/volumeprinter.rb +11 -12
- data/lib/review/webmaker.rb +31 -27
- data/lib/review/webtocprinter.rb +10 -9
- data/lib/review/yamlloader.rb +2 -1
- data/lib/review.rb +1 -1
- data/review.gemspec +5 -3
- data/samples/sample-book/src/config-epub2.yml +1 -1
- data/samples/sample-book/src/config.yml +1 -1
- data/samples/sample-book/src/lib/tasks/review.rake +19 -1
- data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +2 -1
- data/samples/syntax-book/ch01.re +1 -1
- data/samples/syntax-book/ch02.re +30 -6
- data/samples/syntax-book/ch03.re +1 -1
- data/samples/syntax-book/images/img3-2.png +0 -0
- data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +2 -1
- 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 +11 -0
- data/templates/latex/review-jlreq/review-base.sty +7 -9
- data/templates/latex/review-jlreq/review-jlreq.cls +48 -6
- data/templates/latex/review-jlreq/review-style.sty +6 -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/review-base.sty +13 -9
- data/templates/latex/review-jsbook/review-jsbook.cls +41 -6
- data/templates/latex/review-jsbook/review-style.sty +6 -1
- 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 +6 -5
- 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 +60 -0
- data/test/assets/test_template.tex +7 -1
- data/test/assets/test_template_backmatter.tex +7 -1
- data/test/run_test.rb +1 -1
- data/test/test_book_chapter.rb +27 -4
- data/test/test_builder.rb +10 -8
- data/test/test_catalog_converter_cmd.rb +1 -1
- data/test/test_epub3maker.rb +168 -124
- data/test/test_epubmaker.rb +248 -131
- data/test/test_epubmaker_cmd.rb +15 -4
- data/test/test_helper.rb +5 -4
- data/test/test_htmlbuilder.rb +170 -31
- data/test/test_idgxmlbuilder.rb +44 -23
- data/test/test_idgxmlmaker_cmd.rb +7 -3
- data/test/test_img_math.rb +111 -0
- data/test/test_index.rb +30 -4
- data/test/test_indexbuilder.rb +5 -5
- data/test/test_latexbuilder.rb +151 -26
- data/test/test_latexbuilder_v2.rb +18 -10
- data/test/test_lineinput.rb +20 -93
- data/test/test_markdownbuilder.rb +42 -0
- data/test/test_pdfmaker.rb +90 -0
- data/test/test_pdfmaker_cmd.rb +2 -2
- data/test/test_plaintextbuilder.rb +56 -40
- data/test/test_preprocessor.rb +188 -1
- data/test/test_reviewheaderlistener.rb +49 -0
- data/test/test_rstbuilder.rb +13 -0
- data/test/test_template.rb +12 -2
- data/test/test_textmaker_cmd.rb +5 -1
- data/test/test_tocprinter.rb +46 -0
- data/test/test_topbuilder.rb +50 -19
- data/test/test_update.rb +34 -34
- data/test/test_zip_exporter.rb +5 -6
- metadata +95 -17
- data/lib/epubmaker/content.rb +0 -111
- data/lib/epubmaker/epubcommon.rb +0 -449
- data/lib/epubmaker/epubv2.rb +0 -142
- data/lib/epubmaker/epubv3.rb +0 -235
- data/lib/epubmaker/producer.rb +0 -375
- data/lib/epubmaker/zip_exporter.rb +0 -81
- data/lib/epubmaker.rb +0 -23
- data/lib/lineinput.rb +0 -155
data/lib/review/volumeprinter.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2014-
|
2
|
+
# Copyright (c) 2014-2021 Minero Aoki, Kenshi Muto
|
3
3
|
# 2003-2014 Minero Aoki
|
4
4
|
#
|
5
5
|
# This program is free software.
|
@@ -22,21 +22,20 @@ module ReVIEW
|
|
22
22
|
|
23
23
|
def initialize
|
24
24
|
@logger = ReVIEW.logger
|
25
|
-
@config = ReVIEW::Configure.values
|
26
25
|
@yamlfile = 'config.yml'
|
27
26
|
end
|
28
27
|
|
29
28
|
def execute(*args)
|
30
29
|
parse_options(args)
|
31
|
-
@book = ReVIEW::Book::Base.new('.', config: @config)
|
32
|
-
unless File.readable?(@yamlfile)
|
33
|
-
@logger.error("No such fiile or can't open #{@yamlfile}.")
|
34
|
-
exit 1
|
35
|
-
end
|
36
|
-
@book.load_config(@yamlfile)
|
37
|
-
I18n.setup(@book.config['language'])
|
38
|
-
|
39
30
|
begin
|
31
|
+
@config = ReVIEW::Configure.create(yamlfile: @yamlfile)
|
32
|
+
@book = ReVIEW::Book::Base.new('.', config: @config)
|
33
|
+
unless File.readable?(@yamlfile)
|
34
|
+
raise ReVIEW::FileNotFound, "No such fiile or can't open #{@yamlfile}."
|
35
|
+
end
|
36
|
+
|
37
|
+
I18n.setup(@book.config['language'])
|
38
|
+
|
40
39
|
@book.each_part do |part|
|
41
40
|
if part.number
|
42
41
|
print_chapter_volume(part)
|
@@ -45,8 +44,8 @@ module ReVIEW
|
|
45
44
|
print_chapter_volume(chap)
|
46
45
|
end
|
47
46
|
end
|
48
|
-
rescue ReVIEW::FileNotFound, ReVIEW::CompileError => e
|
49
|
-
@logger.error e
|
47
|
+
rescue ReVIEW::ConfigError, ReVIEW::FileNotFound, ReVIEW::CompileError, ReVIEW::ApplicationError => e
|
48
|
+
@logger.error e.message
|
50
49
|
exit 1
|
51
50
|
end
|
52
51
|
puts '============================='
|
data/lib/review/webmaker.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2016-
|
1
|
+
# Copyright (c) 2016-2021 Masayoshi Takahashi, Masanori Kado, Kenshi Muto
|
2
2
|
#
|
3
3
|
# This program is free software.
|
4
4
|
# You can distribute or modify this program under the terms of
|
@@ -20,26 +20,22 @@ require 'review/template'
|
|
20
20
|
require 'review/tocprinter'
|
21
21
|
require 'review/version'
|
22
22
|
require 'review/makerhelper'
|
23
|
+
require 'review/img_math'
|
24
|
+
require 'review/loggable'
|
23
25
|
|
24
26
|
module ReVIEW
|
25
27
|
class WEBMaker
|
26
28
|
include ERB::Util
|
27
29
|
include MakerHelper
|
30
|
+
include Loggable
|
28
31
|
|
29
32
|
attr_accessor :config, :basedir
|
30
33
|
|
31
34
|
def initialize
|
32
35
|
@basedir = nil
|
33
36
|
@logger = ReVIEW.logger
|
34
|
-
|
35
|
-
|
36
|
-
def error(msg)
|
37
|
-
@logger.error msg
|
38
|
-
exit 1
|
39
|
-
end
|
40
|
-
|
41
|
-
def warn(msg)
|
42
|
-
@logger.warn msg
|
37
|
+
@img_math = nil
|
38
|
+
@compile_errors = nil
|
43
39
|
end
|
44
40
|
|
45
41
|
def self.execute(*args)
|
@@ -74,25 +70,29 @@ module ReVIEW
|
|
74
70
|
end
|
75
71
|
|
76
72
|
def remove_old_files(path)
|
77
|
-
cleanup_mathimg
|
73
|
+
@img_math.cleanup_mathimg
|
78
74
|
FileUtils.rm_rf(path)
|
79
75
|
end
|
80
76
|
|
81
77
|
def execute(*args)
|
82
78
|
cmd_config, yamlfile = parse_opts(args)
|
83
|
-
error "#{yamlfile} not found." unless File.exist?(yamlfile)
|
79
|
+
error! "#{yamlfile} not found." unless File.exist?(yamlfile)
|
84
80
|
|
85
81
|
@config = ReVIEW::Configure.create(maker: 'webmaker',
|
86
82
|
yamlfile: yamlfile,
|
87
83
|
config: cmd_config)
|
88
84
|
|
89
85
|
@config['htmlext'] = 'html'
|
86
|
+
@img_math = ReVIEW::ImgMath.new(@config)
|
87
|
+
|
90
88
|
I18n.setup(@config['language'])
|
91
89
|
begin
|
92
90
|
generate_html_files(yamlfile)
|
91
|
+
@logger.success("built #{build_path}")
|
93
92
|
rescue ApplicationError => e
|
94
93
|
raise if @config['debug']
|
95
|
-
|
94
|
+
|
95
|
+
error! e.message
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -103,15 +103,15 @@ module ReVIEW
|
|
103
103
|
Dir.mkdir(@path)
|
104
104
|
|
105
105
|
@book = ReVIEW::Book::Base.new(@basedir, config: @config)
|
106
|
+
@converter = ReVIEW::Converter.new(@book, ReVIEW::HTMLBuilder.new(img_math: @img_math))
|
106
107
|
|
107
108
|
copy_stylesheet(@path)
|
108
109
|
copy_frontmatter(@path)
|
109
110
|
build_body(@path, yamlfile)
|
110
111
|
copy_backmatter(@path)
|
111
112
|
|
112
|
-
|
113
|
-
|
114
|
-
make_math_images(math_dir)
|
113
|
+
if @config['math_format'] == 'imgmath'
|
114
|
+
@img_math.make_math_images
|
115
115
|
end
|
116
116
|
|
117
117
|
copy_images(@config['imagedir'], "#{@path}/#{@config['imagedir']}")
|
@@ -123,8 +123,7 @@ module ReVIEW
|
|
123
123
|
|
124
124
|
def build_body(basetmpdir, _yamlfile)
|
125
125
|
base_path = Pathname.new(@basedir)
|
126
|
-
|
127
|
-
@converter = ReVIEW::Converter.new(@book, builder)
|
126
|
+
@compile_errors = nil
|
128
127
|
@book.parts.each do |part|
|
129
128
|
if part.name.present?
|
130
129
|
if part.file?
|
@@ -139,6 +138,9 @@ module ReVIEW
|
|
139
138
|
|
140
139
|
part.chapters.each { |chap| build_chap(chap, base_path, basetmpdir, false) }
|
141
140
|
end
|
141
|
+
if @compile_errors
|
142
|
+
app_error 'compile error, No web files output.'
|
143
|
+
end
|
142
144
|
end
|
143
145
|
|
144
146
|
def build_part(part, basetmpdir, htmlfile)
|
@@ -152,8 +154,7 @@ module ReVIEW
|
|
152
154
|
|
153
155
|
@language = @config['language']
|
154
156
|
@stylesheets = @config['stylesheet']
|
155
|
-
|
156
|
-
f.write ReVIEW::Template.load(tmplfile).result(binding)
|
157
|
+
f.write ReVIEW::Template.generate(path: template_name, binding: binding)
|
157
158
|
end
|
158
159
|
end
|
159
160
|
|
@@ -188,14 +189,16 @@ module ReVIEW
|
|
188
189
|
|
189
190
|
begin
|
190
191
|
@converter.convert(filename, File.join(basetmpdir, htmlfile))
|
191
|
-
rescue => e
|
192
|
-
|
193
|
-
|
192
|
+
rescue ApplicationError => e
|
193
|
+
@compile_errors = true
|
194
|
+
error "compile error in #{filename} (#{e.class})"
|
195
|
+
error e.message
|
194
196
|
end
|
195
197
|
end
|
196
198
|
|
197
199
|
def copy_images(resdir, destdir)
|
198
200
|
return nil unless File.exist?(resdir)
|
201
|
+
|
199
202
|
allow_exts = @config['image_ext']
|
200
203
|
FileUtils.mkdir_p(destdir)
|
201
204
|
recursive_copy_files(resdir, destdir, allow_exts)
|
@@ -203,6 +206,7 @@ module ReVIEW
|
|
203
206
|
|
204
207
|
def copy_resources(resdir, destdir, allow_exts = nil)
|
205
208
|
return nil if !resdir || !File.exist?(resdir)
|
209
|
+
|
206
210
|
allow_exts ||= @config['image_ext']
|
207
211
|
FileUtils.mkdir_p(destdir)
|
208
212
|
recursive_copy_files(resdir, destdir, allow_exts)
|
@@ -212,6 +216,7 @@ module ReVIEW
|
|
212
216
|
Dir.open(resdir) do |dir|
|
213
217
|
dir.each do |fname|
|
214
218
|
next if fname.start_with?('.')
|
219
|
+
|
215
220
|
if FileTest.directory?("#{resdir}/#{fname}")
|
216
221
|
recursive_copy_files("#{resdir}/#{fname}", "#{destdir}/#{fname}", allow_exts)
|
217
222
|
elsif fname =~ /\.(#{allow_exts.join('|')})\Z/i
|
@@ -263,8 +268,7 @@ module ReVIEW
|
|
263
268
|
@toc = ReVIEW::WEBTOCPrinter.book_to_string(@book)
|
264
269
|
@next = @book.chapters[0]
|
265
270
|
@next_title = @next ? @next.title : ''
|
266
|
-
|
267
|
-
f.write ReVIEW::Template.load(tmplfile).result(binding)
|
271
|
+
f.write ReVIEW::Template.generate(path: template_name, binding: binding)
|
268
272
|
end
|
269
273
|
end
|
270
274
|
|
@@ -284,8 +288,7 @@ module ReVIEW
|
|
284
288
|
|
285
289
|
@language = @config['language']
|
286
290
|
@stylesheets = @config['stylesheet']
|
287
|
-
|
288
|
-
f.write ReVIEW::Template.load(tmplfile).result(binding)
|
291
|
+
f.write ReVIEW::Template.generate(path: template_name, binding: binding)
|
289
292
|
end
|
290
293
|
end
|
291
294
|
|
@@ -300,6 +303,7 @@ module ReVIEW
|
|
300
303
|
|
301
304
|
def copy_file_with_param(name, target_file = nil)
|
302
305
|
return if @config[name].nil? || !File.exist?(@config[name])
|
306
|
+
|
303
307
|
target_file ||= File.basename(@config[name])
|
304
308
|
FileUtils.cp(@config[name], File.join(@path, target_file))
|
305
309
|
end
|
data/lib/review/webtocprinter.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'review/tocprinter'
|
2
2
|
require 'review/i18n'
|
3
|
+
require 'review/htmlutils'
|
3
4
|
|
4
5
|
module ReVIEW
|
5
6
|
class WEBTOCPrinter < TOCPrinter
|
@@ -24,28 +25,28 @@ EOT
|
|
24
25
|
|
25
26
|
path = ''
|
26
27
|
result_array.each do |result|
|
27
|
-
unless result
|
28
|
-
result
|
28
|
+
unless result.headline
|
29
|
+
result.headline = '-'
|
29
30
|
end
|
30
31
|
|
31
|
-
if result
|
32
|
-
path = "#{result
|
32
|
+
if result.name
|
33
|
+
path = "#{result.name}.#{@book.config['htmlext']}"
|
33
34
|
next
|
34
35
|
end
|
35
36
|
|
36
|
-
if result
|
37
|
-
if result
|
37
|
+
if result.part
|
38
|
+
if result.part == 'end'
|
38
39
|
content << "</ul></li>\n"
|
39
40
|
end
|
40
41
|
next
|
41
42
|
end
|
42
43
|
|
43
44
|
if path.start_with?('.')
|
44
|
-
content << "<li>#{escape(result
|
45
|
+
content << "<li>#{escape(result.headline)}"
|
45
46
|
else
|
46
|
-
content << %Q(<li><a href="#{path}">#{escape(result
|
47
|
+
content << %Q(<li><a href="#{path}">#{escape(result.headline)}</a>)
|
47
48
|
end
|
48
|
-
if result
|
49
|
+
if result.level == 0
|
49
50
|
content << "\n<ul>" # part
|
50
51
|
else
|
51
52
|
content << "</li>\n"
|
data/lib/review/yamlloader.rb
CHANGED
@@ -18,9 +18,10 @@ module ReVIEW
|
|
18
18
|
while file_queue.present?
|
19
19
|
current_file = file_queue.shift
|
20
20
|
current_yaml = YAML.load_file(current_file)
|
21
|
-
if current_yaml.
|
21
|
+
if current_yaml.instance_of?(FalseClass)
|
22
22
|
raise "#{File.basename(current_file)} is malformed."
|
23
23
|
end
|
24
|
+
|
24
25
|
yaml = current_yaml.deep_merge(yaml)
|
25
26
|
|
26
27
|
if yaml.key?('inherit')
|
data/lib/review.rb
CHANGED
data/review.gemspec
CHANGED
@@ -7,12 +7,11 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.platform = Gem::Platform::RUBY
|
8
8
|
gem.license = 'LGPL'
|
9
9
|
gem.authors = %w[kmuto takahashim]
|
10
|
-
gem.email = 'kmuto@
|
10
|
+
gem.email = 'kmuto@kmuto.jp'
|
11
11
|
gem.homepage = 'http://github.com/kmuto/review'
|
12
12
|
gem.summary = 'Re:VIEW: a easy-to-use digital publishing system'
|
13
13
|
gem.description = 'Re:VIEW is a digital publishing system for books and ebooks. It supports InDesign, EPUB and LaTeX.'
|
14
14
|
gem.required_rubygems_version = Gem::Requirement.new('>= 0') if gem.respond_to?(:required_rubygems_version=)
|
15
|
-
gem.date = '2020-10-29'
|
16
15
|
|
17
16
|
gem.files = `git ls-files`.split("\n")
|
18
17
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -23,10 +22,13 @@ Gem::Specification.new do |gem|
|
|
23
22
|
gem.add_dependency('image_size')
|
24
23
|
gem.add_dependency('rouge')
|
25
24
|
gem.add_dependency('rubyzip')
|
25
|
+
gem.add_dependency('tty-logger')
|
26
|
+
gem.add_development_dependency('mini_magick')
|
26
27
|
gem.add_development_dependency('pygments.rb')
|
27
28
|
gem.add_development_dependency('rake')
|
28
|
-
gem.add_development_dependency('rubocop', '~>
|
29
|
+
gem.add_development_dependency('rubocop', '~> 1.12.0')
|
29
30
|
gem.add_development_dependency('rubocop-performance')
|
31
|
+
gem.add_development_dependency('rubocop-rake')
|
30
32
|
gem.add_development_dependency('simplecov')
|
31
33
|
gem.add_development_dependency('test-unit')
|
32
34
|
gem.add_development_dependency('unicode-eaw')
|
@@ -11,7 +11,7 @@ language: ja
|
|
11
11
|
# 書名
|
12
12
|
booktitle: Re:VIEWサンプル書籍
|
13
13
|
# 固有IDに使用するドメイン。省略した場合は時刻に基づくランダムUUIDが入る
|
14
|
-
urnid: urn:
|
14
|
+
urnid: urn:uuid:http://tatsu-zine.com/books/review-sample-book/1.0.0/
|
15
15
|
# ISBN。省略した場合はurnidが入る
|
16
16
|
# isbn: null
|
17
17
|
# 著者名。["高橋征義", "John Doe"] のように配列を使うことで複数指定可
|
@@ -3,7 +3,7 @@ review_version: 5.0
|
|
3
3
|
bookname: book
|
4
4
|
language: ja
|
5
5
|
booktitle: Re:VIEWサンプル書籍
|
6
|
-
urnid: urn:
|
6
|
+
urnid: urn:uuid:http://reviewml.com/books/review-sample-book/
|
7
7
|
# isbn: null
|
8
8
|
aut: Re:VIEW Writers
|
9
9
|
pbl: Re:VIEW Publishers
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2006-
|
1
|
+
# Copyright (c) 2006-2021 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
|
2
2
|
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -36,6 +36,11 @@ WEB_OPTIONS = ENV['REVIEW_WEB_OPTIONS'] || ''
|
|
36
36
|
IDGXML_OPTIONS = ENV['REVIEW_IDGXML_OPTIONS'] || ''
|
37
37
|
TEXT_OPTIONS = ENV['REVIEW_TEXT_OPTIONS'] || ''
|
38
38
|
|
39
|
+
REVIEW_VSCLI = ENV['REVIEW_VSCLI'] || 'vivliostyle'
|
40
|
+
REVIEW_VSCLI_USESANDBOX = ENV['REVIEW_VSCLI_USESANDBOX'] ? '' : '--no-sandbox'
|
41
|
+
REVIEW_VSCLI_PDF = ENV['REVIEW_VSCLI_PDF'] || BOOK_PDF
|
42
|
+
REVIEW_VSCLI_OPTIONS = ENV['REVIEW_VSCLI_OPTIONS'] || ''
|
43
|
+
|
39
44
|
def build(mode, chapter)
|
40
45
|
sh("review-compile --target=#{mode} --footnotetext --stylesheet=style.css #{chapter} > tmp")
|
41
46
|
mode_ext = { 'html' => 'html', 'latex' => 'tex', 'idgxml' => 'xml', 'top' => 'txt', 'plaintext' => 'txt' }
|
@@ -125,4 +130,17 @@ file IDGXMLROOT => SRC do
|
|
125
130
|
FileUtils.rm_rf([IDGXMLROOT])
|
126
131
|
end
|
127
132
|
|
133
|
+
desc 'preview with vivliostyle'
|
134
|
+
task 'vivliostyle:preview': BOOK_EPUB do
|
135
|
+
sh "#{REVIEW_VSCLI} preview #{REVIEW_VSCLI_USESANDBOX} #{REVIEW_VSCLI_OPTIONS} #{BOOK_EPUB}"
|
136
|
+
end
|
137
|
+
|
138
|
+
desc 'build with vivliostyle'
|
139
|
+
task 'vivliostyle:build': BOOK_EPUB do
|
140
|
+
sh "#{REVIEW_VSCLI} build #{REVIEW_VSCLI_USESANDBOX} #{REVIEW_VSCLI_OPTIONS} -o #{REVIEW_VSCLI_PDF} #{BOOK_EPUB}"
|
141
|
+
end
|
142
|
+
|
143
|
+
desc 'build with vivliostyle'
|
144
|
+
task vivliostyle: 'vivliostyle:build'
|
145
|
+
|
128
146
|
CLEAN.include([BOOK, BOOK_PDF, BOOK_EPUB, BOOK + '-pdf', BOOK + '-epub', WEBROOT, 'images/_review_math', 'images/_review_math_text', TEXTROOT, IDGXMLROOT])
|
@@ -1,5 +1,6 @@
|
|
1
|
-
desc 'copy sty/* files from current Re:VIEW source code (in git repos)'
|
2
1
|
REVIEW_TEMPLATE = ENV['REVIEW_TEMPLATE'] || 'review-jsbook'
|
2
|
+
|
3
|
+
desc 'copy sty/* files from current Re:VIEW source code (in git repos)'
|
3
4
|
task :copy_sty do
|
4
5
|
review_rootdir = '../../..'
|
5
6
|
template_dir = File.join(review_rootdir, "templates/latex/#{REVIEW_TEMPLATE}")
|
data/samples/syntax-book/ch01.re
CHANGED
@@ -119,7 +119,7 @@ olnumで一応番号が変更可能なことを期待していますが、Webブ
|
|
119
119
|
//emlist{
|
120
120
|
@<b>{bold太字}@<i>{italicイタ}
|
121
121
|
|
122
|
-
: Alpha@<embed>{@}<b>{bold太字}@<embed>{@}<i>{italicイタ}@<embed>{@}<tt>{等幅code}
|
122
|
+
: Alpha@<embed>{@}<b>{bold太字}@<embed>{@}<i>{italicイタ}@<embed>{@}<tt>{等幅code}
|
123
123
|
@<embed>{@}<i>{DEC}の作っていた@<embed>{@}<b>{RISC CPU}。@<embed>{@}<i>{italicイタ}@<embed>{@}<tt>{等幅code}
|
124
124
|
浮動小数点数演算が速い。
|
125
125
|
: POWER
|
data/samples/syntax-book/ch02.re
CHANGED
@@ -254,8 +254,14 @@ Tips。@<b>{太字bold}@<i>{italicイタ}@<tt>{等幅code}
|
|
254
254
|
|
255
255
|
#@# doorquote、bpo、talk、graph、address、box、linebreak、pagebreak、hr、comment、abbr、acronym、dfn、kbd、q、samp、var、big、small、del、ins、recipe、dtp、raw、embed、include
|
256
256
|
|
257
|
+
== 後注
|
258
|
+
後注は脚注と同様の書式で、@<tt>{//endnote}で内容@<endnote>{end1}、@<tt>{@}@<tt>{<endnote>}で参照します@<endnote>{end2}。後注は@<tt>{//printendnotes}を書いた箇所にまとめて書き出されます。ここではファイル末尾に置いています。
|
259
|
+
|
260
|
+
//endnote[end1][後注その1です。]
|
261
|
+
//endnote[end2][後注その2です。]
|
262
|
+
|
257
263
|
== LaTeX式
|
258
|
-
LaTeX式はTeX紙面以外は保証されません。EPUBではMathML(@<tt>{
|
264
|
+
LaTeX式はTeX紙面以外は保証されません。EPUBではMathML(@<tt>{math_format: mathml})を使えますが、表現や互換性が不足しており、LaTeXをバックエンドとして画像化する@<tt>{math_format: imgmath}のほうがよさそうです。
|
259
265
|
|
260
266
|
//texequation{
|
261
267
|
\sum_{i=1}^nf_n(x)
|
@@ -285,7 +291,7 @@ a_{m1} & \cdots & a_{mn}
|
|
285
291
|
#@# 場所ラベル定義
|
286
292
|
|
287
293
|
=== 書体
|
288
|
-
本文での……キーワード@<kw>{キーワード, keyword}@<fn>{kw}、太字@<b>{b太字}、イタリック@<i>{iイタリック}、等幅@<tt>{tt等幅}、強調@<strong>{strong強調}、強調@<em>{em強調}、下線@<u>{u下線}、等幅@<code>{code等幅}、等幅太字@<ttb>{ttb等幅太字}、等幅イタリック@<tti>{tti等幅イタリック}、網カケ@<ami>{amiアミ}、16進UTF文字指定@<uchar>{3042}、インラインアイコン@<icon>{inlineicon}
|
294
|
+
本文での……キーワード@<kw>{キーワード, keyword}@<fn>{kw}、太字@<b>{b太字}、イタリック@<i>{iイタリック}、等幅@<tt>{tt等幅}、強調@<strong>{strong強調}、強調@<em>{em強調}、下線@<u>{u下線}、等幅@<code>{code等幅}、等幅太字@<ttb>{ttb等幅太字}、等幅イタリック@<tti>{tti等幅イタリック}、網カケ@<ami>{amiアミ}、挿入@<ins>{ins挿入}、削除@<del>{del削除}、16進UTF文字指定@<uchar>{3042}、インラインアイコン@<icon>{inlineicon}
|
289
295
|
|
290
296
|
傍点@<embed>{@}<bou>{bou傍点}、ルビ@<embed>{@}<ruby>{愕然, がくぜん}、縦中横@<embed>{@}<tcy>{90}、はTeXでは現状、別パッケージが必要です。
|
291
297
|
#@# FIXME:TEXでの文字スタイル。外部パッケージが必要
|
@@ -299,24 +305,25 @@ a_{m1} & \cdots & a_{mn}
|
|
299
305
|
|
300
306
|
//footnote[kw][キーワードのカッコは太字にしないほうがいいのかなと思いつつあります(手元の案件では太字にしないよう挙動を変えてしまっているほうが多い)。]
|
301
307
|
|
302
|
-
* 箇条書き内での……キーワード@<kw>{キーワード, keyword}、太字@<b>{b太字}、イタリック@<i>{iイタリック}、等幅@<tt>{tt等幅}、強調@<strong>{strong強調}、強調@<em>{em強調}、下線@<u>{u下線}、等幅@<code>{code等幅}、等幅太字@<ttb>{ttb等幅太字}、等幅イタリック@<tti>{tti等幅イタリック}、網カケ@<ami>{amiアミ}、16進UTF文字指定@<uchar>{3042}、インラインアイコン@<icon>{inlineicon}
|
308
|
+
* 箇条書き内での……キーワード@<kw>{キーワード, keyword}、太字@<b>{b太字}、イタリック@<i>{iイタリック}、等幅@<tt>{tt等幅}、強調@<strong>{strong強調}、強調@<em>{em強調}、下線@<u>{u下線}、等幅@<code>{code等幅}、等幅太字@<ttb>{ttb等幅太字}、等幅イタリック@<tti>{tti等幅イタリック}、網カケ@<ami>{amiアミ}、挿入@<ins>{ins挿入}、削除@<del>{del削除}、16進UTF文字指定@<uchar>{3042}、インラインアイコン@<icon>{inlineicon}
|
303
309
|
|
304
310
|
//tsize[|latex|p{120mm}]
|
305
311
|
//table{
|
306
|
-
表内での……キーワード@<kw>{キーワード, keyword}、太字@<b>{b太字}、イタリック@<i>{iイタリック}、等幅@<tt>{tt等幅}、強調@<strong>{strong強調}、強調@<em>{em強調}、下線@<u>{u下線}、等幅@<code>{code等幅}、等幅太字@<ttb>{ttb等幅太字}、等幅イタリック@<tti>{tti等幅イタリック}、網カケ@<ami>{amiアミ}、16進UTF文字指定@<uchar>{3042}、インラインアイコン@<icon>{inlineicon}
|
312
|
+
表内での……キーワード@<kw>{キーワード, keyword}、太字@<b>{b太字}、イタリック@<i>{iイタリック}、等幅@<tt>{tt等幅}、強調@<strong>{strong強調}、強調@<em>{em強調}、下線@<u>{u下線}、等幅@<code>{code等幅}、等幅太字@<ttb>{ttb等幅太字}、等幅イタリック@<tti>{tti等幅イタリック}、網カケ@<ami>{amiアミ}、挿入@<ins>{ins挿入}、削除@<del>{del削除}、16進UTF文字指定@<uchar>{3042}、インラインアイコン@<icon>{inlineicon}
|
307
313
|
//}
|
308
314
|
|
309
315
|
コードブロック内では対応装飾は減らしてよいと考えます。代わりにballoonが追加されます。
|
310
316
|
|
311
|
-
//emlist[キャプション内での……キーワード@<kw>{キーワード, keyword}、太字@<b>{b太字}、イタリック@<i>{iイタリック}、等幅@<tt>{tt等幅}、強調@<strong>{strong強調}、強調@<em>{em強調}、下線@<u>{u下線}、等幅@<code>{code等幅}、等幅太字@<ttb>{ttb等幅太字}、等幅イタリック@<tti>{tti等幅イタリック}、網カケ@<ami>{amiアミ}、16進UTF文字指定@<uchar>{3042}、インラインアイコン@<icon>{inlineicon}]{
|
317
|
+
//emlist[キャプション内での……キーワード@<kw>{キーワード, keyword}、太字@<b>{b太字}、イタリック@<i>{iイタリック}、等幅@<tt>{tt等幅}、強調@<strong>{strong強調}、強調@<em>{em強調}、下線@<u>{u下線}、等幅@<code>{code等幅}、等幅太字@<ttb>{ttb等幅太字}、等幅イタリック@<tti>{tti等幅イタリック}、網カケ@<ami>{amiアミ}、挿入@<ins>{ins挿入}、削除@<del>{del削除}、16進UTF文字指定@<uchar>{3042}、インラインアイコン@<icon>{inlineicon}]{
|
312
318
|
コードブロック内での……
|
313
319
|
太字@<b>{b太字}
|
314
320
|
イタリック@<i>{iイタリック}
|
315
321
|
下線@<u>{u下線}
|
316
322
|
網カケ@<ami>{amiアミ} @<balloon>{ふきだし説明}
|
323
|
+
挿入@<ins>{ins挿入}、削除@<del>{del削除}
|
317
324
|
//}
|
318
325
|
|
319
|
-
=== 見出し内 @<b>{BOLD},@<i>{ITALIC},@<tt>{TT},@<strong>{STRONG},@<em>{EM},@<code>{CODE},@<ttb>{TTB},@<tti>{TTI},@<ami>{AMI},@<bou>{BOU},@<kw>{KW},@<u>{UNDERLINE}
|
326
|
+
=== 見出し内 @<b>{BOLD},@<i>{ITALIC},@<tt>{TT},@<strong>{STRONG},@<em>{EM},@<code>{CODE},@<ttb>{TTB},@<tti>{TTI},@<ami>{AMI},@<bou>{BOU},@<kw>{KW},@<u>{UNDERLINE},@<ins>{INS}、@<del>{DEL}
|
320
327
|
|
321
328
|
==={crossref} 参照
|
322
329
|
#@# FIXME:任意ラベルを使うと、EPUBチェックエラーになることがある?
|
@@ -339,10 +346,27 @@ labelで定義したラベルへの参照の例です。EPUBだと@<href>{#inlin
|
|
339
346
|
#@# FIXME:EPUB側にTeXのほうを寄せるようにRe:VIEWコードを直す
|
340
347
|
#@# FIXME:TeXではpagerefがほしい、ということがありそう。EPUBとの整合性を検討
|
341
348
|
|
349
|
+
説明箇条書きはTeXで特殊な扱いをしているため、参照の確認を以下でしておきます。
|
350
|
+
|
351
|
+
: @<chap>{ch01}
|
352
|
+
章番号
|
353
|
+
: @<title>{ch01}
|
354
|
+
章題
|
355
|
+
: @<chapref>{ch01}
|
356
|
+
章番号+題
|
357
|
+
: @<hd>{ch02|crossref}
|
358
|
+
節
|
359
|
+
: @<column>{ch03|column2}
|
360
|
+
コラム参照
|
361
|
+
|
342
362
|
=== 参考文献
|
343
363
|
参考文献@<tt>{bib.re}ファイルへの文献参照は、@<bib>{lins}とします。
|
344
364
|
|
345
365
|
=== 索引
|
346
366
|
@<hidx>{索引}@<hidx>{index}索引はTeXとIDGXML以外では妥当な動作を定義していません。idx@<hidx>{索引<<>>idx}は文中にも表示し、hidx@<hidx>{索引<<>>hidx}は文中からは隠した形の索引にします。読みは@<idx>{Mecab}があればそちらを使いますが、@<idx>{辞書ファイル}を直接定義することもできます。@<hidx>{!<>"$&()~=|,./\{\}?_[]*:;+%#()'`^}
|
367
|
+
@<hidx>{|}@<hidx>{{}@<hidx>$}$
|
347
368
|
|
348
369
|
idx, hidxいずれも=見出しの中には入れないようにし、後続の段落先頭にhidxで入れるように注意します(入れてしまうと目次などがおかしくなります)。
|
370
|
+
|
371
|
+
==== 後注
|
372
|
+
//printendnotes
|
data/samples/syntax-book/ch03.re
CHANGED
Binary file
|
@@ -1,5 +1,6 @@
|
|
1
|
-
desc 'copy sty/* files from current Re:VIEW source code (in git repos)'
|
2
1
|
REVIEW_TEMPLATE = ENV['REVIEW_TEMPLATE'] || 'review-jsbook'
|
2
|
+
|
3
|
+
desc 'copy sty/* files from current Re:VIEW source code (in git repos)'
|
3
4
|
task :copy_sty do
|
4
5
|
review_rootdir = '../..'
|
5
6
|
template_dir = File.join(review_rootdir, "templates/latex/#{REVIEW_TEMPLATE}")
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div class="colophon">
|
2
|
+
<% if @config['subtitle'].nil? %>
|
3
|
+
<p class="title"><%= h(@config.name_of('title')) %></p>
|
4
|
+
<% else %>
|
5
|
+
<p class="title"><%= h(@config.name_of('title')) %><br /><span class="subtitle"><%= h(@config.name_of('subtitle')) %></span></p>
|
6
|
+
<% end %>
|
7
|
+
<% if @config['date'] || @config['history'] %>
|
8
|
+
<%= colophon_history %>
|
9
|
+
<% end %>
|
10
|
+
<table class="colophon">
|
11
|
+
<% @config['colophon_order'].each do |role| %>
|
12
|
+
<% if @config[role] %>
|
13
|
+
<tr><th><%= h(ReVIEW::I18n.t(role)) %></th><td><%= h(join_with_separator(config.names_of(role), ReVIEW::I18n.t('names_splitter'))) %></td></tr>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
<% if @isbn_hyphen %>
|
17
|
+
<tr><th>ISBN</th><td><%= @isbn_hyphen %></td></tr>
|
18
|
+
<% end %>
|
19
|
+
</table>
|
20
|
+
<% if @config['rights'] && !@config['rights'].empty? %>
|
21
|
+
<p class="copyright"><%= join_with_separator(config.names_of('rights').map { |m| h(m) }, '<br />') %></p>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if @coverimage_src %>
|
2
|
+
<div id="cover-image" class="cover-image">
|
3
|
+
<img src="<%= @coverimage_src %>" alt="<%= h(@config.name_of('title')) %>" class="max"/>
|
4
|
+
</div>
|
5
|
+
<% else %>
|
6
|
+
<h1 class="cover-title"><%= h(@config.name_of('title')) %></h1>
|
7
|
+
<% if @config['subtitle'] %>
|
8
|
+
<h2 class="cover-subtitle"><%= h(@config.name_of('subtitle')) %></h2>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<h1 class="tp-title"><%= @title_str %></h1>
|
2
|
+
<% if @subtitle_str %>
|
3
|
+
<h2 class="tp-subtitle"><%= h(@subtitle_str) %></h2>
|
4
|
+
<% end %>
|
5
|
+
<% if @author_str %>
|
6
|
+
<p>
|
7
|
+
<br />
|
8
|
+
<br />
|
9
|
+
</p>
|
10
|
+
<h2 class="tp-author"><%= h(@author_str) %></h2>
|
11
|
+
<% end %>
|
12
|
+
<% if @publisher_str %>
|
13
|
+
<p>
|
14
|
+
<br />
|
15
|
+
<br />
|
16
|
+
<br />
|
17
|
+
<br />
|
18
|
+
</p>
|
19
|
+
<h3 class="tp-publisher"><%= h(@publisher_str) %></h3>
|
20
|
+
<% end %>
|
@@ -3,6 +3,12 @@
|
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="<%= @language %>">
|
4
4
|
<head>
|
5
5
|
<meta charset="UTF-8" />
|
6
|
+
<% if @javascripts.present? %>
|
7
|
+
<% @javascripts.each do |js| %>
|
8
|
+
<%= js %>
|
9
|
+
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
6
12
|
<% if @stylesheets.present? %>
|
7
13
|
<% @stylesheets.each do |style| %>
|
8
14
|
<link rel="stylesheet" type="text/css" href="<%= style %>" />
|
@@ -4,6 +4,12 @@
|
|
4
4
|
<head>
|
5
5
|
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
|
6
6
|
<meta http-equiv="Content-Style-Type" content="text/css"/>
|
7
|
+
<% if @javascripts.present? %>
|
8
|
+
<% @javascripts.each do |js| %>
|
9
|
+
<%= js %>
|
10
|
+
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
7
13
|
<% if @stylesheets.present? %>
|
8
14
|
<% @stylesheets.each do |style| %>
|
9
15
|
<link rel="stylesheet" type="text/css" href="<%= style %>" />
|
data/templates/latex/config.erb
CHANGED
@@ -104,6 +104,11 @@
|
|
104
104
|
<%- if @config['pdfmaker']['bbox'] -%>
|
105
105
|
\def\review@bbox{<%= @config['pdfmaker']['bbox'] %>}
|
106
106
|
<%- end -%>
|
107
|
+
<%- if @boxsetting -%>
|
108
|
+
\newcommand{\reviewboxsetting}{%
|
109
|
+
<%= @boxsetting %>%
|
110
|
+
}
|
111
|
+
<%- end -%>
|
107
112
|
|
108
113
|
\def\reviewbackcompatibilityhook{
|
109
114
|
\ifdefined\reviewimagecaption\else% for 3.0.0 compatibility
|
@@ -116,6 +121,12 @@
|
|
116
121
|
\ifdefined\covermatter\else% for 4.0.0 compatibility
|
117
122
|
\def\covermatter{}
|
118
123
|
\fi
|
124
|
+
\ifdefined\reviewchapref\else% for 5.1.0 compatibility
|
125
|
+
\newcommand{\reviewchapref}[2]{\hyperref[##2]{##1}}
|
126
|
+
\fi
|
127
|
+
\ifdefined\reviewtcy\else% for 5.3.0 compatibility
|
128
|
+
\DeclareRobustCommand{\reviewtcy}[1]{\rensuji{##1}}
|
129
|
+
\fi
|
119
130
|
}
|
120
131
|
|
121
132
|
\makeatother
|