Class: Metanorma::Plugin::Glossarist::NonVerbalFormatters::Base
- Inherits:
-
Object
- Object
- Metanorma::Plugin::Glossarist::NonVerbalFormatters::Base
- Defined in:
- lib/metanorma/plugin/glossarist/non_verbal_formatters/base.rb
Overview
Shared rendering helpers for non-verbal entity formatters.
Each formatter owns the kind-specific body (image block, table block, stem block) and delegates anchor, caption, and a11y framing to this base. Localized text is resolved by ISO 639 code with graceful fallback to the first available value.
Instance Method Summary collapse
-
#initialize(entity, lang: "eng") ⇒ Base
constructor
A new instance of Base.
- #to_asciidoc ⇒ Object
Constructor Details
#initialize(entity, lang: "eng") ⇒ Base
Returns a new instance of Base.
14 15 16 17 |
# File 'lib/metanorma/plugin/glossarist/non_verbal_formatters/base.rb', line 14 def initialize(entity, lang: "eng") @entity = entity @lang = lang end |
Instance Method Details
#to_asciidoc ⇒ Object
19 20 21 22 |
# File 'lib/metanorma/plugin/glossarist/non_verbal_formatters/base.rb', line 19 def to_asciidoc parts = [anchor_line, caption_line, body].compact.reject(&:empty?) "#{parts.join("\n")}\n" end |