Class: Cooklang::Processors::MetadataProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/cooklang/processors/metadata_processor.rb

Class Method Summary collapse

Class Method Details

.extract_metadata(tokens) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cooklang/processors/metadata_processor.rb', line 9

def (tokens)
   = Metadata.new
  content_tokens = []

  # Check for YAML front matter
  if tokens.first&.type == :yaml_delimiter
    , content_tokens, _ = extract_yaml_frontmatter(tokens)
  else
    content_tokens = tokens.dup
  end

  # Extract inline metadata
  (content_tokens, )

  [, content_tokens]
end