aozora4reader 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/ChangeLog +158 -0
- data/LICENSE +20 -0
- data/README.rdoc +60 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/aozora4reader.gemspec +57 -0
- data/bin/a4r +25 -0
- data/data/gaiji.txt +3698 -0
- data/data/gaiji2.txt +41 -0
- data/lib/aozora4reader.rb +741 -0
- data/memo.txt +7 -0
- data/sty/aozora.sty +661 -0
- data/sty/aozora4reader.sty +481 -0
- data/sty/aozorakindle.sty +463 -0
- data/test/helper.rb +10 -0
- data/test/test_aozora4reader.rb +138 -0
- metadata +76 -0
data/test/helper.rb
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestAozora4reader < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@a4r = Aozora4Reader.new("dummy")
|
7
|
+
@a4r.load_gaiji
|
8
|
+
end
|
9
|
+
|
10
|
+
context "accent" do
|
11
|
+
should "support \\ae" do
|
12
|
+
l = "〔Quid aliud est mulier nisi amicitiae& inimica〕"
|
13
|
+
l2 = 'Quid aliud est mulier nisi amiciti\\ae{} inimica'
|
14
|
+
assert_equal l2, @a4r.translate_accent(l)
|
15
|
+
end
|
16
|
+
should "support A:" do
|
17
|
+
assert_equal '\\"{A}nderung', @a4r.translate_accent('A:nderung')
|
18
|
+
end
|
19
|
+
should "support U:" do
|
20
|
+
assert_equal '\\"{U}bung', @a4r.translate_accent('U:bung')
|
21
|
+
end
|
22
|
+
should "support s&" do
|
23
|
+
assert_equal 'tsch\\"{u}\\ss{}', @a4r.translate_accent('tschu:s&')
|
24
|
+
end
|
25
|
+
should "support a`" do
|
26
|
+
assert_equal 'voil\\`{a}', @a4r.translate_accent('voila`')
|
27
|
+
end
|
28
|
+
should "support a^" do
|
29
|
+
assert_equal '\\^{a}me', @a4r.translate_accent('a^me')
|
30
|
+
end
|
31
|
+
should "support c," do
|
32
|
+
assert_equal 'fran\c{c}ais', @a4r.translate_accent('franc,ais')
|
33
|
+
end
|
34
|
+
should "support i'" do
|
35
|
+
assert_equal 'Andaluc\\\'{i}a', @a4r.translate_accent('Andaluci\'a')
|
36
|
+
end
|
37
|
+
should "support i:" do
|
38
|
+
assert_equal 'ha\\"{\\i}r', @a4r.translate_accent('hai:r')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "gaiji" do
|
43
|
+
should "support 磽※[#「石+角」、第3水準1-89-6]" do
|
44
|
+
l = "磽※[#「石+角」、第3水準1-89-6]"
|
45
|
+
l2 = '磽\\UTF{786e}'
|
46
|
+
assert_equal l2, @a4r.translate_gaiji(l)
|
47
|
+
end
|
48
|
+
=begin
|
49
|
+
should "support 因※[#「木+于」、10-7]" do
|
50
|
+
l = "因※[#「木+于」、10-7]"
|
51
|
+
l2 = '因\\UTF{6745}'
|
52
|
+
assert_equal l2, @a4r.translate_gaiji(l)
|
53
|
+
end
|
54
|
+
|
55
|
+
should "support 於※[#「革+干」、49-11]王" do
|
56
|
+
l = "於※[#「革+干」、49-11]王"
|
57
|
+
l2 = '於\\UTF{976C}王'
|
58
|
+
assert_equal l2, @a4r.translate_gaiji(l)
|
59
|
+
end
|
60
|
+
|
61
|
+
should "support [#「さんずい+闊」]" do
|
62
|
+
l = "「※[#「さんずい+闊」]歩」"
|
63
|
+
l2 = '「\\UTF{24103}歩」'
|
64
|
+
assert_equal l2, @a4r.translate_gaiji(l)
|
65
|
+
end
|
66
|
+
=end
|
67
|
+
|
68
|
+
should "support complex" do
|
69
|
+
l = "とくは※[#「姉」の正字、「女+※[#第3水準1-85-57]のつくり」、256-下-16]や兄が順序に呼ばれたので、こんどは自分が呼ばれたのだと氣が附いた。そして只目を※[#「目+爭」、第3水準1-88-85]つて役人の顏を仰ぎ見た。"
|
70
|
+
l2 = 'とくは\\UTF{59ca}や兄が順序に呼ばれたので、こんどは自分が呼ばれたのだと氣が附いた。そして只目を\\UTF{775c}つて役人の顏を仰ぎ見た。'
|
71
|
+
assert_equal l2, @a4r.translate_gaiji(l)
|
72
|
+
end
|
73
|
+
|
74
|
+
should "support complex2" do
|
75
|
+
l = "[#5字下げ][#小見出し]※[#ローマ数字1、1-13-21][#小見出し終わり]"
|
76
|
+
l2 = "[#5字下げ][#小見出し]\\rensuji{I}[#小見出し終わり]"
|
77
|
+
assert_equal l2, @a4r.translate_gaiji(l)
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
context "bouten" do
|
83
|
+
should "support また、びいどろ[#「びいどろ」に傍点]という" do
|
84
|
+
l = "また、びいどろ[#「びいどろ」に傍点]という"
|
85
|
+
l2 = "また、\\bou{びいどろ}という"
|
86
|
+
assert_equal l2, @a4r.translate_bouten(l)
|
87
|
+
end
|
88
|
+
should "support [#傍点]香一※[#「火+(麈−鹿)」、第3水準1-87-40][#傍点終わり]" do
|
89
|
+
l = "[#傍点]香一\\UTF{70b7}[#傍点終わり]"
|
90
|
+
l2 = '\\bou{香一{\\UTF{70b7}}}'
|
91
|
+
assert_equal l2, @a4r.translate_bouten(l)
|
92
|
+
end
|
93
|
+
|
94
|
+
should "support 白丸傍点" do
|
95
|
+
l = "菫謹勤[#「菫謹勤」に白丸傍点]"
|
96
|
+
l2 = "\\siromarubou{菫謹勤}"
|
97
|
+
assert_equal l2, @a4r.translate_bouten(l)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context "ruby" do
|
102
|
+
should "support 清浄な蒲団《ふとん》" do
|
103
|
+
l = "清浄な蒲団《ふとん》"
|
104
|
+
l2 = "清浄な\\ruby{蒲団}{ふとん}"
|
105
|
+
assert_equal l2, @a4r.translate_ruby(l)
|
106
|
+
end
|
107
|
+
should "support 始終|圧《おさ》えつけていた" do
|
108
|
+
l = "始終|圧《おさ》えつけていた"
|
109
|
+
l2 = "始終\\ruby{圧}{おさ}えつけていた"
|
110
|
+
assert_equal l2, @a4r.translate_ruby(l)
|
111
|
+
end
|
112
|
+
should "support 握〆《にぎりしめ》" do
|
113
|
+
l = "凍つた手を握〆《にぎりしめ》ながら"
|
114
|
+
l2 = "凍つた手を\\ruby{握〆}{にぎりしめ}ながら"
|
115
|
+
assert_equal l2, @a4r.translate_ruby(l)
|
116
|
+
end
|
117
|
+
should "support 〔oe&ille`res〕《オヨイエエル》 " do
|
118
|
+
l = "\\oeill\`{e}res《オヨイエエル》 "
|
119
|
+
l2 = "\\ruby{\\oeill\`{e}res}{オヨイエエル} "
|
120
|
+
assert_equal l2, @a4r.translate_ruby(l)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
context "remove_ruby" do
|
125
|
+
should "support \\ruby{不如帰}{ほととぎす} 小説" do
|
126
|
+
l = "\\ruby{不如帰}{ほととぎす} 小説"
|
127
|
+
l2 = "不如帰 小説"
|
128
|
+
assert_equal l2, @a4r.remove_ruby(l)
|
129
|
+
end
|
130
|
+
|
131
|
+
should "support \\RUBY{}{}" do
|
132
|
+
l = "\\RUBY{不如帰}{ほととぎす} 小説"
|
133
|
+
l2 = "不如帰 小説"
|
134
|
+
assert_equal l2, @a4r.remove_ruby(l)
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
end
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aozora4reader
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- takahashim
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-09-07 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: thoughtbot-shoulda
|
16
|
+
requirement: &2151915740 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2151915740
|
25
|
+
description: Aozora Bunko converter for Sony Reader
|
26
|
+
email: maki@rubycolor.org
|
27
|
+
executables:
|
28
|
+
- a4r
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files:
|
31
|
+
- ChangeLog
|
32
|
+
- LICENSE
|
33
|
+
- README.rdoc
|
34
|
+
files:
|
35
|
+
- .document
|
36
|
+
- ChangeLog
|
37
|
+
- LICENSE
|
38
|
+
- README.rdoc
|
39
|
+
- Rakefile
|
40
|
+
- VERSION
|
41
|
+
- aozora4reader.gemspec
|
42
|
+
- bin/a4r
|
43
|
+
- data/gaiji.txt
|
44
|
+
- data/gaiji2.txt
|
45
|
+
- lib/aozora4reader.rb
|
46
|
+
- memo.txt
|
47
|
+
- sty/aozora.sty
|
48
|
+
- sty/aozora4reader.sty
|
49
|
+
- sty/aozorakindle.sty
|
50
|
+
- test/helper.rb
|
51
|
+
- test/test_aozora4reader.rb
|
52
|
+
homepage: http://github.com/takahashim/aozora4reader
|
53
|
+
licenses: []
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
requirements: []
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.8.6
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: Aozora Bunko converter for Sony Reader
|
76
|
+
test_files: []
|