aozora2html 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -3
- data/.gitignore +1 -0
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +15 -0
- data/aozora2html.gemspec +2 -2
- data/lib/aozora2html/midashi_counter.rb +32 -0
- data/lib/aozora2html/tag/ruby.rb +1 -1
- data/lib/aozora2html/version.rb +1 -1
- data/lib/aozora2html.rb +21 -50
- data/sample/chukiichiran_kinyurei.html +27 -27
- data/sample/chukiichiran_kinyurei.txt +1 -1
- metadata +23 -72
- data/test/test_aozora2html.rb +0 -368
- data/test/test_aozora_accent_parser.rb +0 -48
- data/test/test_command_parse.rb +0 -216
- data/test/test_compat.rb +0 -10
- data/test/test_dakuten_katakana_tag.rb +0 -25
- data/test/test_decorate_tag.rb +0 -27
- data/test/test_dir_tag.rb +0 -27
- data/test/test_editor_note_tag.rb +0 -25
- data/test/test_exception.rb +0 -25
- data/test/test_font_size_tag.rb +0 -44
- data/test/test_gaiji_tag.rb +0 -50
- data/test/test_header.rb +0 -45
- data/test/test_helper.rb +0 -7
- data/test/test_i18n.rb +0 -39
- data/test/test_img_tag.rb +0 -27
- data/test/test_inline_caption_tag.rb +0 -27
- data/test/test_inline_font_size_tag.rb +0 -37
- data/test/test_inline_keigakomi_tag.rb +0 -27
- data/test/test_inline_yokogumi_tag.rb +0 -27
- data/test/test_jizume_tag.rb +0 -27
- data/test/test_jstream.rb +0 -60
- data/test/test_kaeriten_tag.rb +0 -27
- data/test/test_keigakomi_tag.rb +0 -33
- data/test/test_midashi_tag.rb +0 -39
- data/test/test_multiline_caption_tag.rb +0 -27
- data/test/test_multiline_midashi_tag.rb +0 -54
- data/test/test_multiline_style_tag.rb +0 -27
- data/test/test_multiline_yokogumi_tag.rb +0 -27
- data/test/test_okurigana_tag.rb +0 -27
- data/test/test_ruby_parse.rb +0 -130
- data/test/test_ruby_tag.rb +0 -27
- data/test/test_tag_parser.rb +0 -82
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
require 'aozora2html'
|
5
|
-
|
6
|
-
class MultilineMidashiTagTest < Test::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
@parser = Object.new
|
9
|
-
stub(@parser).block_allowed_context? { true }
|
10
|
-
stub(@parser).new_midashi_id { 2 }
|
11
|
-
end
|
12
|
-
|
13
|
-
using Aozora2Html::StringRefinements
|
14
|
-
|
15
|
-
def test_multiline_midashi_new
|
16
|
-
tag = Aozora2Html::Tag::MultilineMidashi.new(@parser, '小'.to_sjis, :normal)
|
17
|
-
assert_equal Aozora2Html::Tag::MultilineMidashi, tag.class
|
18
|
-
assert_equal true, tag.is_a?(Aozora2Html::Tag::Block)
|
19
|
-
assert_equal true, tag.is_a?(Aozora2Html::Tag::Multiline)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_to_s
|
23
|
-
tag = Aozora2Html::Tag::MultilineMidashi.new(@parser, '小'.to_sjis, :normal)
|
24
|
-
assert_equal '<h5 class="ko-midashi"><a class="midashi_anchor" id="midashi2">', tag.to_s
|
25
|
-
assert_equal '</a></h5>', tag.close_tag
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_to_s_chu
|
29
|
-
tag = Aozora2Html::Tag::MultilineMidashi.new(@parser, '中'.to_sjis, :dogyo)
|
30
|
-
assert_equal '<h4 class="dogyo-naka-midashi"><a class="midashi_anchor" id="midashi2">', tag.to_s
|
31
|
-
assert_equal '</a></h4>', tag.close_tag
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_to_s_dai
|
35
|
-
tag = Aozora2Html::Tag::MultilineMidashi.new(@parser, '大'.to_sjis, :mado)
|
36
|
-
assert_equal '<h3 class="mado-o-midashi"><a class="midashi_anchor" id="midashi2">', tag.to_s
|
37
|
-
assert_equal '</a></h3>', tag.close_tag
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_undeined_midashi
|
41
|
-
Aozora2Html::Tag::MultilineMidashi.new(@parser, 'あ'.to_sjis, :mado)
|
42
|
-
rescue Aozora2Html::Error => e
|
43
|
-
assert_equal e.message(123).to_utf8, "エラー(123行目):未定義な見出しです. \r\n処理を停止します"
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_undeined_midashi2
|
47
|
-
Aozora2Html::Tag::MultilineMidashi.new(@parser, '大'.to_sjis, :madoo)
|
48
|
-
rescue Aozora2Html::Error => e
|
49
|
-
assert_equal e.message(123).to_utf8, "エラー(123行目):未定義な見出しです. \r\n処理を停止します"
|
50
|
-
end
|
51
|
-
|
52
|
-
def teardown
|
53
|
-
end
|
54
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
require 'aozora2html'
|
5
|
-
|
6
|
-
class MultilineStyleTagTest < Test::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
@parser = Object.new
|
9
|
-
stub(@parser).block_allowed_context? { true }
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_multiline_style_new
|
13
|
-
tag = Aozora2Html::Tag::MultilineStyle.new(@parser, 'style1')
|
14
|
-
assert_equal Aozora2Html::Tag::MultilineStyle, tag.class
|
15
|
-
assert_equal true, tag.is_a?(Aozora2Html::Tag::Block)
|
16
|
-
assert_equal true, tag.is_a?(Aozora2Html::Tag::Multiline)
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_to_s
|
20
|
-
tag = Aozora2Html::Tag::MultilineStyle.new(@parser, 's1')
|
21
|
-
assert_equal '<div class="s1">', tag.to_s
|
22
|
-
assert_equal '</div>', tag.close_tag
|
23
|
-
end
|
24
|
-
|
25
|
-
def teardown
|
26
|
-
end
|
27
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
require 'aozora2html'
|
5
|
-
|
6
|
-
class MultilineYokogumiTagTest < Test::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
@parser = Object.new
|
9
|
-
stub(@parser).block_allowed_context? { true }
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_multiline_yokogumi_new
|
13
|
-
tag = Aozora2Html::Tag::MultilineYokogumi.new(@parser)
|
14
|
-
assert_equal Aozora2Html::Tag::MultilineYokogumi, tag.class
|
15
|
-
assert_equal true, tag.is_a?(Aozora2Html::Tag::Block)
|
16
|
-
assert_equal true, tag.is_a?(Aozora2Html::Tag::Multiline)
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_to_s
|
20
|
-
tag = Aozora2Html::Tag::MultilineYokogumi.new(@parser)
|
21
|
-
assert_equal '<div class="yokogumi">', tag.to_s
|
22
|
-
assert_equal '</div>', tag.close_tag
|
23
|
-
end
|
24
|
-
|
25
|
-
def teardown
|
26
|
-
end
|
27
|
-
end
|
data/test/test_okurigana_tag.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
require 'aozora2html'
|
5
|
-
|
6
|
-
class OkuriganaTagTest < Test::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
@parser = Object.new
|
9
|
-
stub(@parser).block_allowed_context? { true }
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_okurigana_new
|
13
|
-
tag = Aozora2Html::Tag::Okurigana.new(@parser, 'aaa')
|
14
|
-
assert_equal Aozora2Html::Tag::Okurigana, tag.class
|
15
|
-
assert_equal true, tag.is_a?(Aozora2Html::Tag::Inline)
|
16
|
-
end
|
17
|
-
|
18
|
-
using Aozora2Html::StringRefinements
|
19
|
-
|
20
|
-
def test_to_s
|
21
|
-
tag = Aozora2Html::Tag::Okurigana.new(@parser, 'テスト'.to_sjis)
|
22
|
-
assert_equal '<sup class="okurigana">テスト</sup>', tag.to_s.to_utf8
|
23
|
-
end
|
24
|
-
|
25
|
-
def teardown
|
26
|
-
end
|
27
|
-
end
|
data/test/test_ruby_parse.rb
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
require 'aozora2html'
|
5
|
-
|
6
|
-
class RubyParseTest < Test::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_parse_ruby1
|
11
|
-
src = "青空文庫《あおぞらぶんこ》\r\n"
|
12
|
-
parsed = parse_text(src)
|
13
|
-
expected = "<ruby><rb>青空文庫</rb><rp>(</rp><rt>あおぞらぶんこ</rt><rp>)</rp></ruby><br />\r\n"
|
14
|
-
assert_equal expected, parsed
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_parse_ruby1b
|
18
|
-
src = "身装《みなり》\r\n"
|
19
|
-
parsed = parse_text(src)
|
20
|
-
expected = "<ruby><rb>身装</rb><rp>(</rp><rt>みなり</rt><rp>)</rp></ruby><br />\r\n"
|
21
|
-
assert_equal expected, parsed
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_parse_ruby2
|
25
|
-
src = "霧の|ロンドン警視庁《スコットランドヤード》\r\n"
|
26
|
-
parsed = parse_text(src)
|
27
|
-
expected = "霧の<ruby><rb>ロンドン警視庁</rb><rp>(</rp><rt>スコットランドヤード</rt><rp>)</rp></ruby><br />\r\n"
|
28
|
-
assert_equal expected, parsed
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_parse_ruby2b
|
32
|
-
src = "いかにも最|猛者《もさ》のように\r\n"
|
33
|
-
parsed = parse_text(src)
|
34
|
-
expected = "いかにも最<ruby><rb>猛者</rb><rp>(</rp><rt>もさ</rt><rp>)</rp></ruby>のように<br />\r\n"
|
35
|
-
assert_equal expected, parsed
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_parse_ruby3
|
39
|
-
src = "〆切《しめきり》を逃れるために、市ヶ谷《いちがや》から転々《てんてん》と、居を移した。\r\n"
|
40
|
-
parsed = parse_text(src)
|
41
|
-
expected = "<ruby><rb>〆切</rb><rp>(</rp><rt>しめきり</rt><rp>)</rp></ruby>を逃れるために、<ruby><rb>市ヶ谷</rb><rp>(</rp><rt>いちがや</rt><rp>)</rp></ruby>から<ruby><rb>転々</rb><rp>(</rp><rt>てんてん</rt><rp>)</rp></ruby>と、居を移した。<br />\r\n"
|
42
|
-
assert_equal expected, parsed
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_parse_ruby4
|
46
|
-
src = "水鉢を置いた※[#「木+靈」、第3水準1-86-29]子窓《れんじまど》の下には\r\n"
|
47
|
-
parsed = parse_text(src)
|
48
|
-
expected = "水鉢を置いた<ruby><rb><img src=\"../../../gaiji/1-86/1-86-29.png\" alt=\"※(「木+靈」、第3水準1-86-29)\" class=\"gaiji\" />子窓</rb><rp>(</rp><rt>れんじまど</rt><rp>)</rp></ruby>の下には<br />\r\n"
|
49
|
-
assert_equal expected, parsed
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_parse_ruby5
|
53
|
-
src = "それが彼の 〔E'tude〕《エチュード》 だった。\r\n"
|
54
|
-
parsed = parse_text(src)
|
55
|
-
expected = "それが彼の <ruby><rb><img src=\"../../../gaiji/1-09/1-09-32.png\" alt=\"※(アキュートアクセント付きE)\" class=\"gaiji\" />tude</rb><rp>(</rp><rt>エチュード</rt><rp>)</rp></ruby> だった。<br />\r\n"
|
56
|
-
assert_equal expected, parsed
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_parse_ruby6
|
60
|
-
src = "青空文庫[#「青空文庫」の左に「あおぞらぶんこ」のルビ]\r\n"
|
61
|
-
parsed = parse_text(src)
|
62
|
-
expected = "青空文庫<span class=\"notes\">[#「青空文庫」の左に「あおぞらぶんこ」のルビ]</span><br />\r\n"
|
63
|
-
assert_equal expected, parsed
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_parse_ruby7
|
67
|
-
src = "青空文庫《あおぞらぶんこ》[#「青空文庫」の左に「aozora bunko」のルビ]\r\n"
|
68
|
-
parsed = parse_text(src)
|
69
|
-
expected = %Q(<ruby><rb>青空文庫</rb><rp>(</rp><rt>あおぞらぶんこ</rt><rp>)</rp></ruby><span class="notes">[#「青空文庫」の左に「aozora bunko」のルビ]</span><br />\r\n)
|
70
|
-
assert_equal expected, parsed
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_parse_ruby8
|
74
|
-
src = "大空文庫[#「大空文庫」に「ママ」の注記]\r\n"
|
75
|
-
parsed = parse_text(src)
|
76
|
-
expected = %Q(<ruby><rb>大空文庫</rb><rp>(</rp><rt>ママ</rt><rp>)</rp></ruby><br />\r\n)
|
77
|
-
assert_equal expected, parsed
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_parse_ruby9
|
81
|
-
src = "大空文庫[#「大空文庫」の左に「ママ」の注記]\r\n"
|
82
|
-
parsed = parse_text(src)
|
83
|
-
expected = %Q(大空文庫<span class="notes">[#「大空文庫」の左に「ママ」の注記]</span><br />\r\n)
|
84
|
-
assert_equal expected, parsed
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_parse_ruby10
|
88
|
-
src = "大空文庫《あおぞらぶんこ》[#「大空文庫」の左に「ママ」の注記]\r\n"
|
89
|
-
parsed = parse_text(src)
|
90
|
-
expected = %Q(<ruby><rb>大空文庫</rb><rp>(</rp><rt>あおぞらぶんこ</rt><rp>)</rp></ruby><span class="notes">[#「大空文庫」の左に「ママ」の注記]</span><br />\r\n)
|
91
|
-
assert_equal expected, parsed
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_parse_ruby11
|
95
|
-
src = "大空文庫《あおぞらぶんこ》[#「大空文庫」の左に「ママ」の注記]\r\n"
|
96
|
-
parsed = parse_text(src)
|
97
|
-
expected = %Q(<ruby><rb>大空文庫</rb><rp>(</rp><rt>あおぞらぶんこ</rt><rp>)</rp></ruby><span class="notes">[#「大空文庫」の左に「ママ」の注記]</span><br />\r\n)
|
98
|
-
assert_equal expected, parsed
|
99
|
-
end
|
100
|
-
|
101
|
-
using Aozora2Html::StringRefinements
|
102
|
-
|
103
|
-
def test_parse_ruby12
|
104
|
-
src = "大空文庫《あおぞらぶんこ》[#「大空文庫」に「ママ」の注記]\r\n"
|
105
|
-
assert_raise(Aozora2Html::Error.new('同じ箇所に2つのルビはつけられません'.to_sjis)) do
|
106
|
-
_parsed = parse_text(src)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_parse_ruby13
|
111
|
-
src = "[#注記付き]名※[#二の字点、1-2-22][#「(銘々)」の注記付き終わり]\r\n"
|
112
|
-
parsed = parse_text(src)
|
113
|
-
expected = %Q|<ruby><rb>名<img src="../../../gaiji/1-02/1-02-22.png" alt="※(二の字点、1-2-22)" class="gaiji" /></rb><rp>(</rp><rt>(銘々)</rt><rp>)</rp></ruby><br />\r\n|
|
114
|
-
assert_equal expected, parsed
|
115
|
-
end
|
116
|
-
|
117
|
-
def parse_text(input_text)
|
118
|
-
input = StringIO.new(input_text.to_sjis)
|
119
|
-
output = StringIO.new
|
120
|
-
parser = Aozora2Html.new(input, output)
|
121
|
-
parser.instance_eval { @section = :tail }
|
122
|
-
catch(:terminate) do
|
123
|
-
loop do
|
124
|
-
parser.__send__(:parse)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
output.string.to_utf8
|
129
|
-
end
|
130
|
-
end
|
data/test/test_ruby_tag.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
require 'aozora2html'
|
5
|
-
|
6
|
-
class RubyTagTest < Test::Unit::TestCase
|
7
|
-
def setup
|
8
|
-
@parser = Object.new
|
9
|
-
stub(@parser).block_allowed_context? { true }
|
10
|
-
end
|
11
|
-
|
12
|
-
using Aozora2Html::StringRefinements
|
13
|
-
|
14
|
-
def test_ruby_new
|
15
|
-
tag = Aozora2Html::Tag::Ruby.new(@parser, 'aaa'.to_sjis, 'bb')
|
16
|
-
assert_equal Aozora2Html::Tag::Ruby, tag.class
|
17
|
-
assert_equal true, tag.is_a?(Aozora2Html::Tag::Inline)
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_to_s
|
21
|
-
tag = Aozora2Html::Tag::Ruby.new(@parser, 'テスト'.to_sjis, 'てすと'.to_sjis)
|
22
|
-
assert_equal '<ruby><rb>テスト</rb><rp>(</rp><rt>てすと</rt><rp>)</rp></ruby>', tag.to_s.to_utf8
|
23
|
-
end
|
24
|
-
|
25
|
-
def teardown
|
26
|
-
end
|
27
|
-
end
|
data/test/test_tag_parser.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
require 'aozora2html'
|
5
|
-
require 'fileutils'
|
6
|
-
require 'tmpdir'
|
7
|
-
|
8
|
-
class TagParserTest < Test::Unit::TestCase
|
9
|
-
def setup
|
10
|
-
@jisx0213 = Aozora2Html::Tag::EmbedGaiji.use_jisx0213
|
11
|
-
end
|
12
|
-
|
13
|
-
using Aozora2Html::StringRefinements
|
14
|
-
|
15
|
-
def test_parse_katakana
|
16
|
-
str = "テスト!あいうえお\r\n".to_sjis
|
17
|
-
strio = StringIO.new(str)
|
18
|
-
stream = Jstream.new(strio)
|
19
|
-
command, _raw = Aozora2Html::TagParser.new(stream, '!'.to_sjis, {}, [], gaiji_dir: nil).process
|
20
|
-
expected = 'テスト'
|
21
|
-
assert_equal expected, command.to_s.to_utf8
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_parse_bouten
|
25
|
-
str = "腹がへっても[#「腹がへっても」に傍点]、ひもじゅうない[#「ひもじゅうない」に傍点]とかぶりを振っている…\r\n".to_sjis
|
26
|
-
strio = StringIO.new(str)
|
27
|
-
stream = Jstream.new(strio)
|
28
|
-
command, _raw = Aozora2Html::TagParser.new(stream, '…'.to_sjis, {}, [], gaiji_dir: nil).process
|
29
|
-
expected = '<em class="sesame_dot">腹がへっても</em>、<em class="sesame_dot">ひもじゅうない</em>とかぶりを振っている'
|
30
|
-
assert_equal expected, command.to_s.to_utf8
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_parse_gaiji
|
34
|
-
str = "※[#「てへん+劣」、第3水準1-84-77]…\r\n".to_sjis
|
35
|
-
strio = StringIO.new(str)
|
36
|
-
stream = Jstream.new(strio)
|
37
|
-
command, _raw = Aozora2Html::TagParser.new(stream, '…'.to_sjis, {}, [], gaiji_dir: 'g_dir/').process
|
38
|
-
expected = '<img src="g_dir/1-84/1-84-77.png" alt="※(「てへん+劣」、第3水準1-84-77)" class="gaiji" />'
|
39
|
-
assert_equal expected, command.to_s.to_utf8
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_parse_gaiji_a
|
43
|
-
str = "※[#「口+世」、ページ数-行数]…\r\n".to_sjis
|
44
|
-
strio = StringIO.new(str)
|
45
|
-
stream = Jstream.new(strio)
|
46
|
-
command, _raw = Aozora2Html::TagParser.new(stream, '…'.to_sjis, {}, [], gaiji_dir: 'g_dir/').process
|
47
|
-
expected = '※<span class="notes">[#「口+世」、ページ数-行数]</span>'
|
48
|
-
assert_equal expected, command.to_s.to_utf8
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_parse_gaiji_b
|
52
|
-
str = "※[#二の字点、1-2-22]…\r\n".to_sjis
|
53
|
-
strio = StringIO.new(str)
|
54
|
-
stream = Jstream.new(strio)
|
55
|
-
command, _raw = Aozora2Html::TagParser.new(stream, '…'.to_sjis, {}, [], gaiji_dir: 'g_dir/').process
|
56
|
-
expected = '<img src="g_dir/1-02/1-02-22.png" alt="※(二の字点、1-2-22)" class="gaiji" />'
|
57
|
-
assert_equal expected, command.to_s.to_utf8
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_parse_gaiji_kaeri
|
61
|
-
str = "自[#二]女王國[#一]東度[#レ]海千餘里。…\r\n".to_sjis
|
62
|
-
strio = StringIO.new(str)
|
63
|
-
stream = Jstream.new(strio)
|
64
|
-
command, _raw = Aozora2Html::TagParser.new(stream, '…'.to_sjis, {}, [], gaiji_dir: 'g_dir/').process
|
65
|
-
expected = '自<sub class="kaeriten">二</sub>女王國<sub class="kaeriten">一</sub>東度<sub class="kaeriten">レ</sub>海千餘里。'
|
66
|
-
assert_equal expected, command.to_s.to_utf8
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_parse_gaiji_jisx0213
|
70
|
-
Aozora2Html::Tag::EmbedGaiji.use_jisx0213 = true
|
71
|
-
str = "※[#「てへん+劣」、第3水準1-84-77]…\r\n".to_sjis
|
72
|
-
strio = StringIO.new(str)
|
73
|
-
stream = Jstream.new(strio)
|
74
|
-
command, _raw = Aozora2Html::TagParser.new(stream, '…'.to_sjis, {}, [], gaiji_dir: 'g_dir/').process
|
75
|
-
expected = '挘'
|
76
|
-
assert_equal expected, command.to_s.to_utf8
|
77
|
-
end
|
78
|
-
|
79
|
-
def teardown
|
80
|
-
Aozora2Html::Tag::EmbedGaiji.use_jisx0213 = @jisx0213
|
81
|
-
end
|
82
|
-
end
|