Skip to content

Commit

Permalink
update epubversion and htmlversion (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
takahashim committed Apr 13, 2016
1 parent 9dda9ab commit 785c7f6
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 67 deletions.
4 changes: 2 additions & 2 deletions lib/epubmaker/producer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ def complement
"isbn" => nil,
"toclevel" => 2,
"stylesheet" => [],
"epubversion" => 2,
"htmlversion" => 4,
"epubversion" => 3,
"htmlversion" => 5,
"secnolevel" => 2,
"pre_secnolevel" => 0,
"post_secnolevel" => 1,
Expand Down
4 changes: 2 additions & 2 deletions lib/review/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def self.values
"params" => "", # specify review2html parameters
"toclevel" => 3, # level of toc
"secnolevel" => 2, # level of section #
"epubversion" => 2,
"epubversion" => 3,
"titlepage" => true, # Use title page
"toc" => nil, # Use table of contents in body
"colophon" => nil, # Use colophon
Expand All @@ -39,7 +39,7 @@ def self.values
"language" => 'ja', # XXX default language should be JA??
"mathml" => nil, # for HTML
"htmlext" => "html",
"htmlversion" => 4,
"htmlversion" => 5,

"chapter_file" => 'CHAPS',
"part_file" => 'PART',
Expand Down
99 changes: 44 additions & 55 deletions test/test_epubmaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,11 @@ def test_stage3_mytoc
@producer.mytoc(@output)
expect = <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Re:VIEW"/>
<meta charset="UTF-8" />
<meta name="generator" content="Re:VIEW" />
<title>Table of Contents</title>
</head>
<body>
Expand All @@ -483,12 +482,11 @@ def test_stage3_flat
@producer.mytoc(@output)
expect = <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Re:VIEW"/>
<meta charset="UTF-8" />
<meta name="generator" content="Re:VIEW" />
<title>Table of Contents</title>
</head>
<body>
Expand All @@ -513,12 +511,11 @@ def test_stage3_cover
@producer.cover(@output)
expect = <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Re:VIEW"/>
<meta charset="UTF-8" />
<meta name="generator" content="Re:VIEW" />
<title>Sample Book</title>
</head>
<body>
Expand All @@ -535,12 +532,11 @@ def test_stage3_cover_escape
@producer.cover(@output)
expect = <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Re:VIEW"/>
<meta charset="UTF-8" />
<meta name="generator" content="Re:VIEW" />
<title>Sample&lt;&gt;Book</title>
</head>
<body>
Expand All @@ -557,12 +553,11 @@ def test_stage3_cover_with_image
@producer.cover(@output)
expect = <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Re:VIEW"/>
<meta charset="UTF-8" />
<meta name="generator" content="Re:VIEW" />
<title>Sample Book</title>
</head>
<body>
Expand All @@ -582,12 +577,11 @@ def test_stage3_cover_with_image_escape
@producer.cover(@output)
expect = <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Re:VIEW"/>
<meta charset="UTF-8" />
<meta name="generator" content="Re:VIEW" />
<title>Sample&lt;&gt;Book</title>
</head>
<body>
Expand All @@ -607,12 +601,11 @@ def test_colophon_default
@producer.colophon(@output)
expect = <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Re:VIEW"/>
<meta charset="UTF-8" />
<meta name="generator" content="Re:VIEW" />
<title>Colophon</title>
</head>
<body>
Expand Down Expand Up @@ -643,12 +636,11 @@ def test_colophon_default_escape_and_multiple
@producer.colophon(@output)
expect = <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Re:VIEW"/>
<meta charset="UTF-8" />
<meta name="generator" content="Re:VIEW" />
<title>Colophon</title>
</head>
<body>
Expand Down Expand Up @@ -677,12 +669,11 @@ def test_colophon_pht
@producer.colophon(@output)
expect = <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Re:VIEW"/>
<meta charset="UTF-8" />
<meta name="generator" content="Re:VIEW" />
<title>Colophon</title>
</head>
<body>
Expand Down Expand Up @@ -731,12 +722,11 @@ def test_title
@producer.titlepage(@output)
expect = <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Re:VIEW"/>
<meta charset="UTF-8" />
<meta name="generator" content="Re:VIEW" />
<title>Sample Book</title>
</head>
<body>
Expand Down Expand Up @@ -765,12 +755,11 @@ def test_title_single_value_param
@producer.titlepage(@output)
expect = <<EOT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Re:VIEW"/>
<meta charset="UTF-8" />
<meta name="generator" content="Re:VIEW" />
<title>Sample Book</title>
</head>
<body>
Expand Down
16 changes: 8 additions & 8 deletions test/test_htmlbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def setup
end

def test_xmlns_ops_prefix_epub3
@book.config["epubversion"] = 3
assert_equal "epub", @builder.xmlns_ops_prefix
end

def test_xmlns_ops_prefix_epub2
@book.config["epubversion"] = 2
assert_equal "ops", @builder.xmlns_ops_prefix
end

Expand Down Expand Up @@ -218,17 +218,17 @@ def test_inline_b_and_escape

def test_inline_tt
actual = compile_inline("test @<tt>{inline test} test2")
assert_equal %Q|test <tt>inline test</tt> test2|, actual
assert_equal %Q|test <code class="tt">inline test</code> test2|, actual
end

def test_inline_tti
actual = compile_inline("test @<tti>{inline test} test2")
assert_equal %Q|test <tt><i>inline test</i></tt> test2|, actual
assert_equal %Q|test <code class="tt"><i>inline test</i></code> test2|, actual
end

def test_inline_ttb
actual = compile_inline("test @<ttb>{inline test} test2")
assert_equal %Q|test <tt><b>inline test</b></tt> test2|, actual
assert_equal %Q|test <code class="tt"><b>inline test</b></code> test2|, actual
end

def test_inline_hd_chap
Expand Down Expand Up @@ -285,12 +285,12 @@ def test_inline_uchar

def test_inline_ruby
actual = compile_inline("@<ruby>{粗雑,クルード}と思われているなら@<ruby>{繊細,テクニカル}にやり、繊細と思われているなら粗雑にやる。")
assert_equal "<ruby><rb>粗雑</rb><rp>(</rp><rt>クルード</rt><rp>)</rp></ruby>と思われているなら<ruby><rb>繊細</rb><rp>(</rp><rt>テクニカル</rt><rp>)</rp></ruby>にやり、繊細と思われているなら粗雑にやる。", actual
assert_equal "<ruby>粗雑<rp>(</rp><rt>クルード</rt><rp>)</rp></ruby>と思われているなら<ruby>繊細<rp>(</rp><rt>テクニカル</rt><rp>)</rp></ruby>にやり、繊細と思われているなら粗雑にやる。", actual
end

def test_inline_ruby_comma
actual = compile_inline("@<ruby>{foo\\, bar\\, buz,フー・バー・バズ}")
assert_equal "<ruby><rb>foo, bar, buz</rb><rp>(</rp><rt>フー・バー・バズ</rt><rp>)</rp></ruby>", actual
assert_equal "<ruby>foo, bar, buz<rp>(</rp><rt>フー・バー・バズ</rt><rp>)</rp></ruby>", actual
end

def test_inline_ref
Expand Down Expand Up @@ -1045,7 +1045,7 @@ def test_inline_fn
@chapter.instance_eval{@footnote_index=fn}
actual = compile_block("//footnote[foo][bar\\a\\$buz]\n")
expected =<<-'EOS'
<div class="footnote" id="fn-foo"><p class="footnote">[<a href="#fnb-foo">*1</a>] bar\a\$buz</p></div>
<div class="footnote" epub:type="footnote" id="fn-foo"><p class="footnote">[*1] bar\a\$buz</p></div>
EOS
assert_equal expected, actual
end
Expand All @@ -1055,7 +1055,7 @@ def test_inline_fn_with_tricky_id
@chapter.instance_eval{@footnote_index=fn}
actual = compile_block("//footnote[123 あ_;][bar\\a\\$buz]\n")
expected =<<-'EOS'
<div class="footnote" id="fn-id_123-_E3_81_82___3B"><p class="footnote">[<a href="#fnb-id_123-_E3_81_82___3B">*1</a>] bar\a\$buz</p></div>
<div class="footnote" epub:type="footnote" id="fn-id_123-_E3_81_82___3B"><p class="footnote">[*1] bar\a\$buz</p></div>
EOS
assert_equal expected, actual
end
Expand Down

0 comments on commit 785c7f6

Please sign in to comment.