amakanize 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 681722b052f349616c3e9b1ac05690aa4721ca33
4
- data.tar.gz: 91dc9fc404c25e93c49a194f40c85108e0579557
3
+ metadata.gz: b4e68f4d1e10ede5f0c237c72a4c9bf653bc097d
4
+ data.tar.gz: 9aaa7fdc525426165d53e47677904b04778804b6
5
5
  SHA512:
6
- metadata.gz: 3f4be655eb8c47e8ada2b7db2387ffc502add8030fa8abf150dd4673d2572b5224474b01a14af48a1460c2452bf948186089ae3ab6906ff15a84a30d44a1e5c8
7
- data.tar.gz: 4958f89ac95d1f16fcb412ae1be89f1e46c977434444ef41f5613be267cd66d6ef920f56e83046eee6a1c0dac20b2d0152939c879bd84bca57e29a261bcb8365
6
+ metadata.gz: b3e9f080e1759b1b8c96c43b9c986f2c4a1c1e6fac52ad7c008fb27e2c9b3764068789fdb29904920255092711c5284c1c63255d1741338b533eb87df5438d24
7
+ data.tar.gz: d0f4c4eef8b73b2888b5b821e55927f59e64deda6b7850e7154ede0d26c11699c62b837e496eb8f45cbb143a9928062440147c7556c5bc4b7ad8e82844e8a8de
data/.rubocop.yml ADDED
@@ -0,0 +1,84 @@
1
+ AllCops:
2
+ Exclude:
3
+ - db/**/*
4
+ - node_modules/**/*
5
+ - vendor/**/*
6
+ TargetRubyVersion: 2.2
7
+
8
+ AsciiComments:
9
+ Enabled: false
10
+
11
+ Lint/HandleExceptions:
12
+ Enabled: false
13
+
14
+ Lint/UnusedBlockArgument:
15
+ Enabled: false
16
+
17
+ Lint/UnusedMethodArgument:
18
+ Enabled: false
19
+
20
+ Metrics/AbcSize:
21
+ Enabled: false
22
+
23
+ Metrics/ClassLength:
24
+ Enabled: false
25
+
26
+ Metrics/CyclomaticComplexity:
27
+ Enabled: false
28
+
29
+ Metrics/LineLength:
30
+ Enabled: false
31
+
32
+ Metrics/MethodLength:
33
+ Enabled: false
34
+
35
+ Metrics/ParameterLists:
36
+ Enabled: false
37
+
38
+ Metrics/PerceivedComplexity:
39
+ Max: 10
40
+
41
+ Style/AccessModifierIndentation:
42
+ Enabled: false
43
+
44
+ Style/Documentation:
45
+ Enabled: false
46
+
47
+ Style/DoubleNegation:
48
+ Enabled: false
49
+
50
+ Style/GuardClause:
51
+ Enabled: false
52
+
53
+ Style/IfUnlessModifier:
54
+ Enabled: false
55
+
56
+ Style/MultilineBlockChain:
57
+ Enabled: false
58
+
59
+ Style/MultilineMethodCallIndentation:
60
+ Enabled: false
61
+
62
+ Style/MutableConstant:
63
+ Enabled: false
64
+
65
+ Style/Next:
66
+ Enabled: false
67
+
68
+ Style/PercentLiteralDelimiters:
69
+ Enabled: false
70
+
71
+ Style/PredicateName:
72
+ Enabled: false
73
+
74
+ Style/SpaceAroundOperators:
75
+ Enabled: false
76
+
77
+ Style/StringLiterals:
78
+ EnforcedStyle: double_quotes
79
+
80
+ Style/TrailingCommaInArguments:
81
+ Enabled: false
82
+
83
+ Style/TrailingCommaInLiteral:
84
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,114 +1,151 @@
1
- ## 0.5.1
1
+ ## v0.5.2
2
+
3
+ - Support nested parentheses
4
+
5
+ ## v0.5.1
6
+
2
7
  - Detect アフタヌーン from アフタヌーン 2016年 05 月号
3
8
 
