narou 3.1.11 → 3.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.

@@ -0,0 +1,121 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright 2013 whiteleaf. All rights reserved.
4
+ #
5
+
6
+ # rubocop:disable Style/ClassAndModuleChildren
7
+
8
+ module Narou::ServerHelpers
9
+ RELOAD_TIMING_DEFAULT = "every"
10
+
11
+ #
12
+ # タグをHTMLで装飾する
13
+ #
14
+ def decorate_tags(tags)
15
+ tags.sort.map do |tag|
16
+ %!<span class="tag label label-#{Command::Tag.get_color(tag)}" data-tag="#{escape_html(tag)}">#{escape_html(tag)}</span>!
17
+ end.join(" ")
18
+ end
19
+
20
+ #
21
+ # タグをHTMLで装飾する(除外タグ指定用)
22
+ #
23
+ def decorate_exclusion_tags(tags)
24
+ tags.sort.map do |tag|
25
+ %!<span class="tag label label-#{Command::Tag.get_color(tag)}" data-exclusion-tag="#{escape_html(tag)}">^tag:#{escape_html(tag)}</span>!
26
+ end.join(" ")
27
+ end
28
+
29
+ #
30
+ # Rubyバージョンを構築
31
+ #
32
+ def build_ruby_version
33
+ begin
34
+ `"#{RbConfig.ruby}" -v`.strip
35
+ rescue
36
+ config = RbConfig::CONFIG
37
+ "ruby #{RUBY_VERSION}p#{config["PATCHLEVEL"]} [#{RUBY_PLATFORM}]"
38
+ end
39
+ end
40
+
41
+ #
42
+ # 有効な novel ID だけの配列を生成する
43
+ # ID が指定されなかったか、1件も存在しない場合は nil を返す
44
+ #
45
+ def select_valid_novel_ids(ids)
46
+ return nil unless ids.kind_of?(Array)
47
+ result = ids.select do |id|
48
+ id =~ /^\d+$/
49
+ end
50
+ result.empty? ? nil : result
51
+ end
52
+
53
+ #
54
+ # フォーム情報の真偽値データを実際のデータに変換
55
+ #
56
+ def convert_on_off_to_boolean(str)
57
+ case str
58
+ when "on"
59
+ true
60
+ when "off"
61
+ false
62
+ else
63
+ nil
64
+ end
65
+ end
66
+
67
+ #
68
+ # nil true false を nil on off という文字列に変換
69
+ #
70
+ def convert_boolean_to_on_off(bool)
71
+ case bool
72
+ when TrueClass
73
+ "on"
74
+ when FalseClass
75
+ "off"
76
+ else
77
+ "nil"
78
+ end
79
+ end
80
+
81
+ #
82
+ # HTMLエスケープヘルパー
83
+ #
84
+ def h(text)
85
+ Rack::Utils.escape_html(text)
86
+ end
87
+
88
+ #
89
+ # 与えられたデータが真偽値だった場合、設定画面用に「はい」「いいえ」に変換する
90
+ # 真偽値ではなかった場合、そのまま返す
91
+ #
92
+ def value_to_msg(value)
93
+ case value
94
+ when TrueClass
95
+ "はい"
96
+ when FalseClass
97
+ "いいえ"
98
+ else
99
+ value
100
+ end
101
+ end
102
+
103
+ def notepad_text_path
104
+ File.join(Narou.local_setting_dir, "notepad.txt")
105
+ end
106
+
107
+ def query_to_boolean(value, default: false)
108
+ case value
109
+ when "1", 1, "true", true
110
+ true
111
+ when "0", 0, "false", false
112
+ false
113
+ else
114
+ default
115
+ end
116
+ end
117
+
118
+ def table_reload_timing
119
+ Inventory.load("local_setting")["webui.table.reload-timing"] || RELOAD_TIMING_DEFAULT
120
+ end
121
+ end
@@ -121,7 +121,7 @@
121
121
  %div.input-style
122
122
  %select{name: name, class: "selectpicker show-tick"}
123
123
  %option(value="")
124
- - if name == "theme"
124
+ - if name == "webui.theme"
125
125
  デフォルト
126
126
  - else
127
127
  未設定
@@ -492,6 +492,14 @@ input::-ms-clear {
492
492
  }
493
493
  }
494
494
 
495
+ .tag {
496
+ cursor: copy;
497
+ }
498
+
499
+ .tag-reset {
500
+ cursor: pointer;
501
+ }
502
+
495
503
  #tag-list-canvas {
496
504
  padding: 3px 20px;
497
505
  overflow: auto;
@@ -1139,3 +1147,7 @@ $console-color: white;
1139
1147
  color: darkseagreen;
