asciidoctor-fb2 0.6.0 → 0.7.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: b4d14683d6ca5653b835701b7e011b3bc7660755cbd1be151f1d422d8579b809
4
- data.tar.gz: 7ef57fe7e10a895f66d46e860c28ba04c895b7fa275ce08790aed2247106c0c1
3
+ metadata.gz: c86e38af133de5a0b984e4ba98639333a483284a205f7fd118334248e48adfd5
4
+ data.tar.gz: 6192121701d79223d0c44cb032c87b8be375b0177ce540394a1ef81ddc4a87e5
5
5
  SHA512:
6
- metadata.gz: 609c8f2167f11b4d5186db98081739ceec1ed6ab76078a2a453e85ec6f04c0089b51049aa8690c6aeb4888b5314cfb559a2560dccfc04c54f2931253dafae48a
7
- data.tar.gz: 167f9296722e1c510e441d3e3243c0074c487fdcd08b83400738f5b6899ffcb450c9b17c423cddf37e53ee75044983d72deec437ad9864f333db6d5b4e6575cb
6
+ metadata.gz: 10f7f74ccaf1289f9a6cccfcf6c10938949bd959b22af0fd53a0a60b52a80f010dc0bb9b4bbbb6b3256a1a2f320f78f273e10d0a5339e47f6ddf397e2b726a88
7
+ data.tar.gz: 500756c54b05993d00fa197079a59f19a11824121bfcfae61a1e1fea64b9ba2b7603717a53c6e4bfafefe44300779d264d7a73046a0909414991e369e26899f6
@@ -16,7 +16,8 @@ jobs:
16
16
  test:
17
17
  strategy:
18
18
  matrix:
