Class: Coradoc::Reference::Presentation::Base
- Inherits:
-
Object
- Object
- Coradoc::Reference::Presentation::Base
- Defined in:
- lib/coradoc/reference/presentation/base.rb
Overview
Protocol base. Subclasses implement #layout (resolved graph →
Pages) and #locate_page (find which page a target lives on).
A Presentation NEVER reads the original document — it consumes the resolved graph produced by the Resolver. It never renders.
Direct Known Subclasses
Class Method Summary collapse
-
.key ⇒ Object
Registry key used in materializer lookup tuples [kind, presentation, format].
Instance Method Summary collapse
- #key ⇒ Object
-
#layout(resolved_graph) ⇒ Array<Page>
Lay out the resolved graph as a tree of Pages.
-
#locate_page(edge, target_content, pages:) ⇒ Page?
Given an Edge and its resolved target, find the Page where the target lives.
Class Method Details
.key ⇒ Object
Registry key used in materializer lookup tuples [kind, presentation, format]. Subclasses override so materializers can target a specific layout.
15 16 17 |
# File 'lib/coradoc/reference/presentation/base.rb', line 15 def self.key :any end |
Instance Method Details
#key ⇒ Object
19 20 21 |
# File 'lib/coradoc/reference/presentation/base.rb', line 19 def key self.class.key end |
#layout(resolved_graph) ⇒ Array<Page>
Lay out the resolved graph as a tree of Pages. Subclasses decide slicing, ordering, hierarchy.
29 30 31 |
# File 'lib/coradoc/reference/presentation/base.rb', line 29 def layout(resolved_graph) raise NotImplementedError end |
#locate_page(edge, target_content, pages:) ⇒ Page?
Given an Edge and its resolved target, find the Page where the target lives. This is what makes cross-references survive re-pagination.
41 42 43 |
# File 'lib/coradoc/reference/presentation/base.rb', line 41 def locate_page(edge, target_content, pages:) raise NotImplementedError end |