aozora2html 0.7.1 → 3.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/rubocop.yml +19 -0
- data/.github/workflows/ruby.yml +37 -0
- data/.gitignore +8 -3
- data/.rubocop.yml +111 -0
- data/.rubocop_todo.yml +7 -0
- data/CHANGELOG.md +59 -0
- data/Gemfile +2 -0
- data/Guardfile +3 -1
- data/HACKING.md +45 -0
- data/LICENSE +116 -0
- data/README.md +29 -16
- data/Rakefile +12 -5
- data/aozora2html.gemspec +24 -24
- data/bin/aozora2html +25 -71
- data/lib/aozora2html/accent_parser.rb +99 -0
- data/lib/aozora2html/error.rb +17 -0
- data/lib/aozora2html/header.rb +141 -0
- data/lib/aozora2html/i18n.rb +48 -0
- data/lib/aozora2html/ruby_buffer.rb +116 -0
- data/lib/aozora2html/string_refinements.rb +36 -0
- data/lib/aozora2html/style_stack.rb +33 -0
- data/lib/aozora2html/tag/accent.rb +37 -0
- data/lib/aozora2html/tag/block.rb +21 -0
- data/lib/aozora2html/tag/chitsuki.rb +19 -0
- data/lib/aozora2html/tag/dakuten_katakana.rb +25 -0
- data/lib/aozora2html/tag/decorate.rb +19 -0
- data/lib/aozora2html/tag/dir.rb +17 -0
- data/lib/aozora2html/tag/editor_note.rb +19 -0
- data/lib/aozora2html/tag/embed_gaiji.rb +52 -0
- data/lib/aozora2html/tag/font_size.rb +20 -0
- data/lib/aozora2html/tag/gaiji.rb +12 -0
- data/lib/aozora2html/tag/img.rb +21 -0
- data/lib/aozora2html/tag/indent.rb +8 -0
- data/lib/aozora2html/tag/inline.rb +16 -0
- data/lib/aozora2html/tag/inline_caption.rb +17 -0
- data/lib/aozora2html/tag/inline_font_size.rb +19 -0
- data/lib/aozora2html/tag/inline_keigakomi.rb +17 -0
- data/lib/aozora2html/tag/inline_yokogumi.rb +17 -0
- data/lib/aozora2html/tag/jisage.rb +17 -0
- data/lib/aozora2html/tag/jizume.rb +19 -0
- data/lib/aozora2html/tag/kaeriten.rb +17 -0
- data/lib/aozora2html/tag/keigakomi.rb +19 -0
- data/lib/aozora2html/tag/kunten.rb +12 -0
- data/lib/aozora2html/tag/midashi.rb +20 -0
- data/lib/aozora2html/tag/multiline.rb +9 -0
- data/lib/aozora2html/tag/multiline_caption.rb +13 -0
- data/lib/aozora2html/tag/multiline_chitsuki.rb +10 -0
- data/lib/aozora2html/tag/multiline_jisage.rb +10 -0
- data/lib/aozora2html/tag/multiline_midashi.rb +25 -0
- data/lib/aozora2html/tag/multiline_style.rb +19 -0
- data/lib/aozora2html/tag/multiline_yokogumi.rb +14 -0
- data/lib/aozora2html/tag/okurigana.rb +17 -0
- data/lib/aozora2html/tag/oneline_chitsuki.rb +10 -0
- data/lib/aozora2html/tag/oneline_indent.rb +9 -0
- data/lib/aozora2html/tag/oneline_jisage.rb +10 -0
- data/lib/aozora2html/tag/reference_mentioned.rb +47 -0
- data/lib/aozora2html/tag/ruby.rb +202 -0
- data/lib/aozora2html/tag/un_embed_gaiji.rb +30 -0
- data/lib/aozora2html/tag.rb +57 -0
- data/lib/aozora2html/tag_parser.rb +60 -0
- data/lib/aozora2html/text_buffer.rb +50 -0
- data/lib/aozora2html/utils.rb +156 -0
- data/lib/aozora2html/version.rb +3 -1
- data/lib/aozora2html/yaml_loader.rb +37 -0
- data/lib/aozora2html/zip.rb +4 -0
- data/lib/aozora2html.rb +1359 -8
- data/lib/extensions.rb +12 -0
- data/lib/jstream.rb +139 -0
- data/sample/chukiichiran_kinyurei.html +15 -2
- data/sample/chukiichiran_kinyurei.txt +15 -2
- data/test/test_aozora2html.rb +323 -73
- data/test/test_aozora_accent_parser.rb +34 -6
- data/test/test_command_parse.rb +216 -0
- data/test/test_compat.rb +3 -4
- data/test/test_dakuten_katakana_tag.rb +12 -13
- data/test/test_decorate_tag.rb +11 -7
- data/test/test_dir_tag.rb +11 -7
- data/test/test_editor_note_tag.rb +9 -6
- data/test/test_exception.rb +11 -9
- data/test/test_font_size_tag.rb +22 -11
- data/test/test_gaiji_tag.rb +22 -14
- data/test/test_header.rb +45 -0
- data/test/test_helper.rb +3 -1
- data/test/test_i18n.rb +39 -0
- data/test/test_img_tag.rb +11 -6
- data/test/test_inline_caption_tag.rb +11 -7
- data/test/test_inline_font_size_tag.rb +15 -11
- data/test/test_inline_keigakomi_tag.rb +11 -7
- data/test/test_inline_yokogumi_tag.rb +11 -7
- data/test/test_jizume_tag.rb +11 -8
- data/test/test_jstream.rb +33 -30
- data/test/test_kaeriten_tag.rb +11 -7
- data/test/test_keigakomi_tag.rb +14 -11
- data/test/test_midashi_tag.rb +39 -0
- data/test/test_multiline_caption_tag.rb +11 -8
- data/test/test_multiline_midashi_tag.rb +26 -26
- data/test/test_multiline_style_tag.rb +11 -8
- data/test/test_multiline_yokogumi_tag.rb +11 -8
- data/test/test_okurigana_tag.rb +11 -7
- data/test/test_ruby_parse.rb +130 -0
- data/test/test_ruby_tag.rb +11 -7
- data/test/test_tag_parser.rb +31 -29
- 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 +99 -21
- data/.travis.yml +0 -12
- data/appveyor.yml +0 -23
- data/lib/accent_tag.rb +0 -23
- data/lib/aozora2html/jis2ucs.rb +0 -11237
- data/lib/embed_gaiji_tag.rb +0 -34
- data/lib/t2hs.rb +0 -2535
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5a2a25b5bae94f8cd3f95db62357eb5de12a99fafe7681132ca045067f72dadc
|
4
|
+
data.tar.gz: 8e4474f765260485a1f4917de8cf8b81438f6a6863b2614b9e5d3f9d50abca29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b61e229c27b0b90fca3982e566b7fd51683ee9cabc0c1b77988c46d994ac5fb20d295ad5916da8b7a70947337bad034f45780ad335b9f9993562cf655e6b056f
|
7
|
+
data.tar.gz: 4c693c649646c27596545ae7f0577b1336d9afdb21d6380f63f9e2558253796b1c37d54818a9cc90414a01cf0fdcf5e1e01b2997a31fc86a1c770d9d42e3b5ac
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: rubocop
|
2
|
+
on: [pull_request]
|
3
|
+
jobs:
|
4
|
+
rubocop:
|
5
|
+
name: runner / rubocop
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
steps:
|
8
|
+
- name: Check out code
|
9
|
+
uses: actions/checkout@v2
|
10
|
+
- name: Setup Ruby
|
11
|
+
uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: 3.0.3
|
14
|
+
bundler-cache: true
|
15
|
+
- name: Run rubocop
|
16
|
+
run: |
|
17
|
+
gem install bundler --no-document
|
18
|
+
bundle install --retry 3
|
19
|
+
bundle exec rubocop -P
|
@@ -0,0 +1,37 @@
|
|
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.1', '3.0', '2.7' ]
|
22
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
23
|
+
exclude:
|
24
|
+
- os: windows-latest
|
25
|
+
ruby: '3.1'
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@v1
|
28
|
+
- name: Set up Ruby
|
29
|
+
uses: ruby/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
32
|
+
- name: Build and test with Rake
|
33
|
+
shell: bash
|
34
|
+
run: |
|
35
|
+
gem install bundler --no-document
|
36
|
+
bundle install --jobs 4 --retry 3
|
37
|
+
bundle exec rake
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
# inherit_from: .rubocop_todo.yml
|
4
|
+
|
5
|
+
require:
|
6
|
+
- rubocop-performance
|
7
|
+
- rubocop-rake
|
8
|
+
|
9
|
+
AllCops:
|
10
|
+
TargetRubyVersion: 2.7
|
11
|
+
NewCops: enable
|
12
|
+
|
13
|
+
Style/BarePercentLiterals:
|
14
|
+
EnforcedStyle: percent_q
|
15
|
+
|
16
|
+
Style/Documentation:
|
17
|
+
Exclude:
|
18
|
+
- 'test/**/*'
|
19
|
+
|
20
|
+
Style/EmptyMethod:
|
21
|
+
EnforcedStyle: expanded
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
Style/FormatString:
|
25
|
+
EnforcedStyle: sprintf
|
26
|
+
|
27
|
+
Style/FormatStringToken:
|
28
|
+
EnforcedStyle: unannotated
|
29
|
+
|
30
|
+
Style/FrozenStringLiteralComment:
|
31
|
+
Exclude:
|
32
|
+
- 'lib/aozora2html.rb'
|
33
|
+
|
34
|
+
Style/RedundantPercentQ:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Style/PercentQLiterals:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Style/ParallelAssignment:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Style/AsciiComments:
|
44
|
+
Enabled: false
|
45
|
+
|
46
|
+
Style/LineEndConcatenation:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Style/IfUnlessModifier:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
Style/NumericPredicate:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
Style/PerlBackrefs:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
Style/SpecialGlobalVars:
|
59
|
+
Enabled: false
|
60
|
+
|
61
|
+
Style/SymbolArray:
|
62
|
+
EnforcedStyle: brackets
|
63
|
+
|
64
|
+
Style/WordArray:
|
65
|
+
EnforcedStyle: brackets
|
66
|
+
|
67
|
+
Style/ZeroLengthPredicate:
|
68
|
+
Enabled: false
|
69
|
+
|
70
|
+
Layout/LineLength:
|
71
|
+
Enabled: true
|
72
|
+
Max: 500
|
73
|
+
|
74
|
+
Lint/EmptyClass:
|
75
|
+
AllowComments: true
|
76
|
+
|
77
|
+
Metrics/AbcSize:
|
78
|
+
Enabled: true
|
79
|
+
Max: 260.05
|
80
|
+
|
81
|
+
Metrics/BlockLength:
|
82
|
+
Enabled: true
|
83
|
+
Max: 150
|
84
|
+
|
85
|
+
Metrics/BlockNesting:
|
86
|
+
Enabled: true
|
87
|
+
Max: 10
|
88
|
+
|
89
|
+
Metrics/ClassLength:
|
90
|
+
Enabled: true
|
91
|
+
Max: 2000
|
92
|
+
|
93
|
+
Metrics/CyclomaticComplexity:
|
94
|
+
Enabled: true
|
95
|
+
Max: 100
|
96
|
+
|
97
|
+
Metrics/MethodLength:
|
98
|
+
Enabled: true
|
99
|
+
Max: 200
|
100
|
+
|
101
|
+
Metrics/ModuleLength:
|
102
|
+
Enabled: true
|
103
|
+
Max: 200
|
104
|
+
|
105
|
+
Metrics/ParameterLists:
|
106
|
+
Enabled: true
|
107
|
+
Max: 10
|
108
|
+
|
109
|
+
Metrics/PerceivedComplexity:
|
110
|
+
Enabled: true
|
111
|
+
Max: 100
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config --exclude-limit 99999 --no-offense-counts --no-auto-gen-timestamp`
|
3
|
+
# using RuboCop version 1.23.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,62 @@
|
|
1
|
+
<a name="3.0.0"></a>
|
2
|
+
## 3.0.0
|
3
|
+
|
4
|
+
### Breaking Changes
|
5
|
+
|
6
|
+
* Ruby 2.7未満をサポート対象外にしました。Ruby 3.0以降を推奨します。それ以前のRubyを使われる場合はv2.0.0をご利用ください https://github.com/aozorahack/aozora2html/pull/49
|
7
|
+
* t2hs.rbを廃止し、bin/aozora2html以外からは実行できなくしました https://github.com/aozorahack/aozora2html/pull/65
|
8
|
+
* t2hs.rbにあったメソッドのうち、通常外部から使われないメソッドをprivateにしました https://github.com/aozorahack/aozora2html/pull/93
|
9
|
+
|
10
|
+
### Bug Fixes
|
11
|
+
|
12
|
+
* 以前は全角空白であったところが半角空白になっていたので修正しました https://github.com/aozorahack/aozora2html/pull/62
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
* エラーメッセージがUTF-8になる `--error-utf8` オプションを追加しました https://github.com/aozorahack/aozora2html/pull/72
|
17
|
+
* `sample/chukiichiran_kinyurei.txt`に他の例を追加しました https://github.com/aozorahack/aozora2html/pull/78
|
18
|
+
* `rake chuuki`で`sample/chukiichiran_kinyurei.txt`を`sample/chukiichiran_kinyurei.html`に変換できるrakeタスクを追加しました https://github.com/aozorahack/aozora2html/pull/95
|
19
|
+
|
20
|
+
<a name="2.0.0"></a>
|
21
|
+
## 2.0.0
|
22
|
+
|
23
|
+
### Bug Fixes
|
24
|
+
|
25
|
+
* Ruby 3.0でエラーになる挙動を修正しました https://github.com/aozorahack/aozora2html/pull/36, https://github.com/aozorahack/aozora2html/pull/41
|
26
|
+
|
27
|
+
<a name="0.9.1"></a>
|
28
|
+
## 0.9.1
|
29
|
+
|
30
|
+
### Features
|
31
|
+
|
32
|
+
* 内部構造を改造した
|
33
|
+
* lib/t2hs.rbをUTF-8化した
|
34
|
+
|
35
|
+
<a name="0.9.0"></a>
|
36
|
+
## 0.9.0
|
37
|
+
|
38
|
+
### Features
|
39
|
+
|
40
|
+
* 内部構造を大改造した
|
41
|
+
* lib/t2hs.rb内で定義されているクラスをRubyの命名規則に合わせて変更し、外部ファイルにした
|
42
|
+
* `Aozora2Html.new(input, output)`の引数`input`,`output`でIOも受け取れるようにした
|
43
|
+
* `bin/aozora2html`にあったmonkey patchingも`lib/`以下に移動させた
|
44
|
+
|
45
|
+
<a name="0.7.1"></a>
|
46
|
+
## 0.7.1
|
47
|
+
|
48
|
+
### Bug Fixes
|
49
|
+
|
50
|
+
* `--use-unicode`オプションをつけていない時の外字処理を修正した
|
51
|
+
* くの字点が正しく処理されない場合があるのを修正した
|
52
|
+
|
53
|
+
<a name="0.7.0"></a>
|
54
|
+
## 0.7.0
|
55
|
+
|
56
|
+
### Features
|
57
|
+
|
58
|
+
* `--css-files`オプションを追加して、CSSを変更できるようにした
|
59
|
+
|
1
60
|
<a name="0.6.1"></a>
|
2
61
|
## 0.6.1
|
3
62
|
|
data/Gemfile
CHANGED
data/Guardfile
CHANGED
data/HACKING.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# HACKING
|
2
|
+
|
3
|
+
aozora2htmlの技術的なnoteです。
|
4
|
+
|
5
|
+
## `char_type`について
|
6
|
+
|
7
|
+
aozora2htmlでは、`String#char_type`というメソッドが追加されています。
|
8
|
+
|
9
|
+
`char_type`はルビの範囲を判別するために使われるメソッドです。
|
10
|
+
|
11
|
+
* ひらがな: :hiragana
|
12
|
+
* カタカナ: :katakana
|
13
|
+
* 全角英数(ギリシア文字含む): :zenkaku
|
14
|
+
* 半角英数(記号#-&',含む): :hankaku
|
15
|
+
* 漢字: :kanji
|
16
|
+
* 半角句読点等(.;"?!)): :hankaku_terminate
|
17
|
+
* その他: :else
|
18
|
+
|
19
|
+
欧文アクセント文字は半角英数、濁点つきカタカナはカタカナ、外字は漢字、訓点はその他、ルビ付き文字はその他になります。
|
20
|
+
|
21
|
+
RubyBufferも`RubyBuffer#char_type`を持っています。これはRubyBufferの中身次第で変更されます。複数のchar_typeを内部で持つ場合、char_typeは:elseになります。
|
22
|
+
|
23
|
+
|
24
|
+
## `Aozora2Html::TextBuffer`について
|
25
|
+
|
26
|
+
古いRubyでは、`Array#to_s`はArrayの全要素が文字列だった場合、`join`と同じ挙動でした。
|
27
|
+
|
28
|
+
現在のRubyでは、同様のことをするには`Array#join`を使わなければならなくなっており、`Array#to_s`をすると`[]`等が出力されます。これは埋め込み文字列に使った場合も同様です。
|
29
|
+
そのため、aozora2htmlでは`Array`の代わりに`Aozora2Html::TextBuffer`クラスを導入しています。`Aozora2Html::TextBuffer#to_s`は適切な文字列を返します。
|
30
|
+
|
31
|
+
|
32
|
+
## `Jstream`について
|
33
|
+
|
34
|
+
`JStream`は`IO`の代わりとなるクラスです。
|
35
|
+
|
36
|
+
主に、読み込み行の行数の管理と、任意の文字数の先読みを行うために使われています。
|
37
|
+
|
38
|
+
先読みは同一行内のみ有効で、CRLFを超える先読みは動作が保証されません。
|
39
|
+
|
40
|
+
|
41
|
+
## `Aozora2Html::Tag::Multiline`について
|
42
|
+
|
43
|
+
`Aozora2Html::Tag::Multiline`は、そのタグが複数行であることを表すマーカー用のモジュールです。
|
44
|
+
|
45
|
+
マーカーとして使われるため、メソッド等は特に持っていない、空のモジュールとして実装されています。実行中に追加されたりすることもありません。
|
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,24 +1,28 @@
|
|
1
1
|
# Aozora2Html
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://github.com/aozorahack/aozora2html/workflows/Test/badge.svg)](https://github.com/aozorahack/aozora2html/actions)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/aozora2html.svg)](https://badge.fury.io/rb/aozora2html)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/aozorahack/aozora2html/badges/gpa.svg)](https://codeclimate.com/github/aozorahack/aozora2html)
|
4
6
|
|
5
|
-
|
7
|
+
青空文庫の[「組版案内」](http://kumihan.aozora.gr.jp/)で配布されている `txt2html`内にある`t2hs.rb`を改造するプロジェクトです。
|
6
8
|
|
7
9
|
## 動作環境
|
8
10
|
|
9
|
-
Ruby
|
11
|
+
Ruby 3.0以上が推奨ですが、2.7.xでも動くはずです。
|
12
|
+
|
13
|
+
それ以前のRuby 2.xで利用する場合は、aozora2html-2.0.xをご利用ください。
|
10
14
|
|
11
15
|
## インストール
|
12
16
|
|
13
17
|
RubyGemsとしてインストール可能になっています。
|
14
18
|
|
15
|
-
```
|
19
|
+
```shell-session
|
16
20
|
$ gem install aozora2html
|
17
21
|
```
|
18
22
|
|
19
23
|
ソースからインストールするときは以下のようにします。
|
20
24
|
|
21
|
-
```
|
25
|
+
```shell-session
|
22
26
|
$ gem install bundler
|
23
27
|
$ rake install
|
24
28
|
```
|
@@ -27,38 +31,41 @@ $ rake install
|
|
27
31
|
|
28
32
|
コマンドは`aozora2html`です。以下のように実行します。
|
29
33
|
|
30
|
-
```
|
34
|
+
```shell-session
|
31
35
|
$ aozora2html foo.txt foo.html
|
32
36
|
```
|
33
37
|
|
34
|
-
|
38
|
+
こうすると、青空文庫記法で書かれた`foo.txt`を`foo.html`に変換します。
|
35
39
|
|
36
40
|
また、青空文庫サイトで配布している、中にテキストファイルが同梱されているzip形式のファイルも変換できます。
|
37
41
|
|
38
|
-
```
|
42
|
+
```shell-session
|
39
43
|
$ aozora2html foo.zip foo.html
|
40
44
|
```
|
41
45
|
|
42
46
|
第1引数にURLを指定すると、そのURLのファイルをダウンロードして変換します。
|
43
47
|
|
44
|
-
```
|
48
|
+
```shell-session
|
45
49
|
$ aozora2html http://example.jp/foo/bar.zip foo.html
|
46
50
|
```
|
47
51
|
|
48
52
|
第2引数を省略すると、ファイルではなく標準出力に変換結果を出力します。
|
49
53
|
|
50
|
-
```
|
54
|
+
```shell-session
|
51
55
|
$ aozora2html foo.txt
|
52
56
|
```
|
53
57
|
|
54
|
-
コマンドラインオプションとして`--gaiji-dir`と`--use-jisx0213`、`--use-unicode`があります。
|
55
|
-
|
56
|
-
`--
|
57
|
-
`--
|
58
|
+
コマンドラインオプションとして`--gaiji-dir`と`--css-files`、`--use-jisx0213`、`--use-unicode`、`--error-utf8`があります。
|
59
|
+
|
60
|
+
* `--gaiji-dir`は外字画像のパスを指定します。
|
61
|
+
* `--css-files`はCSSファイルを`,`区切りで指定します。
|
62
|
+
* `--use-jisx0213`はJIS X 0213の外字画像を使わず、数値実体参照として表示します。
|
63
|
+
* `--use-unicode`はUnicodeのコードポイントが指定されている外字を数値実体参照として表示します。
|
64
|
+
* `--error-utf8`はエラーメッセージをUTF-8で出力するようにします。
|
58
65
|
|
59
66
|
可能な限り数値実体参照を使って表示するには、以下のようにオプションを指定します。
|
60
67
|
|
61
|
-
```
|
68
|
+
```shell-session
|
62
69
|
$ aozora2html --use-jisx0213 --use-unicode foo.txt
|
63
70
|
```
|
64
71
|
|
@@ -66,7 +73,7 @@ $ aozora2html --use-jisx0213 --use-unicode foo.txt
|
|
66
73
|
|
67
74
|
テストも追加しています。テストは以下のように実行します。
|
68
75
|
|
69
|
-
```
|
76
|
+
```shell-session
|
70
77
|
$ bundle install
|
71
78
|
$ rake test
|
72
79
|
```
|
@@ -75,8 +82,14 @@ $ rake test
|
|
75
82
|
|
76
83
|
主な更新履歴は[CHANGELOG.md](CHANGELOG.md)にあります。
|
77
84
|
|
85
|
+
## コードについて
|
86
|
+
|
87
|
+
コードに関する技術的なnoteは[HACKING.md](HACKING.md)にあります。
|
88
|
+
|
78
89
|
## License
|
79
90
|
|
80
91
|
CC0
|
81
92
|
|
93
|
+
[![CC0](http://i.creativecommons.org/p/zero/1.0/88x31.png "CC0")](http://creativecommons.org/publicdomain/zero/1.0/deed.ja)
|
94
|
+
|
82
95
|
To the extent possible under law, 青空文庫 has waived all copyright and related or neighboring rights to txt2xhtml. This work is published from Japan.
|
data/Rakefile
CHANGED
@@ -1,12 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rubygems'
|
2
|
-
require
|
4
|
+
require 'bundler/gem_tasks'
|
3
5
|
require 'rake/testtask'
|
4
6
|
require 'rake/clean'
|
5
7
|
|
6
|
-
task :
|
8
|
+
task default: [:test]
|
7
9
|
|
8
|
-
Rake::TestTask.new(
|
9
|
-
t.libs
|
10
|
-
t.test_files = Dir.glob(
|
10
|
+
Rake::TestTask.new('test') do |t|
|
11
|
+
t.libs << 'test'
|
12
|
+
t.test_files = Dir.glob('test/**/test_*.rb')
|
11
13
|
t.verbose = true
|
12
14
|
end
|
15
|
+
|
16
|
+
desc 'convert sample/chukiichiran_kinyurei.txt'
|
17
|
+
task :chuuki do
|
18
|
+
sh 'bundle exec aozora2html --error-utf8 sample/chukiichiran_kinyurei.txt sample/chukiichiran_kinyurei.html'
|
19
|
+
end
|
data/aozora2html.gemspec
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
require 'aozora2html/version'
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/aozora2html/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
6
|
+
spec.name = 'aozora2html'
|
8
7
|
spec.version = Aozora2Html::VERSION
|
9
8
|
spec.platform = Gem::Platform::RUBY
|
10
|
-
spec.license =
|
11
|
-
spec.authors = [
|
12
|
-
spec.email = [
|
9
|
+
spec.license = 'CC0'
|
10
|
+
spec.authors = ['aozorahack team']
|
11
|
+
spec.email = ['takahashimm@gmail.com']
|
13
12
|
|
14
|
-
spec.summary = %q
|
15
|
-
spec.description = %q
|
16
|
-
spec.homepage =
|
13
|
+
spec.summary = %q(converter from Aozora Bunko format into xhtml. It's based of t2hs.rb from kumihan.aozora.gr.jp.)
|
14
|
+
spec.description = %q(converter from Aozora Bunko format into xhtml. It's based of t2hs.rb from kumihan.aozora.gr.jp.)
|
15
|
+
spec.homepage = 'https://github.com/aozorahack/aozora2html'
|
17
16
|
|
17
|
+
spec.required_ruby_version = '>= 2.7.0'
|
18
18
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
-
spec.bindir =
|
19
|
+
spec.bindir = 'bin'
|
20
20
|
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
|
-
spec.require_paths = [
|
22
|
+
spec.require_paths = ['lib']
|
23
23
|
|
24
|
-
spec.add_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
24
|
+
spec.add_dependency 'rubyzip'
|
25
|
+
spec.add_development_dependency 'bundler'
|
26
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
27
|
+
spec.add_development_dependency 'rubocop'
|
28
|
+
spec.add_development_dependency 'rubocop-performance'
|
29
|
+
spec.add_development_dependency 'rubocop-rake'
|
30
|
+
spec.add_development_dependency 'test-unit'
|
31
|
+
spec.add_development_dependency 'test-unit-rr'
|
32
|
+
spec.metadata = {
|
33
|
+
'rubygems_mfa_required' => 'true'
|
34
|
+
}
|
35
35
|
end
|