4
- ## 0.5.0
9
+ ## v0.5.0
10
+
5
11
  - Remove volume number only one time
6
12
  - Normalize continuous spaces
7
13
 
8
- ## 0.4.9
14
+ ## v0.4.9
15
+
9
16
  - Fix a bug in the brackets normalization logic
10
17
 
11
- ## 0.4.8
18
+ ## v0.4.8
19
+
12
20
  - Treat カバーデザイン as role name
13
21
 
14
- ## 0.4.7
22
+ ## v0.4.7
23
+
15
24
  - Support "Buso Renkin, Vol. 5"
16
25
 
17
- ## 0.4.6
26
+ ## v0.4.6
27
+
18
28
  - Treat (キャラクター原案)ハラカズヒロ as ハラカズヒロ
19
29
  - Normalize 「x! 」 into 「x!」
20
30
 
21
- ## 0.4.5
31
+ ## v0.4.5
32
+
22
33
  - Support 2016年04月号 for magazines
23
34
 
24
- ## 0.4.4
35
+ ## v0.4.4
36
+
25
37
  - Support (前) (後) (上) (中) (下)
26
38
 
27
- ## 0.4.3
39
+ ## v0.4.3
40
+
28
41
  - Support (原作・イラスト)XXX
29
42
  - Support イラスト:XXX
30
43
 
31
- ## 0.4.2
44
+ ## v0.4.2
45
+
32
46
  - Support #5
33
47
 
34
- ## 0.4.1
48
+ ## v0.4.1
49
+
35
50
  - Support Vol.3
36
51
  - Support 3 通常版
37
52
  - Support 7.5
38
53
 
39
- ## 0.4.0
54
+ ## v0.4.0
55
+
40
56
  - Add spaces around brackets except for ending
41
57
  - Treat `―XXX―` as brackets (e.g. To LOVEる―とらぶる―)
42
58
 
43
- ## 0.3.0
59
+ ## v0.3.0
60
+
44
61
  - Normalize all brackets into round brackets (parentheses)
45
62
  - Removes only trailing brackets
46
63
 
47
- ## 0.2.2
64
+ ## v0.2.2
65
+
48
66
  - Support volume N
49
67
 
50
- ## 0.2.1
68
+ ## v0.2.1
69
+
51
70
  - Normalize angle brackets
52
71
  - Remove trailing LvN and Lv.N as volume number
53
72
  - Fix volume number detection pattern
54
73
 
55
- ## 0.2.0
74
+ ## v0.2.0
75
+
56
76
  - Fix author name separator
57
77
 
58
- ## 0.1.12
78
+ ## v0.1.12
79
+
59
80
  - Support 第N版
60
81
 
61
- ## 0.1.11
82
+ ## v0.1.11
83
+
62
84
  - Improve volume detection for アニウッド大通り
63
85
 
64
- ## 0.1.10
86
+ ## v0.1.10
87
+
65
88
  - Detect obvious volume number in product title
66
89
 
67
- ## 0.1.9
90
+ ## v0.1.9
91
+
68
92
  - Normalize hyphen with hyphen/minus
69
93
 
70
- ## 0.1.8
94
+ ## v0.1.8
95
+
71
96
  - Normalize hyphen between alphabets in series name
72
97
 
73
- ## 0.1.7
98
+ ## v0.1.7
99
+
74
100
  - Remove trailing surrounding hyphens and payload on series name
75
101
 
76
- ## 0.1.6
102
+ ## v0.1.6
103
+
77
104
  - Remove trailing dash and payload on series name
78
105
 
79
- ## 0.1.5
106
+ ## v0.1.5
107
+
80
108
  - Remove spaces between exclamations for 「ばくおん! !」
81
109
 
82
- ## 0.1.4
110
+ ## v0.1.4
111
+
83
112
  - Add more author name separator
84
113
  - Remove suffix role name
85
114
 
86
- ## 0.1.3
115
+ ## v0.1.3
116
+
87
117
  - Remove trailing 原作・原案・漫画 of author name
88
118
 
