narou 1.1.2.1 → 1.2.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.

data/ChangeLog.md CHANGED
@@ -1,6 +1,30 @@
1
1
  
2
2
  更新履歴 - ChangeLog
3
3
  --------------------
4
+
5
+ 2013/03/19 : **1.2.0**
6
+ * Bug Fix 及び機能改善
7
+ - Windows以外のOSでの動作状況を改善しました(Ubuntu Linuxで確認。Mac OS Xは未確認だが恐らく動くはず)
8
+ + Nコードを指定した場合にエラーが出ていたのを修正
9
+ + AozoraEpub3の出力をうまく扱えていなくエラーが出ていたのを修正
10
+ + Linuxでも `folder` 及び `browser` コマンドを使えるように改善
11
+ + `send` コマンドでデバイスへ送信出来るように(Linuxのみ確認、Mac OS Xは未確認)
12
+ - /media もしくは /mnt を探します。送信出来ない場合はこのフォルダにマウントされているか確認して下さい
13
+ - shebangの記述をちゃんと動くように修正(gem でインストールした場合は影響なし)
14
+ - --no-color 時の処理の最適化
15
+ * 追加機能もしくは仕様変更
16
+ - 漢数字の単位化下限のデフォルトを3桁から4桁へ変更(kanji_num_with_units_lower_digit_zero=3)
17
+ + `100 → 一〇〇、1000 → 千` と変換される
18
+ - 章タイトルページの柱の位置調整
19
+ - 行頭二分アキをいれる対象にノノカギ(〝)を追加
20
+ - !?の直後に全角アキを自動挿入しないパターンに閉じノノカギ(〟)を追加
21
+ - 小説のDL時に最初から用意された変換設定を適用する機能追加
22
+ + 以下の小説の設定を同梱しました(気まぐれで増えていきます)
23
+ - [オーバーロード:後編](http://ncode.syosetu.com/n1839bd/)
24
+ - [異世界迷宮で奴隷ハーレムを](http://ncode.syosetu.com/n4259s/)
25
+ - [ログ・ホライズン](http://ncode.syosetu.com/n8725k/)
26
+ - [無職転生 - 異世界行ったら本気だす -](http://ncode.syosetu.com/n9669bk/)
27
+
4
28
  2013/03/18 : **1.1.2.1**
5
29
  * Bug Fix
6
30
  - Linuxで実行不可能になるエラー修正
data/README.md CHANGED
@@ -17,6 +17,29 @@ Narou.rb ― 小説家になろうダウンローダ&縦書用整形スクリ
17
17
 
18
18
  更新履歴 - ChangeLog
19
19
  --------------------
20
+ 2013/03/19 : **1.2.0**
21
+ * Bug Fix 及び機能改善
22
+ - Windows以外のOSでの動作状況を改善しました(Ubuntu Linuxで確認。Mac OS Xは未確認だが恐らく動くはず)
23
+ + Nコードを指定した場合にエラーが出ていたのを修正
24
+ + AozoraEpub3の出力をうまく扱えていなくエラーが出ていたのを修正
25
+ + Linuxでも `folder` 及び `browser` コマンドを使えるように改善
26
+ + `send` コマンドでデバイスへ送信出来るように(Linuxのみ確認、Mac OS Xは未確認)
27
+ - /media もしくは /mnt を探します。送信出来ない場合はこのフォルダにマウントされているか確認して下さい
28
+ - shebangの記述をちゃんと動くように修正(gem でインストールした場合は影響なし)
29
+ - --no-color 時の処理の最適化
30
+ * 追加機能もしくは仕様変更
31
+ - 漢数字の単位化下限のデフォルトを3桁から4桁へ変更(kanji_num_with_units_lower_digit_zero=3)
32
+ + `100 → 一〇〇、1000 → 千` と変換される
33
+ - 章タイトルページの柱の位置調整
34
+ - 行頭二分アキをいれる対象にノノカギ(〝)を追加
35
+ - !?の直後に全角アキを自動挿入しないパターンに閉じノノカギ(〟)を追加
36
+ - 小説のDL時に最初から用意された変換設定を適用する機能追加
37
+ + 以下の小説の設定を同梱しました(気まぐれで増えていきます)
38
+ - [オーバーロード:後編](http://ncode.syosetu.com/n1839bd/)
39
+ - [異世界迷宮で奴隷ハーレムを](http://ncode.syosetu.com/n4259s/)
40
+ - [ログ・ホライズン](http://ncode.syosetu.com/n8725k/)
41
+ - [無職転生 - 異世界行ったら本気だす -](http://ncode.syosetu.com/n9669bk/)
42
+
20
43
  2013/03/18 : **1.1.2.1**
21
44
  * Bug Fix
22
45
  - Linuxで実行不可能になるエラー修正
@@ -43,11 +66,3 @@ Narou.rb ― 小説家になろうダウンローダ&縦書用整形スクリ
43
66
  - update コマンドにIDを直指定した時の変換時に不正な引数を渡していたのを修正
44
67
  * 追加機能もしくは仕様変更
45
68
  - 三点リーダーの偶数化を1つからするように変更
46
-
47
- 2013/03/07 : **1.1.0**
48
- * Bug Fix
49
- - xhtml_nav.vm の</ol></li>が過剰付与だったのを修正
50
- - |《るび》 な場合、ルビ化を無効にする(なろうの仕様に追随)
51
- * 追加機能もしくは仕様変更
52
- - Ruby2.0.0対応
53
-
data/bin/narou CHANGED
@@ -1,4 +1,4 @@
1
- #! ruby
1
+ #! /usr/bin/env ruby
2
2
  # -*- mode: ruby -*-
3
3
  # -*- coding: utf-8 -*-
4
4
  #
data/lib/command/alias.rb CHANGED
@@ -35,7 +35,7 @@ module Command
35
35
  database = Database.instance
36
36
  aliases.each do |name, id|
37
37
  title = database[id]["title"] rescue "(すでに削除されています)"
38
- puts "<green>#{name}</green>=#{title}".termcolor
38
+ puts "<bold><green>#{name}</green></bold>=#{title}".termcolor
39
39
  end
40
40
  end
41
41
 
@@ -46,7 +46,7 @@ module Command
46
46
  else
47
47
  open_url = toc_url
48
48
  end
49
- Helper.open_url_by_browser(open_url)
49
+ Helper.open_browser(open_url)
50
50
  puts open_url
51
51
  end
52
52
  end
@@ -148,7 +148,7 @@ module Command
148
148
  end
149
149
 
150
150
  unless @options["no-open"]
151
- Helper.open_directory_by_os_filer(File.dirname(@converted_txt_path), "小説の保存フォルダを開きますか")
151
+ Helper.open_directory(File.dirname(@converted_txt_path), "小説の保存フォルダを開きますか")
152
152
  end
153
153
  end
154
154
  rescue Interrupt
@@ -189,7 +189,7 @@ module Command
189
189
 
190
190
  if !@device || !@device.kindle? || @options["no-mobi"]
191
191
  puts File.basename(epub_path) + " を出力しました"
192
- puts "<green>EPUBファイルを出力しました</green>".termcolor
192
+ puts "<bold><green>EPUBファイルを出力しました</green></bold>".termcolor
193
193
  return epub_path
194
194
  end
195
195
 
@@ -208,7 +208,7 @@ module Command
208
208
  end
209
209
  end
210
210
  puts File.basename(mobi_path).encode(Encoding::UTF_8) + " を出力しました"
211
- puts "<green>MOBIファイルを出力しました</green>".termcolor
211
+ puts "<bold><green>MOBIファイルを出力しました</green></bold>".termcolor
212
212
 
213
213
  return mobi_path
214
214
  end
data/lib/command/diff.rb CHANGED
@@ -212,7 +212,7 @@ module Command
212
212
  end
213
213
  puts "差分一覧"
214
214
  cache_list.each.with_index(1) do |cache_path, i|
215
- puts ("<yellow>" + File.basename(cache_path) + " -#{i}</yellow>").termcolor
215
+ puts ("<bold><yellow>" + File.basename(cache_path) + " -#{i}</yellow></bold>").termcolor
216
216
  cache_section_list = Dir.glob(File.join(cache_path, "*.yaml"))
217
217
  if cache_section_list.length > 0
218
218
  cache_section_list.map { |section_path|
@@ -28,7 +28,7 @@ module Command
28
28
  argv.each do |target|
29
29
  dir = Downloader.get_novel_data_dir_by_target(target)
30
30
  if dir
31
- Helper.open_directory_by_os_filer(dir)
31
+ Helper.open_directory(dir)
32
32
  puts dir
33
33
  else
34
34
  error "#{target} は存在しません"
data/lib/command/help.rb CHANGED
@@ -22,13 +22,13 @@ module Command
22
22
  def display_help
23
23
  puts HEADER
24
24
  puts
25
- puts " <green>Usage: narou &lt;command&gt; [arguments...] [options...] [--no-color]</green>".termcolor
25
+ puts " <bold><green>Usage: narou &lt;command&gt; [arguments...] [options...] [--no-color]</green></bold>".termcolor
26
26
  puts
27
27
  puts " コマンドの簡単な説明:"
28
28
  cmd_list = Command.get_list
29
29
  cmd_list.each do |key, command|
30
30
  oneline = command.oneline_help.split("\n")
31
- puts " <green>#{key.ljust(12)}</green> #{oneline.shift}".termcolor
31
+ puts " <bold><green>#{key.ljust(12)}</green></bold> #{oneline.shift}".termcolor
32
32
  oneline.each do |h|
33
33
  puts " " * 16 + h
34
34
  end
@@ -36,18 +36,17 @@ module Command
36
36
  puts
37
37
  puts " 各コマンドの詳細は narou <command> -h/--help を参照してください。"
38
38
  puts " 各コマンドは先頭の一文字か二文字でも指定できます。"
39
- puts " (e.g. `<yellow>narou d n4259s</yellow>', `<yellow>narou fr musyoku</yellow>')".termcolor
40
- puts
41
- puts " 表示の色は--no-colorとオプションを付けるか`<yellow>narou s no-color=true</yellow>'で消せます。".termcolor
39
+ puts " (e.g. `narou <bold><yellow>d</yellow></bold> n4259s', `narou <bold><yellow>fr</yellow></bold> musyoku')".termcolor
40
+ puts " 表示の色は--no-colorとオプションを付けるか`narou s no-color=true'で消せます。".termcolor
42
41
  end
43
42
 
44
43
  def display_help_first_time
45
44
  puts HEADER
46
45
  puts
47
- puts " <green>Usage: narou init</green>".termcolor
46
+ puts " <bold><green>Usage: narou init</green></bold>".termcolor
48
47
  puts
49
48
  puts " まだこのフォルダは初期化されていません。"
50
- puts " <yellow>narou init</yellow> コマンドを実行して初期化を行いましょう。".termcolor
49
+ puts " <bold><yellow>narou init</yellow></bold> コマンドを実行して初期化を行いましょう。".termcolor
51
50
  end
52
51
  end
53
52
  end
data/lib/command/init.rb CHANGED
@@ -65,19 +65,21 @@ module Command
65
65
  if !force && @global_setting["aozoraepub3dir"]
66
66
  return
67
67
  end
68
- puts "<green>AozoraEpub3の設定を行います</green>".termcolor
69
- puts ("<red>" + "!!!WARNING!!!".center(70) + "</red>").termcolor
70
- puts "AozoraEpub3の構成ファイルを書き換えます。narouコマンド用に別途新規インストールしておくことをオススメします"
68
+ puts "<bold><green>AozoraEpub3の設定を行います</green></bold>".termcolor
69
+ unless @global_setting["aozoraepub3dir"]
70
+ puts ("<red>" + "!!!WARNING!!!".center(70) + "</red>").termcolor
71
+ puts "AozoraEpub3の構成ファイルを書き換えます。narouコマンド用に別途新規インストールしておくことをオススメします"
72
+ end
71
73
  aozora_path = ask_aozoraepub3_path
72
74
  unless aozora_path
73
- puts "設定をスキップしました。あとで " + "<yellow>narou init</yellow>".termcolor + " で再度設定出来ます"
75
+ puts "設定をスキップしました。あとで " + "<bold><yellow>narou init</yellow></bold>".termcolor + " で再度設定出来ます"
74
76
  return
75
77
  end
76
78
  puts
77
79
  rewrite_aozoraepub3_files(aozora_path)
78
80
  @global_setting["aozoraepub3dir"] = aozora_path
79
81
  GlobalSetting.get.save_settings("global_setting")
80
- puts "<green>AozoraEpub3の設定を終了しました</green>".termcolor
82
+ puts "<bold><green>AozoraEpub3の設定を終了しました</green></bold>".termcolor
81
83
  end
82
84
 
83
85
  def rewrite_aozoraepub3_files(aozora_path)
@@ -111,7 +113,7 @@ module Command
111
113
 
112
114
  def ask_aozoraepub3_path
113
115
  puts
114
- print "<green>AozoraEpub3のあるフォルダを入力して下さい:</green>\n(未入力でスキップ".termcolor
116
+ print "<bold><green>AozoraEpub3のあるフォルダを入力して下さい:</green></bold>\n(未入力でスキップ".termcolor
115
117
  if @global_setting["aozoraepub3dir"]
116
118
  print "、:keep で前回と同じ設定"
117
119
  end
@@ -129,7 +131,8 @@ module Command
129
131
  when input == ""
130
132
  break
131
133
  end
132
- print "\n<green>入力されたフォルダにAozoraEpub3がありません。もう一度入力して下さい:</green>\n&gt;".termcolor
134
+ print ("\n<bold><green>入力されたフォルダにAozoraEpub3がありません。" +
135
+ "もう一度入力して下さい:</green></bold>\n&gt;").termcolor
133
136
  end
134
137
  nil
135
138
  end
data/lib/command/send.rb CHANGED
@@ -21,7 +21,6 @@ module Command
21
21
  <device>には現在 #{Device::DEVICES.keys.join(", ")} が指定出来ます。
22
22
  ・narou setting device=<device>としておけば、<device>の入力を省略できます。
23
23
  また、convertコマンドで変換時に(端末がPCに接続されていれば)自動でデータを送信するようになります。
24
- !Windows専用コマンドです!
25
24
 
26
25
  Example:
27
26
  narou send kindle 6
@@ -44,10 +43,6 @@ module Command
44
43
  puts @opt.help
45
44
  return
46
45
  end
47
- unless Helper.os_windows?
48
- error "このコマンドはWindows専用です"
49
- exit 1
50
- end
51
46
  device = get_device(argv)
52
47
  unless device
53
48
  error "デバイス名を指定して下さい"
@@ -153,7 +153,7 @@ module Command
153
153
  if value =~ / /
154
154
  value = "'#{value}'"
155
155
  end
156
- puts "<green>#{name}</green>=#{value}".termcolor
156
+ puts "<bold><green>#{name}</green></bold>=#{value}".termcolor
157
157
  end
158
158
  end
159
159
  end
@@ -206,7 +206,7 @@ module Command
206
206
  SETTING_VARIABLES[scope].each do |name, info|
207
207
  if @options["all"] || info[2] != INVISIBLE
208
208
  type_description = self.class.variable_type_to_description(info[0])
209
- result << " <green>#{name.ljust(18)}</green> #{type_description} #{info[1]}\n".termcolor
209
+ result << " <bold><green>#{name.ljust(18)}</green></bold> #{type_description} #{info[1]}\n".termcolor
210
210
  end
211
211
  end
212
212
  result
data/lib/commandbase.rb CHANGED
@@ -9,9 +9,9 @@ module Command
9
9
  class CommandBase
10
10
  def initialize(postfix = "")
11
11
  @opt = OptionParser.new(nil, 20)
12
- @opt.banner = ("<green>" +
12
+ @opt.banner = ("<bold><green>" +
13
13
  TermColor.escape("Usage: narou #{self.class.to_s.scan(/::(.+)$/)[0][0].downcase} #{postfix}") +
14
- "</green>").termcolor
14
+ "</green></bold>").termcolor
15
15
  @options = {}
16
16
  end
17
17
 
data/lib/converterbase.rb CHANGED
@@ -202,7 +202,7 @@ class ConverterBase
202
202
  data.gsub!(/([!?!?]+)([^!?!?])/) do
203
203
  m1, m2 = $1, $2
204
204
  m2 = " " if m2 == " "
205
- if m2 =~ /[^」]』】〉》〕>>≫))"”’ ☆★♪[―]/
205
+ if m2 =~ /[^」]』】〉》〕>>≫))"”’〟 ☆★♪[―]/
206
206
  "#{m1} #{m2}"
207
207
  else
208
208
  "#{m1}#{m2}"
@@ -410,7 +410,7 @@ class ConverterBase
410
410
  data
411
411
  end
412
412
 
413
- HALF_INDENT_TARGET = /^[  \t]*([「『((【〈《≪])/
413
+ HALF_INDENT_TARGET = /^[  \t]*([「『((【〈《≪〝])/
414
414
  FULL_INDENT_TARGET = /^[  \t]*(――)/
415
415
  #
416
416
  # 行頭かぎ括弧(等)に二分アキを追加する
@@ -662,18 +662,13 @@ class ConverterBase
662
662
  #
663
663
  def narou_ruby(data)
664
664
  # 《》なルビの対処
665
- last_i = 0
666
- ruby_stack = {}
667
- data.gsub!(/(.+?)≪(.+?)≫/).with_index do |match, i|
668
- ruby_str = to_ruby(match, $1, $2, ["≪", "≫"])
669
- last_i = i
670
- ruby_str
665
+ data.gsub!(/(.+?)≪(.+?)≫/) do |match|
666
+ to_ruby(match, $1, $2, ["≪", "≫"])
671
667
  end
672
668
  # ()なルビの対処
673
669
  if @text_type != "subtitle"
674
- data.gsub!(/(.+?)(([ぁ-んァ-ヴーゞ・A-Za-zA-Za-z ]{,20}))/).with_index(last_i + 1) do |match, i|
675
- ruby_str = to_ruby(match, $1, $2, ["(", ")"])
676
- ruby_str
670
+ data.gsub!(/(.+?)(([ぁ-んァ-ヴーゞ・A-Za-zA-Za-z ]{,20}))/) do |match|
671
+ to_ruby(match, $1, $2, ["(", ")"])
677
672
  end
678
673
  end
679
674
  data.replace(replace_tatesen(data))
data/lib/device.rb CHANGED
@@ -7,9 +7,13 @@ require "fileutils"
7
7
  require_relative "helper"
8
8
 
9
9
  class Device
10
- if Helper.os_windows?
10
+ case Helper.determine_os
11
+ when :windows
11
12
  require_relative "device/library/windows"
12
13
  extend Device::Library::Windows
14
+ else
15
+ require_relative "device/library/linux"
16
+ extend Device::Library::Linux
13
17
  end
14
18
 
15
19
  require_relative "device/kindle"
@@ -48,7 +52,7 @@ class Device
48
52
  end
49
53
 
50
54
  def get_documents_path
51
- if Helper.os_windows?
55
+ if Device.respond_to?(:get_device_root_dir)
52
56
  dir = Device.get_device_root_dir(@device::VOLUME_NAME)
53
57
  return File.join(dir, @device::DOCUMENTS_PATH) if dir
54
58
  end
@@ -0,0 +1,18 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright 2013 whiteleaf. All rights reserved.
4
+ #
5
+
6
+ module Device::Library
7
+ module Linux
8
+ def get_device_root_dir(volume_name)
9
+ %w(/media /mnt).each do |mount_root|
10
+ path = File.join(mount_root, volume_name)
11
+ if File.directory?(path)
12
+ return path
13
+ end
14
+ end
15
+ nil
16
+ end
17
+ end
18
+ end
data/lib/downloader.rb CHANGED
@@ -178,7 +178,7 @@ class Downloader
178
178
  return data["toc_url"]
179
179
  end
180
180
  end
181
- return "#{@@narou["domain"]}/#{target}/"
181
+ return "#{@@narou["top_url"]}/#{target}/"
182
182
  when :id
183
183
  data = @@database[target.to_i]
184
184
  return data["toc_url"] if data
@@ -488,7 +488,7 @@ class Downloader
488
488
  def sections_download_and_save(subtitles)
489
489
  max = subtitles.count
490
490
  return if max == 0
491
- puts ("<green>" + TermColor.escape("ID:#{@id} #{@title} のDL開始") + "</green>").termcolor
491
+ puts ("<bold><green>" + TermColor.escape("ID:#{@id} #{@title} のDL開始") + "</green></bold>").termcolor
492
492
  interval_sleep_time = LocalSetting.get["local_setting"]["download.interval"] || 0
493
493
  interval_sleep_time = 0 if interval_sleep_time < 0
494
494
  save_least_one = false
@@ -550,7 +550,7 @@ class Downloader
550
550
  if @setting["tcode"]
551
551
  subtitle_url = @setting.replace_group_values("txtdownload_url", subtitle_info)
552
552
  elsif href[0] == "/"
553
- subtitle_url = @setting["domain"] + href
553
+ subtitle_url = @setting["top_url"] + href
554
554
  else
555
555
  subtitle_url = @setting["toc_url"] + href
556
556
  end
@@ -654,12 +654,23 @@ class Downloader
654
654
  # 小説データの格納ディレクトリを初期設定する
655
655
  #
656
656
  def init_novel_dir
657
- dir_path = get_novel_data_dir
658
- FileUtils.mkdir_p(dir_path) unless File.exists?(dir_path)
657
+ novel_dir_path = get_novel_data_dir
658
+ FileUtils.mkdir_p(novel_dir_path) unless File.exists?(novel_dir_path)
659
659
  default_settings = NovelSetting::DEFAULT_SETTINGS
660
- Template.write(NovelSetting::INI_NAME, dir_path, binding)
661
- Template.write("converter.rb", dir_path, binding)
662
- Template.write(NovelSetting::REPLACE_NAME, dir_path, binding)
660
+ special_preset_dir = File.join(Narou.get_preset_dir, @setting["domain"], @setting["ncode"])
661
+ exists_special_preset_dir = File.exists?(special_preset_dir)
662
+ [NovelSetting::INI_NAME, "converter.rb", NovelSetting::REPLACE_NAME].each do |filename|
663
+ if exists_special_preset_dir
664
+ preset_file_path = File.join(special_preset_dir, filename)
665
+ if File.exists?(preset_file_path)
666
+ unless File.exists?(File.join(novel_dir_path, filename))
667
+ FileUtils.cp(preset_file_path, novel_dir_path)
668
+ end
669
+ next
670
+ end
671
+ end
672
+ Template.write(filename, novel_dir_path, binding)
673
+ end
663
674
  end
664
675
 
665
676
  #
data/lib/globalsetting.rb CHANGED
@@ -5,6 +5,7 @@
5
5
 
6
6
  require "yaml"
7
7
  require "singleton"
8
+ require_relative "narou"
8
9
 
9
10
  #
10
11
  # ユーザープロファイルに保存するのでいつでも反映される設定
data/lib/helper.rb CHANGED
@@ -45,27 +45,38 @@ module Helper
45
45
  end
46
46
  end
47
47
 
48
- def self.open_directory_by_os_filer(path, confirm_message = nil)
49
- os = determine_os
50
- return if os == :other
48
+ def self.open_browser_linux(address, error_message)
49
+ %w(xdg-open firefox w3m).each do |browser|
50
+ system(%!#{browser} "#{address}"!)
51
+ return if $?.exitstatus != 127
52
+ end
53
+ error error_message
54
+ end
55
+
56
+ def self.open_directory(path, confirm_message = nil)
51
57
  if confirm_message
52
58
  return unless confirm(confirm_message)
53
59
  end
54
- case os
60
+ case determine_os
55
61
  when :windows
56
62
  `explorer "file:///#{path.encode(Encoding::Windows_31J)}"`
57
63
  when :mac
58
64
  `open "#{path}"`
65
+ else
66
+ open_browser_linux(path, "フォルダが開けませんでした")
59
67
  end
60
68
  end
61
69
 
62
- def self.open_url_by_browser(url)
70
+ def self.open_browser(url)
63
71
  case determine_os
64
72
  when :windows
65
73
  escaped_url = url.gsub("%", "%^").gsub("&", "^&")
74
+ # MEMO: start の引数を "" で囲むと動かない
66
75
  `start #{escaped_url}`
67
76
  when :mac
68
77
  `open "#{url}"`
78
+ else
79
+ open_browser_linux(url, "ブラウザが見つかりませんでした")
69
80
  end
70
81
  end
71
82
 
data/lib/logger.rb CHANGED
@@ -7,6 +7,14 @@ require "singleton"
7
7
  require "stringio"
8
8
  require_relative "color"
9
9
 
10
+ if $disable_color
11
+ class String
12
+ def termcolor
13
+ self.gsub(/<\/?.+?>/, "").gsub("&lt;", "<").gsub("&gt;", ">")
14
+ end
15
+ end
16
+ end
17
+
10
18
  module LoggerModule
11
19
  def initialize
12
20
  super
@@ -22,7 +30,11 @@ module LoggerModule
22
30
  end
23
31
 
24
32
  def strip_color(str)
25
- str.gsub(/(?:\e\[\d*[a-zA-Z])+/, "")
33
+ if $disable_color
34
+ str
35
+ else
36
+ str.gsub(/(?:\e\[\d*[a-zA-Z])+/, "")
37
+ end
26
38
  end
27
39
 
28
40
  def save(path)
@@ -30,12 +42,12 @@ module LoggerModule
30
42
  end
31
43
 
32
44
  def write_console(str, target)
33
- if str.encoding == Encoding::ASCII_8BIT
34
- str.force_encoding("utf-8")
35
- end
36
45
  unless @is_silent
37
- str = strip_color(str) if $disable_color
38
- write_color(str, target)
46
+ if $disable_color
47
+ target.write(str)
48
+ else
49
+ write_color(str, target)
50
+ end
39
51
  end
40
52
  end
41
53
  end
@@ -50,6 +62,9 @@ class Logger < StringIO
50
62
 
51
63
  def write(str)
52
64
  str = str.to_s
65
+ if str.encoding == Encoding::ASCII_8BIT
66
+ str.force_encoding(Encoding::UTF_8)
67
+ end
53
68
  super(strip_color(str))
54
69
  write_console(str, STDOUT)
55
70
  end
@@ -65,6 +80,9 @@ class LoggerError < StringIO
65
80
 
66
81
  def write(str)
67
82
  str = str.to_s
83
+ if str.encoding == Encoding::ASCII_8BIT
84
+ str.force_encoding(Encoding::UTF_8)
85
+ end
68
86
  super(strip_color(str))
69
87
  write_console(str, STDERR)
70
88
  end
@@ -110,7 +110,8 @@ class NovelConverter
110
110
 
111
111
  aozoraepub3_path = Narou.get_aozoraepub3_path
112
112
  unless aozoraepub3_path
113
- error "AozoraEpub3が見つからなかったので、EPUBが出力出来ませんでした"
113
+ error "AozoraEpub3が見つからなかったのでEPUBが出力出来ませんでした。" +
114
+ "narou initでAozoraEpub3の設定を行なって下さい"
114
115
  return nil
115
116
  end
116
117
  aozoraepub3_basename = File.basename(aozoraepub3_path)
@@ -128,8 +129,11 @@ class NovelConverter
128
129
  print "."
129
130
  end
130
131
  visible_aozora_fonts_directory unless use_dakuten_font
131
- # MEMO: Windows環境以外で出力される文字コードはSJISなのか?
132
- stdout_capture = res[0].force_encoding(Encoding::Shift_JIS).encode(Encoding::UTF_8)
132
+
133
+ stdout_capture = res[0]
134
+ if Helper.os_windows?
135
+ stdout_capture = stdout_capture.force_encoding(Encoding::Shift_JIS).encode(Encoding::UTF_8)
136
+ end
133
137
 
134
138
  Dir.chdir(pwd)
135
139
 
@@ -175,7 +179,7 @@ class NovelConverter
175
179
  if Helper.os_windows?
176
180
  epub_path.encode!(Encoding::Windows_31J)
177
181
  end
178
- command = %!"#{kindlegen_path}" "#{epub_path}"!
182
+ command = %!"#{kindlegen_path}" -locale ja "#{epub_path}"!
179
183
  print "kindlegen実行中"
180
184
  res = Helper::AsyncCommand.exec(command) do
181
185
  print "."
@@ -340,13 +344,13 @@ class NovelConverter
340
344
  else
341
345
  # 小説の監視・検査状況を表示する
342
346
  if @inspector.error? || @inspector.warning?
343
- puts "<yellow>―――― 小説にエラーもしくは警告が存在します ――――</yellow>".termcolor
347
+ puts "<bold><yellow>―――― 小説にエラーもしくは警告が存在します ――――</yellow></bold>".termcolor
344
348
  puts ""
345
349
  @inspector.display(Inspector::ERROR | Inspector::WARNING)
346
350
  puts ""
347
351
  end
348
352
  if @inspector.info?
349
- puts "<yellow>―――― 小説の検査状況を表示します ――――</yellow>".termcolor
353
+ puts "<bold><yellow>―――― 小説の検査状況を表示します ――――</yellow></bold>".termcolor
350
354
  puts ""
351
355
  @inspector.display(Inspector::INFO)
352
356
  puts ""
data/lib/novelsetting.rb CHANGED
@@ -123,7 +123,7 @@ class NovelSetting
123
123
  },
124
124
  {
125
125
  name: "kanji_num_with_units_lower_digit_zero",
126
- value: 2,
126
+ value: 3,
127
127
  help: "〇(ゼロ)が最低この数字以上付いてないと千・万などをつける対象にしない"
128
128
  },
129
129
  {
data/lib/sitesetting.rb CHANGED
@@ -60,7 +60,14 @@ class SiteSetting
60
60
  values = @yaml_setting.merge(@match_values).merge(option_values)
61
61
  result = dest.dup
62
62
  result.gsub!(/\\\\k<(.+?)>/) do |match|
63
- values[$1] || match
63
+ value = values[$1]
64
+ if value
65
+ value.gsub(/\\\\k<(.+?)>/) do
66
+ replace_group_values($1, option_values)
67
+ end
68
+ else
69
+ match
70
+ end
64
71
  end
65
72
  result
66
73
  end
data/lib/version.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  # Copyright 2013 whiteleaf. All rights reserved.
4
4
  #
5
5
 
6
- Version = "1.1.2.1"
6
+ Version = "1.2.0"
7
7
 
8
8
  cv_path = File.expand_path(File.join(File.dirname(__FILE__), "../commitversion"))
9
9
  if File.exists?(cv_path)
data/narou.gemspec CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- mode: ruby -*-
2
- # -*- coding: UTF-8 -*-
2
+ # -*- coding: utf-8 -*-
3
3
  lib = File.expand_path("../lib", __FILE__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
@@ -53,7 +53,5 @@ narou コマンドのインストール or アップデートが完了しまし
53
53
  gem.files = `git ls-files`.split("\n") << Narou.create_git_commit_version
54
54
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
55
55
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
56
- #gem.require_paths = ["lib"]
57
56
  gem.add_dependency "termcolor", ">=1.2.2"
58
- gem.add_development_dependency "rspec"
59
57
  end
data/narou.rb CHANGED
@@ -1,4 +1,4 @@
1
- #! ruby
1
+ #! /usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
3
  #
4
4
  # Narou.rb ― 小説家になろうダウンロード&整形スクリプト
@@ -6,21 +6,24 @@
6
6
  # Copyright 2013 whiteleaf. All rights reserved.
7
7
  #
8
8
 
9
- $debug = File.exists?(File.join(File.expand_path(File.dirname($0)), "debug"))
10
- Encoding.default_external = Encoding::UTF_8
11
-
12
- require_relative "lib/logger"
13
- require_relative "lib/version"
14
- require_relative "lib/commandline"
9
+ begin
10
+ $debug = File.exists?(File.join(File.expand_path(File.dirname($0)), "debug"))
11
+ Encoding.default_external = Encoding::UTF_8
15
12
 
16
- rescue_level = $debug ? Exception : StandardError
13
+ require_relative "lib/globalsetting"
17
14
 
18
- begin
19
15
  display_backtrace = ARGV.delete("--backtrace")
20
16
  display_backtrace ||= $debug
21
17
  $disable_color = ARGV.delete("--no-color")
22
18
  $disable_color ||= GlobalSetting.get["global_setting"]["no-color"]
23
- CommandLine.run(ARGV)
19
+
20
+ require_relative "lib/logger"
21
+ require_relative "lib/version"
22
+ require_relative "lib/commandline"
23
+
24
+ rescue_level = $debug ? Exception : StandardError
25
+
26
+ CommandLine.run(ARGV.map { |v| v.dup })
24
27
  rescue rescue_level => e
25
28
  warn $@.shift + ": #{e.message} (#{e.class})"
26
29
  if display_backtrace
@@ -0,0 +1,33 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ #
4
+ # 対象小説情報
5
+ # タイトル: オーバーロード:後編
6
+ # 作者: 丸山くがね
7
+ # URL: http://ncode.syosetu.com/n1839bd/
8
+ #
9
+ converter "オーバーロード:後編" do
10
+ def before(io, text_type)
11
+ super
12
+ end
13
+
14
+ def after(io, text_type)
15
+ if io.string.scan(/[<<〈((]([ぁ-んァ-ヴーゞ・A-Za-zA-Za-z]+?)[>>〉))]/).length > 0
16
+ @inspector.warning("オバロっぽいルビを検出:#{$1}")
17
+ end
18
+ io.string.gsub!(/[≪『](.+?)/(.+?)[≫』]/) do
19
+ spell_ruby, spell_name = $1, $2
20
+ if spell_name =~ /^([ぁ-んァ-ヴーゞ・A-Za-zA-Za-z]+)$/
21
+ spell_name = spell_ruby
22
+ spell_ruby = $&
23
+ end
24
+ option = ""
25
+ if spell_ruby =~ /^――(.+)/
26
+ spell_ruby = $1
27
+ option = "――"
28
+ end
29
+ "#{option}≪|#{spell_name}《#{spell_ruby}》≫"
30
+ end
31
+ io
32
+ end
33
+ end
@@ -0,0 +1,59 @@
1
+ ; 数字の漢数字変換を有効に
2
+ enable_convert_num_to_kanji = true
3
+
4
+ ; 漢数字変換した場合、千・万などに変換するか
5
+ enable_kanji_num_with_units = true
6
+
7
+ ; 〇(ゼロ)が最低この数字以上付いてないと千・万などをつける対象にしない
8
+ kanji_num_with_units_lower_digit_zero = 2
9
+
10
+ ; アルファベットを強制的に全角にする。falseの場合英文は半角、それ以外は全角になる
11
+ enable_alphabet_force_zenkaku = false
12
+
13
+ ; 行頭かぎ括弧に二分アキを挿入する
14
+ enable_half_indent_bracket = true
15
+
16
+ ; 自動行頭字下げ機能。行頭字下げが行われているかを判断し、適切に行頭字下げをする
17
+ enable_auto_indent = false
18
+
19
+ ; かぎ括弧内自動連結を有効に
20
+ ; 例)
21
+ ; 「~~~!
22
+ ;  ***?」 → 「~~~! ***?」
23
+ enable_auto_join_in_brackets = false
24
+
25
+ ; かぎ括弧内のとじ開きが正しくされているかどうか調査する
26
+ enable_inspect_invalid_openclose_brackets = true
27
+
28
+ ; 行末が読点で終わっている部分を出来るだけ連結する
29
+ enable_auto_join_line = false
30
+
31
+ ; [#改ページ]直後の行に中見出しを付与する(テキストファイルを直接変換する場合のみの設定)
32
+ enable_enchant_midashi = true
33
+
34
+ ; 作者コメントを検出するか(テキストファイルを直接変換する場合のみの設定)
35
+ enable_author_comments = true
36
+
37
+ ; 前書きを削除するか
38
+ enable_erase_introduction = false
39
+
40
+ ; 後書きを削除するか
41
+ enable_erase_postscript = false
42
+
43
+ ; ルビ処理対策を有効に
44
+ enable_ruby = false
45
+
46
+ ; 小説家になろうの挿絵タグを有効にする(false なら削除)
47
+ enable_narou_illust = true
48
+
49
+ ; ○/×表記を×分の○表記に変換する。日付表記(10/23)と誤爆しやすいので注意
50
+ enable_transform_fraction = true
51
+
52
+ ; 日付表記(20yy/mm/dd)を任意の形式(date_formatで指定)に変換する
53
+ enable_transform_date = false
54
+
55
+ ; 書式は http://goo.gl/gvJ5u を参考
56
+ date_format = %Y年%m月%d日
57
+
58
+ ; 中黒(・)を並べて三点リーダーもどきにしているのを三点リーダーに変換する
59
+ enable_convert_horizontal_ellipsis = false
@@ -0,0 +1,78 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ #
4
+ # 対象小説情報
5
+ # タイトル: 異世界迷宮で奴隷ハーレムを
6
+ # 作者: 蘇我捨恥
7
+ # URL: http://ncode.syosetu.com/n4259s/
8
+ #
9
+ converter "異世界迷宮で奴隷ハーレムを" do
10
+ def before(io, text_type)
11
+ data = io.read
12
+ data.gsub!("\n\n", "\n")
13
+ StringIO.new(data)
14
+ end
15
+
16
+ def level_convert!(line)
17
+ line.gsub!(/Lv([0-90-9])/, "Lv\\1")
18
+ line.gsub!(/Lv([0-90-9]+)/, "Lv[#「Lv」は縦中横]\\1[#「\\1」は縦中横]")
19
+ end
20
+
21
+ def is_parameter_block?(line)
22
+ if line =~ /^[^「『\((【〈《≪[  ―]/
23
+ return true
24
+ else
25
+ return false
26
+ end
27
+ end
28
+
29
+ def in_parameter_block?(line)
30
+ unless @in_parameter_block
31
+ if is_parameter_block?(line)
32
+ @in_parameter_block = true
33
+ return true
34
+ end
35
+ end
36
+ return false
37
+ end
38
+
39
+ def out_parameter_block?(line)
40
+ if @in_parameter_block
41
+ unless is_parameter_block?(line) || line =~ /^[\**]+/
42
+ @in_parameter_block = false
43
+ return true
44
+ end
45
+ end
46
+ return false
47
+ end
48
+
49
+ def after(io, text_type)
50
+ return io unless text_type == "body"
51
+ write_fp = StringIO.new
52
+ non_close_parameter = false
53
+ @in_parameter_block = false
54
+ io.each do |line|
55
+ line.rstrip!
56
+ if !comments_block?(line)
57
+ level_convert!(line)
58
+ if in_parameter_block?(line)
59
+ non_close_parameter = true
60
+ write_fp.puts("[#ここからパラメーター]")
61
+ end
62
+ if out_parameter_block?(line)
63
+ non_close_parameter = false
64
+ write_fp.puts("[#ここでパラメーター終わり]")
65
+ end
66
+ end
67
+ write_fp.puts(line)
68
+ end
69
+ if non_close_parameter
70
+ write_fp.puts("[#ここでパラメーター終わり]")
71
+ end
72
+ data = write_fp.string
73
+ data.lstrip!
74
+ data.gsub!(/\n\n([#ここからパラメーター])/m, "\n\\1")
75
+ data.gsub!(/([#ここでパラメーター終わり]\n\n)/m, "[#ここでパラメーター終わり]\n")
76
+ write_fp
77
+ end
78
+ end
@@ -0,0 +1,59 @@
1
+ ; 数字の漢数字変換を有効に
2
+ enable_convert_num_to_kanji = false
3
+
4
+ ; 漢数字変換した場合、千・万などに変換するか
5
+ enable_kanji_num_with_units = false
6
+
7
+ ; 〇(ゼロ)が最低この数字以上付いてないと千・万などをつける対象にしない
8
+ kanji_num_with_units_lower_digit_zero = 2
9
+
10
+ ; アルファベットを強制的に全角にする。falseの場合英文は半角、それ以外は全角になる
11
+ enable_alphabet_force_zenkaku = false
12
+
13
+ ; 行頭かぎ括弧に二分アキを挿入する
14
+ enable_half_indent_bracket = true
15
+
16
+ ; 自動行頭字下げ機能。行頭字下げが行われているかを判断し、適切に行頭字下げをする
17
+ enable_auto_indent = false
18
+
19
+ ; かぎ括弧内自動連結を有効に
20
+ ; 例)
21
+ ; 「~~~!
22
+ ;  ***?」 → 「~~~! ***?」
23
+ enable_auto_join_in_brackets = false
24
+
25
+ ; かぎ括弧内のとじ開きが正しくされているかどうか調査する
26
+ enable_inspect_invalid_openclose_brackets = true
27
+
28
+ ; 行末が読点で終わっている部分を出来るだけ連結する
29
+ enable_auto_join_line = true
30
+
31
+ ; [#改ページ]直後の行に中見出しを付与する(テキストファイルを直接変換する場合のみの設定)
32
+ enable_enchant_midashi = true
33
+
34
+ ; 作者コメントを検出するか(テキストファイルを直接変換する場合のみの設定)
35
+ enable_author_comments = true
36
+
37
+ ; 前書きを削除するか
38
+ enable_erase_introduction = false
39
+
40
+ ; 後書きを削除するか
41
+ enable_erase_postscript = false
42
+
43
+ ; ルビ処理対策を有効に
44
+ enable_ruby = true
45
+
46
+ ; 小説家になろうの挿絵タグを有効にする(false なら削除)
47
+ enable_narou_illust = true
48
+
49
+ ; ○/×表記を×分の○表記に変換する。日付表記(10/23)と誤爆しやすいので注意
50
+ enable_transform_fraction = false
51
+
52
+ ; 日付表記(20yy/mm/dd)を任意の形式(date_formatで指定)に変換する
53
+ enable_transform_date = true
54
+
55
+ ; 書式は http://goo.gl/gvJ5u を参考
56
+ date_format = %Y年%m月%d日
57
+
58
+ ; 中黒(・)を並べて三点リーダーもどきにしているのを三点リーダーに変換する
59
+ enable_convert_horizontal_ellipsis = false
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ #
4
+ # 対象小説情報
5
+ # タイトル: ログ・ホライズン
6
+ # 作者: 橙乃ままれ
7
+ # URL: http://ncode.syosetu.com/n8725k/
8
+ #
9
+ converter "ログ・ホライズン" do
10
+ def before(io, element_type)
11
+ super
12
+ end
13
+
14
+ def after(io, text_type)
15
+ data = io.string
16
+ if text_type == "subtitle"
17
+ data.gsub!(/^[#{ConverterBase::KANJI_NUM}]+/) do |match|
18
+ match.tr(ConverterBase::KANJI_NUM, "0-9")
19
+ end
20
+ end
21
+ io
22
+ end
23
+ end
@@ -0,0 +1,89 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ #
4
+ # 対象小説情報
5
+ # タイトル: 無職転生 - 異世界行ったら本気だす -
6
+ # 作者: 理不尽な孫の手
7
+ # URL: http://ncode.syosetu.com/n9669bk/
8
+ #
9
+ converter "無職転生 - 異世界行ったら本気だす -" do
10
+ def before(io, type)
11
+ super
12
+ end
13
+
14
+ def is_parameter_block?(line)
15
+ line =~ /^-{24,}$/ || line =~ /^={10,}$/
16
+ end
17
+
18
+ def in_parameter_block?(line)
19
+ unless @in_parameter_block
20
+ if is_parameter_block?(line)
21
+ @in_parameter_block = true
22
+ return true
23
+ end
24
+ end
25
+ return false
26
+ end
27
+
28
+ def out_parameter_block?(line)
29
+ if @in_parameter_block
30
+ if is_parameter_block?(line)
31
+ @in_parameter_block = false
32
+ return true
33
+ end
34
+ end
35
+ return false
36
+ end
37
+
38
+ def conver_dash!(line)
39
+ line.gsub!(/-{2,}/) do |match|
40
+ match.tr("-", "―")
41
+ end
42
+ line.gsub!(/^(―――)$/) do
43
+ result = "       #{$1}"
44
+ unless blank_line?(@before_line)
45
+ result = "\n" + result
46
+ end
47
+ @request_insert_blank_next_line = true
48
+ result
49
+ end
50
+ line.gsub!(/^(――)/, " \\1")
51
+ end
52
+
53
+ def convert_shiten!(line)
54
+ line.gsub!(/^ *―――?([^―]+?)―――?$/,
55
+ "\n [#1段階小さな文字][#ゴシック体][#斜体]――\\1――" + \
56
+ "[#斜体終わり][#ゴシック体終わり][#小さな文字終わり]\n\n")
57
+ end
58
+
59
+ def after(io, type)
60
+ write_fp = StringIO.new
61
+ @before_line = ""
62
+ @request_insert_blank_next_line = false
63
+ @in_parameter_block = false
64
+ io.each do |line|
65
+ if @request_insert_blank_next_line
66
+ write_fp.puts unless blank_line?(line)
67
+ @request_insert_blank_next_line = false
68
+ end
69
+ zenkaku_rstrip(line)
70
+ if in_parameter_block?(line)
71
+ write_fp.puts("[#ここからパラメーター]")
72
+ next
73
+ elsif out_parameter_block?(line)
74
+ write_fp.puts("[#ここでパラメーター終わり]")
75
+ next
76
+ end
77
+ conver_dash!(line)
78
+ convert_shiten!(line)
79
+ write_fp.puts(line)
80
+ @before_line = line.dup
81
+ end
82
+ data = write_fp.string
83
+ data.gsub!(/\n\n([#ここからパラメーター])/m, "\n\\1")
84
+ data.gsub!(/([#ここでパラメーター終わり]\n\n)/m, "[#ここでパラメーター終わり]\n")
85
+ data.gsub!("それぞれ、人の世界、人神。", "それぞれ、\n 人の世界、人神。")
86
+ data.rstrip!
87
+ write_fp
88
+ end
89
+ end
@@ -0,0 +1,59 @@
1
+ ; 数字の漢数字変換を有効に
2
+ enable_convert_num_to_kanji = true
3
+
4
+ ; 漢数字変換した場合、千・万などに変換するか
5
+ enable_kanji_num_with_units = true
6
+
7
+ ; 〇(ゼロ)が最低この数字以上付いてないと千・万などをつける対象にしない
8
+ kanji_num_with_units_lower_digit_zero = 2
9
+
10
+ ; アルファベットを強制的に全角にする。falseの場合英文は半角、それ以外は全角になる
11
+ enable_alphabet_force_zenkaku = false
12
+
13
+ ; 行頭かぎ括弧に二分アキを挿入する
14
+ enable_half_indent_bracket = true
15
+
16
+ ; 自動行頭字下げ機能。行頭字下げが行われているかを判断し、適切に行頭字下げをする
17
+ enable_auto_indent = false
18
+
19
+ ; かぎ括弧内自動連結を有効に
20
+ ; 例)
21
+ ; 「~~~!
22
+ ;  ***?」 → 「~~~! ***?」
23
+ enable_auto_join_in_brackets = true
24
+
25
+ ; かぎ括弧内のとじ開きが正しくされているかどうか調査する
26
+ enable_inspect_invalid_openclose_brackets = true
27
+
28
+ ; 行末が読点で終わっている部分を出来るだけ連結する
29
+ enable_auto_join_line = true
30
+
31
+ ; [#改ページ]直後の行に中見出しを付与する(テキストファイルを直接変換する場合のみの設定)
32
+ enable_enchant_midashi = true
33
+
34
+ ; 作者コメントを検出するか(テキストファイルを直接変換する場合のみの設定)
35
+ enable_author_comments = true
36
+
37
+ ; 前書きを削除するか
38
+ enable_erase_introduction = false
39
+
40
+ ; 後書きを削除するか
41
+ enable_erase_postscript = false
42
+
43
+ ; ルビ処理対策を有効に
44
+ enable_ruby = true
45
+
46
+ ; 小説家になろうの挿絵タグを有効にする(false なら削除)
47
+ enable_narou_illust = true
48
+
49
+ ; ○/×表記を×分の○表記に変換する。日付表記(10/23)と誤爆しやすいので注意
50
+ enable_transform_fraction = false
51
+
52
+ ; 日付表記(20yy/mm/dd)を任意の形式(date_formatで指定)に変換する
53
+ enable_transform_date = true
54
+
55
+ ; 書式は http://goo.gl/gvJ5u を参考
56
+ date_format = %Y年%m月%d日
57
+
58
+ ; 中黒(・)を並べて三点リーダーもどきにしているのを三点リーダーに変換する
59
+ enable_convert_horizontal_ellipsis = false
@@ -20,8 +20,8 @@ rt { font-size: 0.6em; }
20
20
  /* 柱(もどき) */
21
21
  .running_head {
22
22
  position: absolute !important;
23
- top: 0;
24
- left: 0;
23
+ top: 15px;
24
+ left: 10px;
25
25
  font-size: 0.8em;
26
26
  }
27
27
 
@@ -1,8 +1,10 @@
1
1
  # ------------------------------------------------------------
2
2
  # 小説サイト定義
3
3
  name: 小説家になろう
4
- domain: http://ncode.syosetu.com
5
- url: \\k<domain>/(?<ncode>n\d+[a-z]+)
4
+ scheme: http
5
+ domain: ncode.syosetu.com
6
+ top_url: \\k<scheme>://\\k<domain>
7
+ url: \\k<top_url>/(?<ncode>n\d+[a-z]+)
6
8
  encoding: UTF-8
7
9
  confirm_over18: no
8
10
 
@@ -14,7 +16,7 @@ story: <div class="novel_ex">(?<story>.+?)</div>
14
16
 
15
17
  # ------------------------------------------------------------
16
18
  # 目次取得設定
17
- toc_url: \\k<domain>/\\k<ncode>/
19
+ toc_url: \\k<top_url>/\\k<ncode>/
18
20
  subtitles: |-
19
21
  (?:<tr><td class="chapter" colspan="4">(?<chapter>.+?)</td></tr>
20
22
  <tr>
@@ -26,8 +28,8 @@ subtitles: |-
26
28
  </td>
27
29
  </tr>
28
30
 
29
- tcode: <li><a href="\\k<domain>/txtdownload/top/ncode/(?<tcode>\d+?)/" onclick
30
- txtdownload_url: \\k<domain>/txtdownload/dlstart/ncode/\\k<tcode>/?no=\\k<index>
31
+ tcode: <li><a href="\\k<top_url>/txtdownload/top/ncode/(?<tcode>\d+?)/" onclick
32
+ txtdownload_url: \\k<top_url>/txtdownload/dlstart/ncode/\\k<tcode>/?no=\\k<index>
31
33
 
32
34
  # ------------------------------------------------------------
33
35
  # 特殊な設定
@@ -1,8 +1,10 @@
1
1
  # ------------------------------------------------------------
2
2
  # 小説サイト定義
3
3
  name: ノクターン・ムーンライト
4
- domain: http://novel18.syosetu.com
5
- url: \\k<domain>/(?<ncode>n\d+[a-z]+)
4
+ scheme: http
5
+ domain: novel18.syosetu.com
6
+ top_url: \\k<scheme>://\\k<domain>
7
+ url: \\k<top_url>/(?<ncode>n\d+[a-z]+)
6
8
  encoding: UTF-8
7
9
  confirm_over18: yes
8
10
 
@@ -14,7 +16,7 @@ story: <div class="novel_ex">(?<story>.+?)</div>
14
16
 
15
17
  # ------------------------------------------------------------
16
18
  # 目次取得設定
17
- toc_url: \\k<domain>/\\k<ncode>/
19
+ toc_url: \\k<top_url>/\\k<ncode>/
18
20
  subtitles: |-
19
21
  (?:<tr><td class="chapter" colspan="4">(?<chapter>.+?)</td></tr>
20
22
  <tr>
@@ -26,8 +28,8 @@ subtitles: |-
26
28
  </td>
27
29
  </tr>
28
30
 
29
- tcode: <li><a href="\\k<domain>/txtdownload/top/ncode/(?<tcode>\d+?)/" onclick
30
- txtdownload_url: \\k<domain>/txtdownload/dlstart/ncode/\\k<tcode>/?no=\\k<index>
31
+ tcode: <li><a href="\\k<top_url>/txtdownload/top/ncode/(?<tcode>\d+?)/" onclick
32
+ txtdownload_url: \\k<top_url>/txtdownload/dlstart/ncode/\\k<tcode>/?no=\\k<index>
31
33
 
32
34
  # ------------------------------------------------------------
33
35
  # 特殊な設定
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: narou
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2.1
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-16 00:00:00.000000000 Z
12
+ date: 2013-03-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: termcolor
@@ -27,22 +27,6 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: 1.2.2
30
- - !ruby/object:Gem::Dependency
31
- name: rspec
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
30
  description: 小説家になろうで公開されている小説の管理、及び電子書籍データへの変換を支援します。縦書用に特化されており、横書き用に特化されたWEB小説を違和感なく縦書で読むことが出来るようになります。
47
31
  email:
48
32
  - 2nd.leaf@gmail.com
@@ -85,6 +69,7 @@ files:
85
69
  - lib/device.rb
86
70
  - lib/device/kindle.rb
87
71
  - lib/device/kobo.rb
72
+ - lib/device/library/linux.rb
88
73
  - lib/device/library/windows.rb
89
74
  - lib/downloader.rb
90
75
  - lib/extensions/windows.rb
@@ -112,6 +97,13 @@ files:
112
97
  - preset/DMincho.ttf
113
98
  - preset/bordersymbols.txt
114
99
  - preset/custom_chuki_tag.txt
100
+ - preset/ncode.syosetu.com/n1839bd/converter.rb
101
+ - preset/ncode.syosetu.com/n1839bd/setting.ini
102
+ - preset/ncode.syosetu.com/n4259s/converter.rb
103
+ - preset/ncode.syosetu.com/n4259s/setting.ini
104
+ - preset/ncode.syosetu.com/n8725k/converter.rb
105
+ - preset/ncode.syosetu.com/n9669bk/converter.rb
106
+ - preset/ncode.syosetu.com/n9669bk/setting.ini
115
107
  - preset/vertical_font.css
116
108
  - preset/xhtml_nav.vm
117
109
  - template/converter.rb.erb