Aozora2Epub
view release on metacpan or search on metacpan
lib/Aozora2Epub/XHTML.pm view on Meta::CPAN
my $utf8 = decode('euc-jp-2004', $euc);
return $utf8;
}
sub kindle_jis2chr {
my ($men, $ku, $ten) = @_;
# åæ¿ç¹ä»ãã«ã¿ã«ã ã kindleã ã¨2æåã«è¦ããã®ãªãã¨ããªãããï¼
return if $men == 1 && $ku == 6 && $ten == 88;
# kindle font of these characters are broken.
return if $men == 1 && $ku == 90 && $ten == 61;
return if $men == 2 && $ku == 15 && $ten == 73;
return jisx0213_to_utf8($men, $ku, $ten);
}
# kindle font of these characters are broken.
our %kindle_broken_font_unicode = map { $_ => 1 } (
0x2152,
0x2189,
0x26bd,
0x26be,
0x3244,
);
our %kindle_ok_font_over0xffff = map { $_ => 1 } (
0x20d58, 0x20e97, 0x20ed7, 0x210e4, 0x2124f, 0x2296b,
0x22d07, 0x22e42, 0x22feb, 0x233fe, 0x23cbe, 0x249ad,
0x24e04, 0x24ff2, 0x2546e, 0x2567f, 0x259cc, 0x2688a,
0x279b4, 0x280e9, 0x28e17, 0x29170, 0x2a2b2,
);
sub kindle_unicode_hex2chr {
my $unicode_hex = shift;
my $unicode = hex($unicode_hex);
return if $kindle_broken_font_unicode{$unicode};
# kindle font is almost not avaliable in this range.
return if $unicode > 0xffff && !$kindle_ok_font_over0xffff{$unicode};
return chr($unicode);
}
sub _conv_gaiji_title_author {
my ($unicode, $men, $ku, $ten) = @_;
if ($unicode) {
my $ch = kindle_unicode_hex2chr($unicode);
return $ch if $ch;
return;
share/basic/EPUB/styles/style.css view on Meta::CPAN
}
.dogyo-o-midashi { display:inline;}
.dogyo-naka-midashi { display:inline;}
.dogyo-ko-midashi { display:inline;}
.mado-o-midashi { display:inline;}
.mado-naka-midashi { display:inline;}
.mado-ko-midashi {
display: inline;
margin:0; padding:0;
font-size: 1.1em;
}
figure {
writing-mode: horizontal-tb;
-epub-writing-mode: horizontal-tb;
-webkit-writing-mode: horizontal-tb;
}
figure figcaption {
text-align: center;
}
h1.tobira {
padding-right: 3em;
padding-top: 3em;
font-size: 1.2em;
}
h1 {
padding-top: 3em;
font-size: 1.2em;
padding-right: 1em;
}
h2 {
padding-top: 4em;
font-size: 1.1em;
padding-right: 1em;
}
.subscript { font-size: small; }
.superscript { font-size: small; }
.kaeriten { font-size: small; }
.okurigana { font-size: small; }
span.notes {font-size: 0.8em;}
img.gaiji { width: 1em; height: 1em; align: top; }
.gaiji_list {margin-left: 3em;}
.keigakomi {border: solid 1px;}
div.keigakomi{padding-top: 0.5em;
padding-bottom: 0.5em;
padding-right: 0.5em;
padding-left: 1em;}
.futoji { font-weight: bold;}
.shatai { font-style: italic;}
.sesame_dot {
font-style: normal;
text-emphasis-style: filled sesame;
-webkit-text-emphasis-style: filled sesame;
-epub-text-emphasis-style: filled sesame;
}
.white_sesame_dot {
font-style: normal;
text-emphasis-style: open sesame;
-webkit-text-emphasis-style: open sesame;
-epub-text-emphasis-style: open sesame;
}
.black_circle {
font-style: normal;
text-emphasis-style: filled circle;
-webkit-text-emphasis-style: filled circle;
-epub-text-emphasis-style: filled circle;
}
.white_circle {
font-style: normal;
text-emphasis-style: open circle;
-webkit-text-emphasis-style: open circle;
-epub-text-emphasis-style: open circle;
}
.black_up-pointing_triangle {
font-style: normal;
text-emphasis-style: filled triangle;
-webkit-text-emphasis-style: filled triangle;
-epub-text-emphasis-style: filled triangle;
}
.white_up-pointing_triangle {
font-style: normal;
text-emphasis-style: open triangle;
-webkit-text-emphasis-style: open triangle;
-epub-text-emphasis-style: open triangle;
}
.saltire {
font-style: normal;
text-emphasis-style: 'x'
-webkit-text-emphasis-style: 'x';
-epub-text-emphasis-style: 'x';
}
.underline_solid {
font-style: normal;
text-decoration: underline solid;
}
.underline_double {
font-style: normal;
text-decoration: underline double;
}
.underline_dotted {
font-style: normal;
text-decoration: underline dotted;
}
.underline_dashed {
font-style: normal;
text-decoration: underline dashed;
}
.underline_wave {
font-style: normal;
text-decoration: underline wavy;
}
.overline_solid {
font-style: normal;
text-decoration: overline solid;
}
.overline_double {
font-style: normal;
text-decoration: overline double;
}
.overline_dotted {
font-style: normal;
text-decoration: overline dotted;
}
.overline_dashed {
font-style: normal;
text-decoration: overline dashed;
}
.overline_wave {
font-style: normal;
text-decoration: overline wavy;
}
share/basic/EPUB/text/okuzuke.xhtml view on Meta::CPAN
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="ja-JP" xml:lang="ja-JP">
<head>
<meta charset="utf-8" />
<meta name="generator" content="aozora2epub" />
<title><: $name :></title>
<style>
div.okuzuke { font-size: 0.7em; }
h5 { font-size: 1em; margin:1.75em 0 0.5em 0; padding:0; }
</style>
</head>
<body epub:type="bodymatter">
<section id="start" class="level1 unnumbered">
<div class="okuzuke">
<: $bib_info :>
</div>
</section>
</body>
</html>
share/basic/EPUB/text/title_page.xhtml view on Meta::CPAN
<meta charset="utf-8" />
<meta name="generator" content="aozora2epub" />
<title><: $title :></title>
<style>
.title { margin-top: 3em; text-align: center; }
.author { margin-top: 4em; text-align: center; }
#aozora {
margin-bottom: 5em;
width: 100%;
text-align: center;
font-size: 0.8em;
}
</style>
</head>
<body epub:type="frontmatter">
<section epub:type="titlepage" class="titlepage">
<div id="aozora">é空æåº«</div>
<h1 class="title"><: $title :></h1>
<p class="author"><: $author :></p>
</section>
share/basic/EPUB/toc.xhtml view on Meta::CPAN
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="ja-JP" xml:lang="ja-JP">
<head>
<meta charset="utf-8" />
<meta name="generator" content="aozora2epub" />
<title><: $title :></title>
<style>
h1 { font-size: 1.25em; }
div.level1 { margin-top: 2em; }
div.level2 { margin-top: 4em; }
</style>
<link rel="stylesheet" type="text/css" href="styles/style.css" />
</head>
<body epub:type="bodymatter">
<h1>ç®æ¬¡</h1>
: for $sections -> $s {
<div class="level1"><a href="text/<: $s.file :>.xhtml#<:$s.id :>"><: $s.title :></a></div>
: if $s.children {
share/basic/META-INF/com.apple.ibooks.display-options.xml view on Meta::CPAN
<?xml version="1.0" encoding="UTF-8"?>
<display_options>
<platform name="*">
<option name="specified-fonts">true</option>
</platform>
</display_options>
t/gaiji-replace.t view on Meta::CPAN
ãã<span class="notes">ï¼»ï¼ãããããï¼é¼¾ã®ã¸ããã第4æ°´æº2-79-37ï¼½</span>
--- expected
ãã<span class="notes">ï¼»ï¼ãããããï¼é¼¾ã®ã¸ããã第4æ°´æº2-79-37ï¼½</span>
=== image gaiji in rb
--- html
åç©å¦è
ã¯<ruby><rb>â»<img src="../../../gaiji/1-91/1-91-65.png" alt="â»(ãè«ï¼æ¯ãã第3æ°´æº1-91-65)" class="gaiji" /></rb><rp>ï¼</rp><rt>ããã</rt><rp>ï¼</rp></ruby><span class="notes">ï¼»ï¼ãè«ï¼å ããU+86C5ã18-5ï¼½</...
--- expected
åç©å¦è
ã¯<ruby><rb>\x{86c5}\x{87d6}</rb><rp>ï¼</rp><rt>ããã</rt><rp>ï¼</rp></ruby>ã®å¤ã
=== kindle font broken jis
--- html
<img src="../../../gaiji/1-90/1-90-61.png" />
--- expected
<img src="../gaiji/1-90/1-90-61.png" />
=== kindle font broken jis 2
--- html
<img src="../../../gaiji/2-15/2-15-73.png" />
--- expected
<img src="../gaiji/2-15/2-15-73.png" />
=== kindle font broken jis 3
--- html
<img src="../../../gaiji/1-06/1-06-88.png" />
--- expected
<img src="../gaiji/1-06/1-06-88.png" />
=== kindle font broken unicode
--- html
â»<span class="notes">ï¼»ï¼ããããããU+2152ã369-2ï¼½</span>
--- expected
â»<span class="notes">ï¼»ï¼ããããããU+2152ã369-2ï¼½</span>
=== kindle font broken unicode 2
--- html
â»<span class="notes">ï¼»ï¼ããããããU+2189ã369-2ï¼½</span>
--- expected
â»<span class="notes">ï¼»ï¼ããããããU+2189ã369-2ï¼½</span>
=== kindle font broken unicode 3
--- html
â»<span class="notes">ï¼»ï¼ããããããU+26BDã369-2ï¼½</span>
--- expected
â»<span class="notes">ï¼»ï¼ããããããU+26BDã369-2ï¼½</span>
=== kindle font broken unicode 4
--- html
â»<span class="notes">ï¼»ï¼ããããããU+26BEã369-2ï¼½</span>
--- expected
â»<span class="notes">ï¼»ï¼ããããããU+26BEã369-2ï¼½</span>
=== kindle font broken unicode 5
--- html
â»<span class="notes">ï¼»ï¼ããããããU+3244ã369-2ï¼½</span>
--- expected
â»<span class="notes">ï¼»ï¼ããããããU+3244ã369-2ï¼½</span>
=== kindle font broken unicode over 0xffff
--- html
â»<span class="notes">ï¼»ï¼ããããããU+1F130ã369-2ï¼½</span>
--- expected
â»<span class="notes">ï¼»ï¼ããããããU+1F130ã369-2ï¼½</span>
=== kindle font broken unicode over 0xffff but ok
--- html
â»<span class="notes">ï¼»ï¼ããããããU+2a2b2ã369-2ï¼½</span>
--- expected
\x{2a2b2}
t/gaiji-title-author.t view on Meta::CPAN
ï¼ï¼ï¼»ï¼ãï¼ãã¯ãã¼ãæ°åã1-13-22ï¼½ï¼
--- expected
ï¼\x{2161}ï¼
=== unicode
--- input
ãã¾â»ï¼»ï¼ããããã¸ãï¼æããU+897Bï¼½
--- expected
ãã¾\x{897b}
=== unicode bad font
--- input
失â»ï¼»ï¼ã人ãããï¼äºï¼å¿ããU+2B779ã表ç´ï¼½è¡è¬ç¾©
--- expected
失â»ï¼»ï¼ã人ãããï¼äºï¼å¿ããU+2B779ã表ç´ï¼½è¡è¬ç¾©
--- note
2b779ã¯kindleã ã¨è±è
ã«ãªã
=== no chuuki
--- input
ããããã
( run in 1.146 second using v1.01-cache-2.11-cpan-97f6503c9c8 )