Class: Metanorma::Html::Drops::AdmonitionDrop
- Inherits:
-
BlockElementDrop
- Object
- Liquid::Drop
- BlockElementDrop
- Metanorma::Html::Drops::AdmonitionDrop
- Defined in:
- lib/metanorma/html/drops/admonition_drop.rb
Instance Attribute Summary
Attributes inherited from BlockElementDrop
#content_html, #css_class, #id, #label_html, #type
Class Method Summary collapse
Methods inherited from BlockElementDrop
Constructor Details
This class inherits a constructor from Metanorma::Html::Drops::BlockElementDrop
Class Method Details
.from_model(admonition, renderer:) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/metanorma/html/drops/admonition_drop.rb', line 7 def self.from_model(admonition, renderer:) type = renderer.safe_attr(admonition, :type) || "note" id = renderer.safe_attr(admonition, :id) content_html = renderer.capture_output do admonition.paragraphs&.each { |para| renderer.render_paragraph(para) } end new( id: id, type: type, label_html: renderer.escape_html(type.capitalize), content_html: content_html, css_class: "admonition #{type}", ) end |