narou 2.3.3 → 2.4.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 155b352973030c1d634bcc31d19d6e855d703bc1
4
- data.tar.gz: da60bffbea4f8eee60003ff4f85f0051d6328d22
3
+ metadata.gz: e9304a718adb9745c4a5a09784a829070350e074
4
+ data.tar.gz: df071e525661f21cf51a9be4e792926023a97f60
5
5
  SHA512:
6
- metadata.gz: 4ec94ce72f6167158aa825d5909c6f29bb1ca186f73018c7885c89f9b1e2833a1930fa45c036029638bee02a1059f0659d0cf85fa870533b67553380075f20f5
7
- data.tar.gz: f9f97c41236451a75a1dcd732576e530dbd8e7c088ae7014d67f1e4b04350bd04d07fd30b04780c52fc1feb7ea0e121d3b4ca825ad34794cf3d3073d07688e3e
6
+ metadata.gz: 8d39fbd258a06299a2654561d0bda11d1ba7a3357256ce4a22546f80ae9d50657e43c0bee63bbc2b1a4085700b585ba23af83c77aa6d2f8b924fc7a7da0b902c
7
+ data.tar.gz: 961801e930b51c052f5cf0b225b7e91dd25b319319cda56bddd78a97460a67e89385027cbdf5a17d3019542037c58fcfefac15245aa0bb5e0ca48b2f2f21dacd
data/ChangeLog.md CHANGED
@@ -2,6 +2,35 @@
2
2
  更新履歴 - ChangeLog
3
3
  ====================
4
4
 
5
+ 2.4.0 : 2015/05/16
6
+ ------------------
7
+ #### 追加機能
8
+ - WEB UI に保存フォルダを開くためのボタンを表示する項目「保存先」を追加しました
9
+ - WEB UI に項目「最新話掲載日」を追加しました
10
+ + 「小説家になろう」と「ハーメルン」のみ対応しています(updateした小説から
11
+ 反映されていきます)。更新が無いと反映されないため、手動で反映させたい場合
12
+ はWEB UI サーバを落とした状態で `narou u --gl` コマンドを使用して下さい。
13
+ (基本的に一度実行するだけで十分です)
14
+
15
+ #### 仕様変更
16
+ - 小説リストの「新着」及び「更新」の表示基準を調整しました
17
+ - replace.txt による置換を行うタイミングを変更しました
18
+ + 今までは (before→本体処理→after)*話数分→置換 という処理順だったものが、
19
+ (before→本体処理→after→置換)*話数分 という処理順になりました
20
+
21
+ #### Bug Fix
22
+ - `enable_insert_word_separator` を有効にした場合に発生する以下の不具合を修正
23
+ + 開きカッコの禁則処理が Kindle で処理されなくなる
24
+ + replace.txt による置換が正常に行われない場合がある
25
+ + URLが含まれている文章の単語分割が正常に行われない
26
+ - あらすじだけ更新された場合にデータベースが更新されていなかった不具合を修正
27
+ - 小説サイトのサーバーがダウンしている時にエラーがでる問題を修正
28
+ - WEB UI の小説リストにおいて、更新・新着の表示期間が過ぎているにも関わらず、
29
+ アップデート等をした際に消えない不具合を修正
30
+ - ハーメルンで非公開になっている小説をアップデートするとエラーになる不具合
31
+ を修正
32
+
33
+
5
34
  2.3.3 : 2015/04/24
6
35
  ------------------
7
36
  #### Bug Fix
data/README.md CHANGED
@@ -26,6 +26,35 @@ Narou.rb ― 「小説家になろう」「小説を読もう!」ダウンロ
26
26
  更新履歴 - ChangeLog
27
27
  --------------------
28
28
 
29
+ 2.4.0 : 2015/05/16
30
+ ------------------
31
+ #### 追加機能
32
+ - WEB UI に保存フォルダを開くためのボタンを表示する項目「保存先」を追加しました
33
+ - WEB UI に項目「最新話掲載日」を追加しました
34
+ + 「小説家になろう」と「ハーメルン」のみ対応しています(updateした小説から
35
+ 反映されていきます)。更新が無いと反映されないため、手動で反映させたい場合
36
+ はWEB UI サーバを落とした状態で `narou u --gl` コマンドを使用して下さい。
37
+ (基本的に一度実行するだけで十分です)
38
+
39
+ #### 仕様変更
40
+ - 小説リストの「新着」及び「更新」の表示基準を調整しました
41
+ - replace.txt による置換を行うタイミングを変更しました
42
+ + 今までは (before→本体処理→after)*話数分→置換 という処理順だったものが、
43
+ (before→本体処理→after→置換)*話数分 という処理順になりました
44
+
45
+ #### Bug Fix
46
+ - `enable_insert_word_separator` を有効にした場合に発生する以下の不具合を修正
47
+ + 開きカッコの禁則処理が Kindle で処理されなくなる
48
+ + replace.txt による置換が正常に行われない場合がある
49
+ + URLが含まれている文章の単語分割が正常に行われない
50
+ - あらすじだけ更新された場合にデータベースが更新されていなかった不具合を修正
51
+ - 小説サイトのサーバーがダウンしている時にエラーがでる問題を修正
52
+ - WEB UI の小説リストにおいて、更新・新着の表示期間が過ぎているにも関わらず、
53
+ アップデート等をした際に消えない不具合を修正
54
+ - ハーメルンで非公開になっている小説をアップデートするとエラーになる不具合
55
+ を修正
56
+
57
+
29
58
  2.3.3 : 2015/04/24
30
59
  ------------------
31
60
  #### Bug Fix
@@ -41,32 +70,6 @@ Narou.rb ― 「小説家になろう」「小説を読もう!」ダウンロ
41
70
  - `enable_insert_char_separator` でルビ及び外字注記が壊れる問題を修正
42
71
 
43
72
 
