Class: Coradoc::Html::ReferenceMaterializers::Navigation
- Inherits:
-
Reference::Materializer::Base
- Object
- Reference::Materializer::Base
- Coradoc::Html::ReferenceMaterializers::Navigation
- Defined in:
- lib/coradoc/html/reference_materializers/navigation.rb
Overview
Render a navigation edge (:navigation kind) as an HTML-shaped CoreModel::LinkElement. The href is computed by asking the Presentation where the target lives (so the same edge renders to different hrefs under different presentations). Edges whose target lives on another page get a page-prefixed href.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.format ⇒ Object
21 22 23 |
# File 'lib/coradoc/html/reference_materializers/navigation.rb', line 21 def format :html end |
.kind ⇒ Object
13 14 15 |
# File 'lib/coradoc/html/reference_materializers/navigation.rb', line 13 def kind :navigation end |
.presentation ⇒ Object
17 18 19 |
# File 'lib/coradoc/html/reference_materializers/navigation.rb', line 17 def presentation :any end |
Instance Method Details
#materialize(edge:, result:, node:, presentation:, pages:) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/coradoc/html/reference_materializers/navigation.rb', line 26 def materialize(edge:, result:, node:, presentation:, pages:) href = href_for(edge, result, node, presentation, pages) text = display_text(edge, result) Coradoc::CoreModel::LinkElement.new( target: href, content: text, children: [ Coradoc::CoreModel::TextElement.new(content: text) ] ) end |