asciidoctor-fb2 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +6 -0
- data/asciidoctor-fb2.gemspec +1 -1
- data/data/fb2.css +3 -0
- data/lib/asciidoctor_fb2.rb +12 -2
- data/lib/asciidoctor_fb2/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10a3aff0401e84e1ad7ef6e5beb2cd823dacb368ccd5171326597eb72fadb355
|
4
|
+
data.tar.gz: 0120b9bf29fbde68b6bdea2245bc903a27404da357f419116b07ba41c35e7742
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e1d26f435621c97a0b0a62d2de350ad39fa6d4acac36bf6b5d15d330e881bd7dfd5bcf55cbeea8c4e76ac0cf996583ecf27931012427ee4e34b30f7a8f49d2b
|
7
|
+
data.tar.gz: fbd79588f67f4295829c4b0012d5178dd292167c14be8d5294fe9fe514fa20073b2afd2fea6d2db8db99a58964fc59c1e9b7a505ebe7871b153dbb97d4ec10c0
|
data/CHANGELOG.adoc
CHANGED
@@ -7,6 +7,12 @@
|
|
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.2.4 (2020-11-24) - @slonopotamus
|
11
|
+
|
12
|
+
* add support for table captions
|
13
|
+
* fix images from subfolders not loaded in Calibre
|
14
|
+
* add initial CSS support
|
15
|
+
|
10
16
|
== 0.2.3 (2020-11-24) - @slonopotamus
|
11
17
|
|
12
18
|
* add support for literal blocks
|
data/asciidoctor-fb2.gemspec
CHANGED
@@ -19,7 +19,7 @@ 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.
|
22
|
+
s.add_runtime_dependency 'fb2rb', '~> 0.4.0'
|
23
23
|
|
24
24
|
s.add_development_dependency 'asciidoctor-diagram', '~> 2.0'
|
25
25
|
s.add_development_dependency 'rake', '~> 13.0'
|
data/data/fb2.css
ADDED
data/lib/asciidoctor_fb2.rb
CHANGED
@@ -6,6 +6,8 @@ require 'fb2rb'
|
|
6
6
|
|
7
7
|
module Asciidoctor
|
8
8
|
module FB2
|
9
|
+
DATA_DIR = File.expand_path(File.join(__dir__, '..', 'data'))
|
10
|
+
|
9
11
|
# Converts AsciiDoc documents to FB2 e-book formats
|
10
12
|
class Converter < Asciidoctor::Converter::Base # rubocop:disable Metrics/ClassLength
|
11
13
|
include ::Asciidoctor::Writer
|
@@ -25,6 +27,8 @@ module Asciidoctor
|
|
25
27
|
# @param node [Asciidoctor::Document]
|
26
28
|
def convert_document(node) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
27
29
|
@book = FB2rb::Book.new
|
30
|
+
@book.add_stylesheet('text/css', File.join(DATA_DIR, 'fb2.css'))
|
31
|
+
|
28
32
|
document_info = @book.description.document_info
|
29
33
|
title_info = @book.description.title_info
|
30
34
|
|
@@ -264,7 +268,7 @@ module Asciidoctor
|
|
264
268
|
|
265
269
|
# @param node [Asciidoctor::AbstractNode]
|
266
270
|
# @param target [String]
|
267
|
-
def register_binary(node, target) # rubocop:disable Metrics/MethodLength
|
271
|
+
def register_binary(node, target) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
268
272
|
unless Asciidoctor::Helpers.uriish?(target)
|
269
273
|
out_dir = node.attr('outdir', nil, true) || doc_option(node.document, :to_dir)
|
270
274
|
fs_path = File.join(out_dir, target)
|
@@ -274,6 +278,10 @@ module Asciidoctor
|
|
274
278
|
end
|
275
279
|
|
276
280
|
if File.readable?(fs_path)
|
281
|
+
# Calibre fails to load images if they contain path separators
|
282
|
+
target.sub!('/', '_')
|
283
|
+
target.sub!('\\', '_')
|
284
|
+
|
277
285
|
@book.add_binary(target, fs_path)
|
278
286
|
target = %(##{target})
|
279
287
|
end
|
@@ -361,7 +369,9 @@ module Asciidoctor
|
|
361
369
|
|
362
370
|
# @param node [Asciidoctor::Table]
|
363
371
|
def convert_table(node) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
364
|
-
lines = [
|
372
|
+
lines = []
|
373
|
+
lines << %(<subtitle>#{node.captioned_title}</subtitle>) if node.title?
|
374
|
+
lines << '<table>'
|
365
375
|
node.rows.to_h.each do |tsec, rows| # rubocop:disable Metrics/BlockLength
|
366
376
|
next if rows.empty?
|
367
377
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-fb2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marat Radchenko
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.4.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.
|
40
|
+
version: 0.4.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: asciidoctor-diagram
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- Rakefile
|
130
130
|
- asciidoctor-fb2.gemspec
|
131
131
|
- bin/asciidoctor-fb2
|
132
|
+
- data/fb2.css
|
132
133
|
- lib/asciidoctor_fb2.rb
|
133
134
|
- lib/asciidoctor_fb2/version.rb
|
134
135
|
- tasks/bundler.rake
|