narou 1.1.0.rc1 → 1.1.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

data/lib/loadconverter.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  require_relative "converterbase"
7
7
  require_relative "helper"
8
8
 
9
- class Converter < ConverterBase; end # deprecated
9
+ BlankConverter = Class.new(ConverterBase) {}
10
10
 
11
11
  $converter_container = {}
12
12
 
@@ -66,24 +66,14 @@ def load_converter(title, archive_path)
66
66
  require converter_path
67
67
  end
68
68
  else
69
- return Class.new(ConverterBase) {}
69
+ return BlankConverter
70
70
  end
71
71
  conv = $converter_container[title]
72
72
  if conv
73
73
  return conv
74
74
  else
75
- # deprecated
76
- warn "[DEPRECATED] converter.rb の書式が古いので新しい書式に書き換えました"
77
- renewal_deprecated_converter(title, converter_path)
78
- return Class.new(Converter) {}
75
+ warn "converter.rbは見つかりましたが、`converter'で登録されていないようです。" +
76
+ "変換処理は converter \"#{title}\" として登録する必要があります"
77
+ return BlankConverter
79
78
  end
80
79
  end
81
-
82
- # 書式の古い converter.rb を書き換える
83
- def renewal_deprecated_converter(title, converter_path)
84
- src = open(converter_path, "r:BOM|UTF-8") { |fp| fp.read }
85
- src.gsub!("class Converter < ConverterBase", %!converter "#{title}" do!)
86
- src.gsub!("def before_convert", "def before")
87
- src.gsub!("def after_convert", "def after")
88
- File.write(converter_path, src)
89
- end
@@ -96,8 +96,14 @@ class NovelConverter
96
96
  end
97
97
 
98
98
  ext_option = ""
99
- if device && device.kobo?
100
- ext_option = "-ext " + device.ebook_file_ext
99
+ device_option = ""
100
+ if device
101
+ case device.name
102
+ when "Kobo"
103
+ ext_option = "-ext " + device.ebook_file_ext
104
+ when "Kindle"
105
+ device_option = "-device kindle"
106
+ end
101
107
  end
102
108
 
103
109
  pwd = Dir.pwd
@@ -111,7 +117,7 @@ class NovelConverter
111
117
  aozoraepub3_dir = File.dirname(aozoraepub3_path)
112
118
 
113
119
  Dir.chdir(aozoraepub3_dir)
114
- command = %!java -cp #{aozoraepub3_basename} AozoraEpub3 -enc UTF-8 -of DUMMY ! +
120
+ command = %!java -cp #{aozoraepub3_basename} AozoraEpub3 -enc UTF-8 -of #{device_option} ! +
115
121
  %!#{cover_option} #{dst_option} #{ext_option} "#{abs_srcpath}"!
116
122
  if Helper.os_windows?
117
123
  command = "cmd /c " + command.encode(Encoding::Windows_31J)
@@ -247,7 +253,8 @@ class NovelConverter
247
253
  # 変換処理メイン
248
254
  #
249
255
  def convert_main(text = nil)
250
- puts "ID:#{@novel_id} #{@novel_title} の変換を開始"
256
+ print "ID:#{@novel_id} " if @novel_id
257
+ puts "#{@novel_title} の変換を開始"
251
258
  sections = []
252
259
  @cover_chuki = create_cover_chuki
253
260
 
data/lib/novelsetting.rb CHANGED
@@ -27,7 +27,7 @@ class NovelSetting
27
27
  end
28
28
 
29
29
  def initialize(archive_path)
30
- @archive_path = archive_path
30
+ @archive_path = File.expand_path(archive_path)
31
31
  load_settings
32
32
  set_attribute
33
33
  load_replace_pattern
@@ -124,7 +124,7 @@ class NovelSetting
124
124
  {
125
125
  name: "kanji_num_with_units_lower_digit_zero",
126
126
  value: 2,
127
- help: "〇(ゼロ)が最低この数字以上付いてないと千・万をつける対象にしない"
127
+ help: "〇(ゼロ)が最低この数字以上付いてないと千・万などをつける対象にしない"
128
128
  },
