asciidoctor-pdf-linewrap-ja 0.5.0 → 0.8.0

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
- SHA1:
3
- metadata.gz: a619d460c8bd19a422ebe31801a8413642221e60
4
- data.tar.gz: 624d57daabf8e921621568c7a860381fff671f6c
2
+ SHA256:
3
+ metadata.gz: 4b04bd147272f78f22c84293142a431b424ae3b6594b123c091b679c057be248
4
+ data.tar.gz: '08160ea233cddfd75ddc7d79f9fd4cb1c30d34cd20375ef2a65f20372a563b64'
5
5
  SHA512:
6
- metadata.gz: 3bd6a9a827ed4f00bf46c43cdbdba8794aa4f99e0b4da46333d634a2717bd55e8dec4d2ce7354ce154a6fb9b470772e9dbff4d5611306297dba61201b910cd20
7
- data.tar.gz: cb6ad32fcb3c0a916a2fde75d813bc1dd26e64826914a5cb5cafc014fd513b72d8818afb83b3ac80a91050c015df30c89f3824c592ed6f84ec2f41c43342679a
6
+ metadata.gz: afceaa124938ac6e65dd1c3601485d80fffc751e181fe409b267d8d7540c03cf34d2c6cfebbdc8776830a4488cbbb0d524f52a9491156f92651fc742f26250d5
7
+ data.tar.gz: 849e665eeac18586ba2fd28d2a46bfed402d80ced0b75d85b303f0f16d75ca3d4d5f4ee484d3958b5665331a5463d2e29ae7574c29ae2bff72059067a940870d
@@ -17,8 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "asciidoctor-pdf", "~> 1.5.0.alpha.16"
21
- spec.add_development_dependency "bundler", "~> 1.16"
22
- spec.add_development_dependency "rake", "~> 10.0"
20
+ spec.add_dependency "asciidoctor-pdf", "~> 1.6.0"
21
+ spec.add_development_dependency "bundler", ">= 2.2.10"
22
+ spec.add_development_dependency "rake", ">= 13.0.0"
23
23
  spec.add_development_dependency "minitest", "~> 5.0"
24
24
  end
@@ -1 +1 @@
1
- require_relative 'asciidoctor/pdf/linewrap/ja'
1
+ require_relative 'asciidoctor/pdf/linewrap/ja'
@@ -46,6 +46,13 @@ Extensions.register do
46
46
  raw_text = get_raw_text(list_item)
47
47
  list_item.text = Asciidoctor::Pdf::Linewrap::Ja::Converter::insert_zero_width_space(raw_text)
48
48
  end
49
+
50
+ admonitions = document.find_by context: :admonition
51
+ admonitions.each do |admonition|
52
+ admonition.lines.each_with_index do |line, i|
53
+ admonition.lines[i] = Asciidoctor::Pdf::Linewrap::Ja::Converter::insert_zero_width_space(line)
54
+ end
55
+ end
49
56
  end
50
57
 
51
58
  def get_raw_text(item)
@@ -6,29 +6,24 @@ module Asciidoctor
6
6
 
7
7
  # 行頭禁則文字
8
8
  PROHIBIT_LINE_BREAK_BEFORE =
9
- ')}〕〉》」』】〙〗〟⦆»' +
10
- 'ゝゞーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇷ゚ㇺㇻㇼㇽㇾㇿ々〻' +
11
- 'ァィゥェォッャュョ' +
12
- '‐゠〜~' +
13
- '‼⁇⁈⁉' +
14
- '?!' +
15
- '' +
16
- '、。'
17
-
18
- # 行頭禁則文字(半角)
19
- PROHIBIT_LINE_BREAK_BEFORE_HALF_WIDTH =
20
- ')]>}' +
21
- '-=~' +
22
- '?!'
9
+ '’”)〕]}〉》」』】⦆〙〗»〟' + # 終わり括弧類(cl-02)
10
+ '‐〜゠–' + # ハイフン類(cl-03)
11
+ '!?‼⁇⁈⁉' + # 区切り約物(cl-04)
12
+ '・:;' + # 中点類(cl-05)
13
+ '。.' + # 句点類(cl-06)
14
+ '、,' + # 読点類(cl-07)
15
+ 'ヽヾゝゞ々〻' + # 繰返し記号(cl-09)
16
+ '' + # 長音記号(cl-10)
17
+ 'ぁぃぅぇぉァィゥェォっゃゅょゎゕゖッャュョヮヵヶㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿㇷ゚' + # 小書きの仮名(cl-11)
18
+ ')〕]' # 割注終わり括弧類(cl-29)
23
19
 
