Class: Coradoc::Mirror::ReverseBuilder::GenericBlock

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/mirror/reverse_builder.rb

Overview

Catch-all for unrecognized block types emitted by the forward direction (‘Node::GenericBlock`). Preserves the semantic_type so downstream consumers can dispatch on it.

Instance Attribute Summary

Attributes inherited from Base

#context

Instance Method Summary collapse

Methods inherited from Base

#apply_mark, #build_content, #build_inline_children, #build_node, #extract_text, #initialize, #inline_content, registers

Constructor Details

This class inherits a constructor from Coradoc::Mirror::ReverseBuilder::Base

Instance Method Details

#build(node) ⇒ Object



557
558
559
560
561
562
563
564
565
# File 'lib/coradoc/mirror/reverse_builder.rb', line 557

def build(node)
  attrs = node.attrs
  CoreModel::Block.new(
    block_semantic_type: attrs&.semantic_type || 'generic',
    title: attrs&.title,
    id: attrs&.id,
    content: extract_text(node)
  )
end