Class: Stic::Metadata::BlockCommentYaml

Inherits:
Yaml
  • Object
show all
Defined in:
lib/stic/metadata/block_comment_yaml.rb

Overview

The BlockCommentYaml front matter parses YAML meta data from an block comment at the beginning of a page.

Examples:

/**
 * title: An Example
 */
/*
title: An Example
*/
/* title: An Example */

Constant Summary collapse

BLOCK_COMMENT_YAML_REGEXP =
%r{\A/\**\s*(?<data>.*?\n?)(\s*\*/\s*(\n|$)|^\s*\*/)(?<content>.*)\z}m

Constants inherited from Yaml

Yaml::DASHED_YAML_REGEXP

Instance Method Summary collapse

Methods inherited from Yaml

#match, #parse, #preprocess_content

Methods inherited from Parser

#parse

Instance Method Details

#preprocess_data(blob, data) ⇒ Object



28
29
30
# File 'lib/stic/metadata/block_comment_yaml.rb', line 28

def preprocess_data(blob, data)
  data.gsub(/^\s*\*/, "\n")
end

#regexpObject



24
25
26
# File 'lib/stic/metadata/block_comment_yaml.rb', line 24

def regexp
  BLOCK_COMMENT_YAML_REGEXP
end