89
- ## 0.1.2
119
+ ## v0.1.2
120
+
90
121
  - Add AuthorNames class
91
122
 
92
- ## 0.1.1
123
+ ## v0.1.1
124
+
93
125
  - Support x and X as roman numeric
94
126
 
95
- ## 0.1.0
127
+ ## v0.1.0
128
+
96
129
  - Support roman numerals on series name
97
130
  - Support 第N巻 on series name
98
131
  - Normalize series name
99
132
 
100
- ## 0.0.4
133
+ ## v0.0.4
134
+
101
135
  - Normalize all characters
102
136
 
103
- ## 0.0.3
137
+ ## v0.0.3
138
+
104
139
  - Remove space from author name
105
140
 
106
- ## 0.0.2
141
+ ## v0.0.2
142
+
107
143
  - Remove parentheses of numericals in author name
108
144
  - Remove role name from author name
109
145
  - Remove trailing payload from author name
110
146
  - Strip author name
111
147
  - Unescape HTML in author name
112
148
 
113
- ## 0.0.1
149
+ ## v0.0.1
150
+
114
151
  - 1st release :tada:
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in amakanize.gemspec
3
+ # Specify your gem"s dependencies in amakanize.gemspec
4
4
  gemspec
data/Rakefile CHANGED
@@ -2,4 +2,4 @@ require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
- task :default => :spec
5
+ task default: :spec
data/amakanize.gemspec CHANGED
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
  spec.add_development_dependency "bundler"
21
21
  spec.add_development_dependency "rake", "~> 10.0"
22
22
  spec.add_development_dependency "rspec", "3.5.0"
23
+ spec.add_development_dependency "rubocop", "0.44.1"
23
24
  end
data/lib/amakanize.rb CHANGED
@@ -52,6 +52,7 @@ require "amakanize/filters/spaces_between_exclamations_deletion_filter"
52
52
  require "amakanize/filters/strip_filter"
53
53
  require "amakanize/filters/trailing_author_name_payload_deletion_filter"
54
54
  require "amakanize/filters/trailing_dash_deletion_filter"
55
+ require "amakanize/filters/trailing_double_parentheses_singlization_filter"
55
56
  require "amakanize/filters/trailing_parentheses_deletion_filter"
56
57
  require "amakanize/filters/trailing_series_name_payload_deletion_filter"
57
58
  require "amakanize/filters/trailing_volume_number_deletion_filter"
@@ -33,7 +33,7 @@ module Amakanize
33
33
  output: PAIRS.each_with_object(output) do |(open, close), result|
34
34
  result.gsub!(/#{open}([^\(]+?)#{close}/, '(\1)')
35
35
  end.gsub(/\s*\((.+?)\)(?:\z|(\s*))/) do
36
- " \(#{$1})#{' ' if $2}"
36
+ " \(#{::Regexp.last_match(1)})#{' ' if Regexp.last_match(2)}"
37
37
  end
38
38
  }
39
39
  end
@@ -8,7 +8,7 @@ module Amakanize
8
8
  def call(context:, output:)
9
9
  {
10
10
  context: context,
11
- output: output.gsub("‐", "-"),
11
+ output: output.tr("‐", "-"),
12
12
  }
13
13
  end
14
14
  end
@@ -7,7 +7,7 @@ module Amakanize
7
7
  /\s+#{::Amakanize::PATTERN_OF_VOLUME_PREFIX}#{::Amakanize::PATTERN_OF_NUMERIC_CHARACTERS}\s+.*/,
8
8
  /\s+Lv\.?\s*#{::Amakanize::PATTERN_OF_NUMERIC_CHARACTERS}(?:\s+.*|\z)/,
9
9
  /\s*\(#{::Amakanize::PATTERN_OF_VOLUME_PREFIX}?#{::Amakanize::PATTERN_OF_NUMERIC_CHARACTERS}\).*/,
10
- /\s*\d+年\s*\d+\s*(?:月|\/\d+\s*)号.*/,
10
+ %r<\s*\d+年\s*\d+\s*(?:月|/\d+\s*)号.*>,
11
11
  /\s*\d{4}\s*(?:AUTUMN|SPRING|SUMMER|WINTER)/,
12
12
  )