1140
1148
  }
1141
1149
  }
1150
+
1151
+ .add-filter {
1152
+ cursor: copy;
1153
+ }
@@ -80,5 +80,6 @@ Gem::Specification.new do |gem|
80
80
  gem.add_runtime_dependency 'systemu', '~> 2.6', '>= 2.6.5'
81
81
  gem.add_runtime_dependency 'erubis', '~> 2.7'
82
82
  gem.add_runtime_dependency 'open_uri_redirections', '~> 0.2', '>= 0.2.1'
83
+ gem.add_runtime_dependency 'activesupport', '~> 5.2'
83
84
  end
84
85
 
data/narou.rb CHANGED
@@ -25,12 +25,12 @@ end
25
25
  require_relative "lib/inventory"
26
26
 
27
27
  $development = Narou.commit_version.!
28
- begin
29
- if $development
28
+ if $development
29
+ begin
30
30
  require "pry"
31
31
  require "awesome_print"
32
+ rescue LoadError
32
33
  end
33
- rescue LoadError
34
34
  end
35
35
 
36
36
  global = Inventory.load("global_setting", :global)
@@ -44,10 +44,6 @@ require_relative "lib/narou_logger"
44
44
  require_relative "lib/version"
45
45
  require_relative "lib/commandline"
46
46
 
47
- rescue_level = $debug ? Exception : StandardError
48
-
49
- class HogeError < StandardError; end
50
-
51
47
  Narou::Backtracer.capture do
52
48
  CommandLine.run(ARGV.map(&:dup))
53
49
  end
@@ -115,7 +115,3 @@ kanji_num_with_units_lower_digit_zero = 4
115
115
 
116
116
  ; HTMLの装飾系タグを削除する(主にArcadiaの作品に影響)
117
117
  ; enable_strip_decoration_tag = false
118
-
119
- ; 2倍ダッシュ(――)を画像に差し替える。Kindleのデフォルトフォントみたいにダッシュが太くて気になる人用
120
- ; enable_double_dash_to_image = true
121
-
@@ -3,7 +3,7 @@
3
3
 
4
4
  body {
5
5
  font-family: "@MS 明朝", "@MS Mincho", "ヒラギノ明朝 ProN W3", "HiraMinProN-W3", serif, sans-serif;
6
- line-height: 1.6em !important;
6
+ line-height: <%= line_height %>em !important;
7
7
  }
8
8
 
