Class: AsciidoctorDiagramLayout::Renderer::HtmlRenderer
- Inherits:
-
Object
- Object
- AsciidoctorDiagramLayout::Renderer::HtmlRenderer
- Defined in:
- lib/asciidoctor_diagram_layout/renderer/html_renderer.rb
Overview
Renders a layout node tree to inline HTML (a nested <div> structure).
Each cell is a flex item with a CSS linear gradient background.
Constant Summary collapse
- CELL_BASE =
:nodoc:
"display:flex; align-items:center; justify-content:center;" \ " padding:8px; font-weight:bold; font-family:sans-serif;" \ " min-height:60px; box-sizing:border-box; color:#333;"
Instance Method Summary collapse
-
#render(root, options = RenderOptions.new) ⇒ String
HTML fragment.
Instance Method Details
#render(root, options = RenderOptions.new) ⇒ String
Returns HTML fragment.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/asciidoctor_diagram_layout/renderer/html_renderer.rb', line 17 def render(root, = RenderOptions.new) sb = +"" height_style = .height ? " min-height:#{.height};" : "" wrapper_style = "display:flex; width:#{.width};#{height_style}" \ " box-sizing:border-box; font-family:sans-serif; overflow:hidden;" sb << "<div style=\"#{wrapper_style}\">\n" render_node(root, sb, 1, ) sb << "</div>\n" if .title && !.title.empty? "<div class=\"imageblock\">\n<div class=\"content\">\n#{sb}</div>\n" \ "<div class=\"title\">#{.title}</div>\n</div>" else sb end end |