asciidoctor-fb2 0.6.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +10 -4
- data/.github/workflows/release.yml +16 -3
- data/.gitignore +1 -0
- data/CHANGELOG.adoc +12 -0
- data/README.adoc +3 -2
- data/asciidoctor-fb2.gemspec +6 -6
- data/lib/asciidoctor_fb2/version.rb +1 -1
- data/lib/asciidoctor_fb2.rb +31 -9
- metadata +16 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10efe77eda3ecd7ca1bc920d35dfb2b3994226ae19d8aaf2ca8850b4fea82716
|
4
|
+
data.tar.gz: 6433b48d73caf04e596cdc9948c12231198d6926967ed635285aff1d6c80f73d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 223d61079eb7e7964f56125f8f59a1829e73561a3f786741474e6450b6040e2350e661e114cbb98fca5bc43868cd44dbdbeadaf53337403e4480bb2a69ae9386
|
7
|
+
data.tar.gz: 1a656df2279204979543feb75436e4194b3293fe2f5eb9ecb77636bcccd1f408f763f0215d5fe62bcc4fe0e9ad28e462ebb5c86ff0d93ee4bc398f4d2e0800ad
|
data/.github/workflows/ci.yml
CHANGED
@@ -5,23 +5,29 @@ jobs:
|
|
5
5
|
runs-on: ubuntu-latest
|
6
6
|
steps:
|
7
7
|
- name: Checkout
|
8
|
-
uses: actions/checkout@
|
8
|
+
uses: actions/checkout@v4
|
9
9
|
- name: Set up Ruby
|
10
10
|
uses: ruby/setup-ruby@v1
|
11
11
|
with:
|
12
|
-
ruby-version: '3.
|
12
|
+
ruby-version: '3.4'
|
13
13
|
bundler-cache: true
|
14
14
|
- name: Lint
|
15
15
|
run: bundle exec rake lint
|
16
16
|
test:
|
17
17
|
strategy:
|
18
18
|
matrix:
|
19
|
-
|
19
|
+
# Test oldest and newest supported versions
|
20
|
+
ruby: ['jruby', '2.7', '3.4']
|
20
21
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
21
22
|
runs-on: ${{ matrix.os }}
|
22
23
|
steps:
|
23
24
|
- name: Checkout
|
24
|
-
uses: actions/checkout@
|
25
|
+
uses: actions/checkout@v4
|
26
|
+
- name: Set up Java
|
27
|
+
uses: actions/setup-java@v4
|
28
|
+
with:
|
29
|
+
java-version: '21'
|
30
|
+
distribution: 'adopt'
|
25
31
|
- name: Set up Ruby
|
26
32
|
uses: ruby/setup-ruby@v1
|
27
33
|
with:
|
@@ -7,13 +7,26 @@ jobs:
|
|
7
7
|
build:
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
steps:
|
10
|
-
- uses: actions/checkout@
|
10
|
+
- uses: actions/checkout@v4
|
11
11
|
- name: Set up Ruby
|
12
12
|
uses: ruby/setup-ruby@v1
|
13
13
|
with:
|
14
|
-
ruby-version: '3.
|
14
|
+
ruby-version: '3.4'
|
15
15
|
- name: Publish to RubyGems.org
|
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/.gitignore
CHANGED
data/CHANGELOG.adoc
CHANGED
@@ -7,6 +7,18 @@
|
|
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.8.0 (2025-01-20) - @slonopotamus
|
11
|
+
|
12
|
+
* Bump minimal supported Ruby version to 2.7
|
13
|
+
* Add support for Ruby 3.4
|
14
|
+
|
15
|
+
== 0.7.0 (2022-12-18) - @slonopotamus
|
16
|
+
|
17
|
+
* fix handling of image paths with path separators
|
18
|
+
* add support for image alignment. https://github.com/asciidoctor/asciidoctor-fb2/issues/16[#16]
|
19
|
+
* add support for floating images
|
20
|
+
* add naive admonition icons support. https://github.com/asciidoctor/asciidoctor-fb2/issues/18[#18]
|
21
|
+
|
10
22
|
== 0.6.0 (2022-10-30) - @slonopotamus
|
11
23
|
|
12
24
|
* 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/
|
13
|
+
image:{uri-project}/actions/workflows/ci.yml/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
|
43
|
+
[source,shell]
|
43
44
|
----
|
44
45
|
$ asciidoctor-fb2 -D output path/to/book.adoc
|
45
46
|
----
|
data/asciidoctor-fb2.gemspec
CHANGED
@@ -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.
|
13
|
+
s.required_ruby_version = '>= 2.7.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|
|
@@ -19,13 +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', '
|
22
|
+
s.add_runtime_dependency 'fb2rb', '~> 0.9.1'
|
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
|
-
s.add_development_dependency 'rspec', '~> 3.
|
28
|
-
s.add_development_dependency 'rubocop', '~> 1.
|
29
|
-
s.add_development_dependency 'rubocop-rake', '~> 0.
|
30
|
-
s.add_development_dependency 'rubocop-rspec', '~>
|
27
|
+
s.add_development_dependency 'rspec', '~> 3.13.0'
|
28
|
+
s.add_development_dependency 'rubocop', '~> 1.70.0'
|
29
|
+
s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
30
|
+
s.add_development_dependency 'rubocop-rspec', '~> 3.3'
|
31
31
|
end
|
data/lib/asciidoctor_fb2.rb
CHANGED
@@ -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
|
-
|
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.
|
343
|
-
target.
|
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 = [
|
358
|
-
|
359
|
-
|
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,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-fb2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marat Radchenko
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-20 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: asciidoctor
|
@@ -28,22 +27,16 @@ dependencies:
|
|
28
27
|
name: fb2rb
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
|
-
- - "
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.6'
|
34
|
-
- - "<"
|
30
|
+
- - "~>"
|
35
31
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
32
|
+
version: 0.9.1
|
37
33
|
type: :runtime
|
38
34
|
prerelease: false
|
39
35
|
version_requirements: !ruby/object:Gem::Requirement
|
40
36
|
requirements:
|
41
|
-
- - "
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '0.6'
|
44
|
-
- - "<"
|
37
|
+
- - "~>"
|
45
38
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
39
|
+
version: 0.9.1
|
47
40
|
- !ruby/object:Gem::Dependency
|
48
41
|
name: mime-types
|
49
42
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,57 +85,56 @@ dependencies:
|
|
92
85
|
requirements:
|
93
86
|
- - "~>"
|
94
87
|
- !ruby/object:Gem::Version
|
95
|
-
version: 3.
|
88
|
+
version: 3.13.0
|
96
89
|
type: :development
|
97
90
|
prerelease: false
|
98
91
|
version_requirements: !ruby/object:Gem::Requirement
|
99
92
|
requirements:
|
100
93
|
- - "~>"
|
101
94
|
- !ruby/object:Gem::Version
|
102
|
-
version: 3.
|
95
|
+
version: 3.13.0
|
103
96
|
- !ruby/object:Gem::Dependency
|
104
97
|
name: rubocop
|
105
98
|
requirement: !ruby/object:Gem::Requirement
|
106
99
|
requirements:
|
107
100
|
- - "~>"
|
108
101
|
- !ruby/object:Gem::Version
|
109
|
-
version: 1.
|
102
|
+
version: 1.70.0
|
110
103
|
type: :development
|
111
104
|
prerelease: false
|
112
105
|
version_requirements: !ruby/object:Gem::Requirement
|
113
106
|
requirements:
|
114
107
|
- - "~>"
|
115
108
|
- !ruby/object:Gem::Version
|
116
|
-
version: 1.
|
109
|
+
version: 1.70.0
|
117
110
|
- !ruby/object:Gem::Dependency
|
118
111
|
name: rubocop-rake
|
119
112
|
requirement: !ruby/object:Gem::Requirement
|
120
113
|
requirements:
|
121
114
|
- - "~>"
|
122
115
|
- !ruby/object:Gem::Version
|
123
|
-
version: 0.
|
116
|
+
version: 0.6.0
|
124
117
|
type: :development
|
125
118
|
prerelease: false
|
126
119
|
version_requirements: !ruby/object:Gem::Requirement
|
127
120
|
requirements:
|
128
121
|
- - "~>"
|
129
122
|
- !ruby/object:Gem::Version
|
130
|
-
version: 0.
|
123
|
+
version: 0.6.0
|
131
124
|
- !ruby/object:Gem::Dependency
|
132
125
|
name: rubocop-rspec
|
133
126
|
requirement: !ruby/object:Gem::Requirement
|
134
127
|
requirements:
|
135
128
|
- - "~>"
|
136
129
|
- !ruby/object:Gem::Version
|
137
|
-
version:
|
130
|
+
version: '3.3'
|
138
131
|
type: :development
|
139
132
|
prerelease: false
|
140
133
|
version_requirements: !ruby/object:Gem::Requirement
|
141
134
|
requirements:
|
142
135
|
- - "~>"
|
143
136
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
145
|
-
description:
|
137
|
+
version: '3.3'
|
146
138
|
email:
|
147
139
|
- marat@slonopotamus.org
|
148
140
|
executables:
|
@@ -175,7 +167,6 @@ homepage: https://github.com/asciidoctor/asciidoctor-fb2
|
|
175
167
|
licenses:
|
176
168
|
- MIT
|
177
169
|
metadata: {}
|
178
|
-
post_install_message:
|
179
170
|
rdoc_options: []
|
180
171
|
require_paths:
|
181
172
|
- lib
|
@@ -183,15 +174,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
183
174
|
requirements:
|
184
175
|
- - ">="
|
185
176
|
- !ruby/object:Gem::Version
|
186
|
-
version: 2.
|
177
|
+
version: 2.7.0
|
187
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
179
|
requirements:
|
189
180
|
- - ">="
|
190
181
|
- !ruby/object:Gem::Version
|
191
182
|
version: '0'
|
192
183
|
requirements: []
|
193
|
-
rubygems_version: 3.
|
194
|
-
signing_key:
|
184
|
+
rubygems_version: 3.6.2
|
195
185
|
specification_version: 4
|
196
186
|
summary: Converts AsciiDoc documents to FB2 e-book formats
|
197
187
|
test_files: []
|