asciidoctor-latex 1.5.0.3.dev → 1.5.0.4.dev
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +28 -5
- data/README.adoc +48 -23
- data/Rakefile +2 -1
- data/data/asciidoc_tex_macros.tex +86 -3
- data/data/extras.css +73 -1
- data/data/preamble_article.tex +15 -6
- data/data/preamble_book.tex +25 -9
- data/examples/README.adoc +341 -9
- data/examples/README.html +915 -0
- data/examples/math_article.adoc +46 -46
- data/examples/xref-equations.adoc +1 -2
- data/lib/asciidoctor-latex/click.css +2 -0
- data/lib/asciidoctor-latex/click.js +6 -0
- data/lib/asciidoctor-latex/jquery.js +4 -0
- data/lib/asciidoctor-latex/preamble_processor.rb +18 -0
- data/lib/asciidoctor/latex/click_block.rb +7 -4
- data/lib/asciidoctor/latex/converter.rb +75 -29
- data/lib/asciidoctor/latex/core_ext/utility.rb +55 -0
- data/lib/asciidoctor/latex/css.rb +50 -0
- data/lib/asciidoctor/latex/environment_block.rb +13 -6
- data/lib/asciidoctor/latex/inject_html.rb +2 -1
- data/lib/asciidoctor/latex/node_processors.rb +329 -152
- data/lib/asciidoctor/latex/prepend_processor.rb +1 -0
- data/lib/asciidoctor/latex/tex_postprocessor.rb +8 -3
- data/lib/asciidoctor/latex/tex_preprocessor.rb +31 -9
- data/lib/asciidoctor/latex/version.rb +1 -1
- data/test/examples/adoc/ampersand.adoc +2 -0
- data/test/examples/adoc/block_olist.adoc +58 -0
- data/test/examples/adoc/block_ulist.adoc +42 -0
- data/test/examples/adoc/box.adoc +35 -1
- data/test/examples/adoc/chem.adoc +8 -0
- data/test/examples/adoc/click_plain.adoc +24 -0
- data/test/examples/adoc/dlist.adoc +15 -0
- data/test/examples/adoc/env2.adoc +57 -0
- data/test/examples/adoc/env_joke.adoc +12 -0
- data/test/examples/adoc/env_plain.adoc +10 -0
- data/test/examples/adoc/eq-latex.adoc +39 -0
- data/test/examples/adoc/eq.adoc +18 -0
- data/test/examples/adoc/eq.tex +28 -0
- data/test/examples/adoc/eqalign.adoc +19 -6
- data/test/examples/adoc/eqalign.tex +25 -0
- data/test/examples/adoc/eqno-latex.adoc +120 -0
- data/test/examples/adoc/extras.adoc +14 -0
- data/test/examples/adoc/hypertarget.adoc +29 -0
- data/test/examples/adoc/image.adoc +7 -0
- data/test/examples/adoc/newEnvironments.tex +0 -0
- data/test/examples/adoc/table.adoc +6 -0
- data/test/examples/adoc/table.tex +10 -0
- data/test/examples/adoc/tex_pathologies.adoc +30 -0
- data/test/examples/html/env.html +147 -0
- data/test/examples/html/equations.html +14 -0
- data/test/examples/tex/ampersand.tex +2 -0
- data/test/examples/tex/block_admonition.tex +20 -0
- data/test/examples/tex/block_audio.tex +7 -0
- data/test/examples/tex/block_colist.tex +23 -0
- data/test/examples/tex/block_dlist.tex +117 -0
- data/test/examples/tex/block_example.tex +20 -0
- data/test/examples/tex/block_floating_title.tex +20 -0
- data/test/examples/tex/block_image.tex +46 -0
- data/test/examples/tex/block_listing.tex +59 -0
- data/test/examples/tex/block_literal.tex +28 -0
- data/test/examples/tex/block_olist.tex +119 -0
- data/test/examples/tex/block_open.tex +22 -0
- data/test/examples/tex/block_outline.tex +25 -0
- data/test/examples/tex/block_page_break.tex +4 -0
- data/test/examples/tex/block_paragraph.tex +13 -0
- data/test/examples/tex/block_pass.tex +3 -0
- data/test/examples/tex/block_preamble.tex +15 -0
- data/test/examples/tex/block_quote.tex +51 -0
- data/test/examples/tex/block_sidebar.tex +21 -0
- data/test/examples/tex/block_stem.tex +19 -0
- data/test/examples/tex/block_table.tex +188 -0
- data/test/examples/tex/block_thematic_break.tex +1 -0
- data/test/examples/tex/block_toc.tex +27 -0
- data/test/examples/tex/block_ulist.tex +96 -0
- data/test/examples/tex/block_verse.tex +39 -0
- data/test/examples/tex/block_video.tex +15 -0
- data/test/examples/tex/box.tex +25 -0
- data/test/examples/tex/chem.tex +7 -0
- data/test/examples/tex/click_plain.tex +25 -0
- data/test/examples/tex/dlist.tex +17 -0
- data/test/examples/tex/document.tex +25 -0
- data/test/examples/tex/embedded.tex +7 -0
- data/test/examples/tex/env.tex +7 -7
- data/test/examples/tex/env2.tex +29 -0
- data/test/examples/tex/env_joke.tex +9 -0
- data/test/examples/tex/env_plain.tex +7 -0
- data/test/examples/tex/eq-latex.tex +49 -0
- data/test/examples/tex/eq.tex +9 -0
- data/test/examples/tex/eqalign.tex +23 -0
- data/test/examples/tex/eqno-latex.tex +237 -0
- data/test/examples/tex/exponent1.tex +2 -0
- data/test/examples/tex/exponent2.tex +4 -0
- data/test/examples/tex/extras.tex +13 -0
- data/test/examples/tex/hypertarget.tex +25 -0
- data/test/examples/tex/image.tex +4 -0
- data/test/examples/tex/inline_anchor.tex +25 -0
- data/test/examples/tex/inline_break.tex +7 -0
- data/test/examples/tex/inline_button.tex +1 -0
- data/test/examples/tex/inline_callout.tex +4 -0
- data/test/examples/tex/inline_footnote.tex +9 -0
- data/test/examples/tex/inline_image.tex +25 -0
- data/test/examples/tex/inline_kbd.tex +3 -0
- data/test/examples/tex/inline_menu.tex +5 -0
- data/test/examples/tex/inline_quoted.tex +63 -0
- data/test/examples/tex/line_break.tex +4 -0
- data/test/examples/tex/listing.tex +10 -0
- data/test/examples/tex/literal.tex +42 -0
- data/test/examples/tex/macro_underscore.tex +6 -0
- data/test/examples/tex/math.tex +8 -0
- data/test/examples/tex/open_block.tex +10 -0
- data/test/examples/tex/page_break.tex +4 -0
- data/test/examples/tex/pass.tex +3 -0
- data/test/examples/tex/section.tex +51 -0
- data/test/examples/tex/sections.tex +13 -0
- data/test/examples/tex/table.tex +10 -0
- data/test/examples/tex/tex_pathologies.tex +26 -0
- data/test/examples/tex/zero.tex +1 -1
- metadata +188 -26
- data/examples/box.adoc +0 -16
- data/examples/chem.adoc +0 -17
- data/examples/eq-alignment.adoc +0 -5
- data/examples/eq-block.adoc +0 -60
- data/test/examples/adoc/admonition.adoc +0 -11
- data/test_jc/admonition.adoc +0 -4
- data/test_jc/click.adoc +0 -7
- data/test_jc/env.adoc +0 -31
- data/test_jc/example.adoc +0 -17
- data/test_jc/floating_title.adoc +0 -15
- data/test_jc/image.adoc +0 -84
- data/test_jc/images/frog.jpg +0 -0
- data/test_jc/images/red_frog.jpeg +0 -0
- data/test_jc/images/yellow_frog.jpeg +0 -0
- data/test_jc/listing.adoc +0 -9
- data/test_jc/lists.adoc +0 -20
- data/test_jc/math.adoc +0 -10
- data/test_jc/preamble.adoc +0 -14
- data/test_jc/section-numbered.adoc +0 -9
- data/test_jc/section.adoc +0 -7
- data/test_jc/sidebar.adoc +0 -61
- data/test_jc/verse.adoc +0 -15
@@ -0,0 +1,55 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class String
|
4
|
+
|
5
|
+
# This method allows one to compute
|
6
|
+
# the strings that represent LaTeX
|
7
|
+
# macro applicatins without descent
|
8
|
+
# into a hell of backlslshes and braces,
|
9
|
+
# especially when more than one macro
|
10
|
+
# has to be applied. For example,
|
11
|
+
# instead of
|
12
|
+
#
|
13
|
+
# content = "\\roleblue\{ #{content}\}"
|
14
|
+
#
|
15
|
+
# we say just
|
16
|
+
#
|
17
|
+
# content = content.macro('roleblue')
|
18
|
+
#
|
19
|
+
# Here is an appication of three macros:
|
20
|
+
#
|
21
|
+
# content.macro('roleblue').macro('foo').macro('bar')
|
22
|
+
#
|
23
|
+
#
|
24
|
+
def macro(macro)
|
25
|
+
"\\#{macro}\{#{self}\}"
|
26
|
+
end
|
27
|
+
|
28
|
+
# The 'apply_macros' method simplifies the
|
29
|
+
# chaining of a sequence of macro applications.
|
30
|
+
# For example, we could say
|
31
|
+
#
|
32
|
+
# 'yoda'.macro('baz').macro('bar').macro('foo')
|
33
|
+
#
|
34
|
+
# => "\\foo{\\bar{\\baz{yoda}}}"
|
35
|
+
#
|
36
|
+
# But it is simpler to say
|
37
|
+
#
|
38
|
+
# 'yoda'.apply_macros(['foo', 'bar', 'baz'])
|
39
|
+
#
|
40
|
+
# => "\\foo{\\bar{\\baz{yoda}}}"
|
41
|
+
#
|
42
|
+
# Because we reverse the argument list, the
|
43
|
+
# application order of the LaTeX macros
|
44
|
+
# matches the order in the argument list.
|
45
|
+
|
46
|
+
def apply_macros(macro_list)
|
47
|
+
val = self
|
48
|
+
macro_list.reverse.each do |macro_name|
|
49
|
+
val = val.macro(macro_name)
|
50
|
+
end
|
51
|
+
val
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'asciidoctor'
|
2
|
+
|
3
|
+
require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal'
|
4
|
+
|
5
|
+
include ::Asciidoctor
|
6
|
+
|
7
|
+
|
8
|
+
# The following docinfo processor permits the converter to
|
9
|
+
# read an additional style file (extras.css in the data directory).
|
10
|
+
# The docinfo extension is registered in the converter.rb:
|
11
|
+
#
|
12
|
+
# Asciidoctor::Extensions.register do
|
13
|
+
# docinfo_processor CSSDocinfoProcessor
|
14
|
+
# ..
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
|
18
|
+
class CSSDocinfoProcessor < Asciidoctor::Extensions::DocinfoProcessor
|
19
|
+
|
20
|
+
use_dsl
|
21
|
+
at_location :header
|
22
|
+
|
23
|
+
|
24
|
+
def process doc
|
25
|
+
extdir = File.expand_path("../../../../data", __FILE__)
|
26
|
+
stylesheet_name = 'extras.css'
|
27
|
+
if doc.attr? 'linkcss'
|
28
|
+
stylesheet_href = handle_stylesheet doc, extdir, stylesheet_name
|
29
|
+
%(<link rel="stylesheet" href="#{stylesheet_href}">)
|
30
|
+
else
|
31
|
+
content = doc.read_asset %(#{extdir}/#{stylesheet_name})
|
32
|
+
['<style>', content.chomp, '</style>'] * "\n"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def handle_stylesheet doc, extdir, stylesheet_name
|
37
|
+
outdir = (doc.attr? 'outdir') ? (doc.attr 'outdir') : (doc.attr 'docdir')
|
38
|
+
stylesoutdir = doc.normalize_system_path((doc.attr 'stylesdir'), outdir, (doc.safe >= SafeMode::SAFE ? outdir : nil))
|
39
|
+
if stylesoutdir != extdir && doc.safe < SafeMode::SECURE && (doc.attr? 'copycss')
|
40
|
+
destination = doc.normalize_system_path stylesheet_name, stylesoutdir, (doc.safe >= SafeMode::SAFE ? outdir : nil)
|
41
|
+
content = doc.read_asset %(#{extdir}/#{stylesheet_name})
|
42
|
+
::File.open(destination, 'w') {|f|
|
43
|
+
f.write content
|
44
|
+
}
|
45
|
+
destination
|
46
|
+
else
|
47
|
+
%(./#{stylesheet_name})
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -114,12 +114,15 @@ module Asciidoctor::LaTeX
|
|
114
114
|
# Use the option set if present (numbered, no+_number) otherwise
|
115
115
|
# use a default value, e.g. 'box' is not numbered, the others are numbered
|
116
116
|
if !(attrs['options'] =~ /no_number|numbered/)
|
117
|
-
if %w(box).include? role
|
117
|
+
if %w(capsule box equation equationalign).include? role
|
118
118
|
attrs['options'] = 'no_number'
|
119
119
|
else
|
120
120
|
attrs['options'] = 'numbered'
|
121
121
|
end
|
122
122
|
end
|
123
|
+
if attrs['id']
|
124
|
+
attrs['options'] = 'numbered'
|
125
|
+
end
|
123
126
|
|
124
127
|
|
125
128
|
# Adjust title according to environment name
|
@@ -127,10 +130,15 @@ module Asciidoctor::LaTeX
|
|
127
130
|
if %w(equation equationalign chem).include? role
|
128
131
|
attrs['title'] = env_name
|
129
132
|
elsif role == 'code'
|
130
|
-
attrs['
|
133
|
+
if attrs['id'] or attrs['title']
|
134
|
+
attrs['title'] = 'Listing'
|
135
|
+
else
|
136
|
+
attrs['title'] = ''
|
137
|
+
attrs['options'] = 'no_number'
|
138
|
+
end
|
131
139
|
elsif role == 'jsxgraph'
|
132
140
|
attrs['title'] = 'JSXGraph'
|
133
|
-
elsif role == 'box'
|
141
|
+
elsif role == 'box'or role == 'capsule'
|
134
142
|
attrs['title'] = ''
|
135
143
|
else
|
136
144
|
attrs['title'] = env_name.capitalize
|
@@ -140,6 +148,7 @@ module Asciidoctor::LaTeX
|
|
140
148
|
|
141
149
|
# Creat the block
|
142
150
|
if attrs['role'] == 'code'
|
151
|
+
warn "for rode = code, attrs = #{attrs}".cyan
|
143
152
|
block = create_block parent, :listing, reader.lines, attrs
|
144
153
|
else
|
145
154
|
block = create_block parent, :environment, reader.lines, attrs
|
@@ -164,7 +173,7 @@ module Asciidoctor::LaTeX
|
|
164
173
|
attrs['caption-num'] = caption_num
|
165
174
|
caption = "#{caption_num}"
|
166
175
|
# Set the title, e.g., "Theorem 3: Pythagoras" or just "Theorem 3"
|
167
|
-
# depending on whether the user sets a title, .e.g, ".
|
176
|
+
# depending on whether the user sets a title, .e.g, ".Pythagoras"
|
168
177
|
# in the line preceding "[env.theorem]"
|
169
178
|
if original_title
|
170
179
|
attrs['title'] = "#{env_title} #{caption_num}: #{original_title}"
|
@@ -195,8 +204,6 @@ module Asciidoctor::LaTeX
|
|
195
204
|
block.assign_caption caption
|
196
205
|
if %w(equation equationalign chem).include? role
|
197
206
|
block.title = "#{caption_num}"
|
198
|
-
elsif %w(box).include? role
|
199
|
-
block.title = attrs['title']
|
200
207
|
else
|
201
208
|
block.title = attrs['title']
|
202
209
|
end
|
@@ -1,5 +1,77 @@
|
|
1
1
|
require 'asciidoctor'
|
2
2
|
require 'asciidoctor/latex/core_ext/colored_string'
|
3
|
+
require 'asciidoctor/latex/core_ext/utility'
|
4
|
+
|
5
|
+
|
6
|
+
module TexUtilities
|
7
|
+
|
8
|
+
def self.macro(name, *args)
|
9
|
+
case args.count
|
10
|
+
when 1
|
11
|
+
"\\#{name}\{#{args[0]}\}"
|
12
|
+
when 2
|
13
|
+
"\\#{name}\{#{args[0]}\}\{#{args[1]}\}"
|
14
|
+
when 3
|
15
|
+
"\\#{name}\{#{args[0]}\}\{#{args[1]}\}\{#{args[2]}\}"
|
16
|
+
else
|
17
|
+
''
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# tex.region('bf', 'foo bar') => {\bf foo bar}
|
22
|
+
def self.region(name, arg)
|
23
|
+
"\{\\#{name} #{arg}\}"
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
def self.macro_opt(name, opt, args)
|
28
|
+
case args.count
|
29
|
+
when 1
|
30
|
+
"\\#{name}[#{opt}]\{#{args[0]}\}"
|
31
|
+
when 2
|
32
|
+
"\\#{name}[#{opt}]\{#{args[0]}\}\{#{args[1]}\}"
|
33
|
+
when 3
|
34
|
+
"\\#{name}[#{opt}]\{#{args[0]}\}\{#{args[1]}\}\{#{args[2]}\}"
|
35
|
+
else
|
36
|
+
''
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.apply_macros(macro_list, arg)
|
41
|
+
val = arg
|
42
|
+
macro_list.reverse.each do |macro_name|
|
43
|
+
val = self.macro(macro_name, val)
|
44
|
+
end
|
45
|
+
val
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.begin(arg)
|
49
|
+
macro('begin', arg)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.end(arg)
|
53
|
+
macro('end', arg)
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.env(env, *args)
|
57
|
+
case args.count
|
58
|
+
when 1
|
59
|
+
"#{self.begin(env)}\n#{args[0].strip}\n#{self.end(env)}\n"
|
60
|
+
when 2
|
61
|
+
"#{self.begin(env)}\{#{args[0]}\}\n#{args[1]}\n#{self.end(env)}\n"
|
62
|
+
when 3
|
63
|
+
"#{self.begin(env)}\{#{args[0]}\}\{#{args[1]}\}\n#{args[2]}\n#{self.end(env)}\n"
|
64
|
+
else
|
65
|
+
''
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.hypertarget(name, text)
|
70
|
+
"\\hypertarget\{#{name}\}\{#{text}\}"
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
end
|
3
75
|
|
4
76
|
|
5
77
|
# Yuuk!, The classes in node_processor implement the
|
@@ -8,6 +80,9 @@ require 'asciidoctor/latex/core_ext/colored_string'
|
|
8
80
|
module Asciidoctor
|
9
81
|
|
10
82
|
|
83
|
+
include TexUtilities
|
84
|
+
$tex = TexUtilities
|
85
|
+
|
11
86
|
class Document
|
12
87
|
|
13
88
|
# Write preamble for tex file, write closing
|
@@ -29,17 +104,13 @@ module Asciidoctor
|
|
29
104
|
|
30
105
|
|
31
106
|
def tex_process
|
32
|
-
# warn "Node: #{self.class}".blue if $VERBOSE
|
33
107
|
|
34
108
|
doc = ''
|
35
109
|
|
36
|
-
# # warn "document.attributes['header'] = #{document.attributes['header']}".magenta if $VERBOSE
|
37
|
-
|
38
110
|
unless embedded? or document.attributes['header']=='no'
|
39
111
|
doc << "%% Preamble %%\n"
|
40
112
|
if File.exist? 'preamble.tex'
|
41
113
|
preamble = IO.read('preamble.tex')
|
42
|
-
# warn "preamble: #{preamble.length} chars".yellow
|
43
114
|
doc << preamble << "\n "
|
44
115
|
else
|
45
116
|
doc << File.open(File.join(LaTeX::DATA_DIR, "preamble_#{self.document.doctype}.tex"), 'r') { |f| f.read }
|
@@ -50,13 +121,11 @@ module Asciidoctor
|
|
50
121
|
# doc << File.open(File.join(LaTeX::DATA_DIR, 'macros.tex'), 'r') { |f| f.read }
|
51
122
|
if File.exist? 'macros.tex'
|
52
123
|
macros = IO.read('macros.tex')
|
53
|
-
# warn "macros: #{macros.length} chars".yellow
|
54
124
|
doc << macros
|
55
125
|
else
|
56
126
|
# warn "Could not find file macros.tex".yellow
|
57
127
|
end
|
58
128
|
if File.exist?('myEnvironments.tex')
|
59
|
-
# warn "I will take input from myEnvironments.tex".blue
|
60
129
|
doc << "\\input myEnvironments.tex\n"
|
61
130
|
else
|
62
131
|
# warn "I will take input from newEnvironments.tex".blue
|
@@ -84,11 +153,9 @@ module Asciidoctor
|
|
84
153
|
unless embedded?
|
85
154
|
# Now write the defnitions of the new environments
|
86
155
|
# discovered to file
|
87
|
-
# warn "Writing environment definitions to file: newEnvironments.tex" if $VERBOSE
|
88
156
|
definitions = ""
|
89
157
|
|
90
158
|
$latex_environment_names.uniq.each do |name|
|
91
|
-
# warn name if $VERBOSE
|
92
159
|
definitions << "\\newtheorem\{#{name}\}\{#{name.capitalize}\}" << "\n"
|
93
160
|
end
|
94
161
|
|
@@ -107,7 +174,6 @@ module Asciidoctor
|
|
107
174
|
class Section
|
108
175
|
|
109
176
|
def tex_process
|
110
|
-
# warn ["Node:".blue, "section[#{self.level}]:".cyan, "#{self.title}"].join(" ") if $VERBOSE
|
111
177
|
doctype = self.document.doctype
|
112
178
|
|
113
179
|
tags = { 'article' => [ 'part', 'section', 'subsection', 'subsubsection', 'paragraph' ],
|
@@ -115,8 +181,11 @@ module Asciidoctor
|
|
115
181
|
|
116
182
|
tagname = tags[doctype][self.level]
|
117
183
|
tagsuffix = self.numbered ? '' : '*'
|
118
|
-
|
119
|
-
"\\#{tagname}#{tagsuffix}\{#{self.title}\}
|
184
|
+
id ="_#{self.title.downcase.gsub(' ', '_')}"
|
185
|
+
heading = "\\#{tagname}#{tagsuffix}\{#{self.title}\}"
|
186
|
+
heading = $tex.hypertarget id, heading
|
187
|
+
value = "#{heading}\n#{self.content}"
|
188
|
+
value
|
120
189
|
end
|
121
190
|
end
|
122
191
|
|
@@ -127,7 +196,6 @@ module Asciidoctor
|
|
127
196
|
class List
|
128
197
|
|
129
198
|
def tex_process
|
130
|
-
# warn ["Node:".blue, "#{self.node_name}[#{self.level}]".cyan, "#{self.content.count} items"].join(" ") if $VERBOSE
|
131
199
|
case self.node_name
|
132
200
|
when 'dlist'
|
133
201
|
dlist_process
|
@@ -135,8 +203,6 @@ module Asciidoctor
|
|
135
203
|
ulist_process
|
136
204
|
when 'olist'
|
137
205
|
olist_process
|
138
|
-
when 'colist'
|
139
|
-
colist_process
|
140
206
|
else
|
141
207
|
# warn "This Asciidoctor::List, tex_process. I don't know how to do that (#{self.node_name})" if $VERBOSE
|
142
208
|
end
|
@@ -162,7 +228,6 @@ module Asciidoctor
|
|
162
228
|
def ulist_process
|
163
229
|
list = "\\begin{itemize}\n\n"
|
164
230
|
self.content.each do |item|
|
165
|
-
# warn [" -- item: ".blue, "#{item.text.split("\n").first}"].join(" ") if $VERBOSE
|
166
231
|
list << "\\item #{item.text}\n\n"
|
167
232
|
list << item.content
|
168
233
|
end
|
@@ -172,17 +237,12 @@ module Asciidoctor
|
|
172
237
|
def olist_process
|
173
238
|
list = "\\begin{enumerate}\n\n"
|
174
239
|
self.content.each do |item|
|
175
|
-
|
176
|
-
list << "\\item #{item.text}\n\n"
|
240
|
+
list << item.text.macro('item') << "\n\n"
|
177
241
|
list << item.content
|
178
242
|
end
|
179
243
|
list << "\\end{enumerate}\n\n"
|
180
244
|
end
|
181
245
|
|
182
|
-
def colist_process
|
183
|
-
warn "Please implement me! (colist_process)".red if $VERBOSE
|
184
|
-
end
|
185
|
-
|
186
246
|
end
|
187
247
|
|
188
248
|
# Proces block elements of varios kinds
|
@@ -192,7 +252,6 @@ module Asciidoctor
|
|
192
252
|
STANDARD_ENVIRONMENT_NAMES = %w(equation)
|
193
253
|
|
194
254
|
def tex_process
|
195
|
-
# warn ["Node:".blue , "#{self.blockname}".blue].join(" ") if $VERBOSE
|
196
255
|
case self.blockname
|
197
256
|
when :paragraph
|
198
257
|
paragraph_process
|
@@ -240,141 +299,247 @@ module Asciidoctor
|
|
240
299
|
|
241
300
|
|
242
301
|
def paragraph_process
|
243
|
-
|
302
|
+
options = self.attributes['options']
|
244
303
|
out = ""
|
245
304
|
if self.attributes['title']
|
246
|
-
|
305
|
+
title = "#{self.attributes['title']}\."
|
306
|
+
out << $tex.region('bf', title) + ' '
|
247
307
|
end
|
248
|
-
|
308
|
+
content = LaTeX::TeXPostProcess.make_substitutions(self.content)
|
309
|
+
if role == "red"
|
310
|
+
content = content.macro('rolered')
|
311
|
+
elsif role == "blue"
|
312
|
+
content = content.macro('roleblue')
|
313
|
+
end
|
314
|
+
if options and options.include? 'hardbreaks'
|
315
|
+
# content = content.macro('obeylines')
|
316
|
+
end
|
317
|
+
|
318
|
+
out << content << "\n\n"
|
249
319
|
end
|
250
320
|
|
251
321
|
def stem_process
|
252
|
-
# warn ["Node:".blue, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
253
|
-
# warn self.content.cyan if $VERBOSE
|
254
322
|
environment = LaTeX::TeXBlock.environment_type self.content
|
255
323
|
if LaTeX::TeXBlock::INNER_TYPES.include? environment
|
256
|
-
|
257
|
-
# warn out.yellow if $VERBOSE
|
258
|
-
out
|
324
|
+
"\\\[\n#{LaTeX::TeXPostProcess.stem_substitutions self.content}\n\\\]\n"
|
259
325
|
else
|
260
326
|
self.content
|
261
327
|
end
|
262
328
|
end
|
263
329
|
|
264
330
|
def admonition_process
|
265
|
-
|
266
|
-
"\\admonition\{#{self.style}\}\{#{self.content}\}\n"
|
331
|
+
$tex.macro 'admonition', self.style, self.content
|
267
332
|
end
|
268
333
|
|
269
334
|
def page_break_process
|
270
|
-
# warn ["Node:".blue, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
271
335
|
"\n\\vfill\\eject\n"
|
272
336
|
end
|
273
337
|
|
274
338
|
def literal_process
|
275
|
-
|
276
|
-
|
339
|
+
heading = ''
|
340
|
+
if id and self.title
|
341
|
+
heading = $tex.hypertarget id, self.title
|
342
|
+
elsif self.title
|
343
|
+
heading = self.title
|
344
|
+
end
|
345
|
+
if heading == ''
|
346
|
+
$tex.env 'verbatim', self.content
|
347
|
+
else
|
348
|
+
output = $tex.region 'bf', heading
|
349
|
+
output << "\\vspace\{-1\\baselineskip\}\n"
|
350
|
+
output << ($tex.env 'verbatim', self.content)
|
351
|
+
end
|
277
352
|
end
|
278
353
|
|
279
354
|
def pass_process
|
280
|
-
# warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
281
355
|
self.content
|
282
356
|
end
|
283
357
|
|
284
358
|
def quote_process
|
285
|
-
# warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
286
359
|
if self.attr? 'attribution'
|
287
360
|
attribution = self.attr 'attribution'
|
288
361
|
citetitle = (self.attr? 'citetitle') ? (self.attr 'citetitle') : nil
|
289
|
-
|
290
|
-
|
362
|
+
# citetitle = citetitle ? ' - ' + citetitle : ''
|
363
|
+
citetitle = citetitle ? $tex.region('bf', citetitle) + ' \\\\' : ''
|
364
|
+
$tex.env 'aquote', attribution, citetitle, self.content
|
365
|
+
elsif self.title
|
366
|
+
$tex.env 'tquote', self.title, self.content
|
291
367
|
else
|
292
|
-
|
368
|
+
$tex.env 'quotation', self.content
|
293
369
|
end
|
294
370
|
end
|
295
371
|
|
296
|
-
def environment_process
|
297
372
|
|
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
|
301
373
|
|
302
|
-
|
303
|
-
|
304
|
-
# record any environments encountered but not built=in
|
305
|
-
if !STANDARD_ENVIRONMENT_NAMES.include? env and !$latex_environment_names.include? env
|
306
|
-
# if !($latex_environment_names.include? env)
|
307
|
-
# warn "env added: [#{env}]".blue if $VERBOSE
|
308
|
-
$latex_environment_names << env
|
309
|
-
end
|
374
|
+
####################################################################
|
310
375
|
|
376
|
+
def label
|
311
377
|
if self.id
|
312
|
-
label =
|
378
|
+
label = $tex.macro 'label', self.id
|
379
|
+
# label = $tex.macro 'label', $tex.hypertarget(self.id, self.id)
|
313
380
|
else
|
314
381
|
label = ""
|
315
382
|
end
|
383
|
+
label
|
384
|
+
end
|
316
385
|
|
317
|
-
|
386
|
+
def options
|
387
|
+
self.attributes['options']
|
388
|
+
end
|
318
389
|
|
390
|
+
def env_title
|
319
391
|
if self.attributes['original_title']
|
320
|
-
|
392
|
+
"\{\\rm (#{self.attributes['original_title']}) \}"
|
393
|
+
else
|
394
|
+
''
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
####################################################################
|
399
|
+
|
400
|
+
def handle_listing
|
401
|
+
content = $tex.env 'verbatim', self.content
|
402
|
+
$tex.env env, label, content
|
403
|
+
end
|
404
|
+
|
405
|
+
def handle_eqalign
|
406
|
+
if options.include? 'numbered'
|
407
|
+
content = $tex.env 'split', label + "\n" + self.content.strip
|
408
|
+
$tex.env 'equation', content
|
409
|
+
else
|
410
|
+
content = $tex.env 'split', label + "\n" + self.content.strip
|
411
|
+
$tex.env 'equation*', content
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
def handle_equation
|
416
|
+
if options.include? 'numbered'
|
417
|
+
content = $tex.hypertarget self.id, self.content.strip
|
418
|
+
$tex.env 'equation', "#{label}#{content}"
|
419
|
+
else
|
420
|
+
$tex.env 'equation*', "#{label}#{self.content.strip}"
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
424
|
+
def handle_chem
|
425
|
+
$tex.env 'equation', "#{label}\n\\ce\{#{self.content.strip}\}\n"
|
426
|
+
end
|
427
|
+
|
428
|
+
def handle_plain(env)
|
429
|
+
|
430
|
+
if self.id and self.title
|
431
|
+
_title = $tex.hypertarget self.id, self.env_title
|
321
432
|
else
|
322
|
-
|
433
|
+
_title = self.env_title
|
323
434
|
end
|
324
435
|
|
325
|
-
if
|
326
|
-
|
327
|
-
elsif env == 'equationalign'
|
328
|
-
output = "\\begin\{equation\}#{label}\n\\begin\{split\}\n#{self.content}\n\\end\{split\}\n\\end\{equation\}\n"
|
329
|
-
elsif env == 'chem'
|
330
|
-
output = "\\begin\{equation\}#{label}\n\\ce\{#{self.content}\}\n\\end\{equation\}\n"
|
436
|
+
if self.attributes['plain-option']
|
437
|
+
content = $tex.region 'rm', self.content
|
331
438
|
else
|
332
|
-
|
439
|
+
content = self.content
|
333
440
|
end
|
334
441
|
|
442
|
+
$tex.env env, "#{_title}#{label}#{content}\n"
|
443
|
+
end
|
444
|
+
|
445
|
+
####################################################################
|
335
446
|
|
447
|
+
def environment_process
|
336
448
|
|
337
|
-
|
449
|
+
env = self.attributes["role"]
|
338
450
|
|
451
|
+
# record any environments encountered but not built=in
|
452
|
+
if !STANDARD_ENVIRONMENT_NAMES.include? env and !$latex_environment_names.include? env
|
453
|
+
$latex_environment_names << env
|
454
|
+
end
|
455
|
+
|
456
|
+
case env
|
457
|
+
when 'listing'
|
458
|
+
handle_listing
|
459
|
+
when 'equationalign'
|
460
|
+
handle_eqalign
|
461
|
+
when 'equation'
|
462
|
+
handle_equation
|
463
|
+
when 'chem'
|
464
|
+
handle_chem
|
465
|
+
when 'box'
|
466
|
+
handle_box
|
467
|
+
when 'texmacro'
|
468
|
+
handle_texmacro
|
469
|
+
else
|
470
|
+
handle_plain(env)
|
471
|
+
end
|
339
472
|
end
|
340
473
|
|
341
|
-
def
|
474
|
+
def handle_texmacro
|
475
|
+
self.content
|
476
|
+
end
|
342
477
|
|
343
|
-
|
478
|
+
def handle_box
|
479
|
+
if self.title.nil? or self.title == ''
|
480
|
+
$tex.env 'asciidocbox', self.content
|
481
|
+
else
|
482
|
+
$tex.env 'titledasciidocbox', self.title, self.content
|
483
|
+
end
|
484
|
+
end
|
344
485
|
|
486
|
+
def click_process
|
487
|
+
attr = self.attributes
|
345
488
|
click = self.attributes["role"]
|
346
|
-
# record any
|
489
|
+
# record any environ$ments encounted but not built=in
|
347
490
|
if !STANDARD_ENVIRONMENT_NAMES.include? click
|
348
491
|
$latex_environment_names << click
|
349
492
|
end
|
350
493
|
|
351
|
-
|
352
|
-
|
494
|
+
if title
|
495
|
+
title = self.title.downcase
|
496
|
+
end
|
353
497
|
|
354
|
-
|
355
|
-
|
498
|
+
# original_title = title.split(' ')[0].downcase
|
499
|
+
# FIXME: the above is work-around: instead set
|
500
|
+
# originaltitle in clickblock
|
501
|
+
|
502
|
+
if attr['plain-option']
|
503
|
+
content = $tex.region 'rm', self.content
|
356
504
|
else
|
357
|
-
|
505
|
+
content = $tex.region 'it', self.content
|
506
|
+
end
|
507
|
+
|
508
|
+
# FIXME! This is a temporary hack.
|
509
|
+
# attr['original_title'] can be nil --
|
510
|
+
# it shouldn't be
|
511
|
+
if attr['original_title']
|
512
|
+
if attr['options'] and attr['options'].include? 'numbered'
|
513
|
+
env = attr['original_title'].downcase
|
514
|
+
else
|
515
|
+
env = attr['original_title'].downcase+'*'
|
516
|
+
end
|
517
|
+
else
|
518
|
+
env = 'click'
|
358
519
|
end
|
359
520
|
|
360
|
-
# warn "end click_process\n".blue if $VERBOSE
|
361
521
|
|
362
|
-
output
|
363
522
|
|
523
|
+
if self.id == nil # No label
|
524
|
+
$tex.env env, content
|
525
|
+
else
|
526
|
+
label = $tex.macro 'label', self.id
|
527
|
+
$tex.env env, "#{label}\n#{content}"
|
528
|
+
end
|
364
529
|
end
|
365
530
|
|
366
531
|
def toc_process
|
367
|
-
warn "Please implement me! (toc_process)".red if $VERBOSE
|
532
|
+
# warn "Please implement me! (toc_process)".red if $VERBOSE
|
368
533
|
end
|
369
534
|
|
370
535
|
def report
|
371
536
|
# Report on this node
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
537
|
+
warn ["OPEN BLOCK:".magenta, "id: #{self.id}"].join(" ")
|
538
|
+
warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ")
|
539
|
+
warn ["Attributes:".magenta, "#{self.attributes}".cyan].join(" ")
|
540
|
+
warn ["Title: ".magenta, title.cyan, "style:", self.style].join(" ") if title
|
541
|
+
warn ["Content:".magenta, "#{self.content}".yellow].join(" ")
|
542
|
+
warn ["Style:".green, "#{self.style}".red].join(" ")
|
378
543
|
# warn ["METHODS:".red, "#{self.methods}".yellow].join(" ")
|
379
544
|
end
|
380
545
|
|
@@ -400,53 +565,47 @@ module Asciidoctor
|
|
400
565
|
#
|
401
566
|
def open_process
|
402
567
|
|
403
|
-
report if $VERBOSE
|
404
|
-
|
405
568
|
attr = self.attributes
|
406
569
|
|
407
|
-
# warn "attributes (open block): #{self.attributes}" if $VERBOSE
|
408
|
-
|
409
|
-
|
410
570
|
# Get title !- nil or make a dummy one
|
411
571
|
title = self.attributes["title"]
|
412
572
|
if title == nil
|
413
573
|
title = "Dummy"
|
414
574
|
end
|
415
575
|
|
416
|
-
|
417
|
-
|
418
|
-
|
419
576
|
# strip constructs like {counter:theorem} from the title
|
420
577
|
title = title.gsub /\{.*?\}/, ""
|
421
578
|
title = title.strip
|
422
579
|
|
423
580
|
if attr['role'] == 'text-center'
|
424
|
-
|
581
|
+
$tex.env 'center', self.content
|
425
582
|
else
|
426
583
|
self.content
|
427
584
|
end
|
428
585
|
|
429
|
-
|
430
586
|
end
|
431
587
|
|
432
588
|
def listing_process
|
433
|
-
# warn ["Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
434
|
-
# warn "attributes: #{self.attributes}".cyan if $VERBOSE
|
435
589
|
"\\begin\{verbatim\}\n#{self.content}\n\\end\{verbatim\}\n"
|
436
590
|
end
|
437
591
|
|
438
592
|
def example_process
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
593
|
+
id = self.attributes['id']
|
594
|
+
if self.title
|
595
|
+
heading = $tex.region 'bf', self.title
|
596
|
+
content = "-- #{heading}.\n#{self.content}"
|
597
|
+
else
|
598
|
+
content = self.content
|
599
|
+
end
|
600
|
+
if id
|
601
|
+
hypertarget = $tex.hypertarget id, self.content.split("\n")[0]
|
602
|
+
content = "#{hypertarget}\n#{content}" if id
|
603
|
+
end
|
604
|
+
$tex.env 'example', content
|
445
605
|
end
|
446
606
|
|
447
607
|
|
448
608
|
def floating_title_process
|
449
|
-
# warn ["Node:".blue, "section[#{self.level}]:".cyan, "#{self.title}"].join(" ") if $VERBOSE
|
450
609
|
doctype = self.document.doctype
|
451
610
|
|
452
611
|
tags = { 'article' => [ 'part', 'section', 'subsection', 'subsubsection', 'paragraph' ],
|
@@ -458,8 +617,6 @@ module Asciidoctor
|
|
458
617
|
end
|
459
618
|
|
460
619
|
def image_process
|
461
|
-
# warn ["IXX: Node:".magenta, "#{self.blockname}".cyan].join(" ") if $VERBOSE
|
462
|
-
# warn "IXX: attributes: #{self.attributes}".cyan if $VERBOSE
|
463
620
|
if self.attributes['width']
|
464
621
|
width = "#{self.attributes['width'].to_f/100.0}truein"
|
465
622
|
else
|
@@ -467,19 +624,21 @@ module Asciidoctor
|
|
467
624
|
end
|
468
625
|
raw_image = self.attributes['target']
|
469
626
|
if document.attributes['noteshare'] == 'yes'
|
470
|
-
# warn "IXX: extracting image name".red if $VERBOSE
|
471
627
|
image_rx = /image.*original\/(.*)\?/
|
472
628
|
match_data = raw_image.match image_rx
|
473
629
|
if match_data
|
474
630
|
image = match_data[1]
|
475
|
-
# warn "IXX: image name: #{image}".red if $VERBOSE
|
476
631
|
else
|
477
632
|
image = "undefined"
|
478
633
|
end
|
479
634
|
else
|
480
635
|
image = raw_image
|
481
636
|
end
|
482
|
-
|
637
|
+
if self.title and self.title != ''
|
638
|
+
caption = "\\caption\{#{self.attributes['title']}\}"
|
639
|
+
else
|
640
|
+
caption = ''
|
641
|
+
end
|
483
642
|
refs = self.parent.document.references # [:ids]
|
484
643
|
if self.attributes['align'] == 'center'
|
485
644
|
align = '\\centering'
|
@@ -503,7 +662,11 @@ module Asciidoctor
|
|
503
662
|
else
|
504
663
|
position = '[h]'
|
505
664
|
end
|
506
|
-
"
|
665
|
+
# pos_option = "#{figure_type}}#{position}"
|
666
|
+
# incl_graphics = $tex.macro_opt, "width=#{width}", image
|
667
|
+
# $tex.env figure_type, "#{pos_option}\{#{ftext_width}\}", incl_graphics,
|
668
|
+
#\n\\includegraphics[width=#{width}]{#{image}}\n#{caption}\n#{align}"
|
669
|
+
"\\begin{#{figure_type}}#{position}\{#{ftext_width}\}\n\\centering\\includegraphics[width=#{width}]{#{image}}\n#{caption}\n#{align}\n\\end{#{figure_type}}\n"
|
507
670
|
end
|
508
671
|
|
509
672
|
def preamble_process
|
@@ -512,17 +675,25 @@ module Asciidoctor
|
|
512
675
|
|
513
676
|
|
514
677
|
def sidebar_process
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
678
|
+
title = self.title
|
679
|
+
attr = self.attributes
|
680
|
+
id = attr['id']
|
681
|
+
if id
|
682
|
+
content = "\\hypertarget\{#{id}\}\{#{self.content}\}"
|
683
|
+
else
|
684
|
+
content = self.content
|
685
|
+
end
|
686
|
+
if title
|
687
|
+
title = $tex.env 'bf', title
|
688
|
+
$tex.env 'sidebar', "#{title}\\\\#{content}"
|
689
|
+
else
|
690
|
+
$tex.env 'sidebar', content
|
691
|
+
end
|
519
692
|
end
|
520
693
|
|
521
694
|
def verse_process
|
522
|
-
#
|
523
|
-
|
524
|
-
# warn "attributes: #{self.attributes}".cyan if $VERBOSE
|
525
|
-
"\\begin\{alltt\}\n#{self.content}\n\\end\{alltt\}\n"
|
695
|
+
# $tex.env 'alltt', self.content
|
696
|
+
$tex.env 'verse', self.content
|
526
697
|
end
|
527
698
|
|
528
699
|
end # class Block
|
@@ -543,40 +714,52 @@ module Asciidoctor
|
|
543
714
|
when 'inline_callout'
|
544
715
|
self.inline_callout_process
|
545
716
|
else
|
546
|
-
# warn "This is Asciidoctor::Inline, tex_process. I don't know how to do that (#{self.node_name})".yellow if $VERBOSE
|
547
717
|
""
|
548
718
|
end
|
549
719
|
end
|
550
720
|
|
551
721
|
def inline_quoted_process
|
552
|
-
|
722
|
+
warn "THIS IS: inline_quoted_process: #{self.type}" if $VERBOSE
|
553
723
|
case self.type
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
724
|
+
when :strong
|
725
|
+
"\\textbf\{#{self.text}\}"
|
726
|
+
when :emphasis
|
727
|
+
"\\emph\{#{self.text}\}"
|
728
|
+
when :asciimath
|
729
|
+
output = Asciidoctor.convert( self.text, backend: 'html')
|
730
|
+
output
|
731
|
+
when :monospaced
|
732
|
+
"\\textt\{#{self.text}\}"
|
733
|
+
when :superscript
|
734
|
+
"$\{\}^{#{self.text}}$"
|
735
|
+
when :subscript
|
736
|
+
"$\{\}_{#{self.text}}$"
|
737
|
+
when :mark
|
738
|
+
"\\colorbox\{yellow\}\{ #{self.text}\}"
|
739
|
+
when :double
|
740
|
+
"``#{self.text}''"
|
741
|
+
when :single
|
742
|
+
"`#{self.text}'"
|
743
|
+
when :latexmath
|
744
|
+
"\\(#{LaTeX::TeXPostProcess.stem_substitutions self.text}\\)"
|
745
|
+
# output = Asciidoctor.convert self.text, {stem: 'asciimath', backend: 'html'}
|
746
|
+
self.text
|
747
|
+
when :unquoted
|
748
|
+
role = self.attributes["role"]
|
749
|
+
if role == "red"
|
750
|
+
"\\rolered\{ #{self.text}\}"
|
751
|
+
elsif role == "blue"
|
752
|
+
"\\roleblue\{ #{self.text}\}"
|
753
|
+
else
|
754
|
+
# warn "This is inline_quoted_process. I don't understand role = #{role}" if $VERBOSE
|
755
|
+
end
|
568
756
|
else
|
569
|
-
|
570
|
-
end
|
571
|
-
else
|
572
|
-
"\\unknown\\{#{self.text}\\}"
|
757
|
+
"\\unknown\\{#{self.text}\\}"
|
573
758
|
end
|
574
759
|
end
|
575
760
|
|
576
761
|
def inline_anchor_process
|
577
762
|
|
578
|
-
# warn ["Node:".blue, "#{self.node_name}".magenta, "type[#{self.type}], ".green + " text: #{self.text} target: #{self.target}".cyan].join(" ") if $VERBOSE
|
579
|
-
|
580
763
|
refid = self.attributes['refid']
|
581
764
|
refs = self.parent.document.references[:ids]
|
582
765
|
# FIXME: the next line is HACKISH (and it crashes the app when refs[refid]) is nil)
|
@@ -592,33 +775,27 @@ module Asciidoctor
|
|
592
775
|
reftext = ""
|
593
776
|
end
|
594
777
|
case self.type
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
else
|
604
|
-
# warn "!! : undefined inline anchor -----------".magenta if $VERBOSE
|
778
|
+
when :link
|
779
|
+
$tex.macro 'href', self.target, self.text
|
780
|
+
when :ref
|
781
|
+
$tex.macro 'label', self.text.gsub(/\[(.*?)\]/, "\\1")
|
782
|
+
when :xref
|
783
|
+
$tex.macro 'hyperlink', refid, reftext
|
784
|
+
else
|
785
|
+
# warn "!!".magenta if $VERBOSE
|
605
786
|
end
|
606
787
|
end
|
607
788
|
|
608
789
|
def inline_break_process
|
609
|
-
# warn ["Node:".blue, "#{self.node_name}".cyan, "type[#{self.type}], ".green + " text: #{self.text}"].join(" ") if $VERBOSE
|
610
790
|
"#{self.text} \\\\"
|
611
791
|
end
|
612
792
|
|
613
793
|
def inline_footnote_process
|
614
|
-
|
615
|
-
# # warn self.content.yellow
|
616
|
-
# # warn self.style.magenta
|
617
|
-
"\\footnote\{#{self.text}\}"
|
794
|
+
$tex.macro 'footnote', self.text
|
618
795
|
end
|
619
796
|
|
620
797
|
def inline_callout_process
|
621
|
-
warn "Please implement me! (inline_callout_process)".red if $VERBOSE
|
798
|
+
# warn "Please implement me! (inline_callout_process)".red if $VERBOSE
|
622
799
|
end
|
623
800
|
|
624
801
|
end
|