9
9
  .gtc, .b {
@@ -3,7 +3,7 @@
3
3
 
4
4
  body {
5
5
  font-family: "@MS 明朝", "@MS Mincho", "ヒラギノ明朝 ProN W3", "HiraMinProN-W3", serif, sans-serif;
6
- line-height: 1.6em !important;
6
+ line-height: <%= line_height %>em !important;
7
7
  }
8
8
 
9
9
  .gtc, .b {
@@ -22,15 +22,15 @@ story: |-
22
22
  # 目次取得設定
23
23
  toc_url: \\k<top_url>/works/\\k<ncode>
24
24
  subtitles: |-2
25
- (?:<li class="widget-toc-chapter widget-toc-level1">
25
+ (?:<li class="widget-toc-chapter widget-toc-level1 js-vertical-composition-item">
26
26
  <span>(?<chapter>.+?)</span>
27
27
  </li>
28
- )?(?:<li class="widget-toc-chapter widget-toc-level2">
28
+ )?(?:<li class="widget-toc-chapter widget-toc-level2 js-vertical-composition-item">
29
29
  <span>(?<subchapter>.+?)</span>
30
30
  </li>
31
31
  )?<li class="widget-toc-episode">
32
32
  <a href="(?<href>/works/\d+/episodes/(?<index>\d+))">
33
- <span class="widget-toc-episode-titleLabel">(?<subtitle>.+?)</span>
33
+ <span class="widget-toc-episode-titleLabel js-vertical-composition-item">(?<subtitle>.+?)</span>
34
34
  <time class="widget-toc-episode-datePublished" datetime="(?<subupdate>.+?)">.+?</time>
35
35
  </a>
36
36
  </li>
@@ -64,13 +64,13 @@ s: |-
64
64
 
65
65
  # general_firstup 初回掲載日
66
66
  gf: |-2
67
- <dt><span>公開日</span></dt>
68
- <dd><time itemprop="datePublished" datetime="(?<general_firstup>.+?)">.+?</time>
67
+ <dt><span>公開日</span></dt>
68
+ <dd><time itemprop="datePublished" datetime="(?<general_firstup>.+?)">.+?</time>
69
69
 
70
70
  # novelupdated_at 小説の更新時刻。最終掲載日で代用
71
71
  nu: |-2
72
- <dt><span>最終更新日</span></dt>
73
- <dd><time itemprop="dateModified" datetime="(?<novelupdated_at>.+?)">.+?</time>
72
+ <dt><span>最終更新日</span></dt>
73
+ <dd><time itemprop="dateModified" datetime="(?<novelupdated_at>.+?)">.+?</time>
74
74
 
75
75
  # general_lastup 最新話掲載日
76
76
  gl: null
@@ -78,3 +78,8 @@ gl: null
78
78
  # writer 作者名
79
79
  w: |-
80
80
  (?:<span class="activityName" itemprop="author">(?<writer>.+?)</span>)|(?:<span class="screenName.*?">(?<writer>.+?)</span>)
81
+
82
+ # length 文字数
83
+ l: |-2
84
+ <dt><span>総文字数</span></dt>
85
+ <dd>(?<length>.+?)文字</dd>
@@ -75,3 +75,8 @@ gl: |-
75
75
  w: |-
76
76
  <th>作者名</th>
77
77
  <td>(?:<a href=".+?">)?(?<writer>.+?)(?:</a>)?.?</td>
78
+
79
+ # length 文字数
80
+ l: |-
81
+ <th>文字数</th>
82
+ <td>(?<length>.+?)文字</td>
@@ -75,3 +75,8 @@ gl: |-
75
75
  w: |-
76
76
  <th>作者名</th>
77
77
  <td>(?:<a href=".+?">)?(?<writer>.+?)(?:</a>)?.?</td>
78
+
79
+ # length 文字数
80
+ l: |-
81
+ <th>文字数</th>
82
+ <td>(?<length>.+?)文字</td>
@@ -68,3 +68,6 @@ gl: 最新投稿</td><td>(?<general_lastup>.+?)</td>
68
68
 
69
69
  # writer 作者名
70
70
  w: 作者</td><td bgcolor=\#FFFFFF>(?:<a href=.+?>)?(?<writer>.+?)(?:</a>)?</td>
71
+
72
+ # length 文字数
73
+ l: 合計文字数</td><td>(?<length>.+?)文字
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: 3.1.11
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - whiteleaf7
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-21 00:00:00.000000000 Z
11
+ date: 2018-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: termcolorlight
@@ -278,6 +278,20 @@ dependencies:
278
278
  - - ">="
279
279
  - !ruby/object:Gem::Version
280
280
  version: 0.2.1
281
+ - !ruby/object:Gem::Dependency
282
+ name: activesupport
283
+ requirement: !ruby/object:Gem::Requirement
284
+ requirements:
285
+ - - "~>"
286
+ - !ruby/object:Gem::Version
287
+ version: '5.2'
288
+ type: :runtime
289
+ prerelease: false
290
+ version_requirements: !ruby/object:Gem::Requirement
291
+ requirements:
292
+ - - "~>"
293
+ - !ruby/object:Gem::Version
294
+ version: '5.2'
281
295
  description: 小説家になろうで公開されている小説の管理、及び電子書籍データへの変換を支援します。縦書用に特化されており、横書き用に特化されたWEB小説を違和感なく縦書で読むことが出来るようになります。
282
296
  email:
283
297
  - 2nd.leaf@gmail.com
@@ -422,6 +436,7 @@ files:
422
436
  - lib/web/public/theme/fonts/glyphicons-halflings-regular.woff
423
437
  - lib/web/public/theme/fonts/glyphicons-halflings-regular.woff2
424
438
  - lib/web/pushserver.rb
439
+ - lib/web/server_helpers.rb
425
440
  - lib/web/settingmessages.rb
426
441
  - lib/web/streaminginput.rb
427
442
  - lib/web/streaminglogger.rb
@@ -458,7 +473,6 @@ files:
458
473
  - preset/DMincho.ttf
459
474
  - preset/bordersymbols.txt
460
475
  - preset/custom_chuki_tag.txt
461
- - preset/doubledash.png
462
476
  - preset/mail_setting.yaml
463
477
  - preset/ncode.syosetu.com/n1839bd/converter.rb
464
478
  - preset/ncode.syosetu.com/n1839bd/setting.ini
@@ -478,7 +492,6 @@ files:
478
492
  - preset/ncode.syosetu.com/n9669bk/converter.rb
479
493
  - preset/ncode.syosetu.com/n9669bk/setting.ini
480
494
  - preset/ncode.syosetu.com/n9902bn/converter.rb
481
- - preset/singledash.png
482
495
  - preset/vertical_font.css
483
496
  - preset/vertical_font_with_dakuten.css
484
497
  - template/converter.rb.erb
Binary file
Binary file