"
else
puts "
"
end
end
def _table_after(id, caption, opts)
puts "
"
end
def _table_bottom(hline: false)
end
def _table_tr(cells, hline: false)
if hline
"
#{cells.join}
"
else
"
#{cells.join}
"
end
end
public
## //imgtable
def imgtable(lines, id, caption=nil, option=nil)
super
end
protected
def _render_imgtable(id, caption, opts)
puts "
"
table_header(id, caption, opts)
puts "
"
yield
puts "
"
puts "
"
end
def _render_imgtable_caption(caption)
end
def _render_imgtable_label(id)
end
public
#### インライン命令
def inline_fn(id)
@_fn_count ||= 0
@_fn_labels ||= {}
n = (@_fn_count += 1)
@_fn_labels[id] = n
return "[^#{n}]"
end
## 改段落(箇条書き内では空行を入れられないため)
def inline_par(arg)
#blank()
"
"
end
## ファイル名
def inline_file(str)
"`#{str}`"
end
def on_inline_file
"`#{yield}`"
end
## ユーザ入力
def inline_userinput(str)
str
end
def on_inline_userinput
yield
end
## 引数をそのまま表示 (No Operation)
def inline_nop(str)
str || ""
end
alias inline_letitgo inline_nop
## 目立たせない(@
{} の反対)
def inline_weak(str)
str
end
def on_inline_weak
yield
end
## 文字を小さくする
def inline_small(str); str; end
def inline_xsmall(str); str; end
def inline_xxsmall(str); str; end
def on_inline_small(); yield; end
def on_inline_xsmall(); yield; end
def on_inline_xxsmall(); yield; end
## 文字を大きくする
def inline_large(str); str; end
def inline_xlarge(str); str; end
def inline_xxlarge(str); str; end
def on_inline_large(); yield; end
def on_inline_xlarge(); yield; end
def on_inline_xxlarge(); yield; end
## 文字を大きくした@{}
def inline_strong(str); str; end
def inline_xstrong(str); str; end
def inline_xxstrong(str); str; end
def on_inline_strong(); yield; end
def on_inline_xstrong(); yield; end
def on_inline_xxstrong(); yield; end
## コードブロック中で折り返し箇所を手動で指定する
def inline_foldhere(arg)
""
end
## ターミナルでのカーソル(背景が白、文字が黒)
def inline_cursor(str)
"[#{str}]"
end
## nestable inline commands
def on_inline_i() ; "*#{yield}*" ; end
#def on_inline_b() ; "**#{yield}**" ; end
#def on_inline_code() ; "`#{yield}`" ; end
def on_inline_tt() ; "#{yield}" ; end
def on_inline_del() ; "~~#{yield}~~" ; end
def on_inline_sub() ; "#{yield}" ; end
def on_inline_sup() ; "#{yield}" ; end
def on_inline_em() ; "#{yield}" ; end
def on_inline_strong(); "**#{yield}**" ; end
def on_inline_u() ; "#{yield}" ; end
def on_inline_ami() ; "#{yield}"; end
def on_inline_balloon(); "← #{yield}"; end
def on_inline_b()
if within_codeblock?()
#"#{yield}"
yield
else
"**#{yield}**"
end
end
def on_inline_code()
with_context(:code) do
return "`#{yield}`"
end
end
## 「“」と「”」で囲む
def on_inline_qq()
"“#{yield}”"
end
def build_inline_href(url, escaped_label) # compile_href()をベースに改造
if escaped_label.present?
"[#{escaped_label}](#{url})"
else
url
end
end
def inline_hlink(str)
url, label = str.split(/, /, 2)
flag_link = @book.config['externallink']
return _inline_hyperlink(url, escape(label), flag_link)
end
def _inline_hyperlink(url, escaped_label, flag_link)
if flag_link
label = escaped_label || url
"#{label}"
elsif escaped_label
I18n.t('external_link', [escaped_label, url])
else
escape_html(url)
end
end
private :_inline_hyperlink
def build_inline_ruby(escaped_word, escaped_yomi) # compile_ruby()をベースに改造
"#{escaped_word}(#{escaped_yomi})"
end
protected
## ノートを参照する
def build_noteref(chapter, label, caption)
"ノート「#{compile_inline(caption||'')}」"
end
## 数式を参照する
def build_eq(chapter, label, number)
s = "#{I18n.t('equation')}#{chapter.number}.#{number}"
"#{escape(s)}"
end
public
##########
def noindent()
end
def clearpage
blank2()
end
def on_flushright_block()
blank()
puts "[flushright]"; twospaces()
yield
truncate_blank(); twospaces()
puts "[/flushright]"
blank()
end
def on_centering_block()
blank()
puts "[centering]"; twospaces()
yield
truncate_blank(); twospaces()
puts "[/centering]"
blank()
end
def on_center_block()
blank()
puts "[center]"; twospaces()
yield
truncate_blank(); twospaces()
puts "[/center]"
blank()
end
def on_textleft_block()
blank()
puts "[textleft]"; twospaces()
yield
truncate_blank(); twospaces()
puts "[/textleft]"
blank()
end
def on_textright_block()
blank()
puts "[textright]"; twospaces()
yield
truncate_blank(); twospaces()
puts "[/textright]"
blank()
end
def on_textcenter_block()
blank()
puts "[textcenter]"; twospaces()
yield
truncate_blank(); twospaces()
puts "[/textcenter]"
blank()
end
def sampleoutputbegin(caption=nil)
blank()
if caption.present?
puts "▽#{compile_inline(caption)}"
blank()
end
puts "----------------------------------------"
blank()
end
def sampleoutputend()
blank()
puts "----------------------------------------"
blank()
end
def on_inline_B()
"**#{yield}**"
end
def inline_br(_)
"
"
end
def inline_clearpage(_)
blank2()
end
def inline_m(str)
"$#{str}$"
end
def inline_icon(imagefile)
filepath = find_image_filepath(imagefile)
""
end
def inline_par(arg)
"\n\n"
end
def inline_hd_chap(chap, id)
n = chap.headline_index.number(id)
if chap.number and @book.config['secnolevel'] >= n.split('.').size
str = I18n.t('chapter_quote', "#{n} #{compile_inline(chap.headline(id).caption)}")
else
str = I18n.t('chapter_quote', compile_inline(chap.headline(id).caption))
end
if @book.config['chapterlink']
anchor = 'h' + n.gsub('.', '-')
%Q(#{str})
else
str
end
rescue KeyError
error "unknown headline: #{id}"
end
def inline_TeX(_)
"TeX"
end
def inline_LaTeX(_)
"LaTeX"
end
def inline_hearts(_)
":heart:"
end
end
end