Module: Coradoc::FormatModule::Interface

Defined in:
lib/coradoc/format_module.rb

Overview

Default implementations for optional format module methods. Format modules are auto-extended with this during registration.

Instance Method Summary collapse

Instance Method Details

#handles_model?(_model) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/coradoc/format_module.rb', line 25

def handles_model?(_model)
  false
end

#parse_file_to_core(path, content = nil) ⇒ Coradoc::CoreModel::Base

Parse a file to CoreModel, handling file-specific concerns like include resolution. Format modules that support include directives or file-relative references should override this method.

Parameters:

  • path (String)

    path to the source file

  • content (String, nil) (defaults to: nil)

    pre-read file content (hooks may have modified it)

Returns:



50
51
52
# File 'lib/coradoc/format_module.rb', line 50

def parse_file_to_core(path, content = nil)
  parse_to_core(content || File.read(path))
end

#preserves_unresolved_includes?Boolean

Whether the serializer can represent unresolved include edges (graph-mode CoreModel::Include nodes) without losing them. Formats that round-trip the directive natively (asciidoc, mirror) or preserve it explicitly (markdown comments) override this to true; formats that would silently drop the content keep the default false, and the pipeline raises instead of losing it.

Returns:

  • (Boolean)


39
40
41
# File 'lib/coradoc/format_module.rb', line 39

def preserves_unresolved_includes?
  false
end

#serialize?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/coradoc/format_module.rb', line 29

def serialize?
  true
end