13
13
 
@@ -21,8 +21,8 @@ module Amakanize
21
21
  output: output
22
22
  .gsub(%r<\A#{PATTERN_OF_ROLE_NAME}[:/]>, "")
23
23
  .gsub(%r<[:/]#{PATTERN_OF_ROLE_NAME}\z>, "")
24
- .gsub(%r<\A\(#{PATTERN_OF_ROLE_NAME}(?:・#{PATTERN_OF_ROLE_NAME})*\)>, "")
25
- .gsub(%r<\(#{PATTERN_OF_ROLE_NAME}(?:・#{PATTERN_OF_ROLE_NAME})*\)\z>, ""),
24
+ .gsub(/\A\(#{PATTERN_OF_ROLE_NAME}(?:・#{PATTERN_OF_ROLE_NAME})*\)/, "")
25
+ .gsub(/\(#{PATTERN_OF_ROLE_NAME}(?:・#{PATTERN_OF_ROLE_NAME})*\)\z/, ""),
26
26
  }
27
27
  end
28
28
  end
@@ -0,0 +1,17 @@
1
+ module Amakanize
2
+ module Filters
3
+ class TrailingDoubleParenthesesSinglizationFilter < BaseFilter
4
+ # @note Override
5
+ # @param output [String] e.g. `"ヒナまつり 11 (ヒナまつり) (ビームコミックス(ハルタ) )"`
6
+ # @return [Hash] e.g. `"ヒナまつり 11 (ヒナまつり) (ビームコミックスハルタ )"`
7
+ def call(context:, output:)
8
+ {
9
+ context: context,
10
+ output: output.sub(/\([^\(^\)]+?\([^\(]+?\)[^\)^\(]+?\)\z/) do
11
+ "(" + $&.gsub(/[\(\)]/, "") + ")"
12
+ end,
13
+ }
14
+ end
15
+ end
16
+ end
17
+ end
@@ -13,6 +13,7 @@ module Amakanize
13
13
  ::Amakanize::Filters::SpacesBetweenExclamationsDeletionFilter,
14
14
  ::Amakanize::Filters::SpaceBetweenExclamationAndBracketDeletionFilter,
15
15
  ::Amakanize::Filters::ObviousVolumeNumberDeletionFilter,
16
+ ::Amakanize::Filters::TrailingDoubleParenthesesSinglizationFilter,
16
17
  ::Amakanize::Filters::TrailingParenthesesDeletionFilter,
17
18
  ::Amakanize::Filters::TrailingDashDeletionFilter,
18
19
  ::Amakanize::Filters::TrailingSeriesNamePayloadDeletionFilter,
@@ -1,3 +1,3 @@
1
1
  module Amakanize
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amakanize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - r7kamura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-18 00:00:00.000000000 Z
11
+ date: 2016-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.5.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 0.44.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 0.44.1
69
83
  description:
70
84
  email:
71
85
  - r7kamura@gmail.com
@@ -75,6 +89,7 @@ extra_rdoc_files: []
75
89
  files:
76
90
  - ".gitignore"
77
91
  - ".rspec"
92
+ - ".rubocop.yml"
78
93
  - ".travis.yml"
79
94
  - CHANGELOG.md
80
95
  - Gemfile
@@ -103,6 +118,7 @@ files:
103
118
  - lib/amakanize/filters/strip_filter.rb
104
119
  - lib/amakanize/filters/trailing_author_name_payload_deletion_filter.rb
105
120
  - lib/amakanize/filters/trailing_dash_deletion_filter.rb
121
+ - lib/amakanize/filters/trailing_double_parentheses_singlization_filter.rb
106
122
  - lib/amakanize/filters/trailing_parentheses_deletion_filter.rb
107
123
  - lib/amakanize/filters/trailing_series_name_payload_deletion_filter.rb
108
124
  - lib/amakanize/filters/trailing_volume_number_deletion_filter.rb