asciidoctor-fb2 0.3.1 → 0.4.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
2
  SHA256:
3
- metadata.gz: fefb6e896cf8679642198ac1ffe5222916781f71cbb775130bf32eeb00b375b4
4
- data.tar.gz: 5100ec044994316213786b065115f6214ca4dd29c4f8655fc3a9ffc42726d258
3
+ metadata.gz: 2c92fc77a9c3146a344b615e53430b2a1c33c04688a60a6dd175df173ec5e173
4
+ data.tar.gz: 991a87e1cede4126726357252f2bb19e30380912153f1a81a511ee81873124b2
5
5
  SHA512:
6
- metadata.gz: '099b2149b1dacc1a1239725ce386afdc48ff7429a6aa7e0108af80db0c84630c176ec6adf96090f671c7a51bd1140590d920133ba4de76788e239fe490951317'
7
- data.tar.gz: 7418059f5dd43b7f77087acac3af70764e80af4dc676be995c9d421edd01dd89008b11926c36151b6832b1c137684236cad3b00a12b6798a5747d23690089c7c
6
+ metadata.gz: 7da4ab8d23af356a2d321b9894d2747cfdf9913931566ace0b3945fb43e9dda32c76b1257e6555607cc3a47940c0e6e480213e395b60f5089120f5d6c2ad9db3
7
+ data.tar.gz: 49422fe74cb1ac22574d602a572abc5d79ae66883e20758ed721e7efc579771acf8359aa3acc67d8ad45400d344c8dd6421dab9cda46f04ab25ec358e2f26a0a
@@ -6,3 +6,8 @@ updates:
6
6
  directory: "/"
7
7
  schedule:
8
8
  interval: "daily"
9
+
10
+ - package-ecosystem: "github-actions"
11
+ directory: "/"
12
+ schedule:
13
+ interval: "daily"
@@ -9,17 +9,16 @@ jobs:
9
9
  - name: Set up Ruby
10
10
  uses: ruby/setup-ruby@v1
11
11
  with:
12
- ruby-version: 2.7
13
- - name: Build
14
- run: bundle install --jobs 4 --retry 3
12
+ ruby-version: '3.0'
13
+ bundler-cache: true
15
14
  - name: Lint
16
15
  run: bundle exec rake lint
17
16
  test:
18
17
  strategy:
19
18
  matrix:
20
- ruby: [jruby, 2.4, 2.5, 2.6, 2.7]
21
- platform: [ubuntu-latest, macos-latest, windows-latest]
22
- runs-on: ${{ matrix.platform }}
19
+ ruby: ['jruby', '2.4', '2.5', '2.6', '2.7', '3.0']
20
+ os: [ubuntu-latest, macos-latest, windows-latest]
21
+ runs-on: ${{ matrix.os }}
23
22
  steps:
24
23
  - name: Checkout
25
24
  uses: actions/checkout@v2
@@ -27,7 +26,6 @@ jobs:
27
26
  uses: ruby/setup-ruby@v1
28
27
  with:
29
28
  ruby-version: ${{ matrix.ruby }}
30
- - name: Build
31
- run: bundle install --jobs 4 --retry 3
29
+ bundler-cache: true
32
30
  - name: Test
33
31
  run: bundle exec rake spec
@@ -11,14 +11,9 @@ jobs:
11
11
  - name: Set up Ruby
12
12
  uses: ruby/setup-ruby@v1
13
13
  with:
14
- ruby-version: 2.7
14
+ ruby-version: '3.0'
15
15
  - name: Publish to RubyGems.org
16
- run: |
17
- mkdir -p $HOME/.gem
18
- touch $HOME/.gem/credentials
19
- chmod 0600 $HOME/.gem/credentials
20
- printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials
21
- gem build *.gemspec
22
- gem push *.gem
23
- env:
24
- RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
16
+ uses: dawidd6/action-publish-gem@v1
17
+ with:
18
+ api_key: ${{ secrets.RUBYGEMS_API_KEY }}
19
+
data/CHANGELOG.adoc CHANGED
@@ -7,6 +7,11 @@
7
7
  This document provides a high-level view of the changes to the {project-name} by release.
8
8
  For a detailed view of what has changed, refer to the {uri-project}/commits/master[commit history] on GitHub.
9
9
 
10
+ == 0.4.0 (2021-02-14) - @slonopotamus
11
+
12
+ * fix table cells markup
13
+ * bump fb2rb to 0.6.0
14
+
10
15
  == 0.3.1 (2020-11-29) - @slonopotamus
11
16
 
12
17
  * fix crash on `+toc::[]+` macro
@@ -19,12 +19,13 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ['lib']
20
20
 
21
21
  s.add_runtime_dependency 'asciidoctor', '~> 2.0'
22
- s.add_runtime_dependency 'fb2rb', '~> 0.4.0'
22
+ s.add_runtime_dependency 'fb2rb', '~> 0.6.0'
23
23
  s.add_runtime_dependency 'mime-types', '~> 3.0'
24
24
 
25
25
  s.add_development_dependency 'asciidoctor-diagram', '~> 2.0'
26
26
  s.add_development_dependency 'rake', '~> 13.0'
27
27
  s.add_development_dependency 'rspec', '~> 3.10.0'
28
- s.add_development_dependency 'rubocop', '~> 1.4.0'
29
- s.add_development_dependency 'rubocop-rspec', '~> 2.0.0'
28
+ s.add_development_dependency 'rubocop', '~> 1.9.0'
29
+ s.add_development_dependency 'rubocop-rake', '~> 0.5.0'
30
+ s.add_development_dependency 'rubocop-rspec', '~> 2.2.0'
30
31
  end
@@ -44,30 +44,28 @@ module Asciidoctor
44
44
  end
