#!/usr/bin/env ruby macro :note do %{
#{@name.to_s.capitalize}#{value}
} end macro :box do exact_parameters 2 %{
#{param(0)}
#{param(1)}
} end macro :codeblock do exact_parameters 1 %{

#{value}

} end macro :image do min_parameters 1 max_parameters 3 image = param(0) alt = "@alt[-]" unless attr(:alt) image_element_for image, alt do |alt, dest_file| interpret "img[#{alt}@src[#{Glyph["output.#{Glyph['document.output']}.base"]}#{dest_file}]#{@node.attrs.join}]" end end macro :figure do min_parameters 1 max_parameters 2 image = param(0) alt = "@alt[-]" unless attr(:alt) caption = "div[@class[caption]#{param(1)}]" rescue nil figure_element_for image, alt, caption do |alt, dest_file, caption| interpret %{div[@class[figure] img[#{alt}@src[#{Glyph["output.#{Glyph['document.output']}.base"]}#{dest_file}]#{@node.attrs.join}] #{caption} ]} end end macro :title do no_parameters title_element do %{

#{Glyph["document.title"]}

} end end macro :subtitle do no_parameters subtitle_element do %{

#{Glyph["document.subtitle"]}

} end end macro :author do no_parameters author_element do %{
by #{Glyph["document.author"]}
} end end macro :pubdate do no_parameters %{
#{Time.now.strftime("%B %Y")}
} end macro :revision do no_parameters revision_element do %{
#{Glyph['document.revision']}
} end end macro :navigation do exact_parameters 1 procs = {} procs[:contents] = lambda do %{Contents} end procs[:previous] = lambda do |topic| if topic then %{#{topic[:title]} ←} else "" end end procs[:next] = lambda do |topic| if topic then %{→ #{topic[:title]}} else "" end end procs[:navigation] = lambda do |contents, prev_link, next_link| %{} end navigation_element_for param(0).to_sym, procs end macro_alias :important => :note macro_alias :tip => :note macro_alias :caution => :note