asciidoctor-latex 1.5.0.1.dev → 1.5.0.2.dev
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +17 -31
- data/examples/README.adoc +9 -349
- data/lib/asciidoctor/latex/chem.rb +20 -12
- data/lib/asciidoctor/latex/converter.rb +9 -5
- data/lib/asciidoctor/latex/core_ext/colored_string.rb +5 -0
- data/lib/asciidoctor/latex/node_processors.rb +91 -74
- data/lib/asciidoctor/latex/tex_postprocessor.rb +1 -0
- data/lib/asciidoctor/latex/version.rb +1 -1
- data/test/examples/adoc/admonition.adoc +11 -0
- data/test/examples/adoc/box.adoc +8 -0
- data/test/examples/adoc/env.adoc +20 -0
- data/test/examples/adoc/eqalign.adoc +13 -0
- data/test/examples/adoc/line_break.adoc +5 -0
- data/test/examples/adoc/listing.adoc +12 -0
- data/test/examples/adoc/literal.adoc +20 -0
- data/test/examples/adoc/math.adoc +12 -0
- data/test/examples/adoc/open_block.adoc +17 -0
- data/test/examples/adoc/page_break.adoc +7 -0
- data/test/examples/adoc/pass.adoc +5 -0
- data/test/examples/adoc/sections.adoc +32 -0
- data/test/examples/tex/env.tex +15 -1
- data/test/examples/tex/eq.tex +1 -1
- metadata +24 -3
- data/manual.adoc +0 -285
@@ -3,22 +3,30 @@
|
|
3
3
|
require 'asciidoctor'
|
4
4
|
require 'asciidoctor/extensions'
|
5
5
|
|
6
|
-
|
7
|
-
# of autonumbuering of equations -- which is taken care of
|
8
|
-
# by [env.equation], [env.equationalign]
|
9
|
-
#
|
10
|
-
# See http://www.noteshare.io/section/the-chem-environment
|
11
|
-
#
|
6
|
+
|
12
7
|
module Asciidoctor::LaTeX
|
13
|
-
#
|
8
|
+
# Modify the default mathJax script to run mhchem instead
|
9
|
+
# of auto numbering of equations. Autonumbering is taken care of
|
10
|
+
# by [env.equation], [env.equationalign]
|
11
|
+
#
|
12
|
+
# See http://www.noteshare.io/section/the-chem-environment
|
13
|
+
#
|
14
|
+
# This is a hack. #FIXME!
|
14
15
|
class Chem < Asciidoctor::Extensions::Postprocessor
|
15
16
|
|
16
|
-
def process
|
17
|
-
output
|
17
|
+
def process(document, output)
|
18
|
+
output.gsub(TEX_SNIPPET, CHEM_SNIPPET)
|
18
19
|
end
|
19
20
|
|
20
21
|
end
|
21
|
-
end
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
|
24
|
+
TEX_SNIPPET = 'TeX: { equationNumbers: { autoNumber: "none" } }'
|
25
|
+
# In the standard MathJax script
|
26
|
+
|
27
|
+
|
28
|
+
CHEM_SNIPPET = 'TeX: { extensions: ["mhchem.js"] }'
|
29
|
+
# What we want in the MathJax script
|
30
|
+
|
31
|
+
|
32
|
+
end
|
@@ -146,9 +146,11 @@ require 'asciidoctor/latex/chem'
|
|
146
146
|
$VERBOSE = true
|
147
147
|
|
148
148
|
|
149
|
-
|
150
|
-
# template by @mojavelinux
|
149
|
+
|
151
150
|
module Asciidoctor::LaTeX
|
151
|
+
|
152
|
+
# code for Html5ConverterExtension & its insertion
|
153
|
+
# template by @mojavelinux
|
152
154
|
module Html5ConverterExtensions
|
153
155
|
|
154
156
|
ENV_CSS = "+++<div style='line-height:1.5em;font-size:1.05em;font-style:oblique;margin-bottom:1.5em'>+++"
|
@@ -161,6 +163,8 @@ module Asciidoctor::LaTeX
|
|
161
163
|
|
162
164
|
end
|
163
165
|
|
166
|
+
# Dispatches a handler for the _node_ (`NODE`)
|
167
|
+
# based on its role.
|
164
168
|
def environment node
|
165
169
|
|
166
170
|
attrs = node.attributes
|
@@ -334,10 +338,10 @@ module Asciidoctor::LaTeX
|
|
334
338
|
|
335
339
|
|
336
340
|
TOP_TYPES = %w(document section)
|
337
|
-
LIST_TYPES = %w(dlist olist ulist)
|
338
|
-
INLINE_TYPES = %w(inline_anchor inline_break inline_footnote inline_quoted)
|
341
|
+
LIST_TYPES = %w(dlist olist ulist colist)
|
342
|
+
INLINE_TYPES = %w(inline_anchor inline_break inline_footnote inline_quoted inline_callout)
|
339
343
|
BLOCK_TYPES = %w(admonition listing literal page_break paragraph stem pass open quote \
|
340
|
-
example floating_title image click preamble sidebar verse)
|
344
|
+
example floating_title image click preamble sidebar verse toc)
|
341
345
|
OTHER_TYPES = %w(environment table)
|
342
346
|
NODE_TYPES = TOP_TYPES + LIST_TYPES + INLINE_TYPES + BLOCK_TYPES + OTHER_TYPES
|
343
347
|
|
@@ -2,11 +2,12 @@ require 'asciidoctor'
|
|
2
2
|
require 'asciidoctor/latex/core_ext/colored_string'
|
3
3
|
|
4
4
|
|
5
|
-
# The classes in node_processor implement the
|
5
|
+
# Yuuk!, The classes in node_processor implement the
|
6
6
|
# latex backend for Asciidoctor-latex. This
|
7
7
|
# module is far from complete.
|
8
|
-
|
9
8
|
module Asciidoctor
|
9
|
+
|
10
|
+
|
10
11
|
class Document
|
11
12
|
|
12
13
|
# Write preamble for tex file, write closing
|
@@ -28,17 +29,17 @@ module Asciidoctor
|
|
28
29
|
|
29
30
|
|
30
31
|
def tex_process
|
31
|
-
warn "Node: #{self.class}".blue if $VERBOSE
|
32
|
+
# warn "Node: #{self.class}".blue if $VERBOSE
|
32
33
|
|
33
34
|
doc = ''
|
34
35
|
|
35
|
-
# warn "document.attributes['header'] = #{document.attributes['header']}".magenta if $VERBOSE
|
36
|
+
# # warn "document.attributes['header'] = #{document.attributes['header']}".magenta if $VERBOSE
|
36
37
|
|
37
38
|
unless embedded? or document.attributes['header']=='no'
|
38
39
|
doc << "%% Preamble %%\n"
|
39
40
|
if File.exist? 'preamble.tex'
|
40
41
|
preamble = IO.read('preamble.tex')
|
41
|
-
warn "preamble: #{preamble.length} chars".yellow
|
42
|
+
# warn "preamble: #{preamble.length} chars".yellow
|
42
43
|
doc << preamble << "\n "
|
43
44
|
else
|
44
45
|
doc << File.open(File.join(LaTeX::DATA_DIR, "preamble_#{self.document.doctype}.tex"), 'r') { |f| f.read }
|
@@ -49,16 +50,16 @@ module Asciidoctor
|
|
49
50
|
# doc << File.open(File.join(LaTeX::DATA_DIR, 'macros.tex'), 'r') { |f| f.read }
|
50
51
|
if File.exist? 'macros.tex'
|
51
52
|
macros = IO.read('macros.tex')
|
52
|
-
warn "macros: #{macros.length} chars".yellow
|
53
|
+
# warn "macros: #{macros.length} chars".yellow
|
53
54
|
doc << macros
|
54
55
|
else
|
55
|
-
warn "Could not find file macros.tex".yellow
|
56
|
+
# warn "Could not find file macros.tex".yellow
|
56
57
|
end
|
57
58
|
if File.exist?('myEnvironments.tex')
|
58
|
-
warn "I will take input from myEnvironments.tex".blue
|
59
|
+
# warn "I will take input from myEnvironments.tex".blue
|
59
60
|
doc << "\\input myEnvironments.tex\n"
|
60
61
|
else
|
61
|
-
warn "I will take input from newEnvironments.tex".blue
|
62
|
+
# warn "I will take input from newEnvironments.tex".blue
|
62
63
|
# doc << "\\input newEnvironments.tex\n"
|
63
64
|
end
|
64
65
|
|
@@ -83,11 +84,11 @@ module Asciidoctor
|
|
83
84
|
unless embedded?
|
84
85
|
# Now write the defnitions of the new environments
|
85
86
|
# discovered to file
|
86
|
-
warn "Writing environment definitions to file: newEnvironments.tex" if $VERBOSE
|
87
|
+
# warn "Writing environment definitions to file: newEnvironments.tex" if $VERBOSE
|
87
88
|
definitions = ""
|
88
89
|
|
89
90
|
$latex_environment_names.uniq.each do |name|
|
90
|
-
warn name if $VERBOSE
|
91
|
+
# warn name if $VERBOSE
|
91
92
|
definitions << "\\newtheorem\{#{name}\}\{#{name.capitalize}\}" << "\n"
|
92
93
|
end
|
93
94
|
|
@@ -106,7 +107,7 @@ module Asciidoctor
|
|
106
107
|
class Section
|
107
108
|
|
108
109
|
def tex_process
|
109
|
-
warn ["Node:".blue, "section[#{self.level}]:".cyan, "#{self.title}"].join(" ") if $VERBOSE
|
110
|
+
# warn ["Node:".blue, "section[#{self.level}]:".cyan, "#{self.title}"].join(" ") if $VERBOSE
|
110
111
|
doctype = self.document.doctype
|
111
112
|
|
112
113
|
tags = { 'article' => [ 'part', 'section', 'subsection', 'subsubsection', 'paragraph' ],
|
@@ -126,7 +127,7 @@ module Asciidoctor
|
|
126
127
|
class List
|
127
128
|
|
128
129
|
def tex_process
|
129
|
-
warn ["Node:".blue, "#{self.node_name}[#{self.level}]".cyan, "#{self.content.count} items"].join(" ") if $VERBOSE
|
130
|
+
# warn ["Node:".blue, "#{self.node_name}[#{self.level}]".cyan, "#{self.content.count} items"].join(" ") if $VERBOSE
|
130
131
|
case self.node_name
|
131
132
|
when 'dlist'
|
132
133
|
dlist_process
|
@@ -134,8 +135,10 @@ module Asciidoctor
|
|
134
135
|
ulist_process
|
135
136
|
when 'olist'
|
136
137
|
olist_process
|
138
|
+
when 'colist'
|
139
|
+
colist_process
|
137
140
|
else
|
138
|
-
warn "This Asciidoctor::List, tex_process. I don't know how to do that (#{self.node_name})" if $VERBOSE
|
141
|
+
# warn "This Asciidoctor::List, tex_process. I don't know how to do that (#{self.node_name})" if $VERBOSE
|
139
142
|
end
|
140
143
|
end
|
141
144
|
|
@@ -144,7 +147,7 @@ module Asciidoctor
|
|
144
147
|
self.items.each do |terms, dd|
|
145
148
|
list << "\\item["
|
146
149
|
[*terms].each do |dt|
|
147
|
-
warn [" -- item: ".blue, "#{dt.text}"].join(" ") if $VERBOSE
|
150
|
+
# warn [" -- item: ".blue, "#{dt.text}"].join(" ") if $VERBOSE
|
148
151
|
list << dt.text
|
149
152
|
end
|
150
153
|
list << "]"
|
@@ -159,7 +162,7 @@ module Asciidoctor
|
|
159
162
|
def ulist_process
|
160
163
|
list = "\\begin{itemize}\n\n"
|
161
164
|
self.content.each do |item|
|
162
|
-
warn [" -- item: ".blue, "#{item.text.split("\n").first}"].join(" ") if $VERBOSE
|
165
|
+
# warn [" -- item: ".blue, "#{item.text.split("\n").first}"].join(" ") if $VERBOSE
|
163
166
|
list << "\\item #{item.text}\n\n"
|
164
167
|
list << item.content
|
165
168
|
end
|
@@ -169,13 +172,17 @@ module Asciidoctor
|
|
169
172
|
def olist_process
|
170
173
|
list = "\\begin{enumerate}\n\n"
|
171
174
|
self.content.each do |item|
|
172
|
-
warn [" -- item: ".blue, "#{item.text.split("\n").first}"].join(" ") if $VERBOSE
|
175
|
+
# warn [" -- item: ".blue, "#{item.text.split("\n").first}"].join(" ") if $VERBOSE
|
173
176
|
list << "\\item #{item.text}\n\n"
|
174
177
|
list << item.content
|
175
178
|
end
|
176
179
|
list << "\\end{enumerate}\n\n"
|
177
180
|
end
|
178
181
|
|
182
|
+
def colist_process
|
183
|
+
warn "Please implement me! (colist_process)".red if $VERBOSE
|
184
|
+
end
|
185
|
+
|
179
186
|
end
|
180
187
|
|
181
188
|
# Proces block elements of varios kinds
|
@@ -185,7 +192,7 @@ module Asciidoctor
|
|
185
192
|
STANDARD_ENVIRONMENT_NAMES = %w(equation)
|
186
193
|
|
187
194
|
def tex_process
|
188
|
-
warn ["Node:".blue , "#{self.blockname}".blue].join(" ") if $VERBOSE
|
195
|
+
# warn ["Node:".blue , "#{self.blockname}".blue].join(" ") if $VERBOSE
|
189
196
|
case self.blockname
|
190
197
|
when :paragraph
|
191
198
|
paragraph_process
|
@@ -221,17 +228,19 @@ module Asciidoctor
|
|
221
228
|
self.sidebar_process
|
222
229
|
when :verse
|
223
230
|
self.verse_process
|
231
|
+
when :toc
|
232
|
+
self.toc_process
|
224
233
|
# when :table
|
225
234
|
# self.table_process
|
226
235
|
else
|
227
|
-
warn "This is Asciidoctor::Block, tex_process. I don't know how to do that (#{self.blockname})" if $VERBOSE if $VERBOSE
|
236
|
+
# warn "This is Asciidoctor::Block, tex_process. I don't know how to do that (#{self.blockname})" if $VERBOSE if $VERBOSE
|
228
237
|
""
|
229
238
|
end
|
230
239
|
end
|
231
240
|
|
232
241
|
|
233
242
|
def paragraph_process
|
234
|
-
warn "paragraph attributes: #{self.attributes}".red if $VERBOSE
|
243
|
+
# warn "paragraph attributes: #{self.attributes}".red if $VERBOSE
|
235
244
|
out = ""
|
236
245
|
if self.attributes['title']
|
237
246
|
out << "\{\\bf #{self.attributes['title']}\.}" << "\n"
|
@@ -240,12 +249,12 @@ module Asciidoctor
|
|
240
249
|
end
|
241
250
|
|
242
251
|
def stem_process
|
243
|
-
warn ["Node:".blue, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
244
|
-
warn self.content.cyan if $VERBOSE
|
252
|
+
# warn ["Node:".blue, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
253
|
+
# warn self.content.cyan if $VERBOSE
|
245
254
|
environment = LaTeX::TeXBlock.environment_type self.content
|
246
255
|
if LaTeX::TeXBlock::INNER_TYPES.include? environment
|
247
256
|
out = "\\\[\n#{LaTeX::TeXPostProcess.stem_substitutions self.content}\n\\\]\n"
|
248
|
-
warn out.yellow if $VERBOSE
|
257
|
+
# warn out.yellow if $VERBOSE
|
249
258
|
out
|
250
259
|
else
|
251
260
|
self.content
|
@@ -253,27 +262,27 @@ module Asciidoctor
|
|
253
262
|
end
|
254
263
|
|
255
264
|
def admonition_process
|
256
|
-
warn ["Node:".blue, "#{self.blockname}".cyan, "#{self.style}:".magenta, "#{self.lines[0]}"].join(" ") if $VERBOSE
|
265
|
+
# warn ["Node:".blue, "#{self.blockname}".cyan, "#{self.style}:".magenta, "#{self.lines[0]}"].join(" ") if $VERBOSE
|
257
266
|
"\\admonition\{#{self.style}\}\{#{self.content}\}\n"
|
258
267
|
end
|
259
268
|
|
260
269
|
def page_break_process
|
261
|
-
warn ["Node:".blue, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
270
|
+
# warn ["Node:".blue, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
262
271
|
"\n\\vfill\\eject\n"
|
263
272
|
end
|
264
273
|
|
265
274
|
def literal_process
|
266
|
-
warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
275
|
+
# warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
267
276
|
"\\begin\{verbatim\}\n#{self.content}\n\\end\{verbatim\}\n"
|
268
277
|
end
|
269
278
|
|
270
279
|
def pass_process
|
271
|
-
warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
280
|
+
# warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
272
281
|
self.content
|
273
282
|
end
|
274
283
|
|
275
284
|
def quote_process
|
276
|
-
warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
285
|
+
# warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
277
286
|
if self.attr? 'attribution'
|
278
287
|
attribution = self.attr 'attribution'
|
279
288
|
citetitle = (self.attr? 'citetitle') ? (self.attr 'citetitle') : nil
|
@@ -284,20 +293,18 @@ module Asciidoctor
|
|
284
293
|
end
|
285
294
|
end
|
286
295
|
|
287
|
-
|
288
|
-
|
289
296
|
def environment_process
|
290
297
|
|
291
|
-
warn "begin environment_process, ".blue + "title = #{self.title}".yellow if $VERBOSE
|
292
|
-
warn "environment attributes = #{self.attributes}".red if $VERBOSE
|
293
|
-
warn "role = #{self.attributes["role"]}" if $VERBOSE
|
298
|
+
# warn "begin environment_process, ".blue + "title = #{self.title}".yellow if $VERBOSE
|
299
|
+
# warn "environment attributes = #{self.attributes}".red if $VERBOSE
|
300
|
+
# warn "role = #{self.attributes["role"]}" if $VERBOSE
|
294
301
|
|
295
302
|
env = self.attributes["role"]
|
296
303
|
|
297
304
|
# record any environments encountered but not built=in
|
298
305
|
if !STANDARD_ENVIRONMENT_NAMES.include? env and !$latex_environment_names.include? env
|
299
306
|
# if !($latex_environment_names.include? env)
|
300
|
-
warn "env added: [#{env}]".blue if $VERBOSE
|
307
|
+
# warn "env added: [#{env}]".blue if $VERBOSE
|
301
308
|
$latex_environment_names << env
|
302
309
|
end
|
303
310
|
|
@@ -307,7 +314,7 @@ module Asciidoctor
|
|
307
314
|
label = ""
|
308
315
|
end
|
309
316
|
|
310
|
-
warn "self.attributes['original_title'] = #{self.attributes['original_title']}".cyan if $VERBOSE
|
317
|
+
# warn "self.attributes['original_title'] = #{self.attributes['original_title']}".cyan if $VERBOSE
|
311
318
|
|
312
319
|
if self.attributes['original_title']
|
313
320
|
title = "\{\\rm (#{self.attributes['original_title']}) \}"
|
@@ -333,7 +340,7 @@ module Asciidoctor
|
|
333
340
|
|
334
341
|
def click_process
|
335
342
|
|
336
|
-
warn "begin click_process".blue + "title = #{self.title}".yellow if $VERBOSE
|
343
|
+
# warn "begin click_process".blue + "title = #{self.title}".yellow if $VERBOSE
|
337
344
|
|
338
345
|
click = self.attributes["role"]
|
339
346
|
# record any environments encounted but not built=in
|
@@ -350,21 +357,25 @@ module Asciidoctor
|
|
350
357
|
output = "\\begin\{#{click}\}\n\\label\{#{self.id}\}\n#{self.content}\\end\{#{click}\}\n"
|
351
358
|
end
|
352
359
|
|
353
|
-
warn "end click_process\n".blue if $VERBOSE
|
360
|
+
# warn "end click_process\n".blue if $VERBOSE
|
354
361
|
|
355
362
|
output
|
356
363
|
|
357
364
|
end
|
358
365
|
|
366
|
+
def toc_process
|
367
|
+
warn "Please implement me! (toc_process)".red if $VERBOSE
|
368
|
+
end
|
369
|
+
|
359
370
|
def report
|
360
371
|
# Report on this node
|
361
|
-
warn ["OPEN BLOCK:".magenta, "id: #{self.id}"].join(" ")
|
362
|
-
warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ")
|
363
|
-
warn ["Attributes:".magenta, "#{self.attributes}".cyan].join(" ")
|
364
|
-
warn ["Title: ".magenta, title.cyan, "style:", self.style].join(" ") if title
|
365
|
-
warn ["Content:".magenta, "#{self.content}".yellow].join(" ")
|
366
|
-
warn ["Style:".green, "#{self.style}".red].join(" ")
|
367
|
-
warn ["METHODS:".red, "#{self.methods}".yellow].join(" ")
|
372
|
+
# warn ["OPEN BLOCK:".magenta, "id: #{self.id}"].join(" ")
|
373
|
+
# warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ")
|
374
|
+
# warn ["Attributes:".magenta, "#{self.attributes}".cyan].join(" ")
|
375
|
+
# warn ["Title: ".magenta, title.cyan, "style:", self.style].join(" ") if title
|
376
|
+
# warn ["Content:".magenta, "#{self.content}".yellow].join(" ")
|
377
|
+
# warn ["Style:".green, "#{self.style}".red].join(" ")
|
378
|
+
# warn ["METHODS:".red, "#{self.methods}".yellow].join(" ")
|
368
379
|
end
|
369
380
|
|
370
381
|
|
@@ -393,7 +404,7 @@ module Asciidoctor
|
|
393
404
|
|
394
405
|
attr = self.attributes
|
395
406
|
|
396
|
-
warn "attributes (open block): #{self.attributes}" if $VERBOSE
|
407
|
+
# warn "attributes (open block): #{self.attributes}" if $VERBOSE
|
397
408
|
|
398
409
|
|
399
410
|
# Get title !- nil or make a dummy one
|
@@ -419,23 +430,23 @@ module Asciidoctor
|
|
419
430
|
end
|
420
431
|
|
421
432
|
def listing_process
|
422
|
-
warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
423
|
-
warn "attributes: #{self.attributes}".cyan if $VERBOSE
|
433
|
+
# warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
434
|
+
# warn "attributes: #{self.attributes}".cyan if $VERBOSE
|
424
435
|
"\\begin\{verbatim\}\n#{self.content}\n\\end\{verbatim\}\n"
|
425
436
|
end
|
426
437
|
|
427
438
|
def example_process
|
428
|
-
warn "exAmple_process".yellow
|
429
|
-
warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
430
|
-
warn "attributes: #{self.attributes}".cyan if $VERBOSE
|
439
|
+
# warn "exAmple_process".yellow
|
440
|
+
# warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
441
|
+
# warn "attributes: #{self.attributes}".cyan if $VERBOSE
|
431
442
|
# self.content_model = :verbatim
|
432
|
-
warn "content: #{self.content}".cyan if $VERBOSE
|
443
|
+
# warn "content: #{self.content}".cyan if $VERBOSE
|
433
444
|
"\\begin\{verbatim\}\n#{self.content}\n\\end\{verbatim\}\n"
|
434
445
|
end
|
435
446
|
|
436
447
|
|
437
448
|
def floating_title_process
|
438
|
-
warn ["Node:".blue, "section[#{self.level}]:".cyan, "#{self.title}"].join(" ") if $VERBOSE
|
449
|
+
# warn ["Node:".blue, "section[#{self.level}]:".cyan, "#{self.title}"].join(" ") if $VERBOSE
|
439
450
|
doctype = self.document.doctype
|
440
451
|
|
441
452
|
tags = { 'article' => [ 'part', 'section', 'subsection', 'subsubsection', 'paragraph' ],
|
@@ -447,8 +458,8 @@ module Asciidoctor
|
|
447
458
|
end
|
448
459
|
|
449
460
|
def image_process
|
450
|
-
warn ["IXX: Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
451
|
-
warn "IXX: attributes: #{self.attributes}".cyan if $VERBOSE
|
461
|
+
# warn ["IXX: Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
462
|
+
# warn "IXX: attributes: #{self.attributes}".cyan if $VERBOSE
|
452
463
|
if self.attributes['width']
|
453
464
|
width = "#{self.attributes['width'].to_f/100.0}truein"
|
454
465
|
else
|
@@ -456,12 +467,12 @@ module Asciidoctor
|
|
456
467
|
end
|
457
468
|
raw_image = self.attributes['target']
|
458
469
|
if document.attributes['noteshare'] == 'yes'
|
459
|
-
warn "IXX: extracting image name".red if $VERBOSE
|
470
|
+
# warn "IXX: extracting image name".red if $VERBOSE
|
460
471
|
image_rx = /image.*original\/(.*)\?/
|
461
472
|
match_data = raw_image.match image_rx
|
462
473
|
if match_data
|
463
474
|
image = match_data[1]
|
464
|
-
warn "IXX: image name: #{image}".red if $VERBOSE
|
475
|
+
# warn "IXX: image name: #{image}".red if $VERBOSE
|
465
476
|
else
|
466
477
|
image = "undefined"
|
467
478
|
end
|
@@ -501,16 +512,16 @@ module Asciidoctor
|
|
501
512
|
|
502
513
|
|
503
514
|
def sidebar_process
|
504
|
-
warn "sidebar_process".yellow if $VERBOSE
|
505
|
-
warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
506
|
-
warn "attributes: #{self.attributes}".cyan if $VERBOSE
|
515
|
+
# warn "sidebar_process".yellow if $VERBOSE
|
516
|
+
# warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
517
|
+
# warn "attributes: #{self.attributes}".cyan if $VERBOSE
|
507
518
|
"\\begin\{sidebar\}\n#{self.content}\n\\end\{sidebar\}\n"
|
508
519
|
end
|
509
520
|
|
510
521
|
def verse_process
|
511
|
-
warn "verse_process".yellow if $VERBOSE
|
512
|
-
warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
513
|
-
warn "attributes: #{self.attributes}".cyan if $VERBOSE
|
522
|
+
# warn "verse_process".yellow if $VERBOSE
|
523
|
+
# warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
524
|
+
# warn "attributes: #{self.attributes}".cyan if $VERBOSE
|
514
525
|
"\\begin\{alltt\}\n#{self.content}\n\\end\{alltt\}\n"
|
515
526
|
end
|
516
527
|
|
@@ -529,14 +540,16 @@ module Asciidoctor
|
|
529
540
|
self.inline_break_process
|
530
541
|
when 'inline_footnote'
|
531
542
|
self.inline_footnote_process
|
543
|
+
when 'inline_callout'
|
544
|
+
self.inline_callout_process
|
532
545
|
else
|
533
|
-
warn "This is Asciidoctor::Inline, tex_process. I don't know how to do that (#{self.node_name})".yellow if $VERBOSE
|
546
|
+
# warn "This is Asciidoctor::Inline, tex_process. I don't know how to do that (#{self.node_name})".yellow if $VERBOSE
|
534
547
|
""
|
535
548
|
end
|
536
549
|
end
|
537
550
|
|
538
551
|
def inline_quoted_process
|
539
|
-
warn ["Node:".blue, "#{self.node_name}".cyan, "type[#{self.type}], ".green + " text: #{self.text}"].join(" ") if $VERBOSE
|
552
|
+
# warn ["Node:".blue, "#{self.node_name}".cyan, "type[#{self.type}], ".green + " text: #{self.text}"].join(" ") if $VERBOSE
|
540
553
|
case self.type
|
541
554
|
when :strong
|
542
555
|
#"\\textbf\{#{self.text}\}"
|
@@ -549,11 +562,11 @@ module Asciidoctor
|
|
549
562
|
"\{\\tt #{self.text}\}"
|
550
563
|
when :unquoted
|
551
564
|
role = self.attributes["role"]
|
552
|
-
warn " -- role = #{role}".yellow if $VERBOSE
|
565
|
+
# warn " -- role = #{role}".yellow if $VERBOSE
|
553
566
|
if role == "red"
|
554
567
|
"\\rolered\{ #{self.text}\}"
|
555
568
|
else
|
556
|
-
warn "This is inline_quoted_process. I don't understand role = #{role}" if $VERBOSE
|
569
|
+
# warn "This is inline_quoted_process. I don't understand role = #{role}" if $VERBOSE
|
557
570
|
end
|
558
571
|
else
|
559
572
|
"\\unknown\\{#{self.text}\\}"
|
@@ -562,7 +575,7 @@ module Asciidoctor
|
|
562
575
|
|
563
576
|
def inline_anchor_process
|
564
577
|
|
565
|
-
warn ["Node:".blue, "#{self.node_name}".magenta, "type[#{self.type}], ".green + " text: #{self.text} target: #{self.target}".cyan].join(" ") if $VERBOSE
|
578
|
+
# warn ["Node:".blue, "#{self.node_name}".magenta, "type[#{self.type}], ".green + " text: #{self.text} target: #{self.target}".cyan].join(" ") if $VERBOSE
|
566
579
|
|
567
580
|
refid = self.attributes['refid']
|
568
581
|
refs = self.parent.document.references[:ids]
|
@@ -585,31 +598,35 @@ module Asciidoctor
|
|
585
598
|
"\\label\{#{self.text.gsub(/\[(.*?)\]/, "\\1")}\}"
|
586
599
|
when :xref
|
587
600
|
#"\\ref\{#{self.target.gsub('#','')}\}"
|
588
|
-
# warn "\\hyperlink\{#{refid}\}\{#{reftext}\}".yellow
|
601
|
+
# # warn "\\hyperlink\{#{refid}\}\{#{reftext}\}".yellow
|
589
602
|
"\\hyperlink\{#{refid}\}\{#{reftext}\}"
|
590
603
|
else
|
591
|
-
warn "!! : undefined inline anchor -----------".magenta if $VERBOSE
|
604
|
+
# warn "!! : undefined inline anchor -----------".magenta if $VERBOSE
|
592
605
|
end
|
593
606
|
end
|
594
607
|
|
595
608
|
def inline_break_process
|
596
|
-
warn ["Node:".blue, "#{self.node_name}".cyan, "type[#{self.type}], ".green + " text: #{self.text}"].join(" ") if $VERBOSE
|
609
|
+
# warn ["Node:".blue, "#{self.node_name}".cyan, "type[#{self.type}], ".green + " text: #{self.text}"].join(" ") if $VERBOSE
|
597
610
|
"#{self.text} \\\\"
|
598
611
|
end
|
599
612
|
|
600
613
|
def inline_footnote_process
|
601
|
-
warn ["Node:".blue, "#{self.node_name}".cyan, "type[#{self.type}], ".green + " text: #{self.text}"].join(" ") if $VERBOSE
|
602
|
-
# warn self.content.yellow
|
603
|
-
# warn self.style.magenta
|
614
|
+
# warn ["Node:".blue, "#{self.node_name}".cyan, "type[#{self.type}], ".green + " text: #{self.text}"].join(" ") if $VERBOSE
|
615
|
+
# # warn self.content.yellow
|
616
|
+
# # warn self.style.magenta
|
604
617
|
"\\footnote\{#{self.text}\}"
|
605
618
|
end
|
606
619
|
|
620
|
+
def inline_callout_process
|
621
|
+
warn "Please implement me! (inline_callout_process)".red if $VERBOSE
|
622
|
+
end
|
623
|
+
|
607
624
|
end
|
608
625
|
|
609
626
|
class Table
|
610
627
|
|
611
628
|
def tex_process
|
612
|
-
# warn "This is Asciidoctor::Table, tex_process. I don't know how to do that".yellow + " (#{self.node_name})".magenta if $VERBOSE
|
629
|
+
# # warn "This is Asciidoctor::Table, tex_process. I don't know how to do that".yellow + " (#{self.node_name})".magenta if $VERBOSE
|
613
630
|
# table = Table.new self.parent, self.attributes
|
614
631
|
n_rows = self.rows.body.count
|
615
632
|
n_columns = self.columns.count
|