review 1.7.2 → 2.0.0.beta1
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 +1 -43
- data/.travis.yml +0 -9
- data/ChangeLog +0 -16
- data/Gemfile +1 -0
- data/README.rdoc +1 -1
- data/Rakefile +12 -1
- data/bin/review-check +21 -8
- data/bin/review-compile +15 -9
- data/bin/review-epubmaker-legacy +6 -6
- data/bin/review-index +13 -2
- data/bin/review-init +18 -12
- data/bin/review-preproc +14 -1
- data/bin/review-validate +1 -1
- data/bin/review-vol +13 -1
- data/doc/quickstart.ja.md +1 -1
- data/doc/quickstart.md +1 -1
- data/lib/epubmaker/content.rb +3 -3
- data/lib/epubmaker/epubcommon.rb +108 -91
- data/lib/epubmaker/epubv2.rb +67 -14
- data/lib/epubmaker/epubv3.rb +59 -25
- data/lib/epubmaker/producer.rb +1 -13
- data/lib/lineinput.rb +0 -48
- data/lib/review/book/base.rb +4 -12
- data/lib/review/book/compilable.rb +3 -1
- data/lib/review/book/index.rb +4 -4
- data/lib/review/builder.rb +54 -47
- data/lib/review/compiler.rb +4662 -326
- data/lib/review/compiler/literals_1_8.kpeg +19 -0
- data/lib/review/compiler/literals_1_8.rb +432 -0
- data/lib/review/compiler/literals_1_9.kpeg +22 -0
- data/lib/review/compiler/literals_1_9.rb +435 -0
- data/lib/review/configure.rb +8 -20
- data/lib/review/epubbuilder.rb +1 -1
- data/lib/review/epubmaker.rb +122 -52
- data/lib/review/ewbbuilder.rb +4 -4
- data/lib/review/exception.rb +1 -1
- data/lib/review/extentions.rb +1 -0
- data/lib/review/extentions/array.rb +25 -0
- data/lib/review/htmlbuilder.rb +286 -275
- data/lib/review/htmllayout.rb +0 -2
- data/lib/review/htmlutils.rb +4 -4
- data/lib/review/i18n.rb +2 -6
- data/lib/review/i18n.yml +1 -1
- data/lib/review/idgxmlbuilder.rb +239 -204
- data/lib/review/inaobuilder.rb +75 -73
- data/lib/review/latexbuilder.rb +265 -219
- data/lib/review/latexutils.rb +6 -6
- data/lib/review/layout.tex.erb +1 -1
- data/lib/review/location.rb +24 -0
- data/lib/review/markdownbuilder.rb +124 -79
- data/lib/review/node.rb +267 -0
- data/lib/review/pdfmaker.rb +92 -92
- data/lib/review/preprocessor.rb +51 -14
- data/lib/review/review.kpeg +724 -0
- data/lib/review/textbuilder.rb +1 -1
- data/lib/review/textutils.rb +24 -18
- data/lib/review/tocparser.rb +3 -3
- data/lib/review/tocprinter.rb +31 -8
- data/lib/review/topbuilder.rb +119 -111
- data/lib/review/unfold.rb +2 -2
- data/lib/review/version.rb +1 -1
- data/review.gemspec +2 -2
- data/rubocop-todo.yml +456 -0
- data/test/assets/test_template.tex +1 -1
- data/test/sample-book/src/config.yml +0 -1
- data/test/test.re +1 -1
- data/test/test_book.rb +4 -4
- data/test/test_book_chapter.rb +70 -0
- data/test/test_book_part.rb +1 -1
- data/test/test_builder.rb +6 -28
- data/test/test_compiler.rb +59 -14
- data/test/test_helper.rb +47 -4
- data/test/test_htmlbuilder.rb +104 -73
- data/test/test_i18n.rb +5 -3
- data/test/test_idgxmlbuilder.rb +5 -2
- data/test/test_inaobuilder.rb +4 -2
- data/test/test_latexbuilder.rb +18 -37
- data/test/test_lineinput.rb +25 -4
- data/test/test_markdownbuilder.rb +4 -22
- data/test/test_pdfmaker.rb +12 -11
- data/test/test_textutils.rb +0 -36
- data/test/test_topbuilder.rb +2 -0
- metadata +14 -28
- data/.rubocop_todo.yml +0 -605
- data/Dockerfile +0 -22
- data/doc/NEWS.ja.md +0 -362
- data/doc/NEWS.md +0 -366
- data/lib/review/htmltoc.rb +0 -45
- data/lib/review/template.rb +0 -21
- data/templates/html/layout-html5.html.erb +0 -17
- data/templates/html/layout-xhtml1.html.erb +0 -20
- data/templates/ncx/epubv2.ncx.erb +0 -11
- data/templates/opf/epubv2.opf.erb +0 -21
- data/templates/opf/epubv3.opf.erb +0 -18
- data/templates/xml/container.xml.erb +0 -6
- data/test/assets/test.xml.erb +0 -3
- data/test/sample-book/src/config-epub2.yml +0 -186
- data/test/test_configure.rb +0 -50
- data/test/test_htmltoc.rb +0 -32
- data/test/test_template.rb +0 -26
data/lib/epubmaker/epubv3.rb
CHANGED
@@ -22,13 +22,23 @@ module EPUBMaker
|
|
22
22
|
|
23
23
|
# Return opf file content.
|
24
24
|
def opf
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
s = <<EOT
|
26
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
27
|
+
<package version="3.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="BookId" xml:lang="#{@producer.params["language"]}">
|
28
|
+
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
|
29
|
+
EOT
|
30
|
+
|
31
|
+
s << opf_metainfo
|
32
|
+
|
33
|
+
s << %Q[ </metadata>\n]
|
34
|
+
|
35
|
+
s << opf_manifest
|
36
|
+
s << opf_tocx
|
37
|
+
s << opf_guide # same as ePUB2
|
28
38
|
|
29
|
-
|
30
|
-
|
31
|
-
|
39
|
+
s << %Q[</package>\n]
|
40
|
+
|
41
|
+
s
|
32
42
|
end
|
33
43
|
|
34
44
|
def opf_metainfo
|
@@ -145,11 +155,7 @@ EOT
|
|
145
155
|
end
|
146
156
|
|
147
157
|
s = ""
|
148
|
-
|
149
|
-
s << %Q[ <spine page-progression-direction="#{@producer.params["direction"]}">\n]
|
150
|
-
else
|
151
|
-
s << %Q[ <spine>\n]
|
152
|
-
end
|
158
|
+
s << %Q[ <spine>\n]
|
153
159
|
s << %Q[ <itemref idref="#{@producer.params["bookname"]}" linear="#{cover_linear}"/>\n]
|
154
160
|
s << %Q[ <itemref idref="#{@producer.params["bookname"]}-toc.#{@producer.params["htmlext"]}" />\n] if @producer.params["toc"]
|
155
161
|
|
@@ -162,25 +168,38 @@ EOT
|
|
162
168
|
s
|
163
169
|
end
|
164
170
|
|
165
|
-
def
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
+
def opf_guide
|
172
|
+
s = ""
|
173
|
+
s << %Q[ <guide>\n]
|
174
|
+
s << %Q[ <reference type="cover" title="#{@producer.res.v("covertitle")}" href="#{@producer.params["cover"]}"/>\n]
|
175
|
+
s << %Q[ <reference type="title-page" title="#{@producer.res.v("titlepagetitle")}" href="titlepage.#{@producer.params["htmlext"]}"/>\n] unless @producer.params["titlepage"].nil?
|
176
|
+
s << %Q[ <reference type="toc" title="#{@producer.res.v("toctitle")}" href="#{@producer.params["bookname"]}-toc.#{@producer.params["htmlext"]}"/>\n]
|
177
|
+
s << %Q[ <reference type="colophon" title="#{@producer.res.v("colophontitle")}" href="colophon.#{@producer.params["htmlext"]}"/>\n] unless @producer.params["colophon"].nil?
|
178
|
+
s << %Q[ </guide>\n]
|
179
|
+
s
|
180
|
+
end
|
171
181
|
|
172
|
-
|
182
|
+
def ncx(indentarray)
|
183
|
+
s = common_header
|
184
|
+
s << <<EOT
|
185
|
+
<title>#{@producer.res.v("toctitle")}</title>
|
186
|
+
</head>
|
187
|
+
<body>
|
173
188
|
<nav xmlns:epub="http://www.idpf.org/2007/ops" epub:type="toc" id="toc">
|
174
189
|
<h1 class="toc-title">#{@producer.res.v("toctitle")}</h1>
|
175
|
-
#{ncx_main} </nav>
|
176
190
|
EOT
|
177
191
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
192
|
+
if @producer.params["epubmaker"]["flattoc"].nil?
|
193
|
+
s << hierarchy_ncx("ol")
|
194
|
+
else
|
195
|
+
s << flat_ncx("ol", @producer.params["epubmaker"]["flattocindent"])
|
196
|
+
end
|
197
|
+
s << <<EOT
|
198
|
+
</nav>
|
199
|
+
</body>
|
200
|
+
</html>
|
201
|
+
EOT
|
202
|
+
s
|
184
203
|
end
|
185
204
|
|
186
205
|
# Produce EPUB file +epubfile+.
|
@@ -218,5 +237,20 @@ EOT
|
|
218
237
|
s
|
219
238
|
end
|
220
239
|
|
240
|
+
def common_header
|
241
|
+
s =<<EOT
|
242
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
243
|
+
<!DOCTYPE html>
|
244
|
+
<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="#{@producer.params["language"]}">
|
245
|
+
<head>
|
246
|
+
<meta charset="UTF-8" />
|
247
|
+
<meta name="generator" content="Re:VIEW" />
|
248
|
+
EOT
|
249
|
+
|
250
|
+
@producer.params["stylesheet"].each do |file|
|
251
|
+
s << %Q[ <link rel="stylesheet" type="text/css" href="#{file}"/>\n]
|
252
|
+
end
|
253
|
+
s
|
254
|
+
end
|
221
255
|
end
|
222
256
|
end
|
data/lib/epubmaker/producer.rb
CHANGED
@@ -54,18 +54,6 @@ module EPUBMaker
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def coverimage
|
58
|
-
if !params["coverimage"]
|
59
|
-
return nil
|
60
|
-
end
|
61
|
-
@contents.each do |item|
|
62
|
-
if item.media =~ /\Aimage/ && item.file =~ /#{params["coverimage"]}\Z/ # /
|
63
|
-
return item.file
|
64
|
-
end
|
65
|
-
end
|
66
|
-
return nil
|
67
|
-
end
|
68
|
-
|
69
57
|
# Update parameters by merging from new parameter hash +params+.
|
70
58
|
def merge_params(params)
|
71
59
|
@params = @params.merge(params)
|
@@ -280,7 +268,7 @@ module EPUBMaker
|
|
280
268
|
end
|
281
269
|
end
|
282
270
|
|
283
|
-
@params["htmlversion"]
|
271
|
+
@params["htmlversion"] == 5 if @params["epubversion"] >= 3
|
284
272
|
|
285
273
|
%w[bookname title].each do |k|
|
286
274
|
raise "Key #{k} must have a value. Abort." if @params[k].nil?
|
data/lib/lineinput.rb
CHANGED
@@ -48,46 +48,6 @@ class LineInput
|
|
48
48
|
line
|
49
49
|
end
|
50
50
|
|
51
|
-
def peek
|
52
|
-
line = gets()
|
53
|
-
ungets line if line
|
54
|
-
line
|
55
|
-
end
|
56
|
-
|
57
|
-
def next?
|
58
|
-
peek() ? true : false
|
59
|
-
end
|
60
|
-
|
61
|
-
def skip_blank_lines
|
62
|
-
n = 0
|
63
|
-
while line = gets()
|
64
|
-
unless line.strip.empty?
|
65
|
-
ungets line
|
66
|
-
return n
|
67
|
-
end
|
68
|
-
n += 1
|
69
|
-
end
|
70
|
-
n
|
71
|
-
end
|
72
|
-
|
73
|
-
def gets_if(re)
|
74
|
-
line = gets()
|
75
|
-
if not line or not (re =~ line)
|
76
|
-
ungets line
|
77
|
-
return nil
|
78
|
-
end
|
79
|
-
line
|
80
|
-
end
|
81
|
-
|
82
|
-
def gets_unless(re)
|
83
|
-
line = gets()
|
84
|
-
if not line or re =~ line
|
85
|
-
ungets line
|
86
|
-
return nil
|
87
|
-
end
|
88
|
-
line
|
89
|
-
end
|
90
|
-
|
91
51
|
def each
|
92
52
|
while line = gets()
|
93
53
|
yield line
|
@@ -144,12 +104,4 @@ class LineInput
|
|
144
104
|
nil
|
145
105
|
end
|
146
106
|
|
147
|
-
def getblock(term_re)
|
148
|
-
buf = []
|
149
|
-
until_terminator(term_re) do |line|
|
150
|
-
buf.push line
|
151
|
-
end
|
152
|
-
buf
|
153
|
-
end
|
154
|
-
|
155
107
|
end
|
data/lib/review/book/base.rb
CHANGED
@@ -84,14 +84,6 @@ module ReVIEW
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
def htmlversion
|
88
|
-
if config["htmlversion"].blank?
|
89
|
-
nil
|
90
|
-
else
|
91
|
-
config["htmlversion"].to_i
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
87
|
def parts
|
96
88
|
@parts ||= read_parts()
|
97
89
|
end
|
@@ -119,7 +111,7 @@ module ReVIEW
|
|
119
111
|
end
|
120
112
|
|
121
113
|
def each_chapter_r(&block)
|
122
|
-
chapters.
|
114
|
+
chapters.reverse.each(&block)
|
123
115
|
end
|
124
116
|
|
125
117
|
def chapter_index
|
@@ -225,12 +217,12 @@ module ReVIEW
|
|
225
217
|
end
|
226
218
|
|
227
219
|
def read_PART
|
228
|
-
return @
|
220
|
+
return @read_PART if @read_PART
|
229
221
|
|
230
222
|
if catalog
|
231
|
-
@
|
223
|
+
@read_PART = catalog.parts
|
232
224
|
else
|
233
|
-
@
|
225
|
+
@read_PART = File.read("#{@basedir}/#{config["part_file"]}")
|
234
226
|
end
|
235
227
|
end
|
236
228
|
|
@@ -44,6 +44,7 @@ module ReVIEW
|
|
44
44
|
@title = ''
|
45
45
|
open {|f|
|
46
46
|
f.each_line {|l|
|
47
|
+
l = convert_inencoding(l, book.config["inencoding"])
|
47
48
|
if l =~ /\A=+/
|
48
49
|
@title = l.sub(/\A=+(\[.+?\])?(\{.+?\})?/, '').strip
|
49
50
|
break
|
@@ -73,7 +74,8 @@ module ReVIEW
|
|
73
74
|
attr_writer :content
|
74
75
|
|
75
76
|
def content
|
76
|
-
@content = File.read(path())
|
77
|
+
@content = convert_inencoding(File.read(path()),
|
78
|
+
book.config["inencoding"])
|
77
79
|
rescue
|
78
80
|
@content
|
79
81
|
end
|
data/lib/review/book/index.rb
CHANGED
@@ -58,7 +58,7 @@ module ReVIEW
|
|
58
58
|
@index.fetch(id)
|
59
59
|
rescue
|
60
60
|
if @index.keys.map{|i| i.split(/\|/).last }.flatten. # unfold all ids
|
61
|
-
reduce(Hash.new(0)){|h, i| h[i] += 1; h}.
|
61
|
+
reduce(Hash.new(0)){|h, i| h[i] += 1; h}. # number of occurrences
|
62
62
|
select{|k, v| k == id && v > 1 }.present? # detect duplicated
|
63
63
|
raise KeyError, "key '#{id}' is ambiguous for #{self.class}"
|
64
64
|
end
|
@@ -172,7 +172,7 @@ module ReVIEW
|
|
172
172
|
attr_reader :id
|
173
173
|
attr_reader :number
|
174
174
|
attr_reader :caption
|
175
|
-
attr_writer :index
|
175
|
+
attr_writer :index # internal use only
|
176
176
|
|
177
177
|
def bound?
|
178
178
|
path
|
@@ -245,12 +245,12 @@ module ReVIEW
|
|
245
245
|
end
|
246
246
|
|
247
247
|
def title(id)
|
248
|
-
sprintf(@locale["#{@index.item_type}_caption_format".
|
248
|
+
sprintf(@locale["#{@index.item_type}_caption_format".intern],
|
249
249
|
@index.title(id))
|
250
250
|
end
|
251
251
|
|
252
252
|
def number(id)
|
253
|
-
sprintf(@locale["#{@index.item_type}_number_format".
|
253
|
+
sprintf(@locale["#{@index.item_type}_number_format".intern],
|
254
254
|
@index.number(id))
|
255
255
|
end
|
256
256
|
|
data/lib/review/builder.rb
CHANGED
@@ -22,6 +22,9 @@ module ReVIEW
|
|
22
22
|
|
23
23
|
CAPTION_TITLES = %w(note memo tip info planning best important security caution term link notice point shoot reference practice expert)
|
24
24
|
|
25
|
+
attr_accessor :output
|
26
|
+
attr_accessor :ast
|
27
|
+
|
25
28
|
def pre_paragraph
|
26
29
|
nil
|
27
30
|
end
|
@@ -42,6 +45,7 @@ module ReVIEW
|
|
42
45
|
@compiler = compiler
|
43
46
|
@chapter = chapter
|
44
47
|
@location = location
|
48
|
+
@ast = nil
|
45
49
|
@output = StringIO.new
|
46
50
|
@book = @chapter.book if @chapter.present?
|
47
51
|
@tabwidth = nil
|
@@ -63,11 +67,11 @@ module ReVIEW
|
|
63
67
|
alias_method :raw_result, :result
|
64
68
|
|
65
69
|
def print(*s)
|
66
|
-
|
70
|
+
raise NotImplementedError, "XXX: `print` method is obsoleted. Do not use it."
|
67
71
|
end
|
68
72
|
|
69
73
|
def puts(*s)
|
70
|
-
|
74
|
+
raise NotImplementedError, "XXX: `puts` method is obsoleted. Do not use it."
|
71
75
|
end
|
72
76
|
|
73
77
|
def target_name
|
@@ -82,27 +86,33 @@ module ReVIEW
|
|
82
86
|
end
|
83
87
|
private :headline_prefix
|
84
88
|
|
85
|
-
def list(lines, id, caption, lang = nil)
|
89
|
+
def list(lines, id, caption = nil, lang = nil)
|
90
|
+
buf = ""
|
86
91
|
begin
|
87
|
-
list_header
|
92
|
+
buf << list_header(id, caption, lang)
|
88
93
|
rescue KeyError
|
89
94
|
error "no such list: #{id}"
|
90
95
|
end
|
91
|
-
list_body
|
96
|
+
buf << list_body(id, lines, lang)
|
97
|
+
buf
|
92
98
|
end
|
93
99
|
|
94
|
-
def listnum(lines, id, caption, lang = nil)
|
100
|
+
def listnum(lines, id, caption = nil, lang = nil)
|
101
|
+
buf = ""
|
95
102
|
begin
|
96
|
-
list_header
|
103
|
+
buf << list_header(id, caption, lang)
|
97
104
|
rescue KeyError
|
98
105
|
error "no such list: #{id}"
|
99
106
|
end
|
100
|
-
listnum_body
|
107
|
+
buf << listnum_body(lines, lang)
|
108
|
+
buf
|
101
109
|
end
|
102
110
|
|
103
|
-
def source(lines, caption
|
104
|
-
|
105
|
-
|
111
|
+
def source(lines, caption = nil)
|
112
|
+
buf = ""
|
113
|
+
buf << source_header(caption)
|
114
|
+
buf << source_body(lines)
|
115
|
+
buf
|
106
116
|
end
|
107
117
|
|
108
118
|
def image(lines, id, caption, metric = nil)
|
@@ -115,6 +125,7 @@ module ReVIEW
|
|
115
125
|
end
|
116
126
|
|
117
127
|
def table(lines, id = nil, caption = nil)
|
128
|
+
buf = ""
|
118
129
|
rows = []
|
119
130
|
sepidx = nil
|
120
131
|
lines.each_with_index do |line, idx|
|
@@ -129,26 +140,27 @@ module ReVIEW
|
|
129
140
|
rows = adjust_n_cols(rows)
|
130
141
|
|
131
142
|
begin
|
132
|
-
table_header
|
143
|
+
buf << table_header(id, caption) unless caption.nil?
|
133
144
|
rescue KeyError
|
134
145
|
error "no such table: #{id}"
|
135
146
|
end
|
136
|
-
return if rows.empty?
|
137
|
-
table_begin
|
147
|
+
return buf if rows.empty?
|
148
|
+
buf << table_begin(rows.first.size)
|
138
149
|
if sepidx
|
139
150
|
sepidx.times do
|
140
|
-
tr
|
151
|
+
buf << tr(rows.shift.map {|s| th(s) })
|
141
152
|
end
|
142
153
|
rows.each do |cols|
|
143
|
-
tr
|
154
|
+
buf << tr(cols.map {|s| td(s) })
|
144
155
|
end
|
145
156
|
else
|
146
157
|
rows.each do |cols|
|
147
158
|
h, *cs = *cols
|
148
|
-
tr
|
159
|
+
buf << tr([th(h)] + cs.map {|s| td(s) })
|
149
160
|
end
|
150
161
|
end
|
151
|
-
table_end
|
162
|
+
buf << table_end
|
163
|
+
buf
|
152
164
|
end
|
153
165
|
|
154
166
|
def adjust_n_cols(rows)
|
@@ -177,12 +189,12 @@ module ReVIEW
|
|
177
189
|
# footnote_end
|
178
190
|
#end
|
179
191
|
|
180
|
-
def compile_inline(s)
|
181
|
-
@compiler.text(s)
|
182
|
-
end
|
192
|
+
# def compile_inline(s)
|
193
|
+
# @compiler.text(s)
|
194
|
+
# end
|
183
195
|
|
184
196
|
def inline_chapref(id)
|
185
|
-
|
197
|
+
@book.chapter_index.display_string(id)
|
186
198
|
rescue KeyError
|
187
199
|
error "unknown chapter: #{id}"
|
188
200
|
nofunc_text("[UnknownChapter:#{id}]")
|
@@ -244,22 +256,17 @@ module ReVIEW
|
|
244
256
|
text(str)
|
245
257
|
end
|
246
258
|
|
247
|
-
def inline_ruby(
|
248
|
-
base, *ruby = *arg.scan(/(?:(?:(?:\\\\)*\\,)|[^,\\]+)+/)
|
249
|
-
base = base.gsub(/\\,/, ",") if base
|
250
|
-
ruby = ruby.join(",").gsub(/\\,/, ",") if ruby
|
259
|
+
def inline_ruby(base, ruby)
|
251
260
|
compile_ruby(base, ruby)
|
252
261
|
end
|
253
262
|
|
254
|
-
def inline_kw(
|
255
|
-
word, alt = *arg.split(',', 2)
|
263
|
+
def inline_kw(word, alt = nil)
|
256
264
|
compile_kw(word, alt)
|
257
265
|
end
|
258
266
|
|
259
|
-
def inline_href(
|
260
|
-
url
|
261
|
-
|
262
|
-
label = label.gsub(/\\,/, ",").strip if label
|
267
|
+
def inline_href(url, label = nil)
|
268
|
+
url = url.strip
|
269
|
+
label = label.strip if label
|
263
270
|
compile_href(url, label)
|
264
271
|
end
|
265
272
|
|
@@ -268,15 +275,18 @@ module ReVIEW
|
|
268
275
|
end
|
269
276
|
|
270
277
|
def bibpaper(lines, id, caption)
|
271
|
-
|
278
|
+
buf = ""
|
279
|
+
buf << bibpaper_header(id, caption)
|
272
280
|
unless lines.empty?
|
273
|
-
|
274
|
-
bibpaper_bibpaper
|
281
|
+
buf << "\n"
|
282
|
+
buf << bibpaper_bibpaper(id, caption, lines)
|
275
283
|
end
|
276
|
-
|
284
|
+
buf << "\n"
|
285
|
+
buf
|
277
286
|
end
|
278
287
|
|
279
|
-
def
|
288
|
+
def node_inline_hd(nodelist)
|
289
|
+
id = nodelist[0].to_raw
|
280
290
|
m = /\A([^|]+)\|(.+)/.match(id)
|
281
291
|
chapter = @book.chapters.detect{|chap| chap.id == m[1]} if m && m[1]
|
282
292
|
return inline_hd_chap(chapter, m[2]) if chapter
|
@@ -295,12 +305,12 @@ module ReVIEW
|
|
295
305
|
builders = matched[1].split(/,/).map{|i| i.gsub(/\s/, '') }
|
296
306
|
c = target_name
|
297
307
|
if builders.include?(c)
|
298
|
-
|
308
|
+
matched[2].gsub("\\n", "\n")
|
299
309
|
else
|
300
310
|
""
|
301
311
|
end
|
302
312
|
else
|
303
|
-
|
313
|
+
str.gsub("\\n", "\n")
|
304
314
|
end
|
305
315
|
end
|
306
316
|
|
@@ -309,7 +319,7 @@ module ReVIEW
|
|
309
319
|
end
|
310
320
|
|
311
321
|
def error(msg)
|
312
|
-
raise ApplicationError, "#{
|
322
|
+
raise ApplicationError, "error: #{msg} at #{@compiler.show_pos} \n (#{@compiler.failure_oneline})"
|
313
323
|
end
|
314
324
|
|
315
325
|
def handle_metric(str)
|
@@ -376,7 +386,7 @@ module ReVIEW
|
|
376
386
|
line = self.unescape(lines.join("\n"))
|
377
387
|
cmds = {
|
378
388
|
:graphviz => "echo '#{line}' | dot -T#{image_ext} -o#{file_path}",
|
379
|
-
:gnuplot
|
389
|
+
:gnuplot => "echo 'set terminal " +
|
380
390
|
"#{(image_ext == "eps") ? "postscript eps" : image_ext}\n" +
|
381
391
|
" set output \"#{file_path}\"\n#{line}' | gnuplot",
|
382
392
|
:blockdiag => "echo '#{line}' "+
|
@@ -395,13 +405,9 @@ module ReVIEW
|
|
395
405
|
raise NotImplementedError
|
396
406
|
end
|
397
407
|
|
398
|
-
def inline_include(file_name)
|
399
|
-
compile_inline File.open(file_name).read
|
400
|
-
end
|
401
|
-
|
402
408
|
def include(file_name)
|
403
409
|
File.foreach(file_name) do |line|
|
404
|
-
paragraph([line])
|
410
|
+
paragraph([convert_inencoding(line, @book.config["inencoding"])])
|
405
411
|
end
|
406
412
|
end
|
407
413
|
|
@@ -410,6 +416,7 @@ module ReVIEW
|
|
410
416
|
end
|
411
417
|
|
412
418
|
def ul_item_end
|
419
|
+
""
|
413
420
|
end
|
414
421
|
|
415
422
|
def inline_raw(args)
|
@@ -438,4 +445,4 @@ module ReVIEW
|
|
438
445
|
end
|
439
446
|
end
|
440
447
|
|
441
|
-
end
|
448
|
+
end # module ReVIEW
|