Skip to content

Commit

Permalink
Merge pull request #1453 from kmuto/nocomment
Browse files Browse the repository at this point in the history
add --without-config-comment option to review-init
  • Loading branch information
kmuto authored Dec 29, 2019
2 parents 3a72dbb + e603f0c commit 4d4370d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/review/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ def parse_options(args)
opts.on('', '--epub-version VERSION', 'define EPUB version.') do |version|
@epub_version = version
end
opts.on('', '--without-config-comment', "don't include comments in config.yml.") do
@without_config_comment = true
end
opts.on('', '--without-doc', "don't generate doc files.") do
@without_doc = true
end
Expand Down Expand Up @@ -176,6 +179,10 @@ def generate_config(dir)
content.gsub!(/^#\s*texdocumentclass:.*$/, %Q(texdocumentclass: ["#{@template}", "#{@tex_documentclass_opts[@template]}"]))
end

if @without_config_comment
content = content.split("\n").delete_if { |l| l.strip.start_with?('#') || l.strip.empty? }.join("\n")
end

File.open(File.join(dir, 'config.yml'), 'w') { |f| f.write content }
if @webui && !@web_result[2].empty?
File.open(File.join(dir, 'config-ebook.yml'), 'w') do |f|
Expand Down

0 comments on commit 4d4370d

Please sign in to comment.