19
- ruby: ['jruby', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1']
19
+ # Test oldest and newest supported versions
20
+ ruby: ['jruby-9.2', 'jruby-9.4', '2.5', '3.1']
20
21
  os: [ubuntu-latest, macos-latest, windows-latest]
21
22
  runs-on: ${{ matrix.os }}
22
23
  steps:
@@ -16,4 +16,17 @@ jobs:
16
16
  uses: dawidd6/action-publish-gem@v1
17
17
  with:
18
18
  api_key: ${{ secrets.RUBYGEMS_API_KEY }}
19
-
19
+ - name: Set release version
20
+ run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
21
+ - name: Announcement
22
+ uses: zulip/github-actions-zulip/send-message@v1
23
+ with:
24
+ email: ${{ secrets.ZULIP_USERNAME }}
25
+ api-key: ${{ secrets.ZULIP_API_KEY }}
26
+ organization-url: 'https://asciidoctor.zulipchat.com'
27
+ to: '279652'
28
+ type: 'stream'
29
+ topic: 'releases'
30
+ content: |
31
+ Asciidoctor-FB2 ${{ env.RELEASE_VERSION }} is out!
32
+ https://github.com/asciidoctor/asciidoctor-fb2/releases/tag/${{ env.RELEASE_VERSION }}
data/CHANGELOG.adoc CHANGED
@@ -7,6 +7,13 @@
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.7.0 (2022-12-18) - @slonopotamus
11
+
12
+ * fix handling of image paths with path separators
13
+ * add support for image alignment. https://github.com/asciidoctor/asciidoctor-fb2/issues/16[#16]
14
+ * add support for floating images
15
+ * add naive admonition icons support. https://github.com/asciidoctor/asciidoctor-fb2/issues/18[#18]
16
+
10
17
  == 0.6.0 (2022-10-30) - @slonopotamus
11
18
 
12
19
  * bump fb2rb to 0.7.0
data/README.adoc CHANGED
@@ -3,13 +3,14 @@ Marat Radchenko <marat@slonopotamus.org>
3
3
  :project-name: Asciidoctor FB2
4
4
  :project-handle: asciidoctor-fb2
5
5
  :slug: asciidoctor/{project-handle}
6
+ :source-highlighter: rouge
6
7
  :uri-project: https://github.com/{slug}
7
8
  :uri-ci: {uri-project}/actions?query=branch%3Amaster
8
9
  :uri-gem: https://rubygems.org/gems/{project-handle}
9
10
 
10
11
  image:https://img.shields.io/badge/zulip-join_chat-brightgreen.svg[project chat,link=https://asciidoctor.zulipchat.com/]
11
12
  image:https://img.shields.io/gem/v/{project-handle}.svg[Latest Release,link={uri-gem}]
12
- image:{uri-project}/workflows/CI/badge.svg?branch=master[Build Status,link={uri-ci}]
13
+ image:{uri-project}/workflows/CI/badge.svg?branch=main[Build Status,link={uri-ci}]
13
14
 
14
15
  {project-name} is an Asciidoctor extension for converting AsciiDoc documents directly to the FB2 e-book format.
15
16
 
@@ -39,7 +40,7 @@ This command should be available on your PATH if you installed the `{project-han
39
40
  Otherwise, you can find the command in the [path]_bin_ folder of the project.
40
41
  We also recommend specifying an output directory using the `-D` option flag.
41
42
 
42
- [source,shell script]
43
+ [source,shell]
43
44
  ----
44
45
  $ asciidoctor-fb2 -D output path/to/book.adoc
45
46
  ----
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.summary = 'Converts AsciiDoc documents to FB2 e-book formats'
11
11
  s.homepage = 'https://github.com/asciidoctor/asciidoctor-fb2'
12
12
  s.license = 'MIT'
13
- s.required_ruby_version = '>= 2.4.0'
13
+ s.required_ruby_version = '>= 2.5.0'
14
14
 
15
15
  s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^spec/}) }
16
16
  s.executables = `git ls-files -- bin/*`.split("\n").map do |f|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
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.12.0'
28
- s.add_development_dependency 'rubocop', '~> 1.12.0'
29
- s.add_development_dependency 'rubocop-rake', '~> 0.5.0'
30
- s.add_development_dependency 'rubocop-rspec', '~> 2.2.0'
28
+ s.add_development_dependency 'rubocop', '~> 1.28.2'
29
+ s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
30
+ s.add_development_dependency 'rubocop-rspec', '~> 2.10.0'
31
31
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module FB2
5
- VERSION = '0.6.0'
5
+ VERSION = '0.7.0'
6
6
  end
7
7
  end
@@ -282,7 +282,7 @@ module Asciidoctor
282
282
  # @param node [Asciidoctor::Inline]
283
283
  def convert_inline_image(node)
284
284
  image_attrs = register_binary(node, node.image_uri(node.target), 'image')
285
- %(<image #{image_attrs * ' '}/>)
285
+ %(<image #{image_attrs.sort! * ' '}/>)
286
286
  end
287
287
 
288
288
  # @param node [Asciidoctor::Inline]
@@ -301,11 +301,18 @@ module Asciidoctor
301
301
  end
302
302
 
303
303
  # @param node [Asciidoctor::Block]
304
- def convert_image(node)
304
+ def convert_image(node) # rubocop:disable Metrics/AbcSize
305
305
  image_attrs = register_binary(node, node.image_uri(node.attr('target')), 'image')
306
306
  image_attrs << %(title="#{node.captioned_title}") if node.title?
307
307
  image_attrs << %(id="#{node.id}") if node.id
308
- %(<p><image #{image_attrs * ' '}/></p>)
308
+
309
+ p_style = []
310
+ p_style << %(float: #{node.attr 'float'}) if node.attr? 'float'
311
+ p_style << %(text-align: #{node.attr 'align'}) if node.attr? 'align'
312
+
313
+ p_attrs = []
314
+ p_attrs << %(style="#{p_style.sort! * '; '}") unless p_style.empty?
315
+ %(<p #{p_attrs.sort! * ' '}><image #{image_attrs.sort! * ' '}/></p>)
309
316
  end
310
317
 
311
318
  # @param node [Asciidoctor::Block]
@@ -339,8 +346,8 @@ module Asciidoctor
339
346
 
340
347
  if File.readable?(fs_path)
341
348
  # Calibre fails to load images if they contain path separators
342
- target.sub!('/', '_')
343
- target.sub!('\\', '_')
349
+ target.gsub!('/', '_')
350
+ target.gsub!('\\', '_')
344
351
 
345
352
  mime_type = determine_mime_type(target, media_type)
346
353
  @book.add_binary(target, fs_path, mime_type)
@@ -352,11 +359,26 @@ module Asciidoctor
352
359
  image_attrs << %(alt="#{node.attr('alt')}") if node.attr? 'alt'
353
360
  end
354
361
 
362
+ ADMONITION_ICONS = {
363
+ 'caution' => 'đŸ”Ĩ',
364
+ 'important' => '❗',
365
+ 'note' => 'ℹī¸',
366
+ 'tip' => '💡',
367
+ 'warning' => '⚠ī¸'
368
+ }.freeze
369
+
355
370
  # @param node [Asciidoctor::Block]
356
371
  def convert_admonition(node)
357
- lines = [%(<p><strong>#{node.title || node.caption}:</strong>
358
- #{node.content}
359
- </p>)]
372
+ lines = ['<p>']
373
+
374
+ lines << if node.document.attr?('icons', 'font') && (icon = ADMONITION_ICONS[node.attr 'name'])
375
+ %(#{icon} )
376
+ else
377
+ %(<strong>#{node.title || node.caption}:</strong>)
378
+ end
379
+
380
+ lines << node.content
381
+ lines << '</p>'
360
382
  lines << '<empty-line/>' unless node.has_role?('last')
361
383
  lines * "\n"
362
384
  end
@@ -465,7 +487,7 @@ module Asciidoctor
465
487
  ]
466
488
  cell_attrs << %(colspan="#{cell.colspan}") if cell.colspan
467
489
  cell_attrs << %(rowspan="#{cell.rowspan}") if cell.rowspan
468
- lines << %(<#{cell_tag_name} #{cell_attrs * ' '}>#{cell_content}</#{cell_tag_name}>)
490
+ lines << %(<#{cell_tag_name} #{cell_attrs.sort! * ' '}>#{cell_content}</#{cell_tag_name}>)
469
491
  end
470
492
  lines << '</tr>'
471
493
  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.6.0
4
+ version: 0.7.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: 2022-10-30 00:00:00.000000000 Z
11
+ date: 2022-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -106,42 +106,42 @@ dependencies:
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: 1.12.0
109
+ version: 1.28.2
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: 1.12.0
116
+ version: 1.28.2
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: rubocop-rake
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: 0.5.0
123
+ version: 0.6.0
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: 0.5.0
130
+ version: 0.6.0
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: rubocop-rspec
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: 2.2.0
137
+ version: 2.10.0
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: 2.2.0
144
+ version: 2.10.0
145
145
  description:
146
146
  email:
147
147
  - marat@slonopotamus.org
@@ -183,14 +183,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - ">="
185
185
  - !ruby/object:Gem::Version
186
- version: 2.4.0
186
+ version: 2.5.0
187
187
  required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  requirements:
189
189
  - - ">="
190
190
  - !ruby/object:Gem::Version
191
191
  version: '0'
192
192
  requirements: []
193
- rubygems_version: 3.3.7
193
+ rubygems_version: 3.3.26
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: Converts AsciiDoc documents to FB2 e-book formats