44
- 2.3.1 : 2015/03/24
45
- ------------------
46
- #### Bug Fix
47
- - `enable_insert_word_separator` の動作が単語単位ではなく文字単位で選択になって
48
- しまっていたのを修正
49
- - 文字単位での選択は `enable_insert_char_separator` という設定で出来るように
50
- しました
51
- - 漢数字変換を無効にした場合に章見出しの自動インデント機能が壊れる問題を修正
52
-
53
- 2.3.0 : 2015/03/21
54
- ------------------
55
- #### 追加機能
56
- - Kindle端末で単語の選択を出来るようにするために、小説別変換設定に
57
- `enable_insert_word_separator` オプションが追加されました
58
- + このオプションを使うためには `narou init` を実行して AozoraEpub3 の設定を
59
- 修正する必要があります
60
- + 各小説の setting.ini 内に `enable_insert_word_separator=true` と追加で書き
61
- 込むか、 `narou s force.enable_insert_word_separator=true` とコマンドを打ち
62
- 込むことで有効に出来ます。(WEB UI で設定すると楽です)
63
- + このオプションは、Kindle端末で単語が選択出来ない問題に対応するものです。
64
- device が kindle の時のみ使用可能です。また、Send to Kindle で mobi を azw3
65
- に変換する場合は単語選択は可能なので、設定する必要はありません
66
-
67
- #### Bug Fix
68
- - ハーメルンの仕様変更に対応しました
69
-
70
73
 
71
74
  ----
72
75
 
data/lib/command/list.rb CHANGED
@@ -7,7 +7,7 @@ require_relative "../database"
7
7
 
8
8
  module Command
9
9
  class List < CommandBase
10
- NEW_ARRIVALS_LIMIT = 6 * 60 * 60 # 更新してから何秒までを新着色にするか
10
+ ANNOTATION_COLOR_TIME_LIMIT = 6 * 60 * 60 # 更新してから何秒まで色を変更するか
11
11
 
12
12
  # MEMO: 0 は昔の小説を凍結したままな場合、novel_type が設定されていないので、
13
13
  # nil.to_i → 0 という互換性維持のため
