Class: Metanorma::Plugin::Glossarist::NonVerbalFormatters::Base

Inherits:
Object
  • Object
show all
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.

Direct Known Subclasses

Figure, Formula, Table

Instance Method Summary collapse

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_asciidocObject



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