diff --git a/.travis.yml b/.travis.yml
index a5e5f6c90..928217843 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,10 @@ language: ruby
sudo: false
dist: trusty
+os:
+ - linux
+ - osx
+
addons:
apt:
packages:
@@ -12,23 +16,20 @@ addons:
before_install:
- |-
- RUBY_VER=`ruby -e "print RUBY_VERSION"`
- if [ "$RUBY_VER" = "2.1.10" ]; then
- gem install bundler -v '< 2'
- elif [ "$RUBY_VER" = "2.2.10" ]; then
- gem install bundler -v '< 2'
- else
- gem update --system
- gem install bundler
- fi
+ gem update --system
+ gem install bundler
+ gem install epubcheck-ruby
+
+script:
+ - bundle exec rake
+ - ruby bin/review-init hello && cd hello && ruby ../bin/review-epubmaker config.yml && epubcheck book.epub
+ - cd ..
+ - ruby bin/review-init hello2 --epub-version 2 && cd hello2 && ruby ../bin/review-epubmaker config.yml && epubcheck book.epub
rvm:
- - 2.1
- - 2.2.10
- - 2.3.8
- - 2.4.5
- - 2.5.3
- - 2.6.0
+ - 2.4.6
+ - 2.5.5
+ - 2.6.3
## - ruby-head
branches:
diff --git a/appveyor.yml b/appveyor.yml
index 775f98717..9b5ee87bf 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -8,11 +8,29 @@ build_script:
- bundle exec rake test --trace --verbose
- bundle exec rubocop
+before_test:
+ - gem install -N epubcheck-ruby
+
+test_script:
+ - ruby bin/review-init hello
+ - cd hello
+ - ruby ../bin/review-epubmaker config.yml
+ - epubcheck book.epub
+ - cd ..
+ - ruby bin/review-init hello2 --epub-version 2
+ - cd hello2
+ - ruby ../bin/review-epubmaker config.yml
+ - epubcheck book.epub
+
branches:
only:
- master
environment:
matrix:
- - ruby_version: "23"
- - ruby_version: "23-x64"
\ No newline at end of file
+ - ruby_version: "24"
+ - ruby_version: "24-x64"
+ - ruby_version: "25"
+ - ruby_version: "25-x64"
+ - ruby_version: "26"
+ - ruby_version: "26-x64"
diff --git a/lib/epubmaker/epubv2.rb b/lib/epubmaker/epubv2.rb
index 00eb04454..d7a998ac5 100644
--- a/lib/epubmaker/epubv2.rb
+++ b/lib/epubmaker/epubv2.rb
@@ -39,7 +39,7 @@ def opf_metainfo
if @producer.config[item].is_a?(Array)
s << @producer.config.names_of(item).map { |i| %Q( #{CGI.escapeHTML(i)}\n) }.join
else
- s << %Q( #{CGI.escapeHTML(@producer.config.name_of(item))}\n)
+ s << %Q( #{CGI.escapeHTML(@producer.config.name_of(item).to_s)}\n)
end
end
diff --git a/lib/epubmaker/producer.rb b/lib/epubmaker/producer.rb
index d67455e90..6fa8d622d 100644
--- a/lib/epubmaker/producer.rb
+++ b/lib/epubmaker/producer.rb
@@ -192,7 +192,8 @@ def produce(epubfile, basedir = nil, tmpdir = nil)
current = Dir.pwd
basedir ||= current
- new_tmpdir = tmpdir.nil? ? Dir.mktmpdir : tmpdir
+ # use Dir to solve a path for Windows (see #1011)
+ new_tmpdir = Dir[File.join(tmpdir.nil? ? Dir.mktmpdir : tmpdir)][0]
if epubfile !~ %r{\A/}
epubfile = "#{current}/#{epubfile}"
end
diff --git a/lib/review/latexbuilder.rb b/lib/review/latexbuilder.rb
index 570abe4f0..8d4892a92 100644
--- a/lib/review/latexbuilder.rb
+++ b/lib/review/latexbuilder.rb
@@ -997,7 +997,7 @@ def inline_fn(id)
BOUTEN = '・'.freeze
def inline_bou(str)
- str.split(//).map { |c| macro('ruby', escape(c), macro('textgt', BOUTEN)) }.join('\allowbreak')
+ macro('reviewbou', escape(str))
end
def compile_ruby(base, ruby)
diff --git a/lib/review/preprocessor.rb b/lib/review/preprocessor.rb
index 5b7ac8cc2..b21b37f85 100644
--- a/lib/review/preprocessor.rb
+++ b/lib/review/preprocessor.rb
@@ -43,28 +43,6 @@ def lineno
class Preprocessor
include ErrorUtils
- class Strip
- def initialize(f)
- @f = f
- end
-
- def path
- @f.path
- end
-
- def lineno
- @f.lineno
- end
-
- def gets
- @f.each_line do |line|
- return "\#@\#\n" if /\A\#@/ =~ line
- return line
- end
- nil
- end
- end
-
def initialize(repo, param)
@repository = repo
@config = param
diff --git a/lib/review/yamlloader.rb b/lib/review/yamlloader.rb
index 932088bc9..2bd83d931 100644
--- a/lib/review/yamlloader.rb
+++ b/lib/review/yamlloader.rb
@@ -15,31 +15,38 @@ def load_file(yamlfile)
loaded_files = {}
yaml = {}
- loop do
- # Check exit condition
- return yaml if file_queue.empty?
-
+ while file_queue.present?
current_file = file_queue.shift
current_yaml = YAML.load_file(current_file)
yaml = current_yaml.deep_merge(yaml)
- next unless yaml.key?('inherit')
+ if yaml.key?('inherit')
+ inherit_files = parse_inherit(yaml, yamlfile, loaded_files)
+ file_queue = inherit_files + file_queue
+ end
+ end
+
+ yaml
+ end
- buf = []
- yaml['inherit'].reverse_each do |item|
- inherit_file = File.expand_path(item, File.dirname(yamlfile))
+ def parse_inherit(yaml, yamlfile, loaded_files)
+ files = []
- # Check loop
- if loaded_files[inherit_file]
- raise "Found circular YAML inheritance '#{inherit_file}' in #{yamlfile}."
- end
+ yaml['inherit'].reverse_each do |item|
+ inherit_file = File.expand_path(item, File.dirname(yamlfile))
- loaded_files[inherit_file] = true
- buf << inherit_file
+ # Check loop
+ if loaded_files[inherit_file]
+ raise "Found circular YAML inheritance '#{inherit_file}' in #{yamlfile}."
end
- yaml.delete('inherit')
- file_queue = buf + file_queue
+
+ loaded_files[inherit_file] = true
+ files << inherit_file
end
+
+ yaml.delete('inherit')
+
+ files
end
end
end
diff --git a/templates/latex/review-jlreq/review-base.sty b/templates/latex/review-jlreq/review-base.sty
index 16b2ea694..2010a47db 100644
--- a/templates/latex/review-jlreq/review-base.sty
+++ b/templates/latex/review-jlreq/review-base.sty
@@ -165,6 +165,7 @@
\DeclareRobustCommand{\reviewtt}[1]{\texttt{#1}}
\DeclareRobustCommand{\reviewtti}[1]{\texttt{\textit{#1}}}
\DeclareRobustCommand{\reviewttb}[1]{\texttt{\textbf{#1}}}
+\DeclareRobustCommand{\reviewbou}[1]{\kenten{#1}}
%% @ is ignored in LaTeX with default style
%% \DeclareRobustCommand{\reviewstrike}[1]{#1}
diff --git a/templates/latex/review-jsbook/review-base.sty b/templates/latex/review-jsbook/review-base.sty
index 2f4381e25..a4a26a380 100644
--- a/templates/latex/review-jsbook/review-base.sty
+++ b/templates/latex/review-jsbook/review-base.sty
@@ -265,6 +265,7 @@
\DeclareRobustCommand{\reviewtt}[1]{\texttt{#1}}
\DeclareRobustCommand{\reviewtti}[1]{\texttt{\textit{#1}}}
\DeclareRobustCommand{\reviewttb}[1]{\texttt{\textbf{#1}}}
+\DeclareRobustCommand{\reviewbou}[1]{\kenten{#1}}
%% @ is ignored in LaTeX with default style
\DeclareRobustCommand{\reviewstrike}[1]{#1}
diff --git a/test/test_latexbuilder.rb b/test/test_latexbuilder.rb
index 598756ef8..3a6293827 100644
--- a/test/test_latexbuilder.rb
+++ b/test/test_latexbuilder.rb
@@ -169,6 +169,11 @@ def test_inline_u
assert_equal 'abc\\reviewunderline{def}ghi', actual
end
+ def test_inline_bou
+ actual = compile_inline('傍点の@{テスト}です。')
+ assert_equal '傍点の\\reviewbou{テスト}です。', actual
+ end
+
def test_inline_m
@config['review_version'] = '3.0'
actual = compile_inline('abc@{\\alpha^n = \\inf < 2}ghi')
diff --git a/test/test_preprocessor.rb b/test/test_preprocessor.rb
index d5a710a5d..a2c7e90a9 100644
--- a/test/test_preprocessor.rb
+++ b/test/test_preprocessor.rb
@@ -2,22 +2,8 @@
require 'review/preprocessor'
require 'stringio'
-class PreprocessorStripTest < Test::Unit::TestCase
+class PreprocessorTest < Test::Unit::TestCase
include ReVIEW
- def test_gets
- f = StringIO.new '= Header'
- s = Preprocessor::Strip.new(f)
- expect = '= Header'
- actual = s.gets
- assert_equal expect, actual
- end
-
- def test_gets_with_comment
- f = StringIO.new '#@warn(write it later)'
- s = Preprocessor::Strip.new(f)
- expect = '#@#' + "\n"
- actual = s.gets
- assert_equal expect, actual
- end
+ ## TODO: add tests
end