Sha256: 9f062c8f8fb863574971228d96bcbeb8245bdd4edf79a2c9b6e771dff2bf6b1c

Contents?: true

Size: 991 Bytes

Versions: 4

Compression:

Stored size: 991 Bytes

Contents

#!/usr/bin/env ruby

require 'optparse'

require 'markdown_helper'

options = {:pristine => false}

# Save opts for use below.
opts = nil
parser = OptionParser.new do |_opts|
  opts = _opts
  _opts.banner = "Usage: markdown_helper create_page_toc [options] markdown_file_path toc_file_path"
  _opts.on('--pristine', 'No comments added') do |_|
    options[:pristine] = true
  end
  _opts.on('--help', 'Display help') do
    usage(_opts)
  end
end

def usage(opts)
  puts ''
  puts opts
  puts <<-EOT
    
  where

    * markdown_file_path is the path to an existing markdown file.
    * toc_file_path is the path to the table-of-contents file to be created.

  Typically:

    * Both file types are .md.
    * The markdown file contains various headings.
EOT
  exit
end

parser.parse!

_, markdown_file_path, toc_file_path = ARGV

usage(opts) unless ARGV.size == 3

MarkdownHelper.new(options).create_page_toc(markdown_file_path, toc_file_path)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
markdown_helper-2.1.0 bin/_create_page_toc
markdown_helper-2.0.0 bin/_create_page_toc
markdown_helper-1.9.9 bin/_create_page_toc
markdown_helper-1.9.5 bin/_create_page_toc