24
20
  # 行末禁則文字
25
- PROHIBIT_LINE_BREAK_AFTER = '({〔〈《「『【〘〖〝⦅«'
26
-
27
- # 行末禁則文字(半角)
28
- PROHIBIT_LINE_BREAK_AFTER_HALF_WIDTH = '([<{'
21
+ PROHIBIT_LINE_BREAK_AFTER =
22
+ '‘“(〔[{〈《「『【⦅〘〖«〝' + # 始め括弧類(cl-01)
23
+ '(〔[' # 割注始め括弧類(cl-28)
29
24
 
30
25
  # 分離禁止文字
31
- PROHIBIT_DIVIDE = '…‥〳〴〵'
26
+ PROHIBIT_DIVIDE = '—…‥〳〴〵' # 分離禁止文字(cl-08)
32
27
 
33
28
  # ゼロ幅スペース
34
29
  ZERO_WIDTH_SPACE = '{zwsp}'
@@ -51,7 +46,9 @@ module Asciidoctor
51
46
 
52
47
  def self.insert_zero_width_space?(ch, next_ch)
53
48
 
54
- if japanese_char?(ch)
49
+ if ch == '\\'
50
+ return false
51
+ elsif japanese_char?(ch)
55
52
  return !prohibit_line_break?(ch, next_ch)
56
53
  elsif next_ch != nil && japanese_char?(next_ch)
57
54
  return !prohibit_line_break_before?(next_ch)
@@ -61,9 +58,13 @@ module Asciidoctor
61
58
  end
62
59
 
63
60
  def self.remove_zero_width_space(line)
64
- line.gsub(/http.*?[\]\s]/) do |href|
61
+ line = line.gsub(/http.*?[\]\s]/) do |href|
65
62
  href.gsub(/#{ZERO_WIDTH_SPACE}/, "")
66
63
  end
64
+
65
+ line.gsub(/image:.*?\]/) do |image|
66
+ image.gsub(/#{ZERO_WIDTH_SPACE}/, "")
67
+ end
67
68
  end
68
69
 
69
70
  def self.japanese_char?(ch)
@@ -78,11 +79,11 @@ module Asciidoctor
78
79
  end
79
80
 
80
81
  def self.prohibit_line_break_after?(ch)
81
- PROHIBIT_LINE_BREAK_AFTER.include?(ch) || PROHIBIT_LINE_BREAK_AFTER_HALF_WIDTH.include?(ch)
82
+ PROHIBIT_LINE_BREAK_AFTER.include?(ch)
82
83
  end
83
84
 
84
85
  def self.prohibit_line_break_before?(ch)
85
- ch == nil || PROHIBIT_LINE_BREAK_BEFORE.include?(ch) || PROHIBIT_LINE_BREAK_BEFORE_HALF_WIDTH.include?(ch)
86
+ ch == nil || PROHIBIT_LINE_BREAK_BEFORE.include?(ch)
86
87
  end
87
88
 
88
89
  def self.prohibit_divide?(ch, next_ch)
@@ -2,7 +2,7 @@ module Asciidoctor
2
2
  module Pdf
3
3
  module Linewrap
4
4
  module Ja
5
- VERSION = "0.5.0"
5
+ VERSION = "0.8.0"
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-pdf-linewrap-ja
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - y.fukazawa
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-21 00:00:00.000000000 Z
11
+ date: 2021-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor-pdf
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.5.0.alpha.16
19
+ version: 1.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.5.0.alpha.16
26
+ version: 1.6.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.16'
33
+ version: 2.2.10
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.16'
40
+ version: 2.2.10
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: 13.0.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: 13.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '5.0'
69
- description:
69
+ description:
70
70
  email:
71
71
  - fuka@backport.net
72
72
  executables: []
@@ -90,7 +90,7 @@ homepage: https://github.com/fuka/asciidoctor-pdf-linewrap-ja
90
90
  licenses:
91
91
  - MIT
92
92
  metadata: {}
93
- post_install_message:
93
+ post_install_message:
94
94
  rdoc_options: []
95
95
  require_paths:
96
96
  - lib
@@ -105,9 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  requirements: []
108
- rubyforge_project:
109
- rubygems_version: 2.5.2.2
110
- signing_key:
108
+ rubygems_version: 3.2.22
109
+ signing_key:
111
110
  specification_version: 4
112
111
  summary: Asciidoctor PDF extension providing better line wrap for Japanese document.
113
112
  test_files: []