@@ -166,10 +166,13 @@ module Command
166
166
  selected_lines[id] = [
167
167
  disp_id,
168
168
  novel["last_update"].strftime("%y/%m/%d").tap { |s|
169
- if novel["new_arrivals_date"] && novel["new_arrivals_date"] + NEW_ARRIVALS_LIMIT >= now
169
+ new_arrivals_date = novel["new_arrivals_date"]
170
+ last_update = novel["last_update"]
171
+ if new_arrivals_date && new_arrivals_date >= last_update \
172
+ && new_arrivals_date + ANNOTATION_COLOR_TIME_LIMIT >= now
170
173
  # 新着表示色
171
174
  s.replace "<bold><magenta>#{s}</magenta></bold>"
172
- elsif s == today
175
+ elsif last_update + ANNOTATION_COLOR_TIME_LIMIT >= now
173
176
  # 更新だけあった色
174
177
  s.replace "<bold><green>#{s}</green></bold>"
175
178
  end
@@ -49,6 +49,10 @@ module Command
49
49
  view_log
50
50
  exit 0
51
51
  }
52
+ @opt.on("--gl", "データベースに最新話掲載日を反映させる") {
53
+ update_general_lastup
54
+ exit 0
55
+ }
52
56
  end
53
57
 
54
58
  def execute(argv)
@@ -151,5 +155,30 @@ module Command
151
155
  File.delete(path)
152
156
  end
153
157
  end
158
+
159
+ def update_general_lastup
160
+ database = Database.instance
161
+ progressbar = ProgressBar.new(database.get_object.size - 1)
162
+ puts "最新話掲載日を更新しています..."
163
+ database.each.with_index do |(id, data), i|
164
+ progressbar.output(i)
165
+ setting = Downloader.get_sitesetting_by_target(id)
166
+ begin
167
+ info = NovelInfo.load(setting)
168
+ rescue OpenURI::HTTPError, Errno::ECONNRESET => e
169
+ next
170
+ end
171
+ next unless info
172
+ next unless info["title"]
173
+ data = {
174
+ "general_firstup" => info["general_firstup"],
175
+ "novelupdated_at" => info["novelupdated_at"],
176
+ "general_lastup" => info["general_lastup"]
177
+ }
178
+ database[id].merge!(data)
179
+ end
180
+ database.save_database
181
+ puts "\n更新が完了しました"
182
+ end
154
183
  end
155
184
  end
data/lib/converterbase.rb CHANGED
@@ -1154,6 +1154,11 @@ class ConverterBase
1154
1154
  buffer = ""
1155
1155
  ss = StringScanner.new(str)
1156
1156
  before_symbol = false
1157
+
1158
+ if @text_type == "textfile"
1159
+ buffer << ss.scan(/(.+\n){2}/)
1160
+ end
1161
+
1157
1162
  while char = ss.getch
1158
1163
  symbol = false
1159
1164
  case char
@@ -1165,6 +1170,12 @@ class ConverterBase
1165
1170
  next
1166
1171
  end
1167
1172
  symbol = true
1173
+ when "<"
1174
+ if ss.scan(/.+?>/)
1175
+ buffer << "<#{ss.matched}"
1176
+ next
1177
+ end
1178
+ symbol = true
1168
1179
  when /[\d0-9]/
1169
1180
  ss.scan(/[\d0-9]+/)
1170
1181
  when /[ぁ-んゝゞ]/
@@ -1175,6 +1186,10 @@ class ConverterBase
1175
1186
  ss.scan(/[A-Za-zA-Za-z]+/)
1176
1187
  when /[一-龥朗-鶴]/
1177
1188
  ss.scan(/[一-龥朗-鶴]+/)
1189
+ when /[〔「『\((【〈《≪〝]/
1190
+ buffer << char
1191
+ before_symbol = false
1192
+ next
1178
1193
  else
1179
1194
  symbol = true
1180
1195
  end
@@ -1209,6 +1224,12 @@ class ConverterBase
1209
1224
  next
1210
1225
  end
1211
1226
  symbol = true
1227
+ when "<"
1228
+ if ss.scan(/.+?>/)
1229
+ buffer << "<#{ss.matched}"
1230
+ next
1231
+ end
1232
+ symbol = true
1212
1233
  when /[―…!?!?※]/
1213
1234
  symbol = true
1214
1235
  end
@@ -1231,7 +1252,7 @@ class ConverterBase
1231
1252
  (io = before_convert(io)).rewind
1232
1253
  (io = convert_main(io)).rewind
1233
1254
  (io = after_convert(io)).rewind
1234
- return insert_separator_for_selection(io.read)
1255
+ return insert_separator_for_selection(replace_by_replace_txt(io.read))
1235
1256
  end
1236
1257
 
1237
1258
  #
@@ -1334,9 +1355,11 @@ class ConverterBase
1334
1355
  # replace.txt により単純置換
1335
1356
  #
1336
1357
  def replace_by_replace_txt(text)
1358
+ result = text.dup
1337
1359
  @setting.replace_pattern.each do |pattern|
1338
1360
  src, dst = pattern
1339
- text.gsub!(src, dst)
1361
+ result.gsub!(src, dst)
1340
1362
  end
1363
+ result
1341
1364
  end
1342
1365
  end
data/lib/downloader.rb CHANGED
@@ -403,7 +403,8 @@ class Downloader
403
403
  id_and_title = "#{@id} #{@title}"
404
404
 
405
405
  return_status =
406
- if update_subtitles.size > 0
406
+ case
407
+ when update_subtitles.size > 0
407
408
  @cache_dir = create_cache_dir if old_toc.length > 0
408
409
  begin
409
410
  sections_download_and_save(update_subtitles)
@@ -417,12 +418,17 @@ class Downloader
417
418
  end
418
419
  update_database
419
420
  :ok
420
- elsif old_toc["subtitles"].size > latest_toc["subtitles"].size
421
+ when old_toc["subtitles"].size > latest_toc["subtitles"].size
421
422
  # 削除された節がある(かつ更新がない)場合
422
423
  puts "#{id_and_title} は一部の話が削除されています"
423
424
  :ok
424
- elsif old_toc["story"] != latest_toc["story"]
425
- # あらすじだけ更新されている場合
425
+ when old_toc["title"] != latest_toc["title"]
426
+ # タイトルが更新されている場合
427
+ puts "#{id_and_title} のタイトルが更新されています"
428
+ update_database
429
+ :ok
430
+ when old_toc["story"] != latest_toc["story"]
431
+ # あらすじが更新されている場合
426
432
  puts "#{id_and_title} のあらすじが更新されています"
427
433
  :ok
428
434
  else
@@ -539,6 +545,7 @@ class Downloader
539
545
  # データベース更新
540
546
  #
541
547
  def update_database
548
+ info = @setting["info"] || {}
542
549
  data = {
543
550
  "id" => @id,
544
551
  "author" => @setting["author"],
@@ -551,6 +558,9 @@ class Downloader
551
558
  "last_update" => Time.now,
552
559
  "new_arrivals_date" => (@new_arrivals ? Time.now : @@database[@id]["new_arrivals_date"]),
553
560
  "use_subdirectory" => @download_use_subdirectory,
561
+ "general_firstup" => info["general_firstup"],
562
+ "novelupdated_at" => info["novelupdated_at"],
563
+ "general_lastup" => info["general_lastup"],
554
564
  }
555
565
  if @@database[@id]
556
566
  @@database[@id].merge!(data)
@@ -636,37 +646,45 @@ class Downloader
636
646
  #
637
647
  # HTMLの中から小説が削除されたか非公開なことを示すメッセージを検出する
638
648
  #
639
- def detect_error_message(source)
640
- message = @setting["error_message"]
649
+ def self.detect_error_message(setting, source)
650
+ message = setting["error_message"]
641
651
  return false unless message
642
652
  source.match(message)
643
653
  end
644
654
 
645
- #
646
- # 目次データを取得する
647
- #
648
- def get_latest_table_of_contents
649
- toc_url = @setting["toc_url"]
655
+ def self.get_toc_source(setting)
656
+ toc_url = setting["toc_url"]
650
657
  return nil unless toc_url
651
658
  toc_source = ""
652
- cookie = @setting["cookie"] || ""
659
+ cookie = setting["cookie"] || ""
653
660
  open(toc_url, "Cookie" => cookie) do |toc_fp|
654
661
  if toc_fp.base_uri.to_s != toc_url
655
662
  # リダイレクトされた場合。
656
663
  # ノクターン・ムーンライトのNコードを ncode.syosetu.com に渡すと、novel18.syosetu.com に飛ばされる
657
664
  # 目次の定義が微妙に ncode.syosetu.com と違うので、設定を取得し直す
658
- @setting.clear # 今まで使っていたのは一旦クリア
659
- @setting = Downloader.get_sitesetting_by_target(toc_fp.base_uri.to_s)
660
- toc_url = @setting["toc_url"]
665
+ s = Downloader.get_sitesetting_by_target(toc_fp.base_uri.to_s)
666
+ raise DownloaderNotFoundError unless s # 非公開や削除等でトップページへリダイレクトされる場合がある
667
+ setting.clear # 今まで使っていたのは一旦クリア
668
+ setting = s
669
+ toc_url = setting["toc_url"]
661
670
  end
662
- toc_source = Helper.pretreatment_source(toc_fp.read, @setting["encoding"])
663
- raise DownloaderNotFoundError if detect_error_message(toc_source)
671
+ toc_source = Helper.pretreatment_source(toc_fp.read, setting["encoding"])
672
+ raise DownloaderNotFoundError if detect_error_message(setting, toc_source)
664
673
  end
674
+ toc_source
675
+ end
676
+
677
+ #
678
+ # 目次データを取得する
679
+ #
680
+ def get_latest_table_of_contents
681
+ toc_source = Downloader.get_toc_source(@setting)
682
+ return nil unless toc_source
665
683
  @setting.multi_match(toc_source, "tcode")
666
684
  #if @setting["narou_api_url"]
667
685
  if false
668
686
  # なろうAPIの出力がおかしいので直るまで使用中止
669
- info = Narou::API.new(@setting, "t-s-gf-nu-w")
687
+ info = Narou::API.new(@setting, "t-s-gf-gl-nu-w")
670
688
  else
671
689
  info = NovelInfo.load(@setting)
672
690
  end
@@ -681,6 +699,8 @@ class Downloader
681
699
  raise DownloaderHTTP404Error unless @setting.matched?("title")
682
700
  @setting["story"] = HTML.new(@setting["story"]).to_aozora
683
701
  end
702
+ @setting["info"] = info
703
+
684
704
  @setting["title"] = get_title
685
705
  if series_novel?
686
706
  # 連載小説
@@ -697,7 +717,7 @@ class Downloader
697
717
  "subtitles" => subtitles
698
718
  }
699
719
  toc_objects
700
- rescue OpenURI::HTTPError => e
720
+ rescue OpenURI::HTTPError, Errno::ECONNRESET => e
701
721
  if e.message.include?("404")
702
722
  error "小説が削除されているか非公開な可能性があります"
703
723
  if @@database.novel_exists?(@id)
@@ -382,7 +382,6 @@ class NovelConverter
382
382
  end
383
383
 
384
384
  @use_dakuten_font = conv.use_dakuten_font
385
- conv.replace_by_replace_txt(result)
386
385
 
387
386
  inspect_novel(result)
388
387
 
data/lib/novelinfo.rb CHANGED
@@ -56,6 +56,9 @@ class NovelInfo
56
56
  %w(general_firstup novelupdated_at general_lastup).each do |elm|
57
57
  result[elm] = date_string_to_time(@setting[elm])
58
58
  end
59
+ result["novelupdated_at"] ||= result["general_firstup"]
60
+ result["general_lastup"] ||= result["novelupdated_at"]
61
+
59
62
  result
60
63
  end
61
64
 
data/lib/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # Copyright 2013 whiteleaf. All rights reserved.
4
4
  #
5
5
 
6
- Version = "2.3.3"
6
+ Version = "2.4.0"
7
7
 
data/lib/web/appserver.rb CHANGED
@@ -370,7 +370,7 @@ class Narou::AppServer < Sinatra::Base
370
370
  title: escape_html(data["title"]),
371
371
  author: escape_html(data["author"]),
372
372
  sitename: data["sitename"],
373
- toc_url: %!<a href="#{escape_html(data["toc_url"])}" target="_blank" ! +
373
+ toc_url: %!<a href="#{escape_html(data["toc_url"])}" class="btn btn-default btn-xs" target="_blank" ! +
374
374
  %!data-toggle="tooltip" data-placement="top" title="#{data["toc_url"]}">! +
375
375
  %!<span class="glyphicon glyphicon-link"></span></a>!,
376
376
  novel_type: data["novel_type"] == 2 ? "短編" : "連載",
@@ -380,9 +380,10 @@ class Narou::AppServer < Sinatra::Base
380
380
  tags.include?("end") ? "完結" : nil,
381
381
  tags.include?("404") ? "削除" : nil,
382
382
  ].compact.join(", "),
383
- download: %!<a href="/novels/#{id}/download"><span class="glyphicon glyphicon-book"></span></a>!,
383
+ download: %!<a href="/novels/#{id}/download" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-book"></span></a>!,
384
384
  frozen: Narou.novel_frozen?(id),
385
- new_arrivals_date: data["new_arrivals_date"] ? data["new_arrivals_date"].to_i : nil
385
+ new_arrivals_date: data["new_arrivals_date"].tap { |m| break m.to_i if m },
386
+ general_lastup: data["general_lastup"].tap { |m| break m.to_i if m }
386
387
  }
