aozora2html 0.7.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +34 -0
- data/.gitignore +8 -3
- data/.rubocop.yml +227 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +33 -0
- data/LICENSE +116 -0
- data/README.md +16 -11
- data/aozora2html.gemspec +6 -6
- data/bin/aozora2html +6 -54
- data/lib/aozora2html/accent_parser.rb +91 -0
- data/lib/aozora2html/error.rb +16 -0
- data/lib/aozora2html/header.rb +139 -0
- data/lib/aozora2html/i18n.rb +28 -0
- data/lib/aozora2html/ruby_buffer.rb +81 -0
- data/lib/aozora2html/style_stack.rb +27 -0
- data/lib/aozora2html/tag/accent.rb +39 -0
- data/lib/aozora2html/tag/block.rb +19 -0
- data/lib/aozora2html/tag/chitsuki.rb +15 -0
- data/lib/aozora2html/tag/dakuten_katakana.rb +23 -0
- data/lib/aozora2html/tag/decorate.rb +18 -0
- data/lib/aozora2html/tag/dir.rb +15 -0
- data/lib/aozora2html/tag/editor_note.rb +16 -0
- data/lib/aozora2html/tag/embed_gaiji.rb +48 -0
- data/lib/aozora2html/tag/font_size.rb +17 -0
- data/lib/aozora2html/tag/gaiji.rb +11 -0
- data/lib/aozora2html/tag/img.rb +21 -0
- data/lib/aozora2html/tag/indent.rb +8 -0
- data/lib/aozora2html/tag/inline.rb +13 -0
- data/lib/aozora2html/tag/inline_caption.rb +15 -0
- data/lib/aozora2html/tag/inline_font_size.rb +18 -0
- data/lib/aozora2html/tag/inline_keigakomi.rb +15 -0
- data/lib/aozora2html/tag/inline_yokogumi.rb +16 -0
- data/lib/aozora2html/tag/jisage.rb +15 -0
- data/lib/aozora2html/tag/jizume.rb +16 -0
- data/lib/aozora2html/tag/kaeriten.rb +15 -0
- data/lib/aozora2html/tag/keigakomi.rb +13 -0
- data/lib/aozora2html/tag/kunten.rb +12 -0
- data/lib/aozora2html/tag/midashi.rb +18 -0
- data/lib/aozora2html/tag/multiline.rb +6 -0
- data/lib/aozora2html/tag/multiline_caption.rb +15 -0
- data/lib/aozora2html/tag/multiline_chitsuki.rb +8 -0
- data/lib/aozora2html/tag/multiline_jisage.rb +8 -0
- data/lib/aozora2html/tag/multiline_midashi.rb +22 -0
- data/lib/aozora2html/tag/multiline_style.rb +17 -0
- data/lib/aozora2html/tag/multiline_yokogumi.rb +17 -0
- data/lib/aozora2html/tag/okurigana.rb +15 -0
- data/lib/aozora2html/tag/oneline_chitsuki.rb +9 -0
- data/lib/aozora2html/tag/oneline_indent.rb +2 -0
- data/lib/aozora2html/tag/oneline_jisage.rb +7 -0
- data/lib/aozora2html/tag/reference_mentioned.rb +46 -0
- data/lib/aozora2html/tag/ruby.rb +98 -0
- data/lib/aozora2html/tag/un_embed_gaiji.rb +24 -0
- data/lib/aozora2html/tag.rb +55 -0
- data/lib/aozora2html/tag_parser.rb +53 -0
- data/lib/aozora2html/utils.rb +93 -0
- data/lib/aozora2html/version.rb +1 -1
- data/lib/aozora2html/yaml_loader.rb +31 -0
- data/lib/aozora2html.rb +0 -4
- data/lib/extensions.rb +44 -0
- data/lib/jstream.rb +68 -0
- data/lib/t2hs.rb +837 -1765
- data/test/test_aozora2html.rb +320 -43
- data/test/test_aozora_accent_parser.rb +13 -2
- data/test/test_command_parse.rb +213 -0
- data/test/test_dakuten_katakana_tag.rb +5 -4
- data/test/test_decorate_tag.rb +5 -4
- data/test/test_dir_tag.rb +5 -4
- data/test/test_editor_note_tag.rb +4 -4
- data/test/test_exception.rb +4 -4
- data/test/test_font_size_tag.rb +15 -7
- data/test/test_gaiji_tag.rb +14 -7
- data/test/test_header.rb +60 -0
- data/test/test_i18n.rb +23 -0
- data/test/test_img_tag.rb +5 -4
- data/test/test_inline_caption_tag.rb +5 -4
- data/test/test_inline_font_size_tag.rb +7 -6
- data/test/test_inline_keigakomi_tag.rb +5 -4
- data/test/test_inline_yokogumi_tag.rb +5 -4
- data/test/test_jizume_tag.rb +7 -6
- data/test/test_jstream.rb +5 -5
- data/test/test_kaeriten_tag.rb +5 -4
- data/test/test_keigakomi_tag.rb +8 -7
- data/test/test_midashi_tag.rb +38 -0
- data/test/test_multiline_caption_tag.rb +7 -6
- data/test/test_multiline_midashi_tag.rb +24 -7
- data/test/test_multiline_style_tag.rb +7 -6
- data/test/test_multiline_yokogumi_tag.rb +7 -6
- data/test/test_okurigana_tag.rb +5 -4
- data/test/test_ruby_parse.rb +130 -0
- data/test/test_ruby_tag.rb +5 -4
- data/test/test_tag_parser.rb +10 -10
- data/vendor/jis2ucs/README.md +3 -6
- data/yml/accent_table.yml +240 -0
- data/yml/command_table.yml +61 -0
- data/yml/jis2ucs.yml +11234 -0
- metadata +74 -42
- data/appveyor.yml +0 -19
- data/lib/accent_tag.rb +0 -23
- data/lib/aozora2html/jis2ucs.rb +0 -11237
- data/lib/embed_gaiji_tag.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 635bbe67e2511af4a4f8ccc8a820bdb87991d75d88fa9aa7ca9a90f2f67d7785
|
4
|
+
data.tar.gz: ac7c5d1f77f0c4b89d24f93e6117107d3ee4ac5890aef5e082368f0fa7e8e318
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a939ef551dd506ae1f7ca4d608fbbe747aa7b4ada56a07fd83385c330fade541353d80f66fa8f4ed5d1342cd01d65af74c6c973ed2979c1dce12dcc7b10830a2
|
7
|
+
data.tar.gz: 5c982a53cdffc60bad3c98406b74f640af4c1896fed6b42398a91025788962b4d2377950d40a0b25e4553fd92f94ac69c4ed8ac34fa21918cd0cb2148a1b0def
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Check if Ruby codes pass tests.
|
2
|
+
#
|
3
|
+
# Reference:
|
4
|
+
# - https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
5
|
+
|
6
|
+
name: Test
|
7
|
+
|
8
|
+
on:
|
9
|
+
push:
|
10
|
+
branches:
|
11
|
+
- master
|
12
|
+
pull_request:
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
build:
|
16
|
+
|
17
|
+
runs-on: ${{ matrix.os }}
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
matrix:
|
21
|
+
ruby: [ '3.0', '2.7', '2.6', '2.5', '2.4' ]
|
22
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
23
|
+
steps:
|
24
|
+
- uses: actions/checkout@v1
|
25
|
+
- name: Set up Ruby
|
26
|
+
uses: ruby/setup-ruby@v1
|
27
|
+
with:
|
28
|
+
ruby-version: ${{ matrix.ruby }}
|
29
|
+
- name: Build and test with Rake
|
30
|
+
shell: bash
|
31
|
+
run: |
|
32
|
+
gem install bundler --no-document
|
33
|
+
bundle install --jobs 4 --retry 3
|
34
|
+
bundle exec rake
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,227 @@
|
|
1
|
+
inherit_gem:
|
2
|
+
meowcop:
|
3
|
+
- config/rubocop.yml
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 2.1
|
7
|
+
|
8
|
+
# EnforcedStyle: with_first_parameter => 0 offense
|
9
|
+
# EnforcedStyle: with_fixed_indentation => 17 offenses
|
10
|
+
Layout/AlignParameters:
|
11
|
+
EnforcedStyle: with_first_parameter
|
12
|
+
Enabled: true
|
13
|
+
|
14
|
+
# EnforcedStyle: empty_lines => 80 offenses
|
15
|
+
# EnforcedStyle: no_empty_lines => 0 offense
|
16
|
+
Layout/EmptyLinesAroundBlockBody:
|
17
|
+
EnforcedStyle: no_empty_lines
|
18
|
+
Enabled: true
|
19
|
+
|
20
|
+
# EnforcedStyleInsidePipes: space => 39 offenses
|
21
|
+
# EnforcedStyleInsidePipes: no_space => 0 offense
|
22
|
+
Layout/SpaceAroundBlockParameters:
|
23
|
+
EnforcedStyleInsidePipes: no_space
|
24
|
+
Enabled: true
|
25
|
+
|
26
|
+
# EnforcedStyle: space => 42 offenses
|
27
|
+
# EnforcedStyle: no_space => 4 offenses
|
28
|
+
Layout/SpaceBeforeBlockBraces:
|
29
|
+
EnforcedStyle: no_space
|
30
|
+
Enabled: true
|
31
|
+
|
32
|
+
# EnforcedStyle: space => 98 offenses
|
33
|
+
# EnforcedStyle: no_space => 0 offense
|
34
|
+
Layout/SpaceInsideStringInterpolation:
|
35
|
+
EnforcedStyle: no_space
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
# EnforcedStyle: percent_q => 0 offense
|
39
|
+
# EnforcedStyle: bare_percent => 30 offenses
|
40
|
+
Style/BarePercentLiterals:
|
41
|
+
EnforcedStyle: percent_q
|
42
|
+
Enabled: true
|
43
|
+
|
44
|
+
# EnforcedStyle: nested => 2 offenses
|
45
|
+
# EnforcedStyle: compact => 81 offenses
|
46
|
+
Style/ClassAndModuleChildren:
|
47
|
+
EnforcedStyle: nested
|
48
|
+
Enabled: true
|
49
|
+
|
50
|
+
# EnforcedStyle: compact => 24 offenses
|
51
|
+
# EnforcedStyle: expanded => 0 offense
|
52
|
+
Style/EmptyMethod:
|
53
|
+
EnforcedStyle: expanded
|
54
|
+
Enabled: true
|
55
|
+
|
56
|
+
# EnforcedStyle: when_needed => 10 offenses
|
57
|
+
# EnforcedStyle: always => 57 offenses
|
58
|
+
# EnforcedStyle: never => 32 offenses
|
59
|
+
Style/Encoding:
|
60
|
+
EnforcedStyle: when_needed
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
# EnforcedStyle: for => 13 offenses
|
64
|
+
# EnforcedStyle: each => 0 offense
|
65
|
+
Style/For:
|
66
|
+
EnforcedStyle: each
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
# EnforcedStyle: require_parentheses => 0 offense
|
70
|
+
# EnforcedStyle: require_no_parentheses => 112 offenses
|
71
|
+
# EnforcedStyle: require_no_parentheses_except_multiline => 112 offenses
|
72
|
+
Style/MethodDefParentheses:
|
73
|
+
EnforcedStyle: require_parentheses
|
74
|
+
Enabled: true
|
75
|
+
|
76
|
+
# EnforcedStyle: snake_case => 0 offense
|
77
|
+
# EnforcedStyle: camelCase => 268 offenses
|
78
|
+
Style/MethodName:
|
79
|
+
EnforcedStyle: snake_case
|
80
|
+
Enabled: true
|
81
|
+
|
82
|
+
# EnforcedStyle: compact => 25 offenses
|
83
|
+
# EnforcedStyle: exploded => 0 offense
|
84
|
+
Style/RaiseArgs:
|
85
|
+
EnforcedStyle: exploded
|
86
|
+
Enabled: true
|
87
|
+
|
88
|
+
# EnforcedStyle: only_raise => 0 offense
|
89
|
+
# EnforcedStyle: only_fail => 26 offenses
|
90
|
+
# EnforcedStyle: semantic => 25 offenses
|
91
|
+
Style/SignalException:
|
92
|
+
EnforcedStyle: only_raise
|
93
|
+
Enabled: true
|
94
|
+
|
95
|
+
# EnforcedStyle: snake_case => 0 offense
|
96
|
+
# EnforcedStyle: camelCase => 126 offenses
|
97
|
+
Style/VariableName:
|
98
|
+
EnforcedStyle: snake_case
|
99
|
+
Enabled: true
|
100
|
+
|
101
|
+
# EnforcedStyle: snake_case => 11 offenses
|
102
|
+
# EnforcedStyle: normalcase => 0 offense
|
103
|
+
# EnforcedStyle: non_integer => 11 offenses
|
104
|
+
Style/VariableNumber:
|
105
|
+
EnforcedStyle: normalcase
|
106
|
+
Enabled: true
|
107
|
+
|
108
|
+
Style/StringLiterals:
|
109
|
+
Enabled: false
|
110
|
+
|
111
|
+
Layout/SpaceAfterComma:
|
112
|
+
Enabled: false
|
113
|
+
|
114
|
+
Layout/SpaceAroundOperators:
|
115
|
+
Enabled: false
|
116
|
+
|
117
|
+
Layout/SpaceInsideBlockBraces:
|
118
|
+
Enabled: false
|
119
|
+
|
120
|
+
Style/UnneededPercentQ:
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
Style/PercentQLiterals:
|
124
|
+
Enabled: false
|
125
|
+
|
126
|
+
Style/SpecialGlobalVars:
|
127
|
+
Enabled: false
|
128
|
+
|
129
|
+
Style/Encoding:
|
130
|
+
Enabled: false
|
131
|
+
|
132
|
+
Style/ParallelAssignment:
|
133
|
+
Enabled: false
|
134
|
+
|
135
|
+
Style/IfInsideElse:
|
136
|
+
Enabled: false
|
137
|
+
|
138
|
+
Style/PercentLiteralDelimiters:
|
139
|
+
Enabled: false
|
140
|
+
|
141
|
+
Style/ClassCheck:
|
142
|
+
Enabled: false
|
143
|
+
|
144
|
+
Style/RedundantBegin:
|
145
|
+
Enabled: false
|
146
|
+
|
147
|
+
Layout/EmptyLineAfterMagicComment:
|
148
|
+
Enabled: false
|
149
|
+
|
150
|
+
Style/AsciiComments:
|
151
|
+
Enabled: false
|
152
|
+
|
153
|
+
Style/LineEndConcatenation:
|
154
|
+
Enabled: false
|
155
|
+
|
156
|
+
Style/MethodCallWithoutArgsParentheses:
|
157
|
+
Enabled: false
|
158
|
+
|
159
|
+
Style/GlobalVars:
|
160
|
+
Enabled: false
|
161
|
+
|
162
|
+
Style/IfUnlessModifier:
|
163
|
+
Enabled: false
|
164
|
+
|
165
|
+
Style/NumericPredicate:
|
166
|
+
Enabled: false
|
167
|
+
|
168
|
+
Style/ZeroLengthPredicate:
|
169
|
+
Enabled: false
|
170
|
+
|
171
|
+
Layout/TrailingBlankLines:
|
172
|
+
Enabled: false
|
173
|
+
|
174
|
+
Metrics/AbcSize:
|
175
|
+
Enabled: true
|
176
|
+
Max: 260.05
|
177
|
+
|
178
|
+
Metrics/BlockLength:
|
179
|
+
Enabled: true
|
180
|
+
Max: 150
|
181
|
+
|
182
|
+
Metrics/BlockNesting:
|
183
|
+
Enabled: true
|
184
|
+
Max: 10
|
185
|
+
|
186
|
+
Metrics/ClassLength:
|
187
|
+
Enabled: true
|
188
|
+
Max: 2000
|
189
|
+
|
190
|
+
Metrics/CyclomaticComplexity:
|
191
|
+
Enabled: true
|
192
|
+
Max: 100
|
193
|
+
|
194
|
+
Metrics/LineLength:
|
195
|
+
Enabled: true
|
196
|
+
Max: 500
|
197
|
+
|
198
|
+
Metrics/MethodLength:
|
199
|
+
Enabled: true
|
200
|
+
Max: 200
|
201
|
+
|
202
|
+
Metrics/ModuleLength:
|
203
|
+
Enabled: true
|
204
|
+
Max: 100
|
205
|
+
|
206
|
+
Metrics/ParameterLists:
|
207
|
+
Enabled: true
|
208
|
+
Max: 10
|
209
|
+
|
210
|
+
Metrics/PerceivedComplexity:
|
211
|
+
Enabled: true
|
212
|
+
Max: 100
|
213
|
+
|
214
|
+
|
215
|
+
###
|
216
|
+
Performance/RedundantMatch:
|
217
|
+
Enabled: false
|
218
|
+
Performance/StringReplacement:
|
219
|
+
Enabled: false
|
220
|
+
Layout/SpaceBeforeBlockBraces:
|
221
|
+
Enabled: false
|
222
|
+
|
223
|
+
### あとで直す
|
224
|
+
Lint/StringConversionInInterpolation:
|
225
|
+
Enabled: false
|
226
|
+
Style/ClassAndModuleChildren:
|
227
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,36 @@
|
|
1
|
+
<a name="0.9.1"></a>
|
2
|
+
## 0.9.1
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* 内部構造を改造した
|
7
|
+
* lib/t2hs.rbをUTF-8化した
|
8
|
+
|
9
|
+
<a name="0.9.0"></a>
|
10
|
+
## 0.9.0
|
11
|
+
|
12
|
+
### Features
|
13
|
+
|
14
|
+
* 内部構造を大改造した
|
15
|
+
* lib/t2hs.rb内で定義されているクラスをRubyの命名規則に合わせて変更し、外部ファイルにした
|
16
|
+
* `Aozora2Html.new(input, output)`の引数`input`,`output`でIOも受け取れるようにした
|
17
|
+
* `bin/aozora2html`にあったmonkey patchingも`lib/`以下に移動させた
|
18
|
+
|
19
|
+
<a name="0.7.1"></a>
|
20
|
+
## 0.7.1
|
21
|
+
|
22
|
+
### Bug Fixes
|
23
|
+
|
24
|
+
* `--use-unicode`オプションをつけていない時の外字処理を修正した
|
25
|
+
* くの字点が正しく処理されない場合があるのを修正した
|
26
|
+
|
27
|
+
<a name="0.7.0"></a>
|
28
|
+
## 0.7.0
|
29
|
+
|
30
|
+
### Features
|
31
|
+
|
32
|
+
* `--css-files`オプションを追加して、CSSを変更できるようにした
|
33
|
+
|
1
34
|
<a name="0.6.1"></a>
|
2
35
|
## 0.6.1
|
3
36
|
|
data/LICENSE
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
CC0 1.0 Universal
|
2
|
+
|
3
|
+
Statement of Purpose
|
4
|
+
|
5
|
+
The laws of most jurisdictions throughout the world automatically confer
|
6
|
+
exclusive Copyright and Related Rights (defined below) upon the creator and
|
7
|
+
subsequent owner(s) (each and all, an "owner") of an original work of
|
8
|
+
authorship and/or a database (each, a "Work").
|
9
|
+
|
10
|
+
Certain owners wish to permanently relinquish those rights to a Work for the
|
11
|
+
purpose of contributing to a commons of creative, cultural and scientific
|
12
|
+
works ("Commons") that the public can reliably and without fear of later
|
13
|
+
claims of infringement build upon, modify, incorporate in other works, reuse
|
14
|
+
and redistribute as freely as possible in any form whatsoever and for any
|
15
|
+
purposes, including without limitation commercial purposes. These owners may
|
16
|
+
contribute to the Commons to promote the ideal of a free culture and the
|
17
|
+
further production of creative, cultural and scientific works, or to gain
|
18
|
+
reputation or greater distribution for their Work in part through the use and
|
19
|
+
efforts of others.
|
20
|
+
|
21
|
+
For these and/or other purposes and motivations, and without any expectation
|
22
|
+
of additional consideration or compensation, the person associating CC0 with a
|
23
|
+
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
|
24
|
+
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
|
25
|
+
and publicly distribute the Work under its terms, with knowledge of his or her
|
26
|
+
Copyright and Related Rights in the Work and the meaning and intended legal
|
27
|
+
effect of CC0 on those rights.
|
28
|
+
|
29
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
30
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
31
|
+
Related Rights"). Copyright and Related Rights include, but are not limited
|
32
|
+
to, the following:
|
33
|
+
|
34
|
+
i. the right to reproduce, adapt, distribute, perform, display, communicate,
|
35
|
+
and translate a Work;
|
36
|
+
|
37
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
38
|
+
|
39
|
+
iii. publicity and privacy rights pertaining to a person's image or likeness
|
40
|
+
depicted in a Work;
|
41
|
+
|
42
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
43
|
+
subject to the limitations in paragraph 4(a), below;
|
44
|
+
|
45
|
+
v. rights protecting the extraction, dissemination, use and reuse of data in
|
46
|
+
a Work;
|
47
|
+
|
48
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
49
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
50
|
+
protection of databases, and under any national implementation thereof,
|
51
|
+
including any amended or successor version of such directive); and
|
52
|
+
|
53
|
+
vii. other similar, equivalent or corresponding rights throughout the world
|
54
|
+
based on applicable law or treaty, and any national implementations thereof.
|
55
|
+
|
56
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention of,
|
57
|
+
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
|
58
|
+
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
|
59
|
+
and Related Rights and associated claims and causes of action, whether now
|
60
|
+
known or unknown (including existing as well as future claims and causes of
|
61
|
+
action), in the Work (i) in all territories worldwide, (ii) for the maximum
|
62
|
+
duration provided by applicable law or treaty (including future time
|
63
|
+
extensions), (iii) in any current or future medium and for any number of
|
64
|
+
copies, and (iv) for any purpose whatsoever, including without limitation
|
65
|
+
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
|
66
|
+
the Waiver for the benefit of each member of the public at large and to the
|
67
|
+
detriment of Affirmer's heirs and successors, fully intending that such Waiver
|
68
|
+
shall not be subject to revocation, rescission, cancellation, termination, or
|
69
|
+
any other legal or equitable action to disrupt the quiet enjoyment of the Work
|
70
|
+
by the public as contemplated by Affirmer's express Statement of Purpose.
|
71
|
+
|
72
|
+
3. Public License Fallback. Should any part of the Waiver for any reason be
|
73
|
+
judged legally invalid or ineffective under applicable law, then the Waiver
|
74
|
+
shall be preserved to the maximum extent permitted taking into account
|
75
|
+
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
|
76
|
+
is so judged Affirmer hereby grants to each affected person a royalty-free,
|
77
|
+
non transferable, non sublicensable, non exclusive, irrevocable and
|
78
|
+
unconditional license to exercise Affirmer's Copyright and Related Rights in
|
79
|
+
the Work (i) in all territories worldwide, (ii) for the maximum duration
|
80
|
+
provided by applicable law or treaty (including future time extensions), (iii)
|
81
|
+
in any current or future medium and for any number of copies, and (iv) for any
|
82
|
+
purpose whatsoever, including without limitation commercial, advertising or
|
83
|
+
promotional purposes (the "License"). The License shall be deemed effective as
|
84
|
+
of the date CC0 was applied by Affirmer to the Work. Should any part of the
|
85
|
+
License for any reason be judged legally invalid or ineffective under
|
86
|
+
applicable law, such partial invalidity or ineffectiveness shall not
|
87
|
+
invalidate the remainder of the License, and in such case Affirmer hereby
|
88
|
+
affirms that he or she will not (i) exercise any of his or her remaining
|
89
|
+
Copyright and Related Rights in the Work or (ii) assert any associated claims
|
90
|
+
and causes of action with respect to the Work, in either case contrary to
|
91
|
+
Affirmer's express Statement of Purpose.
|
92
|
+
|
93
|
+
4. Limitations and Disclaimers.
|
94
|
+
|
95
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
96
|
+
surrendered, licensed or otherwise affected by this document.
|
97
|
+
|
98
|
+
b. Affirmer offers the Work as-is and makes no representations or warranties
|
99
|
+
of any kind concerning the Work, express, implied, statutory or otherwise,
|
100
|
+
including without limitation warranties of title, merchantability, fitness
|
101
|
+
for a particular purpose, non infringement, or the absence of latent or
|
102
|
+
other defects, accuracy, or the present or absence of errors, whether or not
|
103
|
+
discoverable, all to the greatest extent permissible under applicable law.
|
104
|
+
|
105
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
106
|
+
that may apply to the Work or any use thereof, including without limitation
|
107
|
+
any person's Copyright and Related Rights in the Work. Further, Affirmer
|
108
|
+
disclaims responsibility for obtaining any necessary consents, permissions
|
109
|
+
or other rights required for any use of the Work.
|
110
|
+
|
111
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
112
|
+
party to this document and has no duty or obligation with respect to this
|
113
|
+
CC0 or use of the Work.
|
114
|
+
|
115
|
+
For more information, please see
|
116
|
+
<http://creativecommons.org/publicdomain/zero/1.0/>
|
data/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# Aozora2Html
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/aozorahack/aozora2html.svg?branch=master)](https://travis-ci.org/aozorahack/aozora2html)
|
3
|
+
[![Build Status](https://travis-ci.org/aozorahack/aozora2html.svg?branch=master)](https://travis-ci.org/aozorahack/aozora2html)
|
4
|
+
[![Build Status](https://github.com/aozorahack/aozora2html/workflows/Test/badge.svg)](https://github.com/aozorahack/aozora2html/actions)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/aozora2html.svg)](https://badge.fury.io/rb/aozora2html)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/aozorahack/aozora2html/badges/gpa.svg)](https://codeclimate.com/github/aozorahack/aozora2html)
|
4
7
|
|
5
|
-
|
8
|
+
青空文庫の[「組版案内」](http://kumihan.aozora.gr.jp/)で配布されている `txt2html`内にある`t2hs.rb`を改造するプロジェクトです。
|
6
9
|
|
7
10
|
## 動作環境
|
8
11
|
|
@@ -12,13 +15,13 @@ Ruby 2.0以上が推奨ですが、1.9でも動くはずです。
|
|
12
15
|
|
13
16
|
RubyGemsとしてインストール可能になっています。
|
14
17
|
|
15
|
-
```
|
18
|
+
```shell-session
|
16
19
|
$ gem install aozora2html
|
17
20
|
```
|
18
21
|
|
19
22
|
ソースからインストールするときは以下のようにします。
|
20
23
|
|
21
|
-
```
|
24
|
+
```shell-session
|
22
25
|
$ gem install bundler
|
23
26
|
$ rake install
|
24
27
|
```
|
@@ -27,27 +30,27 @@ $ rake install
|
|
27
30
|
|
28
31
|
コマンドは`aozora2html`です。以下のように実行します。
|
29
32
|
|
30
|
-
```
|
33
|
+
```shell-session
|
31
34
|
$ aozora2html foo.txt foo.html
|
32
35
|
```
|
33
36
|
|
34
|
-
|
37
|
+
こうすると、青空文庫記法で書かれた`foo.txt`を`foo.html`に変換します。
|
35
38
|
|
36
39
|
また、青空文庫サイトで配布している、中にテキストファイルが同梱されているzip形式のファイルも変換できます。
|
37
40
|
|
38
|
-
```
|
41
|
+
```shell-session
|
39
42
|
$ aozora2html foo.zip foo.html
|
40
43
|
```
|
41
44
|
|
42
45
|
第1引数にURLを指定すると、そのURLのファイルをダウンロードして変換します。
|
43
46
|
|
44
|
-
```
|
47
|
+
```shell-session
|
45
48
|
$ aozora2html http://example.jp/foo/bar.zip foo.html
|
46
49
|
```
|
47
50
|
|
48
51
|
第2引数を省略すると、ファイルではなく標準出力に変換結果を出力します。
|
49
52
|
|
50
|
-
```
|
53
|
+
```shell-session
|
51
54
|
$ aozora2html foo.txt
|
52
55
|
```
|
53
56
|
|
@@ -58,7 +61,7 @@ $ aozora2html foo.txt
|
|
58
61
|
|
59
62
|
可能な限り数値実体参照を使って表示するには、以下のようにオプションを指定します。
|
60
63
|
|
61
|
-
```
|
64
|
+
```shell-session
|
62
65
|
$ aozora2html --use-jisx0213 --use-unicode foo.txt
|
63
66
|
```
|
64
67
|
|
@@ -66,7 +69,7 @@ $ aozora2html --use-jisx0213 --use-unicode foo.txt
|
|
66
69
|
|
67
70
|
テストも追加しています。テストは以下のように実行します。
|
68
71
|
|
69
|
-
```
|
72
|
+
```shell-session
|
70
73
|
$ bundle install
|
71
74
|
$ rake test
|
72
75
|
```
|
@@ -79,4 +82,6 @@ $ rake test
|
|
79
82
|
|
80
83
|
CC0
|
81
84
|
|
85
|
+
[![CC0](http://i.creativecommons.org/p/zero/1.0/88x31.png "CC0")](http://creativecommons.org/publicdomain/zero/1.0/deed.ja)
|
86
|
+
|
82
87
|
To the extent possible under law, 青空文庫 has waived all copyright and related or neighboring rights to txt2xhtml. This work is published from Japan.
|
data/aozora2html.gemspec
CHANGED
@@ -21,13 +21,13 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
|
24
|
+
if RUBY_VERSION < "2.4.0"
|
25
|
+
spec.add_dependency "rubyzip", "~> 1.3"
|
26
|
+
else
|
27
|
+
spec.add_dependency "rubyzip", "~> 2.0"
|
28
|
+
end
|
25
29
|
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "rake", "~>
|
30
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
27
31
|
spec.add_development_dependency "test-unit"
|
28
32
|
spec.add_development_dependency "test-unit-rr"
|
29
|
-
# spec.add_development_dependency "test-unit-notify"
|
30
|
-
# spec.add_development_dependency "terminal-notifier"
|
31
|
-
spec.add_development_dependency "guard"
|
32
|
-
spec.add_development_dependency "guard-test"
|
33
33
|
end
|
data/bin/aozora2html
CHANGED
@@ -3,53 +3,7 @@
|
|
3
3
|
require 'aozora2html'
|
4
4
|
require 'optparse'
|
5
5
|
require "tempfile"
|
6
|
-
|
7
|
-
# override Aozora2Html#push_chars
|
8
|
-
#
|
9
|
-
# Original Aozora2Html#push_chars does not convert "'" into '''; it's old behaivor
|
10
|
-
# of CGI.escapeHTML().
|
11
|
-
#
|
12
|
-
class Aozora2Html
|
13
|
-
def push_chars(obj)
|
14
|
-
if obj.is_a?(Array)
|
15
|
-
obj.each{|x|
|
16
|
-
push_chars(x)
|
17
|
-
}
|
18
|
-
elsif obj.is_a?(String)
|
19
|
-
if obj.length == 1
|
20
|
-
obj = obj.gsub(/[&\"<>]/, {'&' => '&', '"' => '"', '<' => '<', '>' => '>'})
|
21
|
-
end
|
22
|
-
obj.each_char{|x|
|
23
|
-
push_char(x)
|
24
|
-
}
|
25
|
-
else
|
26
|
-
push_char(obj)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def dispatch_gaiji
|
31
|
-
hook = @stream.peek_char(0)
|
32
|
-
if hook == "[".encode("shift_jis")
|
33
|
-
read_char
|
34
|
-
# embed?
|
35
|
-
command,raw = read_to_nest("]".encode("shift_jis"))
|
36
|
-
try_emb = kuten2png(command)
|
37
|
-
if try_emb != command
|
38
|
-
try_emb
|
39
|
-
elsif command.match(/U\+([0-9A-F]{4,5})/)
|
40
|
-
unicode_num = $1
|
41
|
-
ch = Embed_Gaiji_tag.new(self, nil, nil, command)
|
42
|
-
ch.unicode = unicode_num
|
43
|
-
ch
|
44
|
-
else
|
45
|
-
# Unemb
|
46
|
-
escape_gaiji(command)
|
47
|
-
end
|
48
|
-
else
|
49
|
-
"※".encode("shift_jis")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
6
|
+
require 'open-uri'
|
53
7
|
|
54
8
|
opt = OptionParser.new("Usage: aozora2html [options] <text file> [<html file>]\n")
|
55
9
|
opt.on('--gaiji-dir DIR', 'setting gaiji directory')
|
@@ -68,12 +22,12 @@ if options["css-files"]
|
|
68
22
|
end
|
69
23
|
|
70
24
|
if options["use-jisx0213"]
|
71
|
-
|
72
|
-
|
25
|
+
Aozora2Html::Tag::EmbedGaiji.use_jisx0213 = true
|
26
|
+
Aozora2Html::Tag::Accent.use_jisx0213 = true
|
73
27
|
end
|
74
28
|
|
75
29
|
if options["use-unicode"]
|
76
|
-
|
30
|
+
Aozora2Html::Tag::EmbedGaiji.use_unicode = true
|
77
31
|
end
|
78
32
|
|
79
33
|
if ARGV.size < 1 || ARGV.size > 2
|
@@ -88,12 +42,9 @@ Dir.mktmpdir do |dir|
|
|
88
42
|
dest_file = File.join(dir, "output.html")
|
89
43
|
end
|
90
44
|
if src_file =~ /\Ahttps?:/
|
91
|
-
require 'open-uri'
|
92
45
|
down_file = File.join(dir, File.basename(src_file))
|
93
46
|
begin
|
94
|
-
|
95
|
-
open(src_file){|f1| f0.write(f1.read)}
|
96
|
-
end
|
47
|
+
File.write(down_file, URI.parse(src_file).read)
|
97
48
|
src_file = down_file
|
98
49
|
rescue
|
99
50
|
$stderr.print "file not found: #{src_file}\n"
|
@@ -108,6 +59,7 @@ Dir.mktmpdir do |dir|
|
|
108
59
|
end
|
109
60
|
|
110
61
|
if File.extname(src_file) == ".zip"
|
62
|
+
require "aozora2html/zip"
|
111
63
|
tmpfile = File.join(dir, "aozora.txt")
|
112
64
|
Aozora2Html::Zip.unzip(src_file, tmpfile)
|
113
65
|
Aozora2Html.new(tmpfile, dest_file).process
|