From a282e6c53e4b4a9b87f124d5c207c73a327d51dc Mon Sep 17 00:00:00 2001 From: retorquere Date: Wed, 3 Feb 2016 13:56:44 +0100 Subject: [PATCH] YAML front matter --- .../generator/generator_generation.rb | 4 +++- lib/github_changelog_generator/parser.rb | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/github_changelog_generator/generator/generator_generation.rb b/lib/github_changelog_generator/generator/generator_generation.rb index d642d57..337d377 100644 --- a/lib/github_changelog_generator/generator/generator_generation.rb +++ b/lib/github_changelog_generator/generator/generator_generation.rb @@ -8,7 +8,9 @@ module GitHubChangelogGenerator sort_tags_by_date(@filtered_tags) fetch_issues_and_pr - log = "#{@options[:header]}\n\n" + log = '' + log += @options[:frontmatter] if @options[:frontmatter] + log += "#{@options[:header]}\n\n" if @options[:unreleased_only] log += generate_log_between_tags(filtered_tags[0], nil) diff --git a/lib/github_changelog_generator/parser.rb b/lib/github_changelog_generator/parser.rb index 2f16d9b..f1440f0 100644 --- a/lib/github_changelog_generator/parser.rb +++ b/lib/github_changelog_generator/parser.rb @@ -68,6 +68,9 @@ module GitHubChangelogGenerator opts.on("--header-label [LABEL]", "Setup custom header label. Default is \"# Change Log\"") do |v| options[:header] = v end + opts.on("--front-matter [JSON]", "Add YAML front matter. Formatted as JSON because it's easier to add on the command line") do |v| + options[:frontmatter] = JSON.parse(v).to_yaml + "---\n" + end opts.on("--pr-label [LABEL]", "Setup custom label for pull requests section. Default is \"**Merged pull requests:**\"") do |v| options[:merge_prefix] = v end