Aozora2Epub
view release on metacpan or search on metacpan
xt/gappon.t view on Meta::CPAN
};
is $title, "gappon", "title";
is $author, "é
çäºä¸åºæ¥", "author";
is $html, book2(), "book";
done_testing;
};
subtest "with title level" => sub {
my ($title, $author, $html) = do {
Aozora2Epub::Gensym->reset_counter;
my $book = Aozora2Epub->new();
$book->title('gappon');
$book->append('01/files/01_000.html', title=>"part1", title_level=>1);
$book->append('02/files/02_000.html', title=>"part2");
($book->title, $book->author, $book->as_html);
};
is $title, "gappon", "title";
is $author, "é
çäºä¸åºæ¥", "author";
is $html, book3(), "book";
done_testing;
};
subtest "with subtitle" => sub {
my ($title, $author, $html) = do {
Aozora2Epub::Gensym->reset_counter;
my $book = Aozora2Epub->new();
$book->append('02/files/02_000.html', use_subtitle=>1);
$book->append('03/files/03_000.html', use_subtitle=>1);
($book->title, $book->author, $book->as_html);
};
is $title, "ãã¹ã-no-toc", "title";
is $author, "é
çäºä¸åºæ¥", "author";
is $html, book4(), "book";
done_testing;
};
subtest "with title_html" => sub {
my ($title, $author, $html) = do {
Aozora2Epub::Gensym->reset_counter;
my $book = Aozora2Epub->new();
$book->append('02/files/02_000.html',
title_html=>'<h1>åº</h1><h2>abc</h2>');
$book->append('03/files/03_000.html',
title_html=>'<h1>æ¬ç·¨</h1><h2>ãã®1</h2>');
($book->title, $book->author, $book->as_html);
};
is $title, "ãã¹ã-no-toc", "title";
is $author, "é
çäºä¸åºæ¥", "author";
is $html, book5(), "book";
done_testing;
};
}
done_testing();
sub book1 {
my $html =<<'HTML';
<h2 id="g000000006">ãã¹ãï¼</h2>
<h3 id="g000000000">大è¦åºã1</h3>
<h4 id="g000000002">ä¸è¦åºã1-1</h4>
ãããããããã<br />
<img src="../images/fig0.png" /><br />
å³ãã®ï¼ã<br />
<h3 id="g000000001">大è¦åºã2</h3>
<h4 id="g000000003">ä¸è¦åºã2-1</h4>
ã©ããããããã<img class="gaiji" src="../gaiji/1-90/1-90-61.png" />ã§ããã<br />
<h2 id="g000000008">ãã¹ã-no-toc</h2>
ãããããããã<br />
ã©ãããããããã§ããã<br />
HTML
$html =~ s/\n//sg;
return $html
}
sub book2 {
my $html =<<'HTML';
<h2 id="g000000006">part1</h2>
<h3 id="g000000000">大è¦åºã1</h3>
<h4 id="g000000002">ä¸è¦åºã1-1</h4>
ãããããããã<br />
<img src="../images/fig0.png" /><br />
å³ãã®ï¼ã<br />
<h3 id="g000000001">大è¦åºã2</h3>
<h4 id="g000000003">ä¸è¦åºã2-1</h4>
ã©ããããããã<img class="gaiji" src="../gaiji/1-90/1-90-61.png" />ã§ããã<br />
<h2 id="g000000008">part2</h2>
ãããããããã<br />
ã©ãããããããã§ããã<br />
HTML
$html =~ s/\n//sg;
return $html
}
sub book3 {
my $html =<<'HTML';
<h1 id="g000000006">part1</h1>
<h3 id="g000000000">大è¦åºã1</h3>
<h4 id="g000000002">ä¸è¦åºã1-1</h4>
ãããããããã<br />
<img src="../images/fig0.png" /><br />
å³ãã®ï¼ã<br />
<h3 id="g000000001">大è¦åºã2</h3>
<h4 id="g000000003">ä¸è¦åºã2-1</h4>
ã©ããããããã<img class="gaiji" src="../gaiji/1-90/1-90-61.png" />ã§ããã<br />
<h2 id="g000000008">part2</h2>
ãããããããã<br />
ã©ãããããããã§ããã<br />
HTML
$html =~ s/\n//sg;
return $html
}
sub book4 {
my $html =<<'HTML';
<h2 id="g000000001">ãã¹ã-no-toc</h2>
ãããããããã<br />
ã©ãããããããã§ããã<br />
<h2 id="g000000003">ãµãã¿ã¤ãã«3</h2>
ãããããããã<br />
ã©ãããããããã§ããã<br />
HTML
$html =~ s/\n//sg;
return $html
}
sub book5 {
my $html =<<'HTML';
<h1 id="g000000001">åº</h1>
<h2 id="g000000002">abc</h2>
ãããããããã<br />
ã©ãããããããã§ããã<br />
<h1 id="g000000004">æ¬ç·¨</h1>
<h2 id="g000000005">ãã®1</h2>
ãããããããã<br />
ã©ãããããããã§ããã<br />
HTML
$html =~ s/\n//sg;
return $html
}
( run in 3.089 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )