Skip to content

Commit

Permalink
Merge branch 'master' into webmaker
Browse files Browse the repository at this point in the history
  • Loading branch information
takahashim committed Apr 21, 2016
2 parents 65a7687 + ec37c10 commit eb0e8eb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
18 changes: 10 additions & 8 deletions bin/review-init
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ end

def generate_layout(dir)
FileUtils.mkdir_p dir + '/layouts'
if @epub_version.to_i == 2
FileUtils.cp @review_dir + "/templates/html/layout-xhtml1.html.erb", dir + '/layouts/layout.html.erb'
else
FileUtils.cp @review_dir + "/templates/html/layout-html5.html.erb", dir + '/layouts/layout.html.erb'
end
end

def generate_catalog_file(dir)
Expand Down Expand Up @@ -115,11 +110,18 @@ def generate_cover_image(dir)
end

def generate_config(dir)
today = Time.now.strftime("%Y-%m-%d")
content = File.read(@review_dir + "/doc/config.yml.sample")
content.gsub!(/^#\s*coverimage:.*$/, 'coverimage: cover.jpg')
content.gsub!(/^#\s*date:.*$/, "date: #{today}")
content.gsub!(/^#\s*history:.*$/, %Q|history: [["#{today}"]]|)
content.gsub!(/^#\s*texstyle:.*$/, "texstyle: reviewmacro")
content.gsub!(/^(#\s*)?stylesheet:.*$/, %Q|stylesheet: ["style.css"]|)
if @epub_version.to_i == 2
FileUtils.cp @review_dir + "/test/sample-book/src/config-epub2.yml", File.join(dir, "config.yml")
else
FileUtils.cp @review_dir + "/test/sample-book/src/config.yml", dir
content.gsub!(/^#.*epubversion:.*$/,'epubversion: 2')
content.gsub!(/^#.*htmlversion:.*$/,'htmlversion: 4')
end
File.open(File.join(dir, "config.yml"), "w"){|f| f.write(content) }
end

def generate_style(dir)
Expand Down
6 changes: 6 additions & 0 deletions doc/config.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ aut: ["青木峰郎", "武藤健志", "高橋征義", "角征典"]
# デバッグフラグ。nullでないときには一時ファイルをカレントディレクトリに作成し、削除もしない
debug: null

# 固有IDに使用するドメイン。指定しない場合には、時刻に基づくランダムUUIDが入る
# urnid: urn:uid:http://example.com/book-title/
#
# ISBN。省略した場合はurnidが入る
# isbn: null
#
# HTMLファイルの拡張子(省略した場合はhtml)
# htmlext: html
#
Expand Down
9 changes: 6 additions & 3 deletions lib/review/makerhelper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
require 'yaml'

module ReVIEW
class MakerHelper
module MakerHelper
# Return review/bin directory
def self.bindir
def bindir
Pathname.new("#{Pathname.new(__FILE__).realpath.dirname}/../../bin").realpath
end
module_function :bindir

# Copy image files under from_dir to to_dir recursively
# ==== Args
Expand All @@ -34,7 +35,7 @@ def self.bindir
# Image files are copied recursively, and each '.eps' file is converted into '.eps.png'
#

def self.copy_images_to_dir(from_dir, to_dir, options = {})
def copy_images_to_dir(from_dir, to_dir, options = {})
image_files = []

Dir.open(from_dir) do |dir|
Expand Down Expand Up @@ -64,5 +65,7 @@ def self.copy_images_to_dir(from_dir, to_dir, options = {})

image_files
end
module_function :copy_images_to_dir

end
end

0 comments on commit eb0e8eb

Please sign in to comment.