45
45
  node.authors.each do |author|
46
46
  title_info.authors << FB2rb::Author.new(
47
- author.firstname,
48
- author.middlename,
49
- author.lastname,
50
- nil,
51
- [],
52
- author.email.nil? ? [] : [author.email]
47
+ first_name: author.firstname,
48
+ middle_name: author.middlename,
49
+ last_name: author.lastname,
50
+ emails: author.email.nil? ? [] : [author.email]
53
51
  )
54
52
  end
55
53
 
56
54
  if node.attr? 'series-name'
57
55
  series_name = node.attr 'series-name'
58
56
  series_volume = node.attr 'series-volume', 1
59
- title_info.sequences << FB2rb::Sequence.new(series_name, series_volume)
57
+ title_info.sequences << FB2rb::Sequence.new(name: series_name, number: series_volume)
60
58
  end
61
59
 
62
60
  date = node.attr('revdate') || node.attr('docdate')
63
- fb2date = FB2rb::FB2Date.new(date, Date.parse(date))
61
+ fb2date = FB2rb::FB2Date.new(display_value: date, value: Date.parse(date))
64
62
  title_info.date = document_info.date = fb2date
65
63
 
66
64
  unless (cover_image = node.attr('front-cover-image')).nil?
67
65
  cover_image = Regexp.last_match(1) if cover_image =~ IMAGE_ATTRIBUTE_VALUE_RX
68
66
  cover_image_path = node.image_uri(cover_image)
69
67
  register_binary(node, cover_image_path, 'image')
70
- title_info.coverpage = FB2rb::Coverpage.new([%(##{cover_image_path})])
68
+ title_info.coverpage = FB2rb::Coverpage.new(images: [%(##{cover_image_path})])
71
69
  end
72
70
 
73
71
  document_info.id = node.attr('uuid', '')
@@ -81,7 +79,7 @@ module Asciidoctor
81
79
  <title><p>#{node.doctitle}</p></title>
82
80
  #{node.content}
83
81
  </section>)
84
- @book.bodies << FB2rb::Body.new(nil, body)
82
+ @book.bodies << FB2rb::Body.new(content: body)
85
83
  unless node.document.footnotes.empty?
86
84
  notes = []
87
85
  node.document.footnotes.each do |footnote|
@@ -90,7 +88,7 @@ module Asciidoctor
90
88
  <p>#{footnote.text}</p>
91
89
  </section>)
92
90
  end
93
- @book.bodies << FB2rb::Body.new('notes', notes * "\n")
91
+ @book.bodies << FB2rb::Body.new(name: 'notes', content: notes * "\n")
94
92
  end
95
93
  @book
96
94
  end
@@ -382,30 +380,36 @@ module Asciidoctor
382
380
  lines * "\n"
383
381
  end
384
382
 
383
+ # @param cell [Asciidoctor::Table::Cell]
384
+ def get_cell_content(cell) # rubocop:disable Metrics/MethodLength
385
+ case cell.style
386
+ when :asciidoc
387
+ cell.content
388
+ when :emphasis
389
+ %(<emphasis>#{cell.text}</emphasis>)
390
+ when :literal
391
+ %(<code>#{cell.text}</code>)
392
+ when :monospaced
393
+ %(<code>#{cell.text}</code>)
394
+ when :strong
395
+ %(<strong>#{cell.text}</strong>)
396
+ else
397
+ cell.text
398
+ end
399
+ end
400
+
385
401
  # @param node [Asciidoctor::Table]
386
402
  def convert_table(node) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
387
403
  lines = []
388
404
  lines << %(<subtitle>#{node.captioned_title}</subtitle>) if node.title?
389
405
  lines << '<table>'
390
- node.rows.to_h.each do |tsec, rows| # rubocop:disable Metrics/BlockLength
406
+ node.rows.to_h.each do |tsec, rows|
391
407
  next if rows.empty?
392
408
 
393
409
  rows.each do |row|
394
410
  lines << '<tr>'
395
411
  row.each do |cell|
396
- cell_content = if tsec == :head
397
- cell.text
398
- else
399
- case cell.style
400
- when :asciidoc
401
- cell.content
402
- when :literal
403
- %(<p><pre>#{cell.text}</pre></p>)
404
- else
405
- (cell_content = cell.content).empty? ? '' : %(<p>#{cell_content * "</p>\n<p>"}</p>)
406
- end
407
- end
408
-
412
+ cell_content = get_cell_content(cell)
409
413
  cell_tag_name = (tsec == :head || cell.style == :header ? 'th' : 'td')
410
414
  cell_attrs = [
411
415
  %(halign="#{cell.attr 'halign'}"),
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module FB2
5
- VERSION = '0.3.1'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-fb2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marat Radchenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-29 00:00:00.000000000 Z
11
+ date: 2021-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.4.0
33
+ version: 0.6.0
34
34
  type: :runtime
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: 0.4.0
40
+ version: 0.6.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mime-types
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -100,28 +100,42 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.4.0
103
+ version: 1.9.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.4.0
110
+ version: 1.9.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.5.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.5.0
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rubocop-rspec
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - "~>"
116
130
  - !ruby/object:Gem::Version
117
- version: 2.0.0
131
+ version: 2.2.0
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: 2.0.0
138
+ version: 2.2.0
125
139
  description:
126
140
  email:
127
141
  - marat@slonopotamus.org
@@ -170,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
184
  - !ruby/object:Gem::Version
171
185
  version: '0'
172
186
  requirements: []
173
- rubygems_version: 3.1.4
187
+ rubygems_version: 3.2.3
174
188
  signing_key:
175
189
  specification_version: 4
176
190
  summary: Converts AsciiDoc documents to FB2 e-book formats