<commit_before>#!/usr/bin/ruby
require 'optparse'
require 'yaml'

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: example.rb [options]"

  opts.on('-d', '--date YYYY-MM-DD', 'Post date in YYYY-MM-DD') { |v| options[:post_date] = v }
  opts.on('-t', '--title "Title"', 'Post Title') { |v| options[:post_title] = v }

end.parse!

# For debugging, uncomment the next line
# puts options

postFilename = (options[:post_date] + "-" + (options[:post_title]) + ".md").gsub! /\s+/, '-'

frontmatter = {
  'layout' => 'post',
  'title' => options[:post_title],
  'date' => options[:post_date],
}

# ---
# layout:     post
# title:      Post title
# date:       2016-06-10 12:31:19
# summary:    Post summary<commit_msg>Added tags and categories. Both are output using YAML sequences.<commit_after>#!/usr/bin/ruby
require 'optparse'
require 'yaml'

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: example.rb [options]"

  opts.on('-d', '--date YYYY-MM-DD', 'Post date in YYYY-MM-DD') { |v| options[:post_date] = v }
  opts.on('-t', '--title "Title"', 'Post Title') { |v| options[:post_title] = v }
  opts.on('-a', '--tags "tag1 tag2"', 'Tags for post - Space delimited') { |v| options[:post_tags] = v.split }	
  opts.on('-c', '--categories "cat1 cat2"', 'Categories for post - Space delimited') { |v| options[:post_categories] = v.split }

end.parse!

# For debugging, uncomment the next line
# puts options

postFilename = (options[:post_date] + "-" + (options[:post_title]) + ".md").gsub! /\s+/, '-'

frontmatter = {
  'layout' => 'post',
  'title' => options[:post_title],
  'date' => options[:post_date],
  'tags' => options[:post_tags],
  'categories' => options[:post_categories]
}

# ---
# layout:     post
# title:      Post title
# date:       2016-06-10 12:31:19
# summary:    Post summary
{'fraction_non_alphanumeric': 0.20593080724876442, 'fraction_numerical': 0.01757276221856123, 'mean_word_length': 3.683804627249357, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2515068', 'n_tokens_mistral': 701, 'n_tokens_neox': 664, 'n_words': 162}