129
129
  {
130
130
  name: "enable_alphabet_force_zenkaku",
@@ -132,9 +132,9 @@ class NovelSetting
132
132
  help: "アルファベットを強制的に全角にする。falseの場合英文は半角、それ以外は全角になる"
133
133
  },
134
134
  {
135
- name: "enable_hanji_sage",
135
+ name: "enable_half_indent_bracket",
136
136
  value: true,
137
- help: "鍵カッコ等の半字下げを有効に(kindle paperwhite向け設定)"
137
+ help: "行頭鍵カッコに二分アキを挿入する"
138
138
  },
139
139
  {
140
140
  name: "enable_auto_indent",
data/lib/sitesetting.rb CHANGED
@@ -53,6 +53,9 @@ class SiteSetting
53
53
 
54
54
  def replace_group_values(key, option_values = {})
55
55
  dest = option_values[key] || @match_values[key] || @yaml_setting[key]
56
+ if dest.kind_of?(TrueClass) || dest.kind_of?(FalseClass)
57
+ return dest
58
+ end
56
59
  return nil unless dest
57
60
  values = @yaml_setting.merge(@match_values).merge(option_values)
58
61
  result = dest.dup
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.0.rc1"
6
+ Version = "1.1.0.rc2"
7
7
 
8
8
  cv_path = File.expand_path(File.join(File.dirname(__FILE__), "../commitversion"))
9
9
  if File.exists?(cv_path)
@@ -1,7 +1,7 @@
1
1
  ### Narou.rb embedded custom chuki ###
2
2
 
3
3
  ####カスタム注記
4
- 半字下げ <div class="custom_hanji"> </div> 1
4
+ 二分アキ <div class="half_em_space"> </div> 1
5
5
  一字下げ <div class="pt1"> </div> 1
6
6
  二字下げ <div class="pt2"> </div> 1
7
7
  三字下げ <div class="pt3"> </div> 1
@@ -13,10 +13,5 @@
13
13
  ここで後書き終わり </div><div class="clear"></div> 1
14
14
  濁点 <span class="dakuten">
15
15
  濁点終わり </span>
16
- リンク開始 <a href="
17
- リンクアドレスここまで ">
18
- リンク終了 </a>
19
- ここからキンドル左右中央 <div class="kindle_outer"><div class="kindle_inner"> 1
20
- ここでキンドル左右中央終わり </div></div> 1
21
16
 
22
17
  ### Narou.rb embedded custom chuki ###
@@ -13,6 +13,8 @@ body {
13
13
  .b { font-weight: bold; }
14
14
  .i { font-style: italic; }
15
15
 
16
+ rt { font-size: 0.6em; }
17
+
16
18
  /* カスタム注記用 */
17
19
 
18
20
  /* 濁点フォント */
@@ -25,8 +27,8 @@ body {
25
27
  font-family: "DakutenAokinMincho" !important;
26
28
  }
27
29
 
28
- /* 半字下げ */
29
- .custom_hanji { text-indent: 0.5em; }
30
+ /* 二分アキ */
31
+ .half_em_space { text-indent: 0.5em; }
30
32
 
31
33
  /* パラメーター(折り返しあり) */
32
34
  .custom_parameter_block {
@@ -0,0 +1,109 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html>
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2011/epub" lang="ja" xml:lang="ja">
4
+ <head>
5
+ <title>${title}</title>
6
+ <style type="text/css">
7
+ .hidden { display: none; }
8
+ #if (${bookInfo.TocVertical})
9
+ @page {margin:.5em .5em 0 0;}
10
+ html {
11
+ writing-mode: vertical-rl;
12
+ -webkit-writing-mode: vertical-rl;
13
+ -epub-writing-mode: vertical-rl;
14
+ }
15
+ h1 {font-size:1.5em; padding-top:1em;}
16
+ li {list-style:disc; list-style-type: none; padding:0 .25em 0 0; line-height:1.75em;}
17
+ li a {text-decoration:none; border-right-width:1px; border-right-style:solid; padding-right: 1px;}
18
+ .tcy span {
19
+ width: 1em;
20
+ text-combine: horizontal;
21
+ -webkit-text-combine: horizontal;
22
+ -epub-text-combine: horizontal;
23
+ }
24
+ #else
25
+ @page {margin:.5em 0 0 .5em;}
26
+ html {
27
+ writing-mode:horizontal-tb;
28
+ -webkit-writing-mode:horizontal-tb;
29
+ -epub-writing-mode:horizontal-tb;
30
+ }
31
+ h1 {font-size:1.5em; text-align:center;}
32
+ li {padding:.25em 0 0 0; list-style:disc; list-style-type: none; line-height:1.75em;}
33
+ li a {text-decoration:none; border-bottom-width:1px; border-bottom-style:solid; padding-right: 1px;}
34
+ #end
35
+ </style>
36
+ </head>
37
+
38
+ <body>
39
+ ## epub3 landmarks nav ==========================
40
+ <nav epub:type="landmarks" id="landmarks" hidden="" class="hidden">
41
+ <ol>
42
+ #if (${bookInfo.InsertCoverPage})
43
+ <li><a epub:type="cover" href="cover.xhtml">表紙</a></li>
44
+ #end
45
+ #if (${bookInfo.InsertTocPage})
46
+ <li><a epub:type="toc" href="nav.xhtml">目次</a></li>
47
+ #end
48
+ #foreach (${chapter} in ${chapters})
49
+ #if (${chapter.SectionId} == "title")
50
+ <li><a epub:type="title-page" href="title.xhtml">扉</a></li>
51
+ #else
52
+ <li><a epub:type="bodymatter" href="${chapter.SectionId}.xhtml">本文</a></li>
53
+ #break
54
+ #end
55
+ #end
56
+ </ol>
57
+ </nav>
58
+ ## epub3 toc nav ================================
59
+ <nav epub:type="toc" id="toc">
60
+ <h1>目 次</h1>
61
+ <ol>
62
+ #if (${bookInfo.InsertCoverPage} && ${bookInfo.InsertCoverPageToc})
63
+ <li class="chapter" id="toccover"><a href="cover.xhtml">${cover_name}</a></li>
64
+ #end
65
+ #set ($idx=0)
66
+ #set ($nest_level=0)
67
+ #foreach(${chapter} in ${chapters})
68
+ #if ($chapter.ChapterName)
69
+ #set ($idx=$idx+1)
70
+ #if ($chapter.ChapterId)
71
+ #set ($chapter_anchor="#"+$chapter.ChapterId)
72
+ #else
73
+ #set ($chapter_anchor="")
74
+ #end
75
+ ## enable nested toc ------------------------
76
+ #if (${navNest})
77
+ #if (${idx} > 1)
78
+ #if (${chapter.ChapterLevel} > ${nest_level})
79
+ <ol>
80
+ #elseif (${chapter.ChapterLevel} == ${nest_level})
81
+ </li>
82
+ #elseif (${chapter.ChapterLevel} < ${nest_level})
83
+ #set ($loop_count=$nest_level - $chapter.ChapterLevel - 1)
84
+ #foreach (${i} in [0..${loop_count}])
85
+ </li>
86
+ </ol>
87
+ #end
88
+ </li>
89
+ #end
90
+ #end
91
+ <li class="chapter" id="toc${idx}"><a href="${chapter.SectionId}.xhtml$!{chapter_anchor}">${chapter.ChapterName}</a>
92
+ #set ($nest_level=$chapter.ChapterLevel)
93
+ ## disable nested toc -----------------------
94
+ #else
95
+ <li class="chapter" id="toc${idx}"><a href="${chapter.SectionId}.xhtml$!{chapter_anchor}">${chapter.ChapterName}</a></li>
96
+ #end
97
+ #end
98
+ #end
99
+ #if (${navNest})
100
+ #foreach (${end} in [${nest_level}..0])
101
+ </li>
102
+ </ol>
103
+ #end
104
+ #else
105
+ </ol>
106
+ #end
107
+ </nav>
108
+ </body>
109
+ </html>
@@ -6,24 +6,18 @@
6
6
  [#区切り線]
7
7
  <%= toc["story"] %>
8
8
 
9
- 掲載ページ: [#リンク開始]<%= toc["toc_url"] %>[#リンクアドレスここまで]<%= toc["toc_url"] %>[#リンク終了]
9
+ 掲載ページ: <a href="<%= toc["toc_url"] %>"><%= toc["toc_url"] %></a>
10
10
  [#区切り線]
11
11
 
12
12
  <% sections.each_with_index do |section, i| -%>
13
13
  [#改ページ]
14
14
  <% if section["chapter"] != "" -%>
15
15
  [#ページの左右中央]
16
- <% if device && device.name == "Kindle" -%>
17
- [#ここからキンドル左右中央]
18
- <% end -%>
19
16
  <%= toc["title"] %>
20
17
 
21
18
  [#ここから大見出し]<%= section["chapter"] %>[#ここで大見出し終わり]
22
19
   
23
20
   
24
- <% if device && device.name == "Kindle" -%>
25
- [#ここでキンドル左右中央終わり]
26
- <% end -%>
27
21
  [#改ページ]
28
22
  <% end -%>
29
23
  [#3字下げ][#ここから中見出し]<%= section["subtitle"].rstrip %>[#ここで中見出し終わり]
@@ -4,6 +4,7 @@ name: 小説家になろう
4
4
  domain: http://ncode.syosetu.com
5
5
  url: \\k<domain>/(?<ncode>n\d+[a-z]+)
6
6
  encoding: UTF-8
7
+ confirm_over18: no
7
8
 
8
9
  # ------------------------------------------------------------
9
10
  # 書籍情報取得設定
@@ -4,6 +4,7 @@ name: ノクターン・ムーンライト
4
4
  domain: http://novel18.syosetu.com
5
5
  url: \\k<domain>/(?<ncode>n\d+[a-z]+)
6
6
  encoding: UTF-8
7
+ confirm_over18: yes
7
8
 
8
9
  # ------------------------------------------------------------
9
10
  # 書籍情報取得設定
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.0.rc1
4
+ version: 1.1.0.rc2
5
5
  prerelease: 6
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-02 00:00:00.000000000 Z
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: 小説家になろうで公開されている小説の管理、及び電子書籍データへの変換を支援します。縦書用に特化されており、横書き用に特化されたWEB小説を違和感なく縦書で読むことが出来るようになります。
15
15
  email:
@@ -21,7 +21,7 @@ extra_rdoc_files: []
21
21
  files:
22
22
  - .gitattributes
23
23
  - .gitignore
24
- - ChangeLog.txt
24
+ - ChangeLog.md
25
25
  - Gemfile
26
26
  - README.md
27
27
  - Rakefile
@@ -78,6 +78,7 @@ files:
78
78
  - preset/bordersymbols.txt
79
79
  - preset/custom_chuki_tag.txt
80
80
  - preset/vertical_font.css
81
+ - preset/xhtml_nav.vm
81
82
  - template/converter.rb.erb
82
83
  - template/diff.txt.erb
83
84
  - template/novel.txt.erb
data/ChangeLog.txt DELETED
@@ -1,12 +0,0 @@
1
- 
2
- 更新履歴 - ChangeLog
3
- --------------------
4
-
5
- 1.0.2 : 2013/02/24
6
- - フォントのライセンスについて明確に記載した
7
-
8
- 1.0.1 : 2013/02/24
9
- - folder コマンドが正常に機能していないバグを修正
10
-
11
- 1.0.0 : 2013/02/24
12
- - first release