aozoragen 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6042ea1938f9c2996981207f4079e1237a941d65
4
- data.tar.gz: 637c7e62bf26d3dc03e418bce8aff17e271d1f75
3
+ metadata.gz: 728ce3bb7e29455d9964d2cc3445c116d82a6692
4
+ data.tar.gz: f746800df12be4f7ea5112ec22d8fd60ba3639df
5
5
  SHA512:
6
- metadata.gz: 635ca0bbf3080197795a629a18a7bb01937afee516acc3041321b7a1f439f675f13b3d7ffee335fa49dfe432b96f622551bc71975ec623a3add0111ff171ed6b
7
- data.tar.gz: c12c40b115e4c0173c474ca1a6bb02e36a1b314e442aabf7b22d8aab9dfd0f62a29214cc46a3ef18ce95c116735a5109e8640eac23887608da42cf9cb5b162b5
6
+ metadata.gz: 28261bd866b7c4b13014ec9321c3cf32c219f4ee5739400239cdaa2ec5340659d95445f83120a2ac8c07e908d5a95c95b01d1134e68d75b4e050dba8ecd8d5bc
7
+ data.tar.gz: 8a125587bfa5d63b951c8b047b0823cc7c0104751c9c2e719b5a1ea7b2427cac72a039637b972d3441f90736884ffbd4d07fac99ddf33f3b92ca45cf7e11609e
@@ -6,6 +6,12 @@ require 'aozoragen/util'
6
6
  require 'open-uri'
7
7
  require 'pathname'
8
8
 
9
+ class String
10
+ def fix_aozora_notation
11
+ self.gsub(/[||](.+?)『(.+?)』/){"|#$1《#$2》"}
12
+ end
13
+ end
14
+
9
15
  module Aozoragen
10
16
  class Syosetu
11
17
  include Util
@@ -26,13 +32,13 @@ module Aozoragen
26
32
  (@index_html / '.subtitle a').each do |a|
27
33
  uri = @index_uri + a.attr('href')
28
34
 
29
- chapter = Nokogiri(open(uri, 'r:utf-8', &:read).tr('《》', '〈〉'))
35
+ chapter = Nokogiri(open(uri, 'r:utf-8', &:read).tr('《》.|', '『』・|'))
30
36
  text = get_chapter_text(chapter)
31
37
  chapter_id = '%03d' % Pathname(uri.path).basename.to_s.to_i
32
38
  yield({id: chapter_id, uri: uri, text: text})
33
39
  end
34
40
  end
35
-
41
+
36
42
  def get_chapter_text(chapter)
37
43
  text = ''
38
44
  text << (chapter / '.novel_subtitle')[0].text.subhead
@@ -40,7 +46,7 @@ module Aozoragen
40
46
  text << detag(page).gsub(/\n{2,5}/, "\n").gsub(/^ *◆$/, '[#10字下げ]◆')
41
47
  text << "[#改ページ]\n"
42
48
  end
43
- text.han2zen.for_tategaki
49
+ text.han2zen.for_tategaki.fix_aozora_notation
44
50
  end
45
51
  end
46
52
  end
@@ -12,8 +12,8 @@ class String
12
12
  # Half width of Alphabet and Digit to Full width.
13
13
  #
14
14
  def han2zen
15
- self.tr( 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,/',
16
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,/' )
15
+ self.tr( 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,/?',
16
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,/?' )
17
17
  end
18
18
 
19
19
  ##
@@ -1,3 +1,3 @@
1
1
  module Aozoragen
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aozoragen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - TADA Tadashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-12 00:00:00.000000000 Z
11
+ date: 2014-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri