narou 1.3.0.1 → 1.3.1

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: 7d822552e2c7c57a136e94c36dbc174f8fcf3c59
4
- data.tar.gz: 893f1c141e1a8ce24e482bcfef956171f5c7638d
3
+ metadata.gz: 8b1304ad665305f940581561957bb94b94faca4e
4
+ data.tar.gz: 0e6fd8b32b3a9f2df7d9458c8cf490b9ed223d1e
5
5
  SHA512:
6
- metadata.gz: c9730cc98622f575bc71b827d89ea462cb03381f0804e0403c8da37c76e8999d403d09e254573a31d722d7d3ea37e968efbb29aba356a05c730ea4947c4bf1fb
7
- data.tar.gz: 9b7909621284727580bb9711dbc987892ac8faa7a46186f0f176d4df1d697eb2b22d5e987df1dc98861c5053e0a4463e06ad4536b56fe2558187fca3e57bd018
6
+ metadata.gz: b33010af26afa88ae2650116a904ac2844c1a78987f7a23584cd59576aac6002d4e905adaf0444e4ed5ce40912277da7ce356737120baf6fa2ec78d5371eb6ec
7
+ data.tar.gz: 221b5041ba784f83d09c1b04a6fe20184931d9750442d7b2c12c698aef66326c2933c2662c032f54be8cd734a77f3ac03f66ad5490810a4067ac7337b56d4b09
@@ -2,6 +2,17 @@
2
2
  更新履歴 - ChangeLog
3
3
  --------------------
4
4
 
5
+ 2013/09/13 : **1.3.1**
6
+ * Bug Fix
7
+ - 章情報の編集に対応できていなかったので修正
8
+ + 本アップデート以前にダウンロードした小説には反映されません。 `narou d -f` コマンドで強制上書きして下さい
9
+ - 1.3.0.1 の修正で※が正しく区切り記号として認識されなくなっていたのを修正
10
+ - タイトルが数字だけの場合に余分に空白が入ってしまうのを修正
11
+ * 追加機能もしくは仕様変更
12
+ - 漢数字化しない場合、一桁のアラビア数字は全角化するように変更
13
+ - タイトルのアラビア半角数字で特殊な処理を追加
14
+ + 行頭にある3桁の半角アラビア数字は全角化せず縦中横にする
15
+
5
16
  2013/09/03 : **1.3.0.1**
6
17
  * Bug Fix
7
18
  - ※記号の外字注記化コードによって正常に変換できなくなった問題を修正
data/README.md CHANGED
@@ -21,6 +21,17 @@ Narou.rb ― 「小説家になろう」「小説を読もう!」ダウンロ
21
21
  更新履歴 - ChangeLog
22
22
  --------------------
23
23
 
24
+ 2013/09/13 : **1.3.1**
25
+ * Bug Fix
26
+ - 章情報の編集に対応できていなかったので修正
27
+ + 本アップデート以前にダウンロードした小説には反映されません。 `narou d -f` コマンドで強制上書きして下さい
28
+ - 1.3.0.1 の修正で※が正しく区切り記号として認識されなくなっていたのを修正
29
+ - タイトルが数字だけの場合に余分に空白が入ってしまうのを修正
30
+ * 追加機能もしくは仕様変更
31
+ - 漢数字化しない場合、一桁のアラビア数字は全角化するように変更
32
+ - タイトルのアラビア半角数字で特殊な処理を追加
33
+ + 行頭にある3桁の半角アラビア数字は全角化せず縦中横にする
34
+
24
35
  2013/09/03 : **1.3.0.1**
25
36
  * Bug Fix
26
37
  - ※記号の外字注記化コードによって正常に変換できなくなった問題を修正
@@ -43,25 +54,6 @@ Narou.rb ― 「小説家になろう」「小説を読もう!」ダウンロ
43
54
  + すでに setting.ini が書きだされている小説は対象外
44
55
  - 携帯用改行タグ <KBR> でも改行するように変更
45
56
 
46
- 2013/08/03 : **1.2.9**
47
- * Bug Fix
48
- - 小説のタイトルに < 及び > が含まれている場合にエラーになっていた問題を修正
49
- - タイトルが二重に表示されてしまうバグがまだ発生したので修正
50
- * 追加機能もしくは仕様変更
51
- - raw フォルダにテキストデータをそのまま保存する機能を追加
52
- - ライセンスを MIT に設定しました(過去のバージョンに遡って適用します)
53
-
54
- 2013/07/26 : **1.2.8**
55
- * Bug Fix
56
- - なろうの仕様変更でタイトルがたまに二重に表示されてしまうバグ(?)に対処
57
-
58
- 2013/06/12 : **1.2.7**
59
- * 追加機能もしくは仕様変更
60
- - 小説更新時及び `list` コマンドで新着話数があるかどうかを目視出来るようにした
61
- + 更新時はタイトル横に (新着) 表示
62
- + list コマンドでは当日に新着のあった小説の日付が紫になる
63
- - 新着表示が優先で、新着がなくて更新だけの場合は緑になる
64
-
65
57
  ----
