From fbe60ecb1f4d36da24c51d06686eeef9b076cd26 Mon Sep 17 00:00:00 2001 From: Duarte Pinto Date: Thu, 25 Jul 2019 15:30:40 +0100 Subject: [PATCH] v0.1.0 --- README.md | 1 + bin/jocasta | 9 ++++----- jocasta.gemspec | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 362d811..4f32013 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Utility to extract a section of a Markdown file and write it into a separate fil Options: * __--title__ - Title that will replace the section title in the output file. If none, it will use the same title. +* __--out_level__ - Level of the parent section in the output file. If none, it will keep the same level. Named after [Jocasta Nu](https://starwars.fandom.com/wiki/Jocasta_Nu) from Star Wars. Based on script made by [ReSwift](https://github.com/ReSwift/ReSwift/blob/master/.scripts/doc-preprocessor) diff --git a/bin/jocasta b/bin/jocasta index 422233a..0e9e1f3 100755 --- a/bin/jocasta +++ b/bin/jocasta @@ -3,9 +3,6 @@ require 'json' -# This script is based on a script by ReSwift that can be found at -# https://github.com/ReSwift/ReSwift/blob/master/.scripts/doc-preprocessor - def parse_options(paired_args) options = { args: [] } index = 0 @@ -56,7 +53,8 @@ def get_section(content, level, section) end paired_args = { - '--title' => :title + '--title' => :title, + '--out_level' => :out_level } options = parse_options paired_args @@ -77,7 +75,8 @@ unless result end level_hash = '' -(1..level).each do +out_level = options[:out_level] || level +(1..out_level.to_i).each do level_hash += '#' end result = if options[:title] diff --git a/jocasta.gemspec b/jocasta.gemspec index 5395d65..0706db6 100644 --- a/jocasta.gemspec +++ b/jocasta.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'jocasta' - s.version = '0.0.1' + s.version = '0.1.0' s.date = '2019-07-24' s.summary = "Utility to extract a section of a Markdown file and write it into a separate file." s.authors = ["Duarte Pinto"]