narou 1.4.6 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of narou might be problematic. Click here for more details.

@@ -0,0 +1,16 @@
1
+ require 'rspec'
2
+
3
+ Dir["./support/**/*.rb"].each do |f|
4
+ require f
5
+ end
6
+
7
+ RSpec.configure do |config|
8
+ end
9
+
10
+ class String
11
+ def inspect
12
+ self.to_s
13
+ end
14
+ end
15
+
16
+ Encoding.default_external = Encoding::UTF_8
@@ -4,8 +4,10 @@
4
4
  <%= toc["author"] %>
5
5
  <%= cover_chuki %>
6
6
  [#区切り線]
7
+ <% if toc["story"] != "" -%>
7
8
  <%= toc["story"] %>
8
9
 
10
+ <% end -%>
9
11
  掲載ページ: <a href="<%= toc["toc_url"] %>"><%= toc["toc_url"] %></a>
10
12
  [#区切り線]
11
13
 
@@ -7,6 +7,8 @@ top_url: \\k<scheme>://\\k<domain>
7
7
  url: \\k<top_url>/(?<ncode>n\d+[a-z]+)
8
8
  encoding: UTF-8
9
9
  confirm_over18: no
10
+ append_title_to_folder_name: yes
11
+ title_strip_pattern: null
10
12
 
11
13
  # ------------------------------------------------------------
12
14
  # 書籍情報取得設定
@@ -29,10 +31,46 @@ subtitles: |-
29
31
  </dt>
30
32
  </dl>
31
33
 
34
+ # ------------------------------------------------------------
35
+ # 特殊な設定
36
+ is_narou: true
32
37
  tcode: <li><a href="\\k<top_url>/txtdownload/top/ncode/(?<tcode>\d+?)/" onclick
33
38
  txtdownload_url: \\k<top_url>/txtdownload/dlstart/ncode/\\k<tcode>/?no=\\k<index>
39
+ narou_api_url: http://api.syosetu.com/novelapi/api/
34
40
 
35
41
  # ------------------------------------------------------------
36
- # 特殊な設定
37
- narou_api_url: http://api.syosetu.com/novelapi/api/
38
- narou_info_url: \\k<top_url>/novelview/infotop/ncode/\\k<ncode>/
42
+ # 小説情報からパースするための設定
43
+ novel_info_url: \\k<top_url>/novelview/infotop/ncode/\\k<ncode>/
44
+
45
+ # novel_type 小説種別
46
+ nt: <span id="noveltype(?:.*?)">(?<novel_type>.+?)</span>
47
+ novel_type_string:
48
+ 連載中: 1
49
+ 完結済: 1
50
+ 短編: 2
51
+
52
+ # story あらすじ
53
+ s: <td class="ex">(?<story>.+?)</td>
54
+
55
+ # general_firstup 初回掲載日
56
+ gf: |-
57
+ <th>掲載日</th>
58
+ <td>(?<general_firstup>.+?)</td>
59
+
60
+ # novelupdated_at 小説の更新時刻。連載小説だと書いてないので最終掲載日で代用
61
+ nu: |-
62
+ <th>(?:最終更新日|最終話掲載日)</th>
63
+ <td>(?:
64
+ )?(?<novelupdated_at>.+?)(?:
65
+ )?</td>
66
+
67
+ # general_lastup 最終掲載日
68
+ gl: |-
69
+ <th>最終話掲載日</th>
70
+ <td>(?<general_lastup>.+?)</td>
71
+
72
+ # writer 作者名
73
+ w: |-
74
+ <th>作者名</th>
75
+ <td>(?:<a href=".+?">)?(?<writer>.+?)(?:</a>)?
76
+ </td>
@@ -7,6 +7,8 @@ top_url: \\k<scheme>://\\k<domain>
7
7
  url: \\k<top_url>/(?<ncode>n\d+[a-z]+)
8
8
  encoding: UTF-8
9
9
  confirm_over18: yes
10
+ append_title_to_folder_name: yes
11
+ title_strip_pattern: null
10
12
 
11
13
  # ------------------------------------------------------------
12
14
  # 書籍情報取得設定
@@ -29,10 +31,46 @@ subtitles: |-
29
31
  </dt>
30
32
  </dl>
31
33
 
34
+ # ------------------------------------------------------------
35
+ # 特殊な設定
36
+ is_narou: true
32
37
  tcode: <li><a href="\\k<top_url>/txtdownload/top/ncode/(?<tcode>\d+?)/" onclick
33
38
  txtdownload_url: \\k<top_url>/txtdownload/dlstart/ncode/\\k<tcode>/?no=\\k<index>
39
+ narou_api_url: http://api.syosetu.com/novel18api/api/
34
40
 
35
41
  # ------------------------------------------------------------
36
- # 特殊な設定
37
- narou_api_url: http://api.syosetu.com/novel18api/api/
38
- narou_info_url: \\k<top_url>/novelview/infotop/ncode/\\k<ncode>/
42
+ # 小説情報からパースするための設定
43
+ novel_info_url: \\k<top_url>/novelview/infotop/ncode/\\k<ncode>/
44
+
45
+ # novel_type 小説種別
46
+ nt: <span id="noveltype(?:.*?)">(?<novel_type>.+?)</span>
47
+ novel_type_string:
48
+ 連載中: 1
49
+ 完結済: 1
50
+ 短編: 2
51
+
52
+ # story あらすじ
53
+ s: <td class="ex">(?<story>.+?)</td>
54
+
55
+ # general_firstup 初回掲載日
56
+ gf: |-
57
+ <th>掲載日</th>
58
+ <td>(?<general_firstup>.+?)</td>
59
+
60
+ # novelupdated_at 小説の更新時刻。連載小説だと書いてないので最終掲載日で代用
61
+ nu: |-
62
+ <th>(?:最終更新日|最終話掲載日)</th>
63
+ <td>(?:
64
+ )?(?<novelupdated_at>.+?)(?:
65
+ )?</td>
66
+
67
+ # general_lastup 最終掲載日
68
+ gl: |-
69
+ <th>最終話掲載日</th>
70
+ <td>(?<general_lastup>.+?)</td>
71
+
72
+ # writer 作者名
73
+ w: |-
74
+ <th>作者名</th>
75
+ <td>(?:<a href=".+?">)?(?<writer>.+?)(?:</a>)?
76
+ </td>
@@ -0,0 +1,67 @@
1
+ # ------------------------------------------------------------
2
+ # 小説サイト定義
3
+ name: ハーメルン
4
+ scheme: http
5
+ domain: novel.syosetu.org
6
+ top_url: \\k<scheme>://\\k<domain>
7
+ url: \\k<top_url>/(?<ncode>\d+)
8
+ encoding: UTF-8
9
+ confirm_over18: no
10
+ append_title_to_folder_name: yes
11
+ title_strip_pattern: null
12
+
13
+ # ------------------------------------------------------------
14
+ # 書籍情報取得設定
15
+ title: <font size=\+2>(<a href=.+?>)?(?<title>.+?)(</a>)?</font>
16
+ author: 作:<a href=.+?>(?<author>.+?)</a>
17
+ story: |-
18
+ </div>
19
+ <div class="ss">(?<story>.+?)
20
+ <hr style="margin:20px 0px; border-width:1px 0 0 0;" color="#bbbbbb"></div>
21
+
22
+ # ------------------------------------------------------------
23
+ # 目次取得設定
24
+ toc_url: \\k<top_url>/\\k<ncode>/
25
+ subtitles: |-
26
+ (?:<tr><td colspan=2><strong>(?<chapter>.+?)</strong></td></tr>)?<tr bgcolor="#.+?" class="bgcolor\d"><td width=60%><span id="(?<index>\d+?)"> </span> <a href=.+? style="text-decoration:none;">(?<subtitle>.+?)</a></td><td><NOBR>(?<subdate>.+?)(?:<span title="(?<subupdate>.+?)改稿">\(<u>改</u>\)</span>)?</NOBR></td></tr>
27
+
28
+ href: \\k<index>.html
29
+
30
+ # ------------------------------------------------------------
31
+ # 本文取得設定
32
+
33
+ text_body: |-
34
+ (?:<div id=maegaki>(?<introduction>.+?)</div><BR><HR><BR>
35
+ )?<font size=\+1>.+?</font><BR><BR>
36
+ (?<body>.+?)
37
+ <BR>(?:<HR><BR><div id=atogaki>(?<postscript>.+?)</div>)?
38
+
39
+ illust_current_url: null
40
+ illust_grep_pattern: <a href="(?<src>.+?)" alt="挿絵" name='img'>【挿絵表示】</a>
41
+
42
+ # ------------------------------------------------------------
43
+ # 小説情報からパースするための設定
44
+ novel_info_url: http://syosetu.org/?mode=ss_detail&nid=\\k<ncode>&volume=1
45
+
46
+ # novel_type 小説種別
47
+ nt: 状態</td><td>.+?,(?<novel_type>.+?)</td>
48
+ novel_type_string:
49
+ 連載(連載中): 1
50
+ 連載(未完): 1
51
+ 連載(完結): 1
52
+ 短編: 2
53
+
54
+ # story あらすじ
55
+ s: "あらすじ</td><td colspan=3 bgcolor=#FFFFFF>(?<story>.+?)</td>"
56
+
57
+ # general_firstup 初回掲載日
58
+ gf: 掲載日</td><td>(?<general_firstup>.+?)</td>
59
+
60
+ # novelupdated_at 小説の更新時刻。最終掲載日で代用
61
+ nu: 最終投稿日</td><td>(?<novelupdated_at>.+?)</td>
62
+
63
+ # general_lastup 最終掲載日
64
+ gl: 最終投稿日</td><td>(?<novelupdated_at>.+?)</td>
65
+
66
+ # writer 作者名
67
+ w: 作者</td><td bgcolor=\#FFFFFF><a href=.+?>(?<writer>.+?)</a>
@@ -0,0 +1,39 @@
1
+ # ------------------------------------------------------------
2
+ # 小説サイト定義
3
+ name: Arcadia
4
+ scheme: http
5
+ domain: www.mai-net.net
6
+ top_url: \\k<scheme>://\\k<domain>
7
+ url: \\k<top_url>/bbs/sst/sst.php\?act=dump&cate=(?<category>.+?)&all=(?<ncode>\d+)
8
+ encoding: UTF-8
9
+ confirm_over18: no
10
+ append_title_to_folder_name: yes
11
+ title_strip_pattern: (【.+?】|\(.+?\)|(.+?))
12
+
13
+ # ------------------------------------------------------------
14
+ # 書籍情報取得設定
15
+ title: <font size=4 color=4444aa>(?<title>.+?)</font>
16
+ author: "<tt>Name: (?<author>.+?)◆"
17
+ story: ""
18
+
19
+ # ------------------------------------------------------------
20
+ # 目次取得設定
21
+ toc_url: \\k<top_url>/bbs/sst/sst.php?act=dump&cate=\\k<category>&all=\\k<ncode>&n=0&count=1
22
+ chapter: ""
23
+ subtitles: |-
24
+ <td width="0%" style="font-size:60%">\[(?<index>\d+?)\]</td><td width="0%" style="font-size:60%"><b>
25
+ <a href="(?<href>.+?)#kiji">(?<subtitle>.+?)</a></b></td><td width="0%" style="font-size:60%">\[(.+?)\]</td><td width="0%" style="font-size:60%">\((?<subdate>.+?)\)</td>
26
+
27
+ # subupdate がない場合、更新チェックは subdate を使うようになる
28
+ subupdate: no
29
+
30
+ # ------------------------------------------------------------
31
+ # 本文取得設定
32
+
33
+ text_body: <blockquote><div style="line-height:1.5">(?<body>.+?)</div></blockquote>
34
+ introduction: ""
35
+ postscript: ""
36
+
37
+ # ------------------------------------------------------------
38
+ # 小説情報からパースするための設定
39
+ novel_info_url: null
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: narou
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.6
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - whiteleaf7
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-28 00:00:00.000000000 Z
11
+ date: 2014-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: termcolor
@@ -101,6 +101,7 @@ files:
101
101
  - lib/extensions/windows.rb
102
102
  - lib/globalsetting.rb
103
103
  - lib/helper.rb
104
+ - lib/html.rb
104
105
  - lib/illustration.rb
105
106
  - lib/ini.rb
106
107
  - lib/inspector.rb
@@ -111,20 +112,19 @@ files:
111
112
  - lib/narou.rb
112
113
  - lib/narou/api.rb
113
114
  - lib/novelconverter.rb
115
+ - lib/novelinfo.rb
114
116
  - lib/novelsetting.rb
115
117
  - lib/progressbar.rb
116
118
  - lib/ruby.rb
117
119
  - lib/sitesetting.rb
118
120
  - lib/template.rb
119
121
  - lib/version.rb
120
- - lib/watcher.rb
121
122
  - narou.gemspec
122
123
  - narou.rb
123
124
  - preset/AozoraEpub3.ini
124
125
  - preset/DMincho.ttf
125
126
  - preset/bordersymbols.txt
126
127
  - preset/custom_chuki_tag.txt
127
- - preset/narou_novel_info.yaml
128
128
  - preset/ncode.syosetu.com/n1839bd/converter.rb
129
129
  - preset/ncode.syosetu.com/n1839bd/setting.ini
130
130
  - preset/ncode.syosetu.com/n2267be/converter.rb
@@ -136,19 +136,26 @@ files:
136
136
  - preset/ncode.syosetu.com/n9669bk/converter.rb
137
137
  - preset/ncode.syosetu.com/n9669bk/setting.ini
138
138
  - preset/vertical_font.css
139
+ - spec/data/html_test.html
140
+ - spec/data/html_test.txt
141
+ - spec/data/test.ini
142
+ - spec/device_spec.rb
143
+ - spec/generator/num_to_kanji_test_gen.rb
144
+ - spec/html_spec.rb
145
+ - spec/ini_spec.rb
146
+ - spec/novelinfo_spec.rb
147
+ - spec/num_to_kanji_spec.rb
148
+ - spec/spec_helper.rb
139
149
  - template/converter.rb.erb
140
150
  - template/diff.txt.erb
141
151
  - template/ibunko_novel.txt.erb
142
152
  - template/novel.txt.erb
143
153
  - template/replace.txt.erb
144
154
  - template/setting.ini.erb
145
- - test/data/test.ini
146
- - test/device_spec.rb
147
- - test/generator/num_to_kanji_test_gen.rb
148
- - test/ini_spec.rb
149
- - test/num_to_kanji.rb
150
155
  - webnovel/ncode.syosetu.com.yaml
151
156
  - webnovel/novel18.syosetu.com.yaml
157
+ - webnovel/syosetu.org.yaml
158
+ - webnovel/www.mai-net.net.yaml
152
159
  homepage: http://whiteleaf.hatenablog.com/
153
160
  licenses:
154
161
  - MIT
@@ -163,11 +170,19 @@ post_install_message: |
163
170
  初めてこのアプリケーションを使う場合、小説管理用のフォルダを初期化する必要があります。
164
171
  任意のフォルダで `narou init' を実行して下さい。
165
172
 
166
- 2014/02/28 : **1.4.6**
173
+ 2014/03/06 : **1.5.0**
167
174
  * 追加機能もしくは仕様変更
168
- - `narou diff` コマンドに(凍結済を除く)全ての小説の差分データを削除する `--all-clean` オプションが追加されました
175
+ - 小説投稿サイト ハーメルン (http://syosetu.org/) に対応しました
176
+ - 小説投稿サイト Arcadia (http://www.mai-net.net/) に対応しました
177
+ + Arcadiaは `narou d "http://www.mai-net.net/bbs/sst/sst.php?~略~&n=0&count=1"` のように
178
+ URLを " で囲まないとコマンドがきちんと通りませんのでご注意下さい
179
+ - このバージョン以降ダウンロードした小説の保存フォルダ名には、タイトルの前にIDが付加されるようになりました
180
+ - アラビア数字を漢数字に変換しないパターンを追加(%や単位系)
181
+ - `setting.ini` の項目、 `enable_narou_illust` が `enable_illust` に変更になりました
169
182
  * Bug Fix
170
- - 傍点化の処理が特殊な状況下で Index Error を吐いて止まっていた問題を修正
183
+ - `narou browser --vote` コマンドがなろうのレイアウト変更に対応していなかったので修正
184
+ - 半角カナを全角カナに変換するように修正 #36
185
+ - 小説のタイトルにはルビをふれないように修正 #37
171
186
 
172
187
  *******************************************************************************
173
188
  rdoc_options: []
@@ -190,9 +205,14 @@ signing_key:
190
205
  specification_version: 4
191
206
  summary: Narou.rb ― 小説家になろうダウンローダ&縦書用整形スクリプト
192
207
  test_files:
193
- - test/data/test.ini
194
- - test/device_spec.rb
195
- - test/generator/num_to_kanji_test_gen.rb
196
- - test/ini_spec.rb
197
- - test/num_to_kanji.rb
208
+ - spec/data/html_test.html
209
+ - spec/data/html_test.txt
210
+ - spec/data/test.ini
211
+ - spec/device_spec.rb
212
+ - spec/generator/num_to_kanji_test_gen.rb
213
+ - spec/html_spec.rb
214
+ - spec/ini_spec.rb
215
+ - spec/novelinfo_spec.rb
216
+ - spec/num_to_kanji_spec.rb
217
+ - spec/spec_helper.rb
198
218
  has_rdoc:
@@ -1,61 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright 2014 whiteleaf. All rights reserved.
4
- #
5
-
6
- module Watcher
7
- extend self
8
-
9
- @@counter = {}
10
-
11
- def included(klass)
12
- return if @@counter[klass]
13
- @@counter[klass] = {}
14
- mod = Module.new
15
- klass.class_eval do
16
- alias_method(:org_initialize, :initialize)
17
- define_method(:initialize) do |*init_argv, &init_b|
18
- self.methods.each do |name|
19
- next if Object.methods.include?(name) || name =~ /^__.+?__$/ || name == :included
20
- @@counter[klass][name] = 0
21
- mod.__send__(:define_method, name) do |*argv, &b|
22
- @@counter[klass][name] += 1
23
- super(*argv, &b)
24
- end
25
- end
26
- self.extend mod
27
- org_initialize(*init_argv, &init_b)
28
- end
29
- end
30
- end
31
-
32
- def __display_report__
33
- puts
34
- puts "=================="
35
- puts " Watcher Report"
36
- puts "=================="
37
- @@counter.each do |klass, data|
38
- next if data.count == 0
39
- puts "class #{klass}"
40
- data.select { |_, c| c > 0 }.each do |name, count|
41
- puts "#{name.to_s.rjust(30)} = #{count}"
42
- end
43
- not_call_methods = data.select { |_, c| c == 0 }.keys
44
- if not_call_methods.count > 0
45
- puts "* not call methods *"
46
- puts not_call_methods.join(", ")
47
- end
48
- puts
49
- end
50
- end
51
-
52
- def __regist__(*klasses)
53
- klasses.each do |klass|
54
- klass.__send__(:include, self)
55
- end
56
- end
57
- end
58
-
59
- at_exit do
60
- Watcher.__display_report__
61
- end
@@ -1,25 +0,0 @@
1
- # ------------------------------------------------------------
2
- # なろうAPI用のデータを小説情報からパースするための設定
3
-
4
- # novel_type 小説種別
5
- nt: <span id="noveltype(?:.*?)">(?<novel_type>.+?)</span>
6
-
7
- # story あらすじ
8
- s: <td class="ex">(?<story>.+?)</td>
9
-
10
- # general_firstup 初回掲載日
11
- gf: |-
12
- <th>掲載日</th>
13
- <td>(?<general_firstup>.+?)</td>
14
-
15
- # novelupdated_at 小説の更新時刻。連載小説だと書いてないので最終掲載日で代用
16
- nu: |-
17
- <th>(?:最終更新日|最終話掲載日)</th>
18
- <td>(?:
19
- )?(?<novelupdated_at>.+?)(?:
20
- )?</td>
21
-
22
- # general_lastup 最終掲載日
23
- gl: |-
24
- <th>最終話掲載日</th>
25
- <td>(?<general_lastup>.+?)</td>