review 1.1.0 → 1.2.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 +7 -0
- data/.travis.yml +1 -0
- data/ChangeLog +100 -0
- data/README.rdoc +11 -12
- data/Rakefile +6 -2
- data/bin/review-check +1 -1
- data/bin/review-compile +13 -4
- data/bin/review-epubmaker +172 -24
- data/bin/review-epubmaker-ng +8 -161
- data/bin/review-index +1 -1
- data/bin/review-init +17 -5
- data/bin/review-pdfmaker +40 -19
- data/bin/review-preproc +1 -1
- data/bin/review-validate +2 -2
- data/bin/review-vol +1 -1
- data/debian/control +2 -2
- data/doc/format.rdoc +23 -6
- data/doc/format_idg.rdoc +3 -3
- data/doc/libepubmaker/config.yaml +163 -0
- data/doc/quickstart.rdoc +27 -27
- data/doc/sample.yaml +10 -5
- data/lib/epubmaker.rb +2 -5
- data/lib/epubmaker/content.rb +9 -6
- data/lib/epubmaker/epubv2.rb +233 -109
- data/lib/epubmaker/epubv3.rb +83 -119
- data/lib/epubmaker/producer.rb +50 -20
- data/lib/epubmaker/resource.rb +22 -8
- data/lib/review/book/base.rb +1 -0
- data/lib/review/book/chapter.rb +2 -2
- data/lib/review/book/compilable.rb +1 -1
- data/lib/review/book/index.rb +33 -27
- data/lib/review/book/parameters.rb +3 -2
- data/lib/review/book/part.rb +1 -1
- data/lib/review/builder.rb +10 -42
- data/lib/review/compiler.rb +1 -1
- data/lib/review/configure.rb +3 -3
- data/lib/review/epubmaker.rb +428 -0
- data/lib/review/htmlbuilder.rb +45 -95
- data/lib/review/htmlutils.rb +2 -0
- data/lib/review/i18n.yaml +25 -0
- data/lib/review/idgxmlbuilder.rb +11 -9
- data/lib/review/inaobuilder.rb +1 -1
- data/lib/review/latexbuilder.rb +7 -6
- data/lib/review/latexutils.rb +6 -0
- data/lib/review/makerhelper.rb +4 -2
- data/lib/review/markdownbuilder.rb +8 -0
- data/lib/review/sec_counter.rb +71 -0
- data/lib/review/topbuilder.rb +0 -1
- data/lib/review/version.rb +2 -2
- data/review.gemspec +4 -4
- data/test/sample-book/README.md +2 -2
- data/test/sample-book/src/Rakefile +2 -2
- data/test/sample-book/src/config.yml +4 -4
- data/test/sample-book/src/images/cover.jpg +0 -0
- data/test/sample-book/src/sty/{samplemacro.sty → reviewmacro.sty} +1 -1
- data/test/test_book_parameter.rb +1 -1
- data/test/test_epubmaker.rb +77 -15
- data/test/test_epubmaker_cmd.rb +11 -7
- data/test/test_helper.rb +7 -0
- data/test/test_htmlbuilder.rb +39 -6
- data/test/test_idgxmlbuilder.rb +14 -2
- data/test/test_inaobuilder.rb +2 -1
- data/test/test_latexbuilder.rb +23 -2
- data/test/test_makerhelper.rb +19 -3
- data/test/test_markdownbuilder.rb +35 -0
- data/test/test_pdfmaker_cmd.rb +11 -7
- data/test/test_topbuilder.rb +36 -2
- metadata +18 -18
- data/VERSION +0 -1
- data/doc/libepubmaker/sample.yaml +0 -90
data/bin/review-epubmaker-ng
CHANGED
@@ -1,176 +1,23 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
3
|
#
|
4
|
-
# Copyright (c) 2010 Kenshi Muto and Masayoshi Takahashi
|
4
|
+
# Copyright (c) 2010-2013 Kenshi Muto and Masayoshi Takahashi
|
5
5
|
#
|
6
6
|
# This program is free software.
|
7
7
|
# You can distribute or modify this program under the terms of
|
8
8
|
# the GNU LGPL, Lesser General Public License version 2.1.
|
9
9
|
# For details of the GNU LGPL, see the file "COPYING".
|
10
10
|
#
|
11
|
-
|
12
11
|
require 'pathname'
|
13
12
|
bindir = Pathname.new(__FILE__).realpath.dirname
|
14
13
|
$LOAD_PATH.unshift((bindir + '../lib').realpath)
|
15
|
-
require 'review'
|
16
|
-
require 'epubmaker'
|
17
|
-
include EPUBMaker
|
18
|
-
|
19
|
-
def main
|
20
|
-
if ARGV.size != 1
|
21
|
-
puts "Usage: #{$0} configfile"
|
22
|
-
exit 0
|
23
|
-
end
|
24
|
-
|
25
|
-
yamlfile = ARGV[0]
|
26
|
-
@params = ReVIEW::Configure.values.merge(YAML.load_file(yamlfile))
|
27
|
-
@epub = Producer.new(@params)
|
28
|
-
@epub.load(yamlfile)
|
29
|
-
@params = @epub.params
|
30
|
-
|
31
|
-
bookname = @params["bookname"]
|
32
|
-
|
33
|
-
if File.exist?("#{bookname}.epub")
|
34
|
-
STDERR.puts "#{bookname}.epub exists. Please remove or rename it first."
|
35
|
-
exit 1
|
36
|
-
end
|
37
|
-
if @params["debug"] && File.exist?("#{bookname}")
|
38
|
-
STDERR.puts "#{bookname} debug directory exists. Please remove or rename it first."
|
39
|
-
exit 1
|
40
|
-
end
|
41
|
-
|
42
|
-
basetmp = Dir.mktmpdir
|
43
|
-
|
44
|
-
FileUtils.cp(@params["cover"], "#{basetmp}/#{@params["cover"]}") if !@params["cover"].nil? && File.exist?(@params["cover"])
|
45
|
-
|
46
|
-
if @params["titlepage"] # FIXME
|
47
|
-
FileUtils.cp(@params["titlepage"], "#{basetmp}/#{@params["titlepage"]}")
|
48
|
-
@epub.contents.push(Content.new("id" => "title", "file" => @params["titlepage"], "title" => @epub.res.v("titlepagetitle")))
|
49
|
-
end
|
50
|
-
|
51
|
-
makeBody(basetmp, yamlfile)
|
52
|
-
|
53
|
-
if @params["colophon"]
|
54
|
-
if @params["colophon"].instance_of?(String)
|
55
|
-
FileUtils.cp(@params["colophon"], "#{basetmp}/colophon.#{@params["htmlext"]}")
|
56
|
-
else
|
57
|
-
File.open("#{basetmp}/colophon.#{@params["htmlext"]}", "w") {|f| @epub.colophon(f) }
|
58
|
-
end
|
59
|
-
@epub.contents.push(Content.new("id" => "colophon", "file" => "colophon.#{@params["htmlext"]}", "title" => @epub.res.v("colophontitle")))
|
60
|
-
end
|
61
|
-
|
62
|
-
epubtmpdir = @params["debug"].nil? ? nil : "#{Dir.pwd}/#{bookname}"
|
63
|
-
unless @params["debug"].nil?
|
64
|
-
Dir.mkdir(bookname)
|
65
|
-
end
|
66
|
-
@epub.produce("#{bookname}.epub", basetmp, epubtmpdir)
|
67
|
-
|
68
|
-
FileUtils.rm_r(basetmp)
|
69
|
-
end
|
70
|
-
|
71
|
-
def makeBody(basetmp, yamlfile)
|
72
|
-
pre = 0
|
73
|
-
body = 0
|
74
|
-
post = 0
|
75
|
-
@manifeststr = ""
|
76
|
-
@ncxstr = ""
|
77
|
-
@tocdesc = Array.new
|
78
|
-
toccount = 2
|
79
|
-
|
80
|
-
if File.exists?("PREDEF")
|
81
|
-
File.open("PREDEF") do |chaps|
|
82
|
-
chaps.each_line do |l|
|
83
|
-
pre += 1
|
84
|
-
next if l =~ /\A#/
|
85
|
-
fork {
|
86
|
-
STDOUT.reopen("#{basetmp}/pre#{pre}.#{@params["htmlext"]}")
|
87
|
-
exec("review-compile --target=html --yaml=#{yamlfile} #{l}")
|
88
|
-
}
|
89
|
-
Process.waitall
|
90
|
-
getanchors(basetmp, "pre#{pre}.#{@params["htmlext"]}")
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
if File.exists?("CHAPS")
|
96
|
-
File.open("CHAPS") do |chaps|
|
97
|
-
chaps.each_line do |l|
|
98
|
-
body += 1
|
99
|
-
next if l =~ /\A#/
|
100
|
-
fork {
|
101
|
-
STDOUT.reopen("#{basetmp}/chap#{body}.#{@params["htmlext"]}")
|
102
|
-
exec("review-compile --target=html --yaml=#{yamlfile} #{l}")
|
103
|
-
}
|
104
|
-
Process.waitall
|
105
|
-
getanchors(basetmp, "chap#{body}.#{@params["htmlext"]}")
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
if File.exists?("POSTDEF")
|
111
|
-
File.open("POSTDEF") do |chaps|
|
112
|
-
chaps.each_line do |l|
|
113
|
-
post += 1
|
114
|
-
next if l =~ /^#/
|
115
|
-
fork {
|
116
|
-
STDOUT.reopen("#{basetmp}/post#{post}.#{@params["htmlext"]}")
|
117
|
-
exec("review-compile --target=html --yaml=#{yamlfile} #{l}")
|
118
|
-
}
|
119
|
-
Process.waitall
|
120
|
-
getanchors(basetmp, "post#{post}.#{@params["htmlext"]}")
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
if File.exist?("images")
|
125
|
-
Dir.mkdir("#{basetmp}/images")
|
126
|
-
copyImagesToDir("images", "#{basetmp}/images")
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def getanchors(basetmp, filename)
|
131
|
-
File.open("#{basetmp}/#{filename}") do |f|
|
132
|
-
firsttime = true
|
133
|
-
f.each_line do |l|
|
134
|
-
if l =~ /\A<h(\d)><a id=\"(.+?)\" \/>(.+?)<\/h/
|
135
|
-
# level, ID, content
|
136
|
-
level = $1.to_i
|
137
|
-
id = $2
|
138
|
-
title = $3
|
139
|
-
if level == 1 && !firsttime.nil?
|
140
|
-
@epub.contents.push(Content.new({
|
141
|
-
"id" => "#{filename.sub(".#{@params["htmlext"]}", '')}",
|
142
|
-
"file" => "#{filename}",
|
143
|
-
"level" => level,
|
144
|
-
"title" => title
|
145
|
-
}))
|
146
|
-
firsttime = nil
|
147
|
-
else
|
148
|
-
@epub.contents.push(Content.new({
|
149
|
-
"id" => "#{filename.sub(".#{@params["htmlext"]}", '')}-#{id}",
|
150
|
-
"file" => "#{filename}##{id}",
|
151
|
-
"level" => level,
|
152
|
-
"title" => title
|
153
|
-
}))
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
14
|
+
require 'review/epubmaker'
|
159
15
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
if FileTest.directory?("#{dirname}/#{fname}")
|
165
|
-
copyImagesToDir("#{dirname}/#{fname}", "#{copybase}/#{fname}")
|
166
|
-
else
|
167
|
-
if fname =~ /\.(png|gif|jpg|jpeg|svg)\Z/i
|
168
|
-
Dir.mkdir(copybase) unless File.exist?(copybase)
|
169
|
-
FileUtils.cp "#{dirname}/#{fname}", copybase
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|
16
|
+
rv = ReVIEW::EPUBMaker.new
|
17
|
+
if ARGV.size < 1 || !File.exist?(ARGV[0])
|
18
|
+
STDERR.puts "Usage: #{$0} YAML_filename [export_filename]"
|
19
|
+
exit 0
|
174
20
|
end
|
175
21
|
|
176
|
-
|
22
|
+
bookname = (ARGV.size > 1) ? ARGV[1] : nil
|
23
|
+
rv.produce(ARGV[0], bookname)
|
data/bin/review-index
CHANGED
data/bin/review-init
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# Copyright (c) 2013 Masanori Kado
|
3
|
+
# Copyright (c) 2013-2014 Masanori Kado
|
4
4
|
#
|
5
5
|
# This program is free software.
|
6
6
|
# You can distribute or modify this program under the terms of
|
@@ -15,14 +15,16 @@ def main
|
|
15
15
|
exit
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
initdir = File.expand_path(ARGV.shift)
|
19
19
|
@review_dir = File.dirname(File.expand_path(__FILE__ + "./../"))
|
20
20
|
|
21
|
-
generate_dir(
|
21
|
+
generate_dir(initdir) do |dir|
|
22
22
|
generate_review_setting_files(dir)
|
23
23
|
generate_sample(dir)
|
24
24
|
generate_images_dir(dir)
|
25
|
+
generate_cover_image(dir)
|
25
26
|
generate_layout(dir)
|
27
|
+
generate_texmacro(dir)
|
26
28
|
generate_config(dir)
|
27
29
|
generate_rakefile(dir)
|
28
30
|
end
|
@@ -54,7 +56,7 @@ def generate_layout(dir)
|
|
54
56
|
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
|
55
57
|
<meta http-equiv="Content-Style-Type" content="text/css" />
|
56
58
|
<link rel="stylesheet" type="text/css" href="style.css" />
|
57
|
-
<meta name="generator" content="
|
59
|
+
<meta name="generator" content="Re:VIEW" />
|
58
60
|
<title><%= title %></title>
|
59
61
|
</head>
|
60
62
|
<body>
|
@@ -77,6 +79,10 @@ def generate_images_dir(dir)
|
|
77
79
|
Dir.mkdir dir + '/images'
|
78
80
|
end
|
79
81
|
|
82
|
+
def generate_cover_image(dir)
|
83
|
+
FileUtils.cp @review_dir + "/test/sample-book/src/images/cover.jpg", dir + '/images/'
|
84
|
+
end
|
85
|
+
|
80
86
|
def generate_config(dir)
|
81
87
|
FileUtils.cp @review_dir + "/test/sample-book/src/config.yml", dir
|
82
88
|
end
|
@@ -85,10 +91,16 @@ def generate_style(dir)
|
|
85
91
|
File.open(dir + "/style.css", "w")
|
86
92
|
end
|
87
93
|
|
94
|
+
def generate_texmacro(dir)
|
95
|
+
texmacrodir = dir + '/sty'
|
96
|
+
Dir.mkdir texmacrodir
|
97
|
+
FileUtils.cp @review_dir + "/test/sample-book/src/sty/reviewmacro.sty", texmacrodir
|
98
|
+
end
|
99
|
+
|
88
100
|
def generate_rakefile(dir)
|
89
101
|
FileUtils.cp @review_dir + "/test/sample-book/src/Rakefile", dir
|
90
102
|
end
|
91
103
|
|
92
|
-
if $0 == __FILE__
|
104
|
+
if File.basename($0) == File.basename(__FILE__)
|
93
105
|
main()
|
94
106
|
end
|
data/bin/review-pdfmaker
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
3
|
#
|
4
|
-
# Copyright (c) 2010 Kenshi Muto and Masayoshi Takahashi
|
4
|
+
# Copyright (c) 2010-2014 Kenshi Muto and Masayoshi Takahashi
|
5
5
|
#
|
6
6
|
# This program is free software.
|
7
7
|
# You can distribute or modify this program under the terms of
|
@@ -19,6 +19,7 @@ bindir = Pathname.new(__FILE__).realpath.dirname
|
|
19
19
|
$LOAD_PATH.unshift((bindir + '../lib').realpath)
|
20
20
|
|
21
21
|
require 'review'
|
22
|
+
require 'review/i18n'
|
22
23
|
|
23
24
|
def error(msg)
|
24
25
|
$stderr.puts "#{File.basename($0, '.*')}: error: #{msg}"
|
@@ -32,7 +33,7 @@ end
|
|
32
33
|
|
33
34
|
def check_book(values)
|
34
35
|
pdf_file = values["bookname"]+".pdf"
|
35
|
-
if File.
|
36
|
+
if File.exist? pdf_file
|
36
37
|
error "file already exists:#{pdf_file}"
|
37
38
|
end
|
38
39
|
end
|
@@ -86,6 +87,10 @@ def main
|
|
86
87
|
values["usepackage"] = "\\usepackage{#{values['texstyle']}}"
|
87
88
|
end
|
88
89
|
|
90
|
+
%w[aut csl trl dsr ill cov edt].each do |item|
|
91
|
+
values[item] = [values[item]] if !values[item].nil? && values[item].instance_of?(String)
|
92
|
+
end
|
93
|
+
|
89
94
|
copy_images("./images", "#{@path}/images")
|
90
95
|
copyStyToDir(Dir.pwd + "/sty", @path)
|
91
96
|
copyStyToDir(Dir.pwd, @path, "tex")
|
@@ -97,22 +102,25 @@ def main
|
|
97
102
|
## do compile
|
98
103
|
enc = values["params"].to_s.split(/\s+/).find{|i| i =~ /\A--outencoding=/ }
|
99
104
|
kanji = enc ? enc.split(/=/).last.gsub(/-/, '').downcase : 'utf8'
|
105
|
+
texcommand = values["texcommand"] || "platex"
|
100
106
|
fork {
|
101
|
-
exec("
|
107
|
+
exec("#{texcommand} -kanji=#{kanji} book.tex")
|
102
108
|
}
|
103
109
|
Process.waitall
|
104
110
|
fork {
|
105
|
-
exec("
|
111
|
+
exec("#{texcommand} -kanji=#{kanji} book.tex")
|
106
112
|
}
|
107
113
|
Process.waitall
|
108
114
|
fork {
|
109
|
-
exec("
|
115
|
+
exec("#{texcommand} -kanji=#{kanji} book.tex")
|
110
116
|
}
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
117
|
+
if texcommand != "lualatex"
|
118
|
+
Process.waitall
|
119
|
+
fork {
|
120
|
+
exec("dvipdfmx -d 5 book.dvi")
|
121
|
+
}
|
122
|
+
Process.waitall
|
123
|
+
end
|
116
124
|
}
|
117
125
|
FileUtils.cp("#{@path}/book.pdf", "#{@basedir}/#{bookname}.pdf")
|
118
126
|
end
|
@@ -170,16 +178,29 @@ def get_template(values)
|
|
170
178
|
|
171
179
|
okuduke = ""
|
172
180
|
authors = ""
|
173
|
-
if values["aut"]
|
174
|
-
okuduke += "著 者 & #{values["aut"]} \\\\\n"
|
175
|
-
authors = values["aut"]+ "
|
181
|
+
if !values["aut"].nil? && !values["aut"].empty?
|
182
|
+
okuduke += "著 者 & #{values["aut"].join(ReVIEW::I18n.t("names_splitter"))} \\\\\n"
|
183
|
+
authors = values["aut"].join(ReVIEW::I18n.t("names_splitter")) + ReVIEW::I18n.t("author_postfix")
|
184
|
+
end
|
185
|
+
if !values["csl"].nil? && !values["csl"].empty?
|
186
|
+
okuduke += "監 修 & #{values["csl"].join(ReVIEW::I18n.t("names_splitter"))} \\\\\n"
|
187
|
+
authors += " \\\\\n"+values["csl"].join(ReVIEW::I18n.t("names_splitter")) + ReVIEW::I18n.t("supervisor_postfix")
|
188
|
+
end
|
189
|
+
if !values["trl"].nil? && !values["trl"].empty?
|
190
|
+
okuduke += "翻 訳 & #{values["trl"].join(ReVIEW::I18n.t("names_splitter"))} \\\\\n"
|
191
|
+
authors += " \\\\\n"+values["trl"].join(ReVIEW::I18n.t("names_splitter")) + ReVIEW::I18n.t("translator_postfix")
|
192
|
+
end
|
193
|
+
if !values["dsr"].nil? && !values["dsr"].empty?
|
194
|
+
okuduke += "デザイン & #{values["dsr"].join(ReVIEW::I18n.t("names_splitter"))} \\\\\n"
|
195
|
+
end
|
196
|
+
if !values["ill"].nil? && !values["ill"].empty?
|
197
|
+
okuduke += "イラスト & #{values["ill"].join(ReVIEW::I18n.t("names_splitter"))} \\\\\n"
|
176
198
|
end
|
177
|
-
if values["
|
178
|
-
|
179
|
-
okuduke += "翻 訳 & #{values["trl"]} \\\\\n"
|
199
|
+
if !values["cov"].nil? && !values["cov"].empty?
|
200
|
+
okuduke += "表 紙 & #{values["cov"].join(ReVIEW::I18n.t("names_splitter"))} \\\\\n"
|
180
201
|
end
|
181
|
-
if values["edt"]
|
182
|
-
okuduke += "編集者 & #{values["edt"]} \\\\\n"
|
202
|
+
if !values["edt"].nil? && !values["edt"].empty?
|
203
|
+
okuduke += "編集者 & #{values["edt"].join(ReVIEW::I18n.t("names_splitter"))} \\\\\n"
|
183
204
|
end
|
184
205
|
okuduke += <<EOB
|
185
206
|
発行所 & #{values["prt"]} \\\\
|
@@ -190,7 +211,7 @@ EOB
|
|
190
211
|
template = File.expand_path(File.dirname(__FILE__) +
|
191
212
|
'/../lib/review/review.tex.erb')
|
192
213
|
layout_file = File.join(@basedir, "layouts", "layout.tex.erb")
|
193
|
-
if File.
|
214
|
+
if File.exist?(layout_file)
|
194
215
|
template = layout_file
|
195
216
|
end
|
196
217
|
|
data/bin/review-preproc
CHANGED
data/bin/review-validate
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# Copyright (c) 2010 Kenshi Muto
|
2
|
+
# Copyright (c) 2010-2014 Kenshi Muto
|
3
3
|
#
|
4
4
|
# This program is free software
|
5
5
|
# You can distribute or modify this program under the terms of
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# For details of the GNU LGPL, see the file "COPYING".
|
8
8
|
#
|
9
9
|
|
10
|
-
# simple validator for
|
10
|
+
# simple validator for Re:VIEW
|
11
11
|
|
12
12
|
block = nil
|
13
13
|
maxcolcount = 0
|
data/bin/review-vol
CHANGED
data/debian/control
CHANGED
@@ -13,10 +13,10 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ruby
|
|
13
13
|
Recommends: zip
|
14
14
|
Suggests: ptex-bin, okumura-clsfiles, libmathml-ruby
|
15
15
|
Description: easy-to-use digital publishing system for Japanese books and ebooks
|
16
|
-
|
16
|
+
Re:VIEW is a digital publishing system for books and ebooks.
|
17
17
|
It is aimed professional Japanese editorial use.
|
18
18
|
.
|
19
|
-
|
19
|
+
Re:VIEW generates HTML, LaTeX, plain text, and Adobe InDesign XML
|
20
20
|
from a text file with simple and extensible tags.
|
21
21
|
.
|
22
22
|
This package provides the builders for EPUB and PDF.
|
data/doc/format.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
=
|
1
|
+
= Re:VIEW フォーマット
|
2
2
|
|
3
|
-
|
3
|
+
Re:VIEW フォーマットの文法について解説します。Re:VIEW
|
4
4
|
フォーマットは ASCII の EWB を基本としながら、一部に
|
5
5
|
RD や各種 Wiki の文法をとりいれて簡素化しています。
|
6
6
|
|
@@ -226,6 +226,21 @@ RD や各種 Wiki の文法をとりいれて簡素化しています。
|
|
226
226
|
|
227
227
|
なお、後述しますが、インラインで図を出力するには@<icon>を使用します。
|
228
228
|
|
229
|
+
図として貼り込む画像ファイルは、次の順序で探索され、最初に発見されたものが利用されます。
|
230
|
+
|
231
|
+
1. <imgdir>/<builder>/<chapid>/<id>.<ext>
|
232
|
+
2. <imgdir>/<builder>/<chapid>-<id>.<ext>
|
233
|
+
3. <imgdir>/<builder>/<id>.<ext>
|
234
|
+
4. <imgdir>/<chapid>/<id>.<ext>
|
235
|
+
5. <imgdir>/<chapid>-<id>.<ext>
|
236
|
+
6. <imgdir>/<id>.<ext>
|
237
|
+
|
238
|
+
* <imgdir> はデフォルトでは images ディレクトリです。
|
239
|
+
* <builder> は利用しているビルダ名 (ターゲット名) で、たとえば --target=html としているのであれば、images/html ディレクトリとなります。
|
240
|
+
* <chapid> は re ファイルの名前に相当します。たとえば ch01.re という名前であれば「ch01」です。
|
241
|
+
* <id> は //image[〜] の最初に入れた「〜」のことです (つまり、ID に日本語や空白交じりの文字を使ってしまうと、後で画像ファイル名の名付けに苦労することになります!)。
|
242
|
+
* <ext> は Re:VIEW が自動で判別する拡張子です。ビルダによってサポートおよび優先する拡張子は異なります。
|
243
|
+
|
229
244
|
== 番号が振られていない図
|
230
245
|
|
231
246
|
//indepimage[ファイル名][キャプション] で番号が振られていない画像ファイルを生成します。キャプションは省略できます。
|
@@ -317,7 +332,9 @@ footnotetextオプションを使うには、YAMLファイルのparamsに「--fo
|
|
317
332
|
|
318
333
|
これでPDFのコラムや表のなかでも脚注が使えるようになります。
|
319
334
|
|
320
|
-
ただし、通常の脚注(footnote)ではなく、footnotemarkとfootnotetext
|
335
|
+
ただし、通常の脚注(footnote)ではなく、footnotemarkとfootnotetextを使うため、
|
336
|
+
本文と脚注が別ページに分かれる可能性があるなど、いろいろな制約があります。
|
337
|
+
なお、採番が別々になるためfootnoteとfootnotemark/footnotetextを両立させることはできません。
|
321
338
|
|
322
339
|
== 参考文献の定義
|
323
340
|
|
@@ -393,7 +410,7 @@ LaTeX の式を挿入するには、//texequation{ 〜 //} を使います。
|
|
393
410
|
|
394
411
|
== 生データ行
|
395
412
|
|
396
|
-
|
413
|
+
Re:VIEW のタグ範囲を越えて何か特別な行を挿入したい場合、//raw を使います。
|
397
414
|
|
398
415
|
例:
|
399
416
|
|
@@ -419,7 +436,7 @@ ReVIEW のタグ範囲を越えて何か特別な行を挿入したい場合、/
|
|
419
436
|
|
420
437
|
== その他の文法
|
421
438
|
|
422
|
-
|
439
|
+
Re:VIEW は任意のブロックを追加可能なので、本によって専用ブロックを
|
423
440
|
使う場合があります。これまでに使った例を以下に示します。
|
424
441
|
|
425
442
|
//prototype:: 関数プロトタイプ。『ふつうのLinuxプログラミング』で使用。
|
@@ -568,7 +585,7 @@ Web ハイパーリンクを記述するには、リンクに @<href>、アン
|
|
568
585
|
|
569
586
|
== 国際化(i18n)
|
570
587
|
|
571
|
-
|
588
|
+
Re:VIEWが出力する文字列(「第◯章」「図」「表」など)を、指定した言語に
|
572
589
|
合わせて出力することができます。デフォルトは日本語です。
|
573
590
|
|
574
591
|
CHAPS などと同じディレクトリに locale.yaml というファイルを用意して、
|