asciidoctor-pdf 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +13 -0
- data/README.adoc +2 -2
- data/lib/asciidoctor/pdf/converter.rb +23 -10
- data/lib/asciidoctor/pdf/ext/prawn/extensions.rb +2 -2
- data/lib/asciidoctor/pdf/ext/prawn-gmagick.rb +18 -0
- data/lib/asciidoctor/pdf/ext/prawn-svg/calculators/document_sizing.rb +9 -0
- data/lib/asciidoctor/pdf/ext/prawn-svg.rb +1 -0
- data/lib/asciidoctor/pdf/ext/prawn.rb +4 -0
- data/lib/asciidoctor/pdf/ext.rb +1 -0
- data/lib/asciidoctor/pdf/formatted_text/text_background_and_border_renderer.rb +1 -2
- data/lib/asciidoctor/pdf/version.rb +1 -1
- data/lib/asciidoctor/pdf.rb +4 -9
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be0ccb9b1f50f98f904f500c7b2bf0118157714825e28739ab80df39ff101bf9
|
4
|
+
data.tar.gz: 1ce0fafde09b3e41ad86782397e0034bc8bd6f82d06dff01346bf055ead214d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea8d2b78a501da0ce41cc9dabf88f19fe1926262725661012c4f5f00ffc10f34e1a479ca4cf6b66a6601d4f9f2ada928fc23eb0cb422b391503955f21b072a8d
|
7
|
+
data.tar.gz: 3916e7d631167b57babd839b9f352932ca3df05022a4487195a2d8c8ee07165bdccb0127cd447d1e525f23a6bd2ef88d7710ad63075ec70c5763e5e7b8f6a237
|
data/CHANGELOG.adoc
CHANGED
@@ -5,6 +5,19 @@
|
|
5
5
|
This document provides a high-level view of the changes to the {project-name} by release.
|
6
6
|
For a detailed view of what has changed, refer to the {url-repo}/commits/main[commit history] on GitHub.
|
7
7
|
|
8
|
+
== 2.0.6 (2022-05-30) - @mojavelinux
|
9
|
+
|
10
|
+
Bug Fixes::
|
11
|
+
|
12
|
+
* indent content of collapsible block and apply bottom margin to match style of HTML output (#2219)
|
13
|
+
* patch prawn-gmagick to reread bit depth of a PNG image if it extracts the wrong value (#2216)
|
14
|
+
* interpret width of SVG correctly when width is defined in file using px units (#2215)
|
15
|
+
* don't crash if inline role defines border width but not border color
|
16
|
+
|
17
|
+
=== Details
|
18
|
+
|
19
|
+
{url-repo}/releases/tag/v2.0.6[git tag] | {url-repo}/compare/v2.0.5\...v2.0.6[full diff]
|
20
|
+
|
8
21
|
== 2.0.5 (2022-05-26) - @mojavelinux
|
9
22
|
|
10
23
|
Bug Fixes::
|
data/README.adoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Asciidoctor PDF: A native PDF converter for AsciiDoc
|
2
2
|
Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
|
3
|
-
v2.0.
|
3
|
+
v2.0.6, 2022-05-30
|
4
4
|
// Settings:
|
5
5
|
:experimental:
|
6
6
|
:idprefix:
|
@@ -24,7 +24,7 @@ endif::[]
|
|
24
24
|
:project-handle: asciidoctor-pdf
|
25
25
|
// Variables:
|
26
26
|
:release-line: 2.0.x
|
27
|
-
:release-version: 2.0.
|
27
|
+
:release-version: 2.0.6
|
28
28
|
// URLs:
|
29
29
|
:url-gem: https://rubygems.org/gems/asciidoctor-pdf
|
30
30
|
:url-project: https://github.com/asciidoctor/asciidoctor-pdf
|
@@ -6,9 +6,6 @@ require_relative 'pdfmark'
|
|
6
6
|
require_relative 'roman_numeral'
|
7
7
|
require_relative 'section_info_by_page'
|
8
8
|
|
9
|
-
autoload :StringIO, 'stringio'
|
10
|
-
autoload :Tempfile, 'tempfile'
|
11
|
-
|
12
9
|
module Asciidoctor
|
13
10
|
module PDF
|
14
11
|
class Converter < ::Prawn::Document
|
@@ -1167,8 +1164,26 @@ module Asciidoctor
|
|
1167
1164
|
alias convert_literal convert_code
|
1168
1165
|
alias convert_listing_or_literal convert_code
|
1169
1166
|
|
1167
|
+
def convert_collapsible node
|
1168
|
+
id = node.id
|
1169
|
+
title = (collapsible_marker = %(\u25bc )) + (node.title? ? node.title : 'Details')
|
1170
|
+
indent_by = theme_font(:caption) { rendered_width_of_string collapsible_marker }
|
1171
|
+
if !at_page_top? && (id || (node.option? 'unbreakable'))
|
1172
|
+
arrange_block node do
|
1173
|
+
add_dest_for_block node if id
|
1174
|
+
tare_first_page_content_stream { ink_caption title }
|
1175
|
+
indent(indent_by) { traverse node }
|
1176
|
+
end
|
1177
|
+
else
|
1178
|
+
add_dest_for_block node if id
|
1179
|
+
tare_first_page_content_stream { ink_caption title }
|
1180
|
+
indent(indent_by) { traverse node }
|
1181
|
+
end
|
1182
|
+
theme_margin :block, :bottom, (next_enclosed_block node)
|
1183
|
+
end
|
1184
|
+
|
1170
1185
|
def convert_example node
|
1171
|
-
return
|
1186
|
+
return convert_collapsible node if node.option? 'collapsible'
|
1172
1187
|
caption_bottom = @theme.example_caption_end&.to_sym == :bottom
|
1173
1188
|
arrange_block node do |extent|
|
1174
1189
|
add_dest_for_block node if node.id
|
@@ -1193,14 +1208,12 @@ module Asciidoctor
|
|
1193
1208
|
if !at_page_top? && (has_title || id || (node.option? 'unbreakable'))
|
1194
1209
|
arrange_block node do
|
1195
1210
|
add_dest_for_block node if id
|
1196
|
-
tare_first_page_content_stream
|
1197
|
-
node.context == :example ? (ink_caption %(\u25bc #{node.title})) : (ink_caption node, labeled: false)
|
1198
|
-
end if has_title
|
1211
|
+
tare_first_page_content_stream { ink_caption node, labeled: false } if has_title
|
1199
1212
|
traverse node
|
1200
1213
|
end
|
1201
1214
|
else
|
1202
1215
|
add_dest_for_block node if id
|
1203
|
-
|
1216
|
+
ink_caption node, labeled: false if has_title
|
1204
1217
|
traverse node
|
1205
1218
|
end
|
1206
1219
|
end
|
@@ -3001,7 +3014,7 @@ module Asciidoctor
|
|
3001
3014
|
end
|
3002
3015
|
end
|
3003
3016
|
end
|
3004
|
-
theme_font_cascade [
|
3017
|
+
theme_font_cascade ['caption', category_caption] do
|
3005
3018
|
if ((opts.delete :end) || (opts.delete :side) || :top) == :top
|
3006
3019
|
margin = { top: caption_margin_outside, bottom: caption_margin_inside }
|
3007
3020
|
else
|
@@ -4346,7 +4359,7 @@ module Asciidoctor
|
|
4346
4359
|
end
|
4347
4360
|
|
4348
4361
|
def theme_font_cascade categories, &block
|
4349
|
-
if ::Array === (category = (categories = categories.
|
4362
|
+
if ::Array === (category = (categories = categories.uniq).shift)
|
4350
4363
|
category, opts = category
|
4351
4364
|
else
|
4352
4365
|
opts = {}
|
@@ -257,10 +257,10 @@ module Asciidoctor
|
|
257
257
|
# Prevents at_page_top? from returning true while yielding to the specified block.
|
258
258
|
#
|
259
259
|
def conceal_page_top
|
260
|
-
margin_box.instance_variable_set :@y, (old_top = margin_box.absolute_top) + 0.0001
|
260
|
+
@margin_box.instance_variable_set :@y, (old_top = @margin_box.absolute_top) + 0.0001
|
261
261
|
yield
|
262
262
|
ensure
|
263
|
-
margin_box.instance_variable_set :@y, old_top
|
263
|
+
@margin_box.instance_variable_set :@y, old_top
|
264
264
|
end
|
265
265
|
|
266
266
|
# Returns whether the current page is the last page in the document.
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'prawn/gmagick'
|
5
|
+
rescue LoadError # rubocop:disable Lint/SuppressedException
|
6
|
+
end unless defined? GMagick::Image
|
7
|
+
|
8
|
+
Gmagick.prepend (Module.new do
|
9
|
+
def initialize image_blob
|
10
|
+
super
|
11
|
+
# apply patch for https://github.com/packetmonkey/prawn-gmagick/issues/19
|
12
|
+
if bits != 8 && (GMagick::Image.format image_blob) == 'PNG'
|
13
|
+
(io = StringIO.new image_blob).read 8
|
14
|
+
chunk_size = io.read 4
|
15
|
+
self.bits = ((io.read chunk_size.unpack1 'N').unpack 'NNC')[-1] if (io.read 4) == 'IHDR'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end) if defined? GMagick::Image
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Prawn::SVG::Calculators::DocumentSizing.prepend (Module.new do
|
4
|
+
def initialize *_args
|
5
|
+
super
|
6
|
+
@document_width = @document_width.to_f * 0.75 if @document_width&.end_with? 'px'
|
7
|
+
@document_height = @document_height.to_f * 0.75 if @document_height&.end_with? 'px'
|
8
|
+
end
|
9
|
+
end)
|
@@ -1,5 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# NOTE: patch float precision constant so prawn-table does not fail to arrange cells that span columns (see #1835)
|
4
|
+
Prawn.send :remove_const, :FLOAT_PRECISION
|
5
|
+
Prawn::FLOAT_PRECISION = 1e-3
|
6
|
+
|
3
7
|
# the following are organized under the Asciidoctor::Prawn namespace
|
4
8
|
require_relative 'prawn/document/column_box'
|
5
9
|
require_relative 'prawn/font_metric_cache'
|
data/lib/asciidoctor/pdf/ext.rb
CHANGED
@@ -36,8 +36,7 @@ module Asciidoctor::PDF::FormattedText
|
|
36
36
|
end
|
37
37
|
pdf.fill_color prev_fill_color
|
38
38
|
end
|
39
|
-
if (border_width = data[:border_width])
|
40
|
-
border_color = data[:border_color]
|
39
|
+
if (border_width = data[:border_width]) && (border_color = data[:border_color])
|
41
40
|
prev_stroke_color = pdf.stroke_color
|
42
41
|
prev_line_width = pdf.line_width
|
43
42
|
pdf.stroke_color border_color
|
data/lib/asciidoctor/pdf.rb
CHANGED
@@ -1,18 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
autoload :Set, 'set'
|
4
|
+
autoload :StringIO, 'stringio'
|
5
|
+
autoload :Tempfile, 'tempfile'
|
6
|
+
require 'time' unless defined? Time.parse
|
3
7
|
require_relative 'pdf/version'
|
4
8
|
require 'asciidoctor'
|
5
9
|
require 'prawn'
|
6
|
-
# NOTE: patch float precision constant so prawn-table does not fail to arrange cells that span columns (see #1835)
|
7
|
-
Prawn.send :remove_const, :FLOAT_PRECISION
|
8
|
-
Prawn::FLOAT_PRECISION = 1e-3
|
9
10
|
require 'prawn/templates'
|
10
|
-
begin
|
11
|
-
require 'prawn/gmagick'
|
12
|
-
rescue LoadError # rubocop:disable Lint/SuppressedException
|
13
|
-
end unless defined? GMagick::Image
|
14
|
-
autoload :Set, 'set'
|
15
|
-
require 'time' unless defined? Time.parse
|
16
11
|
require_relative 'pdf/measurements'
|
17
12
|
require_relative 'pdf/sanitizer'
|
18
13
|
require_relative 'pdf/text_transformer'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Allen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-05-
|
12
|
+
date: 2022-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: asciidoctor
|
@@ -258,7 +258,9 @@ files:
|
|
258
258
|
- lib/asciidoctor/pdf/ext/core/string.rb
|
259
259
|
- lib/asciidoctor/pdf/ext/pdf-core.rb
|
260
260
|
- lib/asciidoctor/pdf/ext/pdf-core/page.rb
|
261
|
+
- lib/asciidoctor/pdf/ext/prawn-gmagick.rb
|
261
262
|
- lib/asciidoctor/pdf/ext/prawn-svg.rb
|
263
|
+
- lib/asciidoctor/pdf/ext/prawn-svg/calculators/document_sizing.rb
|
262
264
|
- lib/asciidoctor/pdf/ext/prawn-svg/loaders/data.rb
|
263
265
|
- lib/asciidoctor/pdf/ext/prawn-svg/loaders/web.rb
|
264
266
|
- lib/asciidoctor/pdf/ext/prawn-svg/url_loader.rb
|