66
58
 
67
59
  「小説家になろう」は株式会社ヒナプロジェクトの登録商標です
@@ -386,11 +386,20 @@ class ConverterBase
386
386
  # 特殊な記号を外字注記に変換
387
387
  #
388
388
  def convert_aozora_special_charactoers(data)
389
- data.gsub!("※", "※[#米印、1-2-8]")
389
+ data.gsub!("※", "※※") # 外字注記表記だと border_symbol? 等で困るのであとで外字注記化する
390
390
  data.gsub!("≪", "※[#始め二重山括弧]")
391
391
  data.gsub!("≫", "※[#終わり二重山括弧]")
392
392
  end
393
393
 
394
+ #
395
+ # ※の外字注記化
396
+ #
397
+ # convert_aozora_special_charactoers で2つにしておいた※を外字注記化する
398
+ #
399
+ def rebuild_kome_to_gaiji(data)
400
+ data.gsub!("※※", "※[#米印、1-2-8]")
401
+ end
402
+
394
403
  #
395
404
  # 濁点のついてない文字に濁点をつける表現を対応
396
405
  #
@@ -490,15 +499,17 @@ class ConverterBase
490
499
  #
491
500
  # 半角アラビア数字の全角化
492
501
  #
493
- # 3桁以上:全角化
494
- # 1,2桁:縦中横化
502
+ # 1桁、3桁以上:全角化
503
+ # 2桁:縦中横化
495
504
  #
496
505
  def hankaku_num_to_zenkaku_num(data)
497
506
  data.gsub!(/\d+/) do |num|
498
- if num.length > 2
499
- num.tr("0-9", "0-9")
500
- else
507
+ if num.length == 2
501
508
  tcy(num)
