Class: Coradoc::AsciiDoc::ReferenceMaterializers::Navigation

Inherits:
Reference::Materializer::Base
  • Object
show all
Defined in:
lib/coradoc/asciidoc/reference_materializers/navigation.rb

Overview

Render a navigation edge as a first-class CrossReferenceElement — the model-driven xref node the AsciiDoc serializer already knows how to emit (never a raw macro string). Materializing for AsciiDoc fills in the visible text from the authored label or the resolved target's title.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.formatObject



21
22
23
# File 'lib/coradoc/asciidoc/reference_materializers/navigation.rb', line 21

def format
  :asciidoc
end

.kindObject



13
14
15
# File 'lib/coradoc/asciidoc/reference_materializers/navigation.rb', line 13

def kind
  :navigation
end

.presentationObject



17
18
19
# File 'lib/coradoc/asciidoc/reference_materializers/navigation.rb', line 17

def presentation
  :any
end

Instance Method Details

#materialize(edge:, result:) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/coradoc/asciidoc/reference_materializers/navigation.rb', line 26

def materialize(edge:, result:, **)
  text = display_text(edge, result)
  Coradoc::CoreModel::CrossReferenceElement.new(
    target: xref_target(edge.address),
    content: text,
    children: [
      Coradoc::CoreModel::TextElement.new(content: text)
    ]
  )
end