Class: Asciidoctor::Html::SubnavBlockMacro
- Inherits:
-
Extensions::BlockMacroProcessor
- Object
- Extensions::BlockMacroProcessor
- Asciidoctor::Html::SubnavBlockMacro
- Defined in:
- lib/asciidoctor/html/subnav_block_macro.rb
Overview
Inserts a subnav for current chapter
Instance Method Summary collapse
Instance Method Details
#process(parent, _target, attrs) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/asciidoctor/html/subnav_block_macro.rb', line 14 def process(parent, _target, attrs) title = %(<h5 class="block-title">#{attrs["title"]}</h5>) if attrs.include?("title") bordered_class = " bordered" if attrs.include?("border") border_width = attrs["border"].to_i if bordered_class style = %( style="border-top-width: #{border_width}px; border-bottom-width: #{border_width}px;") if border_width roles = attrs["role"] if attrs.include?("role") roles = attrs["roles"] if attrs.include?("roles") role = " #{roles.tr ",", " "}" if roles content = <<~HTML <div class="subnav#{bordered_class}#{role}"#{style}> #{title} <nav> <%= subnav %> </nav> </div> HTML create_pass_block parent, content, attrs, subs: nil end |