509
+ elsif num.length == 3 && @text_type == "subtitle" && $`.empty?
510
+ tcy(num)
511
+ else
512
+ num.tr("0-9", "0-9")
502
513
  end
503
514
  end
504
515
  data
@@ -534,6 +545,8 @@ class ConverterBase
534
545
  #
535
546
  # 章見出しっぽい文字列を字下げして前後に空行を入れる
536
547
  #
548
+ # TODO: 半角数字の縦中横注記をいれた影響で、2桁の半角数字が認識されてないのをどうにかする
549
+ #
537
550
  def force_indent_special_chapter(line)
538
551
  line.sub!(/^(?:[  \t]|[#二分アキ])*([-―<<〈-]*)([0-90-9#{KANJI_NUM}]+)([-―>>〉-]*)$/) do
539
552
  @request_insert_blank_next_line = true
@@ -1029,28 +1042,32 @@ class ConverterBase
1029
1042
  progressbar.output(0)
1030
1043
  end
1031
1044
  @read_fp = StringIO.new(data)
1032
- @read_fp.each_with_index do |line, i|
1033
- progressbar.output(i) if @text_type == "textfile"
1034
- @request_skip_output_line = false
1035
- zenkaku_rstrip(line)
1036
- if @request_insert_blank_next_line
1037
- outputs unless blank_line?(line)
1038
- @request_insert_blank_next_line = false
1039
- end
1040
- process_author_comment(line) if @text_type == "textfile"
1041
- insert_blank_line_to_border_symbol(line)
1042
- force_indent_special_chapter(line)
1043
-
1044
- outputs(line)
1045
- unless @delay_outputs_buffer.empty?
1046
- @write_fp.write(@delay_outputs_buffer)
1047
- @before_line = @delay_outputs_buffer
1048
- @delay_outputs_buffer = ""
1049
- else
1050
- @before_line = line
1045
+ if @text_type == "subtitle"
1046
+ @write_fp.write(data)
1047
+ else
1048
+ @read_fp.each_with_index do |line, i|
1049
+ progressbar.output(i) if @text_type == "textfile"
1050
+ @request_skip_output_line = false
1051
+ zenkaku_rstrip(line)
1052
+ if @request_insert_blank_next_line
1053
+ outputs unless blank_line?(line)
1054
+ @request_insert_blank_next_line = false
1055
+ end
1056
+ process_author_comment(line) if @text_type == "textfile"
1057
+ insert_blank_line_to_border_symbol(line)
1058
+ force_indent_special_chapter(line)
1059
+
1060
+ outputs(line)
1061
+ unless @delay_outputs_buffer.empty?
1062
+ @write_fp.write(@delay_outputs_buffer)
1063
+ @before_line = @delay_outputs_buffer
1064
+ @delay_outputs_buffer = ""
1065
+ else
1066
+ @before_line = line
1067
+ end
1051
1068
  end
1069
+ author_comment_force_close if @text_type == "textfile"
1052
1070
  end
1053
- author_comment_force_close if @text_type == "textfile"
1054
1071
 
1055
1072
  @write_fp.rewind
1056
1073
  data = @write_fp.string
@@ -1067,6 +1084,7 @@ class ConverterBase
1067
1084
  rebuild_url(data)
1068
1085
  rebuild_english_sentences(data)
1069
1086
  rebuild_hankaku_num_and_comma(data)
1087
+ rebuild_kome_to_gaiji(data)
1070
1088
  # 再構築された文章にルビがふられる可能性を考慮して、
1071
1089
  # この位置でルビの処理を行う
1072
1090
  narou_ruby(data) if @setting.enable_ruby
@@ -330,7 +330,7 @@ class Downloader
330
330
  if @force
331
331
  update_subtitles = latest_toc["subtitles"]
332
332
  else
333
- update_subtitles = update_check(old_toc["subtitles"], latest_toc["subtitles"])
333
+ update_subtitles = update_body_check(old_toc["subtitles"], latest_toc["subtitles"])
334
334
  end
335
335
  if update_subtitles.count > 0
336
336
  @cache_dir = create_cache_dir if old_toc.length > 0
@@ -441,22 +441,32 @@ class Downloader
441
441
  toc_objects
442
442
  end
443
443
 
444
+ def __search_index_in_subtitles(subtitles, index)
445
+ subtitles.index { |item|
446
+ item["index"] == index
447
+ }
448
+ end
449
+
444
450
  #
445
- # 更新チェック
451
+ # 本文更新チェック
446
452
  #
447
453
  # 更新された subtitle だけまとまった配列を返す
448
454
  #
449
- def update_check(old_subtitles, latest_subtitles)
455
+ def update_body_check(old_subtitles, latest_subtitles)
450
456
  return latest_subtitles unless old_subtitles
451
457
  latest_subtitles.dup.keep_if do |latest|
452
458
  index = latest["index"]
453
- index_in_old_toc = old_subtitles.index { |item| item["index"] == index }
459
+ index_in_old_toc = __search_index_in_subtitles(old_subtitles, index)
454
460
  next true unless index_in_old_toc
455
461
  old = old_subtitles[index_in_old_toc]
456
462
  # タイトルチェック
457
463
  if old["subtitle"] != latest["subtitle"]
458
464
  next true
459
465
  end
466
+ # 章チェック
467
+ if old["chapter"] != latest["chapter"]
468
+ next true
469
+ end
460
470
  # 更新日チェック
461
471
  old_subupdate = old["subupdate"]
462
472
  latest_subupdate = latest["subupdate"]
@@ -512,7 +522,12 @@ class Downloader
512
522
  else
513
523
  sleep(interval_sleep_time) if i > 0
514
524
  end
515
- index, subtitle, file_subtitle = %w(index subtitle file_subtitle).map {|k| subtitle_info[k] }
525
+ index, subtitle, file_subtitle, chapter = %w(index subtitle file_subtitle chapter).map { |k|
526
+ subtitle_info[k]
527
+ }
528
+ unless chapter.empty?
529
+ puts "#{chapter}"
530
+ end
516
531
  print "第#{index}部分 #{subtitle} (#{i+1}/#{max})"
517
532
  section_element = a_section_download(subtitle_info)
518
533
  info = subtitle_info.dup
@@ -3,7 +3,7 @@
3
3
  # Copyright 2013 whiteleaf. All rights reserved.
4
4
  #
5
5
 
6
- Version = "1.3.0.1"
6
+ Version = "1.3.1"
7
7
 
8
8
  cv_path = File.expand_path(File.join(File.dirname(__FILE__), "../commitversion"))
9
9
  if File.exists?(cv_path)
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.3.0.1
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - whiteleaf7
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-03 00:00:00.000000000 Z
11
+ date: 2013-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: termcolor