asciidoctor-pdf 2.3.7 → 2.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +31 -0
- data/README.adoc +1 -1
- data/lib/asciidoctor/pdf/converter.rb +13 -7
- data/lib/asciidoctor/pdf/ext/core/file.rb +1 -1
- data/lib/asciidoctor/pdf/ext/prawn/extensions.rb +1 -1
- data/lib/asciidoctor/pdf/ext/prawn-svg/elements/image.rb +1 -1
- data/lib/asciidoctor/pdf/ext/prawn-table/cell/text.rb +2 -4
- data/lib/asciidoctor/pdf/formatted_text/inline_image_arranger.rb +9 -1
- data/lib/asciidoctor/pdf/optimizer.rb +3 -0
- data/lib/asciidoctor/pdf/sanitizer.rb +2 -2
- data/lib/asciidoctor/pdf/theme_loader.rb +1 -1
- data/lib/asciidoctor/pdf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8c0a40b569d9103d197f7063f91e12ef370e22fe2b591cc628097ae78ac8dc2
|
4
|
+
data.tar.gz: af5b79bc2a7ce74f9bddd471bc6751c56ef0119b7c417a7bd5473d2f13638fbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2b0972adc236388028ecbd29af29f0bbd18889a2bd7229b2508769831db3882fd6123b500be4a11ce317c569e35fb5531dfafb1ffa7cd0a892199df50dcd33f
|
7
|
+
data.tar.gz: 25c2b33f2c6427ad23fbbb0215b8c9a0f0bc84312d6751b13a5ee664db9e7b44e2c4bbaab419d0e89e266644cb0714175c18b2d80da69396dfc32459a54f9ff4
|
data/CHANGELOG.adoc
CHANGED
@@ -5,6 +5,37 @@
|
|
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.3.9 (2023-06-28) - @mojavelinux
|
9
|
+
|
10
|
+
Bug Fixes::
|
11
|
+
|
12
|
+
* correctly align block image in raster format in column when align is right or center and page columns are enabled (#2433)
|
13
|
+
* honor table caption end placement (`table-caption-end` theme key) when `unbreakable` (or `breakable`) option is set on table (#2434)
|
14
|
+
|
15
|
+
=== Details
|
16
|
+
|
17
|
+
{url-repo}/releases/tag/v2.3.9[git tag] | {url-repo}/compare/v2.3.8\...v2.3.9[full diff]
|
18
|
+
|
19
|
+
== 2.3.8 (2023-06-25) - @mojavelinux
|
20
|
+
|
21
|
+
Improvements::
|
22
|
+
|
23
|
+
* do not attempt to fit inline image in normal table cell to computed height of cell (#2428)
|
24
|
+
* support `fit=none` attribute on inline image to prevent image from being scaled down to fit available height (#2428)
|
25
|
+
|
26
|
+
Bug Fixes::
|
27
|
+
|
28
|
+
* remove null character enclosed in XML tag when sanitizing text; fixes invisible text in outline when heading contains index term (#2430)
|
29
|
+
* alias `File.exists?` to `File.exist?` when loading RGhost optimizer to patch incompatibility when using Ruby 3.2
|
30
|
+
|
31
|
+
Build / Infrastructure::
|
32
|
+
|
33
|
+
* bump upper Ruby version from 3.1 to 3.2 in CI workflow
|
34
|
+
|
35
|
+
=== Details
|
36
|
+
|
37
|
+
{url-repo}/releases/tag/v2.3.8[git tag] | {url-repo}/compare/v2.3.7\...v2.3.8[full diff]
|
38
|
+
|
8
39
|
== 2.3.7 (2023-04-16) - @mojavelinux
|
9
40
|
|
10
41
|
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.3.
|
3
|
+
v2.3.9, 2023-06-28
|
4
4
|
// Settings:
|
5
5
|
:experimental:
|
6
6
|
:idprefix:
|
@@ -1856,9 +1856,16 @@ module Asciidoctor
|
|
1856
1856
|
update_colors if graphic_state.color_space.empty?
|
1857
1857
|
ink_caption node, category: :image, end: :top, block_align: alignment, block_width: rendered_w, max_width: caption_max_width if caption_end == :top && node.title?
|
1858
1858
|
image_y = y
|
1859
|
-
|
1859
|
+
left = bounds.left
|
1860
|
+
# NOTE: prawn does not compute :at for alignment correctly in column box, so resort to our own logic
|
1861
|
+
case alignment
|
1862
|
+
when :center
|
1863
|
+
left += (available_w - rendered_w) * 0.5
|
1864
|
+
when :right
|
1865
|
+
left += available_w - rendered_w
|
1866
|
+
end
|
1860
1867
|
# NOTE: specify both width and height to avoid recalculation
|
1861
|
-
embed_image image_obj, image_info,
|
1868
|
+
embed_image image_obj, image_info, at: [left, (image_cursor = cursor)], height: rendered_h, width: rendered_w
|
1862
1869
|
draw_image_border image_cursor, rendered_w, rendered_h, alignment unless pinned || (node.role? && (node.has_role? 'noborder'))
|
1863
1870
|
if (link = node.attr 'link')
|
1864
1871
|
add_link_to_image link, { width: rendered_w, height: rendered_h }, position: alignment, y: image_y
|
@@ -1974,6 +1981,7 @@ module Asciidoctor
|
|
1974
1981
|
end
|
1975
1982
|
|
1976
1983
|
def convert_table node
|
1984
|
+
caption_end = (theme = @theme).table_caption_end&.to_sym || :top
|
1977
1985
|
if !at_page_top? && ((unbreakable = node.option? 'unbreakable') || ((node.option? 'breakable') && (node.id || node.title?)))
|
1978
1986
|
# NOTE: we use the current node as the parent so we can navigate back into the document model
|
1979
1987
|
(table_container = Block.new node, :open) << (table_dup = node.dup)
|
@@ -1985,7 +1993,7 @@ module Asciidoctor
|
|
1985
1993
|
end
|
1986
1994
|
table_container.style = 'table-container'
|
1987
1995
|
table_container.id, table_dup.id = table_dup.id, nil
|
1988
|
-
if table_dup.title?
|
1996
|
+
if caption_end == :top && table_dup.title?
|
1989
1997
|
table_container.title = ''
|
1990
1998
|
table_container.instance_variable_set :@converted_title, table_dup.captioned_title
|
1991
1999
|
table_dup.title = nil
|
@@ -1997,7 +2005,6 @@ module Asciidoctor
|
|
1997
2005
|
num_rows = node.attr 'rowcount'
|
1998
2006
|
num_cols = node.columns.size
|
1999
2007
|
table_header_size = false
|
2000
|
-
theme = @theme
|
2001
2008
|
prev_font_scale, @font_scale = @font_scale, 1 if node.document.nested?
|
2002
2009
|
|
2003
2010
|
tbl_bg_color = resolve_theme_color :table_background_color
|
@@ -2235,7 +2242,6 @@ module Asciidoctor
|
|
2235
2242
|
alignment = theme.table_align&.to_sym || :left
|
2236
2243
|
end
|
2237
2244
|
|
2238
|
-
caption_end = theme.table_caption_end&.to_sym || :top
|
2239
2245
|
caption_max_width = theme.table_caption_max_width || 'fit-content'
|
2240
2246
|
|
2241
2247
|
table_settings = {
|
@@ -2267,7 +2273,7 @@ module Asciidoctor
|
|
2267
2273
|
@column_widths = column_widths unless column_widths.empty?
|
2268
2274
|
# NOTE: call width to capture resolved table width
|
2269
2275
|
table_width = width
|
2270
|
-
@pdf.ink_table_caption node, alignment, table_width, caption_max_width if
|
2276
|
+
@pdf.ink_table_caption node, alignment, table_width, caption_max_width if caption_end == :top && node.title?
|
2271
2277
|
# NOTE: align using padding instead of bounding_box as prawn-table does
|
2272
2278
|
# using a bounding_box across pages mangles the margin box of subsequent pages
|
2273
2279
|
if alignment != :left && table_width != (this_bounds = @pdf.bounds).width
|
@@ -2340,7 +2346,7 @@ module Asciidoctor
|
|
2340
2346
|
bounds.subtract_left_padding left_padding
|
2341
2347
|
bounds.subtract_right_padding right_padding if right_padding
|
2342
2348
|
end
|
2343
|
-
ink_table_caption node, alignment, table_width, caption_max_width, caption_end if
|
2349
|
+
ink_table_caption node, alignment, table_width, caption_max_width, caption_end if caption_end == :bottom && node.title?
|
2344
2350
|
theme_margin :block, :bottom, (next_enclosed_block node)
|
2345
2351
|
rescue ::Prawn::Errors::CannotFit
|
2346
2352
|
log :error, (message_with_context 'cannot fit contents of table cell into specified column width', source_location: node.source_location)
|
@@ -9,6 +9,6 @@ File.singleton_class.prepend (Module.new do
|
|
9
9
|
|
10
10
|
# NOTE: JRuby < 9.4 doesn't implement this method; JRuby 9.4 implements it incorrectly
|
11
11
|
def absolute_path? path
|
12
|
-
(
|
12
|
+
(Pathname.new path).absolute? && !(%r/\A[[:alpha:]][[:alnum:]\-+]*:\/\/\S/.match? path)
|
13
13
|
end
|
14
14
|
end) if RUBY_ENGINE == 'jruby'
|
@@ -4,7 +4,7 @@ Prawn::Font::AFM.instance_variable_set :@hide_m17n_warning, true
|
|
4
4
|
|
5
5
|
require 'prawn/icon'
|
6
6
|
|
7
|
-
Prawn::Icon::Compatibility.prepend (
|
7
|
+
Prawn::Icon::Compatibility.prepend (Module.new { def warning *_args; end })
|
8
8
|
|
9
9
|
module Asciidoctor
|
10
10
|
module Prawn
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Prawn::SVG::Elements::Image.prepend (Module.new do
|
4
4
|
def image_dimensions data
|
5
5
|
unless (handler = find_image_handler data)
|
6
|
-
raise
|
6
|
+
raise Prawn::SVG::Elements::Base::SkipElementError, 'Unsupported image type supplied to image tag'
|
7
7
|
end
|
8
8
|
image = handler.new data
|
9
9
|
[image.width.to_f, image.height.to_f]
|
@@ -10,11 +10,9 @@ class Prawn::Table::Cell::Text
|
|
10
10
|
def draw_content
|
11
11
|
with_font do
|
12
12
|
self.valign = [:center, -font.descender * 0.5] if valign == :center
|
13
|
+
(bounds = @pdf.bounds).instance_variable_set :@table_cell, true
|
13
14
|
remaining_text = with_text_color do
|
14
|
-
(text_box
|
15
|
-
width: spanned_content_width + FPTolerance,
|
16
|
-
height: spanned_content_height + FPTolerance,
|
17
|
-
at: [0, @pdf.cursor]).render
|
15
|
+
(text_box width: bounds.width, height: bounds.height, at: [0, @pdf.cursor]).render
|
18
16
|
end
|
19
17
|
unless remaining_text.empty? || @pdf.scratch?
|
20
18
|
logger.error message_with_context %(the table cell on page #{@pdf.page_number} has been truncated; Asciidoctor PDF does not support table cell content that exceeds the height of a single page), source_location: @source_location
|
@@ -63,7 +63,15 @@ module Asciidoctor::PDF::FormattedText
|
|
63
63
|
image_w = [available_w, pctidx ? (image_w.to_f / 100 * available_w) : image_w.to_f].min
|
64
64
|
end
|
65
65
|
|
66
|
-
|
66
|
+
if (fit = fragment[:image_fit]) === 'line'
|
67
|
+
max_image_h = [available_h, doc.font.height].min
|
68
|
+
elsif fit == 'none'
|
69
|
+
max_image_h = doc.margin_box.height
|
70
|
+
elsif doc.bounds.instance_variable_get :@table_cell
|
71
|
+
max_image_h = doc.bounds.parent.height
|
72
|
+
else
|
73
|
+
max_image_h = available_h
|
74
|
+
end
|
67
75
|
|
68
76
|
# TODO: make helper method to calculate width and height of image
|
69
77
|
if image_format == 'svg'
|
@@ -6,6 +6,9 @@ require 'rghost/gs_alone'
|
|
6
6
|
require 'tmpdir'
|
7
7
|
autoload :Open3, 'open3'
|
8
8
|
|
9
|
+
# rghost still uses File.exists?
|
10
|
+
File.singleton_class.alias_method :exists?, :exist? unless File.respond_to? :exists?
|
11
|
+
|
9
12
|
RGhost::GSAlone.prepend (Module.new do
|
10
13
|
def initialize params, debug
|
11
14
|
(@params = params.dup).push(*(@params.pop.split File::PATH_SEPARATOR))
|
@@ -19,11 +19,11 @@ module Asciidoctor
|
|
19
19
|
'nbsp' => ' ',
|
20
20
|
'quot' => '"',
|
21
21
|
}).default = '?'
|
22
|
-
SanitizeXMLRx = /<[^>]
|
22
|
+
SanitizeXMLRx = /<[^>]+>\0?/
|
23
23
|
CharRefRx = /&(?:amp;)?(?:([a-z][a-z]+\d{0,2})|#(?:(\d\d\d{0,4})|x(\h\h\h{0,3})));/
|
24
24
|
UnescapedAmpersandRx = /&(?!(?:[a-z][a-z]+\d{0,2}|#(?:\d\d\d{0,4}|x\h\h\h{0,3}));)/
|
25
25
|
|
26
|
-
# Strip leading, trailing and repeating whitespace, remove XML tags and
|
26
|
+
# Strip leading, trailing and repeating whitespace, remove XML tags along with an enclosed null character, and
|
27
27
|
# resolve all entities in the specified string.
|
28
28
|
#
|
29
29
|
# FIXME: move to a module so we can mix it in elsewhere
|
@@ -22,7 +22,7 @@ module Asciidoctor
|
|
22
22
|
LoneVariableRx = /^\$([a-z0-9_-]+)$/
|
23
23
|
HexColorEntryRx = /^(?<k> *\p{Graph}+): +(?!null$)(?<q>["']?)(?<h>#)?(?<v>\h\h\h\h{0,3})\k<q> *(?:#.*)?$/
|
24
24
|
MultiplyDivideOpRx = %r((-?\d+(?:\.\d+)?) +([*/^]) +(-?\d+(?:\.\d+)?))
|
25
|
-
AddSubtractOpRx = /(-?\d+(?:\.\d+)?) +([
|
25
|
+
AddSubtractOpRx = /(-?\d+(?:\.\d+)?) +([+-]) +(-?\d+(?:\.\d+)?)/
|
26
26
|
PrecisionFuncRx = /^(round|floor|ceil)\(/
|
27
27
|
RoleAlignKeyRx = /(?:_text)?_align$/
|
28
28
|
|
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.3.
|
4
|
+
version: 2.3.9
|
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: 2023-
|
12
|
+
date: 2023-06-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: asciidoctor
|