387
388
  end
388
389
  json json_objects
@@ -500,9 +501,7 @@ class Narou::AppServer < Sinatra::Base
500
501
 
501
502
  post "/api/folder" do
502
503
  ids = select_valid_novel_ids(params["ids"]) or pass
503
- Narou::Worker.push do
504
- CommandLine.run!(["folder", ids])
505
- end
504
+ CommandLine.run!(["folder", ids])
506
505
  end
507
506
 
508
507
  post "/api/backup" do
@@ -20,13 +20,13 @@ $(document).ready(function() {
20
20
  {
21
21
  id: false, last_update: false, title: true, author: false, sitename: false,
22
22
  toc_url: false, novel_type: false, tags: false, status: false, menu: true,
23
- download: false,
23
+ download: false, folder: false, general_lastup: false,
24
24
  }
25
25
  // PC
26
26
  : {
27
27
  id: true, last_update: true, title: true, author: true, sitename: true,
28
28
  toc_url: true, novel_type: true, tags: true, status: true, menu: true,
29
- download: true,
29
+ download: true, folder: true, general_lastup: true,
30
30
  });
31
31
 
32
32
  $.fn.dataTable.Api.register("fireChangeSelect()", function() {
@@ -41,13 +41,22 @@ $(document).ready(function() {
41
41
  });
42
42
  });
43
43
 
44
- var now = new Date;
45
- var today = Narou.formatDate(now, "YYYYMMDD");
46
- var NEW_ARRIVALS_LIMIT = 6 * 60 * 60; // 6時間(秒)
44
+ var ANNOTATION_COLOR_TIME_LIMIT = 6 * 60 * 60; // 6時間(秒)
45
+ var GENERAL_LASTUP_CLASSES = [
46
+ [60 * 60, "gl-60minutes"],
47
+ [6 * 60 * 60, "gl-6hour"],
48
+ [24 * 60 * 60, "gl-24hour"],
49
+ [7 * 24 * 60 * 60, "gl-1week"],
50
+ [-1, "gl-other"]
51
+ ];
52
+
53
+ function today() {
54
+ return Narou.formatDate(new Date, "YYYYMMDD");
55
+ }
47
56
 
48
57
  function isToday(date) {
49
58
  var dateobj = (typeof date === "number" ? new Date(date * 1000) : date);
50
- return Narou.formatDate(dateobj, "YYYYMMDD") === today;
59
+ return Narou.formatDate(dateobj, "YYYYMMDD") === today();
51
60
  }
52
61
 
53
62
  var table = t = $("#novel-list").DataTable({
@@ -62,23 +71,25 @@ $(document).ready(function() {
62
71
  // ID
63
72
  { title: "ID",
64
73
  data: "id", className: "column-id text-center", visible: cell_visible.id },
65
- // 最終更新日
74
+ // UPDATEした日時
66
75
  { title: "更新日",
67
76
  data: "last_update", className: "text-center",
68
77
  orderSequence: [ "desc", "asc" ], visible: cell_visible.last_update,
69
78
  render: function(data, type, row) {
70
79
  if (type === "display" || type === "filter") {
80
+ var now = new Date;
71
81
  var date = new Date(data * 1000);
72
82
  var display = Narou.formatDate(date, "YYYY/MM/DD<br>hh:mm");
73
83
  if (type === "display") {
74
84
  var klass = null;
75
85
  if (row.new_arrivals_date) {
76
- if ((row.new_arrivals_date + NEW_ARRIVALS_LIMIT) * 1000 >= now) {
86
+ if (row.new_arrivals_date >= data
87
+ && (row.new_arrivals_date + ANNOTATION_COLOR_TIME_LIMIT) * 1000 >= now) {
77
88
  klass = "new-arrivals";
78
89
  }
79
90
  }
80
- if (!klass && isToday(date)) {
81
- klass = "today-update";
91
+ if (!klass && (data + ANNOTATION_COLOR_TIME_LIMIT) * 1000 >= now) {
92
+ klass = "new-update";
82
93
  }
83
94
  if (klass) {
84
95
  display = "<span class=" + klass + ">" + display + "</span>";
@@ -89,6 +100,30 @@ $(document).ready(function() {
89
100
  return data;
90
101
  }
91
102
  },
103
+ // なろう:最終話掲載日、ハーメルン:最新投稿
104
+ {
105
+ title: "最新話<br>掲載日",
106
+ data: "general_lastup", className: "text-center",
107
+ orderSequence: [ "desc", "asc" ], visible: cell_visible.general_lastup,
108
+ render: function(data, type, row) {
109
+ if (type === "display" || type === "filter") {
110
+ if (!data)
111
+ return "";
112
+ var now = new Date;
113
+ var date = new Date(data * 1000);
114
+ var diff_time = (now - date) / 1000;
115
+ var display = Narou.formatDate(date, "YYYY/MM/DD<br>hh:mm");
116
+ var klass = "";
117
+ for (var i = 0;; i++) {
118
+ var value = GENERAL_LASTUP_CLASSES[i];
119
+ klass = value[1];
120
+ if (value[0] === -1 || diff_time <= value[0]) break;
121
+ }
122
+ return '<span class="general-lastup ' + klass + '">' + display + '</span>';
123
+ }
124
+ return data;
125
+ }
126
+ },
92
127
  // タイトル
93
128
  { title: "タイトル",
94
129
  data: "title", visible: cell_visible.title },
@@ -98,11 +133,6 @@ $(document).ready(function() {
98
133
  // 掲載サイト
99
134
  { title: "掲載",
100
135
  data: "sitename", visible: cell_visible.sitename },
101
- // 掲載URL
102
- {
103
- title: "リンク",
104
- data: "toc_url", className: "text-center", orderable: false,
105
- searchable: false, visible: cell_visible.toc_url },
106
136
  // 小説種別
107
137
  { title: "種別",
108
138
  data: "novel_type", className: "text-center", width: "25px",
@@ -114,11 +144,34 @@ $(document).ready(function() {
114
144
  // 状態
115
145
  { title: "状態",
116
146
  data: "status", visible: cell_visible.status },
147
+ // 掲載URL
148
+ {
149
+ title: "リンク",
150
+ data: "toc_url", className: "text-center", orderable: false,
151
+ searchable: false, visible: cell_visible.toc_url },
117
152
  // 書籍データDLリンク
118
153
  {
119
154
  title: "DL",
120
155
  data: "download", className: "text-center", orderable: false,
121
156
  searchable: false, visible: cell_visible.download },
157
+ {
158
+ title: "保存先",
159
+ data: "folder", className: "text-center", orderable: false,
160
+ searchable: false, visible: cell_visible.folder,
161
+ defaultContent: '<button class="btn btn-default btn-xs">' +
162
+ '<span class="glyphicon glyphicon-folder-open"></span></button>',
163
+ createdCell: function(td, cellData, rowData, rowIndex, colIndex) {
164
+ $(td).children("button")
165
+ .data("targetId", rowData.id)
166
+ .on("click", function(e) {
167
+ e.stopPropagation();
168
+ var $this = $(this);
169
+ var target_id = $this.data("targetId");
170
+ action.folder(target_id);
171
+ });
172
+ },
173
+ render: function() {}
174
+ },
122
175
  {
123
176
  title: "個別",
124
177
  data: "menu", className: "text-center",
@@ -132,7 +132,6 @@
132
132
  ・小説の文章を置換する設定を行うことが出来ます(replace.txt を書き換えます)<br>
133
133
  ・変更を反映させるには再度変換を実行する必要があります<br>
134
134
  ・保存するとこの小説の replace.txt に書かれているコメントは削除されます<br>
135
- ・replace.txt による置換が行われるタイミングは、全てのテキスト処理が行われた後の、整形済みテキスト全文です。つまり見出しやストーリー等も置換対象です。
136
135
  .list-group
137
136
  .list-group-item.form-group
138
137
  .list-group-item-text
@@ -188,19 +188,84 @@ table#novel-list {
188
188
  @include dataTableSortingHeader("/resources/sort_desc.png");
189
189
  }
190
190
  }
191
+ /*
191
192
  a {
192
193
  display: block;
193
194
  }
195
+ */
194
196
 
195
197
  span.new-arrivals:after {
196
198
  color: magenta;
197
199
  content: " 新着";
198
200
  }
199
201
 
200
- span.today-update:after {
202
+ span.new-update:after {
201
203
  color: green;
202
204
  content: " 更新";
203
205
  }
206
+
207
+ /* 最新話更新日 +/
208
+ .general-lastup {
209
+ }
210
+ /* 60分以内 */
211
+ .gl-60minutes {
212
+ &::after {
213
+ content: "1h";
214
+ background-color: lighten(red, 23%);
215
+
216
+ position: relative;
217
+ left: 4px;
218
+ padding: 1px 2px 1px 2px;
219
+ font-size: 90%;
220
+ color: white;
221
+ border-radius: 4px;
222
+ }
223
+ }
224
+ /* 6時間以内 */
225
+ .gl-6hour {
226
+ &::after {
227
+ content: "6h";
228
+ background-color: #5cb85c;
229
+
230
+ position: relative;
231
+ left: 4px;
232
+ padding: 1px 2px 1px 2px;
233
+ font-size: 90%;
234
+ color: white;
235
+ border-radius: 4px;
236
+ }
237
+ }
238
+ /* 24時間以内 */
239
+ .gl-24hour {
240
+ &::after {
241
+ content: "24h";
242
+ background-color: lighten(blue, 30%);
243
+
244
+ position: relative;
245
+ left: 4px;
246
+ padding: 1px 2px 1px 2px;
247
+ font-size: 90%;
248
+ color: white;
249
+ border-radius: 4px;
250
+ }
251
+ }
252
+ /* 1週間以内 */
253
+ .gl-1week {
254
+ &::after {
255
+ content: "1w";
256
+ color: darken(gray, 15%);
257
+ background-color: lighten(gray, 35%);
258
+
259
+ position: relative;
260
+ left: 4px;
261
+ padding: 1px 2px 1px 2px;
262
+ font-size: 90%;
263
+ border-radius: 4px;
264
+ }
265
+ }
266
+ /* 上記の日付以上を過ぎている */
267
+ .gl-other {
268
+ }
204
269
  }
205
270
 
206
271
  .context-menu-target-cover {
@@ -640,7 +705,12 @@ $console-color: white;
640
705
  padding: 7px;
641
706
  }
642
707
  input {
643
- width: 250px;
708
+ @media (min-width: 768px) {
709
+ width: 250px;
710
+ }
711
+ @media (max-width: 767px) {
712
+ width: 150px;
713
+ }
644
714
  }
645
715
  }
646
716
  }
data/narou.gemspec CHANGED
@@ -32,21 +32,33 @@ Gem::Specification.new do |gem|
32
32
  install_message = <<-EOS
33
33
  #{"*" * 79}
34
34
 
35
- 2.3.3 : 2015/04/24
35
+ 2.4.0 : 2015/05/16
36
36
  ------------------
37
- #### Bug Fix
38
- - `enable_ruby_youon_to_big` で拗音が大きくならない場合があったのを修正
39
- - WEB UI 起動中にタイトルやあらすじが変更された場合に反映されない場合があった
40
- のを修正
41
- + アップデート時に10分以上経ったキャッシュは捨てるようにしました
42
-
37
+ #### 追加機能
38
+ - WEB UI に保存フォルダを開くためのボタンを表示する項目「保存先」を追加しました
39
+ - WEB UI に項目「最新話掲載日」を追加しました
40
+ + 「小説家になろう」と「ハーメルン」のみ対応しています(updateした小説から
41
+ 反映されていきます)。更新が無いと反映されないため、手動で反映させたい場合
42
+ はWEB UI サーバを落とした状態で `narou u --gl` コマンドを使用して下さい。
43
+ (基本的に一度実行するだけで十分です)
43
44
 
44
- narou コマンドのインストール or アップデートが完了しました。
45
- 詳しい説明は `narou help' コマンドをご覧下さい。
45
+ #### 仕様変更
46
+ - 小説リストの「新着」及び「更新」の表示基準を調整しました
47
+ - replace.txt による置換を行うタイミングを変更しました
48
+ + 今までは (before→本体処理→after)*話数分→置換 という処理順だったものが、
49
+ (before→本体処理→after→置換)*話数分 という処理順になりました
46
50
 
47
- NOTICE
48
- 初めてこのアプリケーションを使う場合、小説管理用のフォルダを初期化する必要があります。
49
- 任意のフォルダで `narou init' を実行して下さい。
51
+ #### Bug Fix
52
+ - `enable_insert_word_separator` を有効にした場合に発生する以下の不具合を修正
53
+ + 開きカッコの禁則処理が Kindle で処理されなくなる
54
+ + replace.txt による置換が正常に行われない場合がある
55
+ + URLが含まれている文章の単語分割が正常に行われない
56
+ - あらすじだけ更新された場合にデータベースが更新されていなかった不具合を修正
57
+ - 小説サイトのサーバーがダウンしている時にエラーがでる問題を修正
58
+ - WEB UI の小説リストにおいて、更新・新着の表示期間が過ぎているにも関わらず、
59
+ アップデート等をした際に消えない不具合を修正
60
+ - ハーメルンで非公開になっている小説をアップデートするとエラーになる不具合
61
+ を修正
50
62
 
51
63
  #{"*" * 79}
52
64
  EOS
data/spec/convert_spec.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Copyright 2013 whiteleaf. All rights reserved.
4
4
  #
5
- # auto generated at 2014-09-27 00:52:31 +0900
5
+ # auto generated at 2015-05-15 01:05:21 +0900
6
6
 
7
7
  Encoding.default_external = Encoding::UTF_8
8
8
 
@@ -75,6 +75,14 @@ describe "convert" do
75
75
  check_answer("horizontal_ellipsis/test_horizontal_ellipsis.txt")
76
76
  end
77
77
 
78
+ it "insert_separator/test_insert_separator.txt" do
79
+ check_answer("insert_separator/test_insert_separator.txt")
80
+ end
81
+
82
+ it "insert_separator_and_replace_txt/test_insert_separator_and_replace_txt.txt" do
83
+ check_answer("insert_separator_and_replace_txt/test_insert_separator_and_replace_txt.txt")
84
+ end
85
+
78
86
  it "kanji_num/test_kanji_num.txt" do
79
87
  check_answer("kanji_num/test_kanji_num.txt")
80
88
  end
@@ -124,7 +124,7 @@ opqrstu
124
124
  it do
125
125
  expect(@converter.insert_word_separator \
126
126
  "[#二分アキ]「注釈内は区切らない」").to eq \
127
- "[#二分アキ]「[#zws]注釈内[#zws]は[#zws]区切[#zws]らない[#zws]」"
127
+ "[#二分アキ]「注釈内[#zws]は[#zws]区切[#zws]らない[#zws]」"
128
128
  end
129
129
 
130
130
  it do
@@ -148,7 +148,7 @@ opqrstu
148
148
  it do
149
149
  expect(@converter.insert_word_separator \
150
150
  "「あいう」、「えお」").to eq \
151
- "「[#zws]あいう[#zws]」、「[#zws]えお[#zws]」"
151
+ "「あいう[#zws]」、「えお[#zws]」"
152
152
  end
153
153
 
154
154
  it "ルビは除外" do
@@ -165,6 +165,13 @@ opqrstu
165
165
  "失われし楽園※[#始め二重山括弧]パラダイスロスト※[#終わり二重山括弧]!!").to eq \
166
166
  "失[#zws]われし[#zws]楽園[#zws]※[#始め二重山括弧][#zws]パラダイスロスト[#zws]※[#終わり二重山括弧]!!"
167
167
  end
168
+
169
+ # zws があるせいで禁則処理が正常に働かないための対応
170
+ it "開きカッコの直後にzwsは挿入しない" do
171
+ expect(@converter.insert_word_separator \
172
+ "そっちの『鈴』と一緒に入っていた").to eq \
173
+ "そっちの[#zws]『鈴[#zws]』[#zws]と[#zws]一緒[#zws]に[#zws]入[#zws]っていた[#zws]"
174
+ end
168
175
  end
169
176
 
170
177
  describe "文字単位で区切る" do
@@ -0,0 +1,12 @@
1
+ test_insert_separator
2
+ whiteleaf
3
+
4
+ [#改ページ]
5
+ [#3字下げ][#中見出し][#zws]単語分割[#zws]の[#zws]テスト[#zws][#中見出し終わり]
6
+
7
+
8
+  [#zws]単語分割[#zws]の[#zws]テスト[#zws]。
9
+ [#二分アキ]「隣[#zws]の[#zws]客[#zws]はよく[#zws]柿食[#zws]う[#zws]客[#zws]だ[#zws]」
10
+
11
+ <a href="http://www.google.com/">[#zws]http[#zws]://[#zws]www[#zws].[#zws]google[#zws].[#zws]com[#zws]/</a>
12
+
@@ -0,0 +1,3 @@
1
+ ; 単語選択がしやすいように単語単位の区切りデータを挿入する(Kindle専用)
2
+ enable_insert_word_separator = true
3
+
@@ -0,0 +1,12 @@
1
+ test_insert_separator
2
+ whiteleaf
3
+
4
+ [#改ページ]
5
+ 単語分割のテスト
6
+
7
+  単語分割のテスト。
8
+
9
+ 「隣の客はよく柿食う客だ」
10
+
11
+
12
+ http://www.google.com/
@@ -0,0 +1,11 @@
1
+ test_insert_separator_and_replace_txt
2
+ whiteleaf
3
+
4
+ [#改ページ]
5
+ [#3字下げ][#中見出し][#zws]単語分割[#zws]をしつつ[#zws]置換[#zws]する[#zws]テスト[#zws][#中見出し終わり]
6
+
7
+
8
+  [#zws]隣[#zws]の[#zws]客[#zws]はよく[#zws]カキ[#zws]食[#zws]う[#zws]客[#zws]だ[#zws]。
9
+  [#zws]さんぞうほうしは[#zws]天竺[#zws]を[#zws]目指[#zws]した[#zws]。[#zws]仲間[#zws]としてそんごくう[#zws]、[#zws]さごじょう[#zws]、[#zws]チョハッカイ[#zws]という[#zws]妖怪[#zws]を[#zws]従[#zws]えていた[#zws]。
10
+
11
+  [#zws]すでに[#zws]置換済[#zws]みの[#zws]文章[#zws]
@@ -0,0 +1,8 @@
1
+ 柿 カキ
2
+
3
+ 三蔵法師 さんぞうほうし
4
+ 孫悟空 そんごくう
5
+ 沙悟浄 さごじょう
6
+ 猪八戒 チョハッカイ
7
+
8
+ 色々まとめて置換 すでに置換済みの文章
@@ -0,0 +1,3 @@
1
+ ; 単語選択がしやすいように単語単位の区切りデータを挿入する(Kindle専用)
2
+ enable_insert_word_separator = true
3
+
@@ -0,0 +1,11 @@
1
+ test_insert_separator_and_replace_txt
2
+ whiteleaf
3
+
4
+ [#改ページ]
5
+ 単語分割をしつつ置換するテスト
6
+
7
+  隣の客はよく柿食う客だ。
8
+  三蔵法師は天竺を目指した。仲間として孫悟空、沙悟浄、猪八戒という妖怪を従えていた。
9
+
10
+
11
+  色々まとめて置換
@@ -64,7 +64,7 @@ nu: |-
64
64
  )?(?<novelupdated_at>.+?)(?:
65
65
  )?</td>
66
66
 
67
- # general_lastup 最終掲載日
67
+ # general_lastup 最終話掲載日
68
68
  gl: |-
69
69
  <th>最終話掲載日</th>
70
70
  <td>(?<general_lastup>.+?)</td>
@@ -64,7 +64,7 @@ nu: |-
64
64
  )?(?<novelupdated_at>.+?)(?:
65
65
  )?</td>
66
66
 
67
- # general_lastup 最終掲載日
67
+ # general_lastup 最終話掲載日
68
68
  gl: |-
69
69
  <th>最終話掲載日</th>
70
70
  <td>(?<general_lastup>.+?)</td>
@@ -56,13 +56,13 @@ ga: 話数</td><td>(?<general_all_no>\d+)話</td>
56
56
  s: "あらすじ</td><td colspan=3 bgcolor=#FFFFFF>(?<story>.+?)</td>"
57
57
 
58
58
  # general_firstup 初回掲載日
59
- gf: 掲載日</td><td>(?<general_firstup>.+?)</td>
59
+ gf: 掲載開始</td><td>(?<general_firstup>.+?)</td>
60
60
 
61
- # novelupdated_at 小説の更新時刻。最終掲載日で代用
62
- nu: 最終投稿日</td><td>(?<novelupdated_at>.+?)</td>
61
+ # novelupdated_at 小説の更新時刻。最新投稿日で代用
62
+ nu: 最新投稿</td><td>(?<novelupdated_at>.+?)</td>
63
63
 
64
64
  # general_lastup 最終掲載日
65
- gl: 最終投稿日</td><td>(?<novelupdated_at>.+?)</td>
65
+ gl: 最新投稿</td><td>(?<general_lastup>.+?)</td>
66
66
 
67
67
  # writer 作者名
68
68
  w: 作者</td><td bgcolor=\#FFFFFF>(?:<a href=.+?>)?(?<writer>.+?)(?:</a>)?</td>
@@ -26,6 +26,8 @@ subtitles: |-
26
26
 
27
27
  subupdate: no
28
28
 
29
+ error_message: この小説は作者の諸事情により非公開にしています
30
+
29
31
  # ------------------------------------------------------------
30
32
  # 本文取得設定
31
33
  body_pattern: |-
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: 2.3.3
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - whiteleaf7
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-23 00:00:00.000000000 Z
11
+ date: 2015-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: termcolorlight
@@ -355,6 +355,13 @@ files:
355
355
  - spec/data/convert_test/force_indent_special_chapter/test_force_indent_special_chapter.txt
356
356
  - spec/data/convert_test/horizontal_ellipsis/correct_test_horizontal_ellipsis.txt
357
357
  - spec/data/convert_test/horizontal_ellipsis/test_horizontal_ellipsis.txt
358
+ - spec/data/convert_test/insert_separator/correct_test_insert_separator.txt
359
+ - spec/data/convert_test/insert_separator/setting.ini
360
+ - spec/data/convert_test/insert_separator/test_insert_separator.txt
361
+ - spec/data/convert_test/insert_separator_and_replace_txt/correct_test_insert_separator_and_replace_txt.txt
362
+ - spec/data/convert_test/insert_separator_and_replace_txt/replace.txt
363
+ - spec/data/convert_test/insert_separator_and_replace_txt/setting.ini
364
+ - spec/data/convert_test/insert_separator_and_replace_txt/test_insert_separator_and_replace_txt.txt
358
365
  - spec/data/convert_test/kanji_num/correct_test_kanji_num.txt
359
366
  - spec/data/convert_test/kanji_num/test_kanji_num.txt
360
367
  - spec/data/convert_test/nonokagi/correct_test_nonokagi.txt
@@ -408,21 +415,33 @@ metadata: {}
408
415
  post_install_message: |
409
416
  *******************************************************************************
410
417
 
411
- 2.3.3 : 2015/04/24
418
+ 2.4.0 : 2015/05/16
412
419
  ------------------
413
- #### Bug Fix
414
- - `enable_ruby_youon_to_big` で拗音が大きくならない場合があったのを修正
415
- - WEB UI 起動中にタイトルやあらすじが変更された場合に反映されない場合があった
416
- のを修正
417
- + アップデート時に10分以上経ったキャッシュは捨てるようにしました
418
-
420
+ #### 追加機能
421
+ - WEB UI に保存フォルダを開くためのボタンを表示する項目「保存先」を追加しました
422
+ - WEB UI に項目「最新話掲載日」を追加しました
423
+ + 「小説家になろう」と「ハーメルン」のみ対応しています(updateした小説から
424
+ 反映されていきます)。更新が無いと反映されないため、手動で反映させたい場合
425
+ はWEB UI サーバを落とした状態で `narou u --gl` コマンドを使用して下さい。
426
+ (基本的に一度実行するだけで十分です)
419
427
 
420
- narou コマンドのインストール or アップデートが完了しました。
421
- 詳しい説明は `narou help' コマンドをご覧下さい。
428
+ #### 仕様変更
429
+ - 小説リストの「新着」及び「更新」の表示基準を調整しました
430
+ - replace.txt による置換を行うタイミングを変更しました
431
+ + 今までは (before→本体処理→after)*話数分→置換 という処理順だったものが、
432
+ (before→本体処理→after→置換)*話数分 という処理順になりました
422
433
 
423
- NOTICE
424
- 初めてこのアプリケーションを使う場合、小説管理用のフォルダを初期化する必要があります。
425
- 任意のフォルダで `narou init' を実行して下さい。
434
+ #### Bug Fix
435
+ - `enable_insert_word_separator` を有効にした場合に発生する以下の不具合を修正
436
+ + 開きカッコの禁則処理が Kindle で処理されなくなる
437
+ + replace.txt による置換が正常に行われない場合がある
438
+ + URLが含まれている文章の単語分割が正常に行われない
439
+ - あらすじだけ更新された場合にデータベースが更新されていなかった不具合を修正
440
+ - 小説サイトのサーバーがダウンしている時にエラーがでる問題を修正
441
+ - WEB UI の小説リストにおいて、更新・新着の表示期間が過ぎているにも関わらず、
442
+ アップデート等をした際に消えない不具合を修正
443
+ - ハーメルンで非公開になっている小説をアップデートするとエラーになる不具合
444
+ を修正
426
445
 
427
446
  *******************************************************************************
428
447
  rdoc_options: []
@@ -462,6 +481,13 @@ test_files:
462
481
  - spec/data/convert_test/force_indent_special_chapter/test_force_indent_special_chapter.txt
463
482
  - spec/data/convert_test/horizontal_ellipsis/correct_test_horizontal_ellipsis.txt
464
483
  - spec/data/convert_test/horizontal_ellipsis/test_horizontal_ellipsis.txt
484
+ - spec/data/convert_test/insert_separator/correct_test_insert_separator.txt
485
+ - spec/data/convert_test/insert_separator/setting.ini
486
+ - spec/data/convert_test/insert_separator/test_insert_separator.txt
487
+ - spec/data/convert_test/insert_separator_and_replace_txt/correct_test_insert_separator_and_replace_txt.txt
488
+ - spec/data/convert_test/insert_separator_and_replace_txt/replace.txt
489
+ - spec/data/convert_test/insert_separator_and_replace_txt/setting.ini
490
+ - spec/data/convert_test/insert_separator_and_replace_txt/test_insert_separator_and_replace_txt.txt
465
491
  - spec/data/convert_test/kanji_num/correct_test_kanji_num.txt
466
492
  - spec/data/convert_test/kanji_num/test_kanji_num.txt
467
493
  - spec/data/convert_test/nonokagi/correct_test_nonokagi.txt