review 2.3.0 → 2.4.0
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +90 -66
- data/.travis.yml +1 -1
- data/Gemfile +0 -1
- data/NEWS.ja.md +82 -0
- data/NEWS.md +83 -0
- data/README.md +5 -3
- data/Rakefile +8 -8
- data/bin/review +1 -5
- data/bin/review-catalog-converter +22 -27
- data/bin/review-check +36 -43
- data/bin/review-checkdep +10 -15
- data/bin/review-compile +37 -55
- data/bin/review-epubmaker +4 -5
- data/bin/review-index +21 -29
- data/bin/review-init +26 -37
- data/bin/review-pdfmaker +0 -2
- data/bin/review-preproc +25 -45
- data/bin/review-validate +19 -18
- data/bin/review-vol +15 -27
- data/doc/config.yml.sample +5 -2
- data/doc/format.ja.md +20 -1
- data/doc/format.md +21 -5
- data/doc/images/review-generate.png +0 -0
- data/lib/epubmaker.rb +1 -3
- data/lib/epubmaker/content.rb +24 -27
- data/lib/epubmaker/epubcommon.rb +135 -148
- data/lib/epubmaker/epubv2.rb +39 -46
- data/lib/epubmaker/epubv3.rb +93 -103
- data/lib/epubmaker/producer.rb +138 -151
- data/lib/epubmaker/zip_exporter.rb +21 -26
- data/lib/review/book.rb +3 -6
- data/lib/review/book/base.rb +78 -103
- data/lib/review/book/chapter.rb +36 -40
- data/lib/review/book/compilable.rb +28 -31
- data/lib/review/book/image_finder.rb +6 -13
- data/lib/review/book/index.rb +100 -121
- data/lib/review/book/page_metric.rb +2 -7
- data/lib/review/book/part.rb +18 -20
- data/lib/review/book/volume.rb +9 -13
- data/lib/review/builder.rb +81 -116
- data/lib/review/catalog.rb +15 -19
- data/lib/review/compiler.rb +64 -83
- data/lib/review/configure.rb +87 -97
- data/lib/review/converter.rb +2 -7
- data/lib/review/epubbuilder.rb +1 -3
- data/lib/review/epubmaker.rb +213 -205
- data/lib/review/exception.rb +2 -4
- data/lib/review/extentions.rb +0 -1
- data/lib/review/extentions/hash.rb +2 -2
- data/lib/review/extentions/string.rb +5 -30
- data/lib/review/htmlbuilder.rb +320 -375
- data/lib/review/htmltoc.rb +4 -7
- data/lib/review/htmlutils.rb +29 -32
- data/lib/review/i18n.rb +33 -44
- data/lib/review/i18n.yml +3 -3
- data/lib/review/idgxmlbuilder.rb +309 -345
- data/lib/review/latexbuilder.rb +175 -212
- data/lib/review/latexindex.rb +2 -8
- data/lib/review/latexutils.rb +33 -43
- data/lib/review/lineinput.rb +1 -1
- data/lib/review/logger.rb +21 -0
- data/lib/review/makerhelper.rb +1 -4
- data/lib/review/markdownbuilder.rb +44 -53
- data/lib/review/md2inaobuilder.rb +6 -12
- data/lib/review/pdfmaker.rb +143 -173
- data/lib/review/preprocessor.rb +64 -101
- data/lib/review/rstbuilder.rb +126 -158
- data/lib/review/sec_counter.rb +18 -34
- data/lib/review/template.rb +4 -5
- data/lib/review/textbuilder.rb +2 -3
- data/lib/review/textutils.rb +7 -13
- data/lib/review/tocparser.rb +31 -56
- data/lib/review/tocprinter.rb +26 -52
- data/lib/review/topbuilder.rb +219 -247
- data/lib/review/unfold.rb +15 -24
- data/lib/review/version.rb +1 -1
- data/lib/review/webmaker.rb +75 -99
- data/lib/review/webtocprinter.rb +15 -20
- data/lib/review/yamlloader.rb +13 -15
- data/review.gemspec +20 -22
- data/templates/latex/layout.tex.erb +2 -2
- data/templates/opf/epubv2.opf.erb +7 -7
- data/templates/opf/epubv3.opf.erb +7 -7
- data/templates/web/html/layout-html5.html.erb +2 -2
- data/test/assets/black.eps +280 -0
- data/test/assets/fit.png +0 -0
- data/test/assets/large.gif +0 -0
- data/test/assets/large.jpg +0 -0
- data/test/assets/large.png +0 -0
- data/test/assets/large.svg +65 -0
- data/test/assets/test_template.tex +1 -1
- data/test/book_test_helper.rb +2 -2
- data/test/run_test.rb +4 -4
- data/test/sample-book/src/Rakefile +21 -22
- data/test/syntax-book/Gemfile +4 -0
- data/test/syntax-book/Rakefile +72 -0
- data/test/syntax-book/appA.re +22 -0
- data/test/syntax-book/bib.re +6 -0
- data/test/syntax-book/catalog.yml +15 -0
- data/test/syntax-book/ch01.re +136 -0
- data/test/syntax-book/ch02.re +351 -0
- data/test/syntax-book/ch03.re +82 -0
- data/test/syntax-book/config.yml +35 -0
- data/test/syntax-book/images/ball.png +0 -0
- data/test/syntax-book/images/cover.jpg +0 -0
- data/test/syntax-book/images/fractal.png +0 -0
- data/test/syntax-book/images/img3-1.png +0 -0
- data/test/syntax-book/images/inlineicon.jpg +0 -0
- data/test/syntax-book/images/logic.png +0 -0
- data/test/syntax-book/images/logic2.png +0 -0
- data/test/syntax-book/images/puzzle.jpg +0 -0
- data/test/syntax-book/images/table.jpg +0 -0
- data/test/syntax-book/part2.re +6 -0
- data/test/syntax-book/pre01.re +26 -0
- data/test/syntax-book/review-ext.rb +14 -0
- data/test/syntax-book/sty/jumoline.sty +310 -0
- data/test/syntax-book/sty/reviewmacro.sty +39 -0
- data/test/syntax-book/style.css +494 -0
- data/test/syntax-book/syntax.dic +2 -0
- data/test/test_book.rb +106 -111
- data/test/test_book_chapter.rb +21 -22
- data/test/test_book_part.rb +3 -5
- data/test/test_builder.rb +11 -22
- data/test/test_catalog.rb +17 -18
- data/test/test_catalog_converter_cmd.rb +5 -5
- data/test/test_compiler.rb +18 -16
- data/test/test_configure.rb +35 -38
- data/test/test_converter.rb +3 -4
- data/test/test_epub3maker.rb +136 -117
- data/test/test_epubmaker.rb +107 -114
- data/test/test_epubmaker_cmd.rb +2 -4
- data/test/test_extentions_hash.rb +32 -33
- data/test/test_helper.rb +9 -11
- data/test/test_htmlbuilder.rb +454 -420
- data/test/test_htmltoc.rb +8 -12
- data/test/test_htmlutils.rb +0 -2
- data/test/test_i18n.rb +159 -150
- data/test/test_idgxmlbuilder.rb +190 -197
- data/test/test_image_finder.rb +21 -22
- data/test/test_index.rb +24 -29
- data/test/test_latexbuilder.rb +274 -264
- data/test/test_lineinput.rb +7 -10
- data/test/test_location.rb +7 -7
- data/test/test_makerhelper.rb +13 -25
- data/test/test_markdownbuilder.rb +23 -26
- data/test/test_md2inaobuilder.rb +8 -11
- data/test/test_pdfmaker.rb +114 -123
- data/test/test_pdfmaker_cmd.rb +1 -3
- data/test/test_review_ext.rb +3 -5
- data/test/test_rstbuilder.rb +92 -97
- data/test/test_template.rb +3 -7
- data/test/test_textutils.rb +27 -27
- data/test/test_tocparser.rb +2 -2
- data/test/test_topbuilder.rb +98 -103
- data/test/test_webtocprinter.rb +5 -6
- data/test/test_yamlloader.rb +42 -42
- data/test/test_zip_exporter.rb +12 -18
- metadata +86 -9
- data/lib/review/ewbbuilder.rb +0 -382
data/bin/review-pdfmaker
CHANGED
data/bin/review-preproc
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
#
|
|
3
|
-
# $Id: review-preproc 3761 2007-12-31 07:20:09Z aamine $
|
|
4
|
-
#
|
|
5
3
|
# Copyright (c) 2010-2014 Minero Aoki, Kenshi Muto
|
|
6
|
-
#
|
|
4
|
+
# 1999-2007 Minero Aoki
|
|
7
5
|
#
|
|
8
6
|
# This program is free software.
|
|
9
7
|
# You can distribute or modify this program under the terms of
|
|
@@ -20,6 +18,7 @@ require 'review/preprocessor'
|
|
|
20
18
|
require 'review/unfold'
|
|
21
19
|
require 'review/version'
|
|
22
20
|
require 'review/extentions'
|
|
21
|
+
require 'review/logger'
|
|
23
22
|
require 'lineinput'
|
|
24
23
|
require 'stringio'
|
|
25
24
|
require 'fileutils'
|
|
@@ -36,11 +35,12 @@ rescue Errno::EPIPE
|
|
|
36
35
|
end
|
|
37
36
|
|
|
38
37
|
def main
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
@logger = ReVIEW.logger
|
|
39
|
+
if File.file?('review-preproc-ext.rb')
|
|
40
|
+
if ENV['REVIEW_SAFE_MODE'].to_i & 2 > 0
|
|
41
|
+
@logger.warn 'review-preproc-ext.rb is prohibited in safe mode. ignored.'
|
|
42
42
|
else
|
|
43
|
-
Kernel.load File.expand_path(
|
|
43
|
+
Kernel.load File.expand_path('review-preproc-ext.rb')
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -49,31 +49,21 @@ def main
|
|
|
49
49
|
mode = :output
|
|
50
50
|
opts = OptionParser.new
|
|
51
51
|
opts.version = ReVIEW::VERSION
|
|
52
|
-
opts.banner = "Usage: #{File.basename($
|
|
53
|
-
opts.on('-c', '--check', 'Check if preprocess is needed.') {
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
opts.on('-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
opts.on('--
|
|
60
|
-
mode = :replace
|
|
61
|
-
}
|
|
62
|
-
opts.on('-s', '--strip', 'Strip preprocessor tags.') {
|
|
63
|
-
mode = :strip
|
|
64
|
-
}
|
|
65
|
-
opts.on('--final', 'Unfold text and strip preprocessor tags. (deprecated)') {
|
|
66
|
-
mode = :final
|
|
67
|
-
}
|
|
68
|
-
opts.on('--tabwidth=WIDTH', "Replace tabs with space characters. (0: don't replace)") {|width| param["tabwidth"] = width.to_i }
|
|
69
|
-
opts.on('--help', 'Print this message and quit.') {
|
|
52
|
+
opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} [-c|-d|-s|--replace] [<file>...]"
|
|
53
|
+
opts.on('-c', '--check', 'Check if preprocess is needed.') { mode = :check }
|
|
54
|
+
opts.on('-d', '--diff', 'Show diff from current file.') { mode = :diff }
|
|
55
|
+
opts.on('--replace', 'Replace file by preprocessed one.') { mode = :replace }
|
|
56
|
+
opts.on('-s', '--strip', 'Strip preprocessor tags.') { mode = :strip }
|
|
57
|
+
opts.on('--final', 'Unfold text and strip preprocessor tags. (deprecated)') { mode = :final }
|
|
58
|
+
opts.on('--tabwidth=WIDTH', "Replace tabs with space characters. (0: don't replace)") { |width| param['tabwidth'] = width.to_i }
|
|
59
|
+
opts.on('--help', 'Print this message and quit.') do
|
|
70
60
|
puts opts.help
|
|
71
61
|
exit 0
|
|
72
|
-
|
|
62
|
+
end
|
|
73
63
|
begin
|
|
74
64
|
opts.parse!
|
|
75
65
|
rescue OptionParser::ParseError => err
|
|
76
|
-
|
|
66
|
+
@logger.error err.message
|
|
77
67
|
$stderr.puts opts.help
|
|
78
68
|
exit 1
|
|
79
69
|
end
|
|
@@ -84,9 +74,7 @@ def main
|
|
|
84
74
|
current_file = path
|
|
85
75
|
case mode
|
|
86
76
|
when :output
|
|
87
|
-
File.open(path) {|f|
|
|
88
|
-
pp.process f, $stdout
|
|
89
|
-
}
|
|
77
|
+
File.open(path) { |f| pp.process f, $stdout }
|
|
90
78
|
when :replace
|
|
91
79
|
File.write "#{path}.pptmp", preproc(pp, path)
|
|
92
80
|
File.rename "#{path}.pptmp", path
|
|
@@ -103,38 +91,30 @@ def main
|
|
|
103
91
|
FileUtils.rm_f tmp
|
|
104
92
|
end
|
|
105
93
|
when :strip
|
|
106
|
-
File.open(path)
|
|
107
|
-
ReVIEW::Preprocessor::Strip.new(f).each
|
|
108
|
-
|
|
109
|
-
end
|
|
110
|
-
}
|
|
94
|
+
File.open(path) do |f|
|
|
95
|
+
ReVIEW::Preprocessor::Strip.new(f).each { |line| puts line }
|
|
96
|
+
end
|
|
111
97
|
when :final
|
|
112
98
|
u = ReVIEW::Unfold.new
|
|
113
|
-
File.open(path) {|f|
|
|
114
|
-
u.unfold ReVIEW::Preprocessor::Strip.new(f), $stdout
|
|
115
|
-
}
|
|
99
|
+
File.open(path) { |f| u.unfold ReVIEW::Preprocessor::Strip.new(f), $stdout }
|
|
116
100
|
else
|
|
117
101
|
raise "must not happen: #{mode}"
|
|
118
102
|
end
|
|
119
103
|
end
|
|
120
104
|
rescue ReVIEW::Error => err
|
|
121
105
|
raise if $DEBUG
|
|
122
|
-
|
|
106
|
+
@logger.error err.message
|
|
123
107
|
exit 1
|
|
124
108
|
end
|
|
125
109
|
|
|
126
110
|
def preproc(pp, path)
|
|
127
111
|
buf = StringIO.new
|
|
128
|
-
File.open(path) {|f|
|
|
129
|
-
pp.process f, buf
|
|
130
|
-
}
|
|
112
|
+
File.open(path) { |f| pp.process f, buf }
|
|
131
113
|
buf.string
|
|
132
114
|
end
|
|
133
115
|
|
|
134
116
|
def File.write(path, str)
|
|
135
|
-
File.open(path, 'w') {|f|
|
|
136
|
-
f.write str
|
|
137
|
-
}
|
|
117
|
+
File.open(path, 'w') { |f| f.write str }
|
|
138
118
|
end
|
|
139
119
|
|
|
140
120
|
sigmain
|
data/bin/review-validate
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
# Copyright (c) 2010-
|
|
2
|
+
# Copyright (c) 2010-2017 Kenshi Muto
|
|
3
3
|
#
|
|
4
4
|
# This program is free software
|
|
5
5
|
# You can distribute or modify this program under the terms of
|
|
@@ -8,45 +8,46 @@
|
|
|
8
8
|
#
|
|
9
9
|
|
|
10
10
|
# simple validator for Re:VIEW
|
|
11
|
+
require 'pathname'
|
|
12
|
+
|
|
13
|
+
bindir = Pathname.new(__FILE__).realpath.dirname
|
|
14
|
+
$LOAD_PATH.unshift((bindir + '../lib').realpath)
|
|
15
|
+
require 'review/logger'
|
|
11
16
|
|
|
12
17
|
block = nil
|
|
13
18
|
maxcolcount = 0
|
|
14
19
|
colcount = 0
|
|
15
20
|
ln = 0
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
@logger = ReVIEW.logger
|
|
23
|
+
|
|
24
|
+
ARGF.each do |line|
|
|
18
25
|
ln += 1
|
|
19
|
-
if line =~
|
|
26
|
+
if line =~ %r{\A//([a-z]+)\{\s*\Z} || line =~ %r{\A//([a-z]+)\[.+?\{\s*\Z}
|
|
20
27
|
# block
|
|
21
28
|
new_block = $1
|
|
22
|
-
|
|
29
|
+
@logger.warn "#{ln}: block #{new_block} started, but previous block #{block} didn't close yet." if block
|
|
23
30
|
block = new_block
|
|
24
|
-
elsif line =~
|
|
25
|
-
|
|
31
|
+
elsif line =~ %r{\A//\}}
|
|
32
|
+
@logger.warn "#{ln}: block ended, but not opened." if block.nil?
|
|
26
33
|
block = nil
|
|
27
34
|
maxcolcount = 0
|
|
28
35
|
colcount = 0
|
|
29
36
|
elsif line =~ /\A(\d+\.)\s+/
|
|
30
37
|
# number
|
|
31
|
-
unless [
|
|
32
|
-
puts "#{ln}: found '#{$1}' without the head space. Is it correct?"
|
|
33
|
-
end
|
|
38
|
+
@logger.warn "#{ln}: found '#{$1}' without the head space. Is it correct?" unless %w[list emlist listnum emlistnum cmd image table].include?(block)
|
|
34
39
|
elsif line =~ /\A\*\s+/
|
|
35
40
|
# itemize
|
|
36
|
-
unless [
|
|
37
|
-
puts "#{ln}: found '*' without the head space. Is it correct?"
|
|
38
|
-
end
|
|
41
|
+
@logger.warn "#{ln}: found '*' without the head space. Is it correct?" unless %w[list emlist listnum emlistnum cmd image table].include?(block)
|
|
39
42
|
elsif line =~ /\A\s+(\d+\.)\s+/ && line =~ /\A\s+\*\s+/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
end
|
|
43
|
-
elsif block == "table"
|
|
43
|
+
@logger.warn "#{ln}: found itemized list or numbered list in #{block}. Is it correct?" unless Tw[list emlist listnum emlistnum cmd image table].include?(block)
|
|
44
|
+
elsif block == 'table'
|
|
44
45
|
next if line.start_with?('#@')
|
|
45
46
|
if line !~ /\A\-\-\-\-\-/
|
|
46
47
|
# table
|
|
47
48
|
colcount = line.split("\t").size
|
|
48
49
|
maxcolcount = colcount if maxcolcount == 0
|
|
49
|
-
|
|
50
|
+
@logger.warn "#{ln}: the number of table columns seems mismatch. (#{maxcolcount} != #{colcount})" if colcount != maxcolcount
|
|
50
51
|
end
|
|
51
52
|
end
|
|
52
|
-
|
|
53
|
+
end
|
data/bin/review-vol
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2003-2014 Minero Aoki
|
|
3
|
+
# Copyright (c) 2014-2017 Minero Aoki, Kenshi Muto
|
|
4
|
+
# 2003-2014 Minero Aoki
|
|
6
5
|
#
|
|
7
6
|
# This program is free software.
|
|
8
7
|
# You can distribute or modify this program under the terms of
|
|
@@ -21,6 +20,7 @@ require 'optparse'
|
|
|
21
20
|
include ReVIEW::TextUtils
|
|
22
21
|
|
|
23
22
|
def main
|
|
23
|
+
@logger = ReVIEW.logger
|
|
24
24
|
@config = ReVIEW::Configure.values
|
|
25
25
|
|
|
26
26
|
part_sensitive = false
|
|
@@ -28,55 +28,43 @@ def main
|
|
|
28
28
|
yamlfile = nil
|
|
29
29
|
opts = OptionParser.new
|
|
30
30
|
opts.version = ReVIEW::VERSION
|
|
31
|
-
opts.on('--yaml=YAML', 'Read configurations from YAML file.')
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
opts.on('
|
|
35
|
-
part_sensitive = true
|
|
36
|
-
}
|
|
37
|
-
opts.on('--directory=DIR', 'Compile all chapters in DIR.') {|path|
|
|
38
|
-
basedir = path
|
|
39
|
-
}
|
|
40
|
-
opts.on('--help', 'Print this message and quit') {
|
|
31
|
+
opts.on('--yaml=YAML', 'Read configurations from YAML file.') { |yaml| yamlfile = yaml }
|
|
32
|
+
opts.on('-P', '--part-sensitive', 'Prints volume of each parts.') { part_sensitive = true }
|
|
33
|
+
opts.on('--directory=DIR', 'Compile all chapters in DIR.') { |path| basedir = path }
|
|
34
|
+
opts.on('--help', 'Print this message and quit') do
|
|
41
35
|
puts opts.help
|
|
42
36
|
exit 0
|
|
43
|
-
|
|
37
|
+
end
|
|
44
38
|
begin
|
|
45
39
|
opts.parse!
|
|
46
40
|
rescue OptionParser::ParseError => err
|
|
47
|
-
|
|
41
|
+
@logger.error err.message
|
|
48
42
|
$stderr.puts opts.help
|
|
49
43
|
exit 1
|
|
50
44
|
end
|
|
51
45
|
|
|
52
46
|
book = basedir ? ReVIEW::Book.load(basedir) : ReVIEW::Book::Base.load
|
|
53
47
|
book.config = @config
|
|
54
|
-
if yamlfile
|
|
55
|
-
book.load_config(yamlfile)
|
|
56
|
-
end
|
|
48
|
+
book.load_config(yamlfile) if yamlfile
|
|
57
49
|
|
|
58
50
|
if part_sensitive
|
|
59
|
-
sep =
|
|
51
|
+
sep = ''
|
|
60
52
|
book.each_part do |part|
|
|
61
53
|
print sep
|
|
62
54
|
sep = "\n"
|
|
63
55
|
puts "Part #{part.number} #{part.name}" if part.number
|
|
64
|
-
part.each_chapter
|
|
65
|
-
print_chapter_volume chap
|
|
66
|
-
end
|
|
56
|
+
part.each_chapter { |chap| print_chapter_volume chap }
|
|
67
57
|
puts ' --------------------'
|
|
68
58
|
print_volume part.volume
|
|
69
59
|
end
|
|
70
60
|
else
|
|
71
|
-
book.each_chapter
|
|
72
|
-
print_chapter_volume chap
|
|
73
|
-
end
|
|
61
|
+
book.each_chapter { |chap| print_chapter_volume chap }
|
|
74
62
|
end
|
|
75
63
|
puts '============================='
|
|
76
|
-
print_volume book.volume #puts "Total #{book.volume}"
|
|
64
|
+
print_volume book.volume # puts "Total #{book.volume}"
|
|
77
65
|
rescue ReVIEW::ApplicationError, Errno::ENOENT => err
|
|
78
66
|
raise if $DEBUG
|
|
79
|
-
|
|
67
|
+
@logger.error "#{File.basename($PROGRAM_NAME)}: #{err.message}"
|
|
80
68
|
exit 1
|
|
81
69
|
end
|
|
82
70
|
|
data/doc/config.yml.sample
CHANGED
|
@@ -134,8 +134,8 @@ secnolevel: 2
|
|
|
134
134
|
# 表紙に配置し、書籍の影絵にも利用する画像ファイル。省略した場合はnull (画像を使わない)。画像ディレクトリ内に置いてもディレクトリ名は不要(例: cover.jpg)
|
|
135
135
|
# coverimage: null
|
|
136
136
|
#
|
|
137
|
-
# 表紙の後に大扉ページを作成するか。省略した場合は
|
|
138
|
-
# titlepage:
|
|
137
|
+
# 表紙の後に大扉ページを作成するか。省略した場合はtrue (作成する)
|
|
138
|
+
# titlepage: true
|
|
139
139
|
#
|
|
140
140
|
# 自動生成される大扉ページを上書きするファイル。ファイル名を指定すると大扉として入る (PDFMaker向けにはLaTeXソース断片、EPUBMaker向けにはHTMLファイル)
|
|
141
141
|
# titlefile: null
|
|
@@ -252,6 +252,9 @@ epubmaker:
|
|
|
252
252
|
# verify_target_imagesがtrueの状態において、解析で発見されなくても強制的に取り込むファイルの相対パスの配列
|
|
253
253
|
# force_include_images: []
|
|
254
254
|
#
|
|
255
|
+
# 画像ファイルの縦x横の最大ピクセル数許容値
|
|
256
|
+
# image_maxpixels: 4000000
|
|
257
|
+
#
|
|
255
258
|
# Re:VIEWファイル名を使わず、前付にpre01,pre02...、本文にchap01,chap02l...、後付にpost01,post02...という名前付けルールにするか
|
|
256
259
|
# rename_for_legacy: null
|
|
257
260
|
#
|
data/doc/format.ja.md
CHANGED
|
@@ -155,7 +155,7 @@ Re:VIEW フォーマットの文法について解説します。Re:VIEW フォ
|
|
|
155
155
|
@<命令>{対象の内容}
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
-
内容に「}」という文字が必要であれば、`\}`
|
|
158
|
+
内容に「}」という文字が必要であれば、`\}` でリテラルを表現できます。なお、内容の末尾を「\」としたい場合は、`\\` と記述する必要があります(たとえば `@<tt>{\\}`)。
|
|
159
159
|
|
|
160
160
|
記法および処理の都合で、次のような制約があります。
|
|
161
161
|
|
|
@@ -163,6 +163,25 @@ Re:VIEW フォーマットの文法について解説します。Re:VIEW フォ
|
|
|
163
163
|
* ブロック命令内には見出しや箇条書きを格納できません。
|
|
164
164
|
* インライン命令には別のインライン命令をネストできません。
|
|
165
165
|
|
|
166
|
+
### インライン命令のフェンス記法
|
|
167
|
+
|
|
168
|
+
インライン命令において `}` や 末尾 `\` を多用したい場合、それぞれ `\}` や `\\` のようにエスケープするのはわずらわしいことがあります。そのようなときには、インライン命令の囲みの `{ }` の代わりに `$ $` あるいは `| |` を使って内容を囲むことで、エスケープ表記せずに記述できます。
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
@<命令>$対象の内容$
|
|
172
|
+
@<命令>|対象の内容|
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
例:
|
|
176
|
+
|
|
177
|
+
```review
|
|
178
|
+
@<m>$\Delta = \frac{\partial^2}{\partial x_1^2}+\frac{\partial^2}{\partial x_2^2} + \cdots + \frac{\partial^2}{\partial x_n^2}$
|
|
179
|
+
@<tt>|if (exp) then { ... } else { ... }|
|
|
180
|
+
@<b>|\|
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
あくまでも代替であり、推奨する記法ではありません。濫用は避けてください。
|
|
184
|
+
|
|
166
185
|
## ソースコードなどのリスト
|
|
167
186
|
|
|
168
187
|
ソースコードなどのリストには`//list`を使います。連番を付けたくない場合は先頭に `em`(embedded の略)、行番号を付ける場合は末尾に `num` を付加します。まとめると、以下の4種類になります。
|
data/doc/format.md
CHANGED
|
@@ -115,7 +115,6 @@ They aren't nested.
|
|
|
115
115
|
|
|
116
116
|
Usage:
|
|
117
117
|
|
|
118
|
-
|
|
119
118
|
```
|
|
120
119
|
1. 1st condition
|
|
121
120
|
2. 2nd condition
|
|
@@ -185,7 +184,7 @@ Inline commands are used in block, paragraphes, headings, block contents and bl
|
|
|
185
184
|
@<command>{content}
|
|
186
185
|
```
|
|
187
186
|
|
|
188
|
-
When you want to use a character `}` in inline content, you must use escaping `\}`.
|
|
187
|
+
When you want to use a character `}` in inline content, you must use escaping `\}`. If the content ends with `\`, it must be written `\\`. (ex. `@<tt>{\\}`)
|
|
189
188
|
|
|
190
189
|
There are some limitations in blocks and inlines.
|
|
191
190
|
|
|
@@ -193,6 +192,24 @@ There are some limitations in blocks and inlines.
|
|
|
193
192
|
* You cannot write headings and itemize in block contents.
|
|
194
193
|
* Inline commands also do not support nestins. You cannot write inlines in another inline.
|
|
195
194
|
|
|
195
|
+
### Fence notation for inline commands
|
|
196
|
+
You may be tired of escaping when you use a large number of inline commands including `{` and `\`. By surrounding the contents with `$ $` or `| |` instead of `{ }`, you can write without escaping.
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
@<command>$content$
|
|
200
|
+
@<command>|content|
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Example:
|
|
204
|
+
|
|
205
|
+
```review
|
|
206
|
+
@<m>$\Delta = \frac{\partial^2}{\partial x_1^2}+\frac{\partial^2}{\partial x_2^2} + \cdots + \frac{\partial^2}{\partial x_n^2}$
|
|
207
|
+
@<tt>|if (exp) then { ... } else { ... }|
|
|
208
|
+
@<b>|\|
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Since this notation is substitute, please avoid abuse.
|
|
212
|
+
|
|
196
213
|
## Code List
|
|
197
214
|
|
|
198
215
|
Code list like source codes is `//list`. If you don't need numbers, you can use ``em`` prefix (as embedded). If you need line numbers, you can use ``num`` postfix. So you can use four types of lists.
|
|
@@ -518,10 +535,9 @@ is in footnotes.
|
|
|
518
535
|
|
|
519
536
|
Note that In LATEXBuilder, you should use `footnotetext` option to use `@<fn>{...}` in columns and tables.
|
|
520
537
|
|
|
521
|
-
###
|
|
538
|
+
### `footnotetext` option
|
|
522
539
|
|
|
523
|
-
|
|
524
|
-
With this option, you can use footnote in tables and short notes.
|
|
540
|
+
By adding `footnotetext:true` in config.yml, you can use footnote in tables and short notes.
|
|
525
541
|
|
|
526
542
|
Note that there are some constraints that (because of normal footnote )
|
|
527
543
|
|
|
Binary file
|
data/lib/epubmaker.rb
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
1
|
# = epubmaker.rb -- EPUB production set.
|
|
4
2
|
#
|
|
5
3
|
# Copyright (c) 2010-2017 Kenshi Muto
|
|
@@ -12,7 +10,7 @@
|
|
|
12
10
|
# == Quick usage
|
|
13
11
|
# require 'epubmaker'
|
|
14
12
|
# producer = EPUBMaker::Producer.new
|
|
15
|
-
#
|
|
13
|
+
# config = producer.load("config.yml")
|
|
16
14
|
# producer.contents.push(EPUBMaker::Content.new({"file" => "ch01.xhtml"}))
|
|
17
15
|
# producer.contents.push(EPUBMaker::Content.new({"file" => "ch02.xhtml"}))
|
|
18
16
|
# ...
|
data/lib/epubmaker/content.rb
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
1
|
# = content.rb -- Content object for EPUBMaker.
|
|
4
2
|
#
|
|
5
3
|
# Copyright (c) 2010-2017 Kenshi Muto
|
|
@@ -11,7 +9,6 @@
|
|
|
11
9
|
#
|
|
12
10
|
|
|
13
11
|
module EPUBMaker
|
|
14
|
-
|
|
15
12
|
# EPUBMaker::Content represents a content data for EPUBMaker.
|
|
16
13
|
# EPUBMaker#contents takes an array of Content.
|
|
17
14
|
class Content
|
|
@@ -32,22 +29,26 @@ module EPUBMaker
|
|
|
32
29
|
# Chapter type (pre/post/part/nil(body))
|
|
33
30
|
attr_accessor :chaptype
|
|
34
31
|
|
|
32
|
+
def inspect
|
|
33
|
+
"<Content id=#{@id}, file=#{@file}, media=#{@media}, title=#{@title}, level=#{@level}, notoc=#{@notoc}, properties=#{@properties}, chaptype=#{@chaptype}>"
|
|
34
|
+
end
|
|
35
|
+
|
|
35
36
|
# :call-seq:
|
|
36
37
|
# initialize(file, id, media, title, level, notoc)
|
|
37
38
|
# initialize(hash)
|
|
38
39
|
# Construct Content object by passing a sequence of parameters or hash.
|
|
39
40
|
# Keys of +hash+ relate with each parameters.
|
|
40
41
|
# +file+ (or +hash+["file"]) is required. Others are optional.
|
|
41
|
-
def initialize(fileorhash, id=nil, media=nil, title=nil, level=nil, notoc=nil, properties=nil, chaptype=nil)
|
|
42
|
+
def initialize(fileorhash, id = nil, media = nil, title = nil, level = nil, notoc = nil, properties = nil, chaptype = nil)
|
|
42
43
|
if fileorhash.instance_of?(Hash)
|
|
43
|
-
@id = fileorhash[
|
|
44
|
-
@file = fileorhash[
|
|
45
|
-
@media = fileorhash[
|
|
46
|
-
@title = fileorhash[
|
|
47
|
-
@level = fileorhash[
|
|
48
|
-
@notoc = fileorhash[
|
|
49
|
-
@properties = fileorhash[
|
|
50
|
-
@chaptype = fileorhash[
|
|
44
|
+
@id = fileorhash['id']
|
|
45
|
+
@file = fileorhash['file']
|
|
46
|
+
@media = fileorhash['media']
|
|
47
|
+
@title = fileorhash['title']
|
|
48
|
+
@level = fileorhash['level']
|
|
49
|
+
@notoc = fileorhash['notoc']
|
|
50
|
+
@properties = fileorhash['properties'] || []
|
|
51
|
+
@chaptype = fileorhash['chaptype']
|
|
51
52
|
else
|
|
52
53
|
@file = fileorhash
|
|
53
54
|
@id = id
|
|
@@ -62,9 +63,7 @@ module EPUBMaker
|
|
|
62
63
|
end
|
|
63
64
|
|
|
64
65
|
def ==(other)
|
|
65
|
-
|
|
66
|
-
return false
|
|
67
|
-
end
|
|
66
|
+
return false unless self.class == other.class
|
|
68
67
|
[self.id, self.file, self.media, self.title, self.level, self.notoc, self.chaptype, self.properties] ==
|
|
69
68
|
[other.id, other.file, other.media, other.title, other.level, other.notoc, other.chaptype, other.properties]
|
|
70
69
|
end
|
|
@@ -73,22 +72,20 @@ module EPUBMaker
|
|
|
73
72
|
|
|
74
73
|
# Complement other parameters by using file parameter.
|
|
75
74
|
def complement
|
|
76
|
-
@id = @file.gsub(
|
|
75
|
+
@id = @file.gsub(%r{[\\/\. ]}, '-') if @id.nil?
|
|
77
76
|
@id = "rv-#{@id}" if @id =~ /\A[^a-z]/i
|
|
78
77
|
@media = @file.sub(/.+\./, '').downcase if !@file.nil? && @media.nil?
|
|
79
78
|
|
|
80
|
-
@media =
|
|
81
|
-
@media =
|
|
82
|
-
@media =
|
|
83
|
-
@media =
|
|
84
|
-
@media =
|
|
85
|
-
@media =
|
|
86
|
-
@media =
|
|
87
|
-
@media =
|
|
79
|
+
@media = 'application/xhtml+xml' if @media == 'xhtml' || @media == 'xml' || @media == 'html'
|
|
80
|
+
@media = 'text/css' if @media == 'css'
|
|
81
|
+
@media = 'image/jpeg' if @media == 'jpg' || @media == 'jpeg' || @media == 'image/jpg'
|
|
82
|
+
@media = 'image/png' if @media == 'png'
|
|
83
|
+
@media = 'image/gif' if @media == 'gif'
|
|
84
|
+
@media = 'image/svg+xml' if @media == 'svg' || @media == 'image/svg'
|
|
85
|
+
@media = 'application/vnd.ms-opentype' if @media == 'ttf' || @media == 'otf'
|
|
86
|
+
@media = 'application/font-woff' if @media == 'woff'
|
|
88
87
|
|
|
89
|
-
if @id.nil? || @file.nil? || @media.nil?
|
|
90
|
-
raise "Type error: #{id}, #{file}, #{media}, #{title}, #{notoc}"
|
|
91
|
-
end
|
|
88
|
+
raise "Type error: #{id}, #{file}, #{media}, #{title}, #{notoc}" if @id.nil? || @file.nil? || @media.nil?
|
|
92
89
|
end
|
|
93
90
|
end
|
|
94
91
|
end
|