asciidoctor-pdf 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +16 -0
- data/README.adoc +3 -10
- data/lib/asciidoctor/pdf/converter.rb +29 -17
- 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: b41dc215a6b942da9191850d15cf3e68224f1b633147b2df34a5e1e88756f797
|
4
|
+
data.tar.gz: 929dd071b2dc29b6d6f4500efb87e1ffa251c9413ae1e8076a14285bca51a600
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17d8c003b47e99e0e7156027783ff1fa1e8298767b82de209f40a523e40d6d1f35f7263c1b673bb686082a474a219c9fda26e3f2894852f51374dd554844aae2
|
7
|
+
data.tar.gz: 9711e5816aa9c9893ddaf139c717fb125d285b5788d42ebac4473660148f66126b1eccc1f389d781e4fc13ccb02010f9a909fa69580b7239765b907a160a4a3b
|
data/CHANGELOG.adoc
CHANGED
@@ -5,6 +5,22 @@
|
|
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.3 (2022-05-25) - @mojavelinux
|
9
|
+
|
10
|
+
Improvements::
|
11
|
+
|
12
|
+
* compute the optimize settings in init_pdf and store as Hash instead of after writing the PDF file
|
13
|
+
|
14
|
+
Bug Fixes::
|
15
|
+
|
16
|
+
* adjust TrimBox to fit inside of BleedBox when using optimizer and compliance is PDF/X (#2203)
|
17
|
+
* set height of resized image to available height to avoid float precision error when scaling down image to fit page (#2205)
|
18
|
+
* prevent content on title page from overrunning the bounds of a single page and warn; restriction applies to `ink_title_page`
|
19
|
+
|
20
|
+
=== Details
|
21
|
+
|
22
|
+
{url-repo}/releases/tag/v2.0.3[git tag] | {url-repo}/compare/v2.0.2\...v2.0.3[full diff]
|
23
|
+
|
8
24
|
== 2.0.2 (2022-05-22) - @mojavelinux
|
9
25
|
|
10
26
|
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.3, 2022-05-25
|
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.3
|
28
28
|
// URLs:
|
29
29
|
:url-gem: https://rubygems.org/gems/asciidoctor-pdf
|
30
30
|
:url-project: https://github.com/asciidoctor/asciidoctor-pdf
|
@@ -97,14 +97,7 @@ Pass the name of the gem to the `gem install` command as follows:
|
|
97
97
|
Installing Asciidoctor PDF will install a number of other gems mentioned in these docs, including asciidoctor, prawn, prawn-svg, prawn-table, prawn-icon, and ttfunk.
|
98
98
|
For the most part, the versions of these dependencies are locked to the version of Asciidoctor PDF.
|
99
99
|
|
100
|
-
|
101
|
-
|
102
|
-
$ gem install matrix
|
103
|
-
|
104
|
-
The matrix gem used to be bundled in the Ruby distribution, but was split out starting in Ruby 3.1.
|
105
|
-
This requirement will be lifted once Prawn declares it as a runtime dependency.
|
106
|
-
|
107
|
-
For further installation information, see {url-project-docs}/install/[the installation documentation].
|
100
|
+
For further installation information about installing Asciidoctor PDF, see {url-project-docs}/install/[the installation documentation].
|
108
101
|
For troubleshooting help, see {url-project-docs}/install/#installation-troubleshooting[Installation troubleshooting].
|
109
102
|
|
110
103
|
=== Install a prerelease or development version
|
@@ -174,7 +174,9 @@ module Asciidoctor
|
|
174
174
|
if (has_title_page = (title_page_on = doc.doctype == 'book' || (doc.attr? 'title-page')) && (start_title_page doc))
|
175
175
|
# NOTE: the base font must be set before any content is written to the main or scratch document
|
176
176
|
font @theme.base_font_family, size: @root_font_size, style: @theme.base_font_style
|
177
|
-
ink_title_page doc
|
177
|
+
if perform_on_single_page { ink_title_page doc }
|
178
|
+
log :warn, 'the title page contents has been truncated to prevent it from overrunning the bounds of a single page'
|
179
|
+
end
|
178
180
|
start_new_page
|
179
181
|
else
|
180
182
|
@page_margin_by_side[:cover] = @page_margin_by_side[:recto] if @media == 'prepress' && page_number == 0
|
@@ -321,6 +323,7 @@ module Asciidoctor
|
|
321
323
|
stamp_foreground_image doc, has_front_cover
|
322
324
|
ink_cover_page doc, :back
|
323
325
|
add_dest_for_top doc
|
326
|
+
state.pages.each {|it| fit_trim_box it } if (@optimize&.[] :compliance)&.start_with? 'PDF/X'
|
324
327
|
nil
|
325
328
|
end
|
326
329
|
|
@@ -411,8 +414,14 @@ module Asciidoctor
|
|
411
414
|
# NOTE: we have to init Pdfmark class here while we have reference to the doc
|
412
415
|
@pdfmark = (doc.attr? 'pdfmark') ? (Pdfmark.new doc) : nil
|
413
416
|
# NOTE: defer instantiating optimizer until we know min pdf version
|
414
|
-
if (
|
415
|
-
|
417
|
+
if (optimize = doc.attr 'optimize') &&
|
418
|
+
((defined? ::Asciidoctor::PDF::Optimizer) || !(Helpers.require_library OptimizerRequirePath, 'rghost', :warn).nil?)
|
419
|
+
@optimize = (optimize.include? ',') ?
|
420
|
+
([:quality, :compliance].zip (optimize.split ',', 2)).to_h :
|
421
|
+
((optimize.include? '/') ? { compliance: optimize } : { quality: optimize })
|
422
|
+
fit_trim_box if @optimize[:compliance]&.start_with? 'PDF/X'
|
423
|
+
else
|
424
|
+
@optimize = nil
|
416
425
|
end
|
417
426
|
allocate_scratch_prototype
|
418
427
|
self
|
@@ -1110,11 +1119,11 @@ module Asciidoctor
|
|
1110
1119
|
end
|
1111
1120
|
if (srclang = node.attr 'language')
|
1112
1121
|
if srclang.include? '?'
|
1113
|
-
if (lexer = ::Rouge::Lexer.find_fancy srclang)
|
1122
|
+
if (lexer = ::Rouge::Lexer.find_fancy srclang)&.tag == 'php' && !(node.option? 'mixed') && !((lexer_opts = lexer.options).key? 'start_inline')
|
1114
1123
|
lexer = lexer.class.new lexer_opts.merge 'start_inline' => true
|
1115
1124
|
end
|
1116
|
-
elsif (lexer = ::Rouge::Lexer.find srclang)
|
1117
|
-
lexer = lexer.new start_inline: true
|
1125
|
+
elsif (lexer = ::Rouge::Lexer.find srclang)&.tag == 'php' && !(node.option? 'mixed')
|
1126
|
+
lexer = lexer.new start_inline: true
|
1118
1127
|
end
|
1119
1128
|
end
|
1120
1129
|
lexer ||= ::Rouge::Lexers::PlainText
|
@@ -1205,10 +1214,10 @@ module Asciidoctor
|
|
1205
1214
|
b_left_width = nil
|
1206
1215
|
b_width = nil if (b_width = @theme[%(#{category}_border_width)]) == 0
|
1207
1216
|
end
|
1208
|
-
if (attribution =
|
1217
|
+
if (attribution = node.attr 'attribution')
|
1209
1218
|
# NOTE: temporary workaround to allow bare & to be used without having to wrap value in single quotes
|
1210
1219
|
attribution = escape_amp attribution if attribution.include? '&'
|
1211
|
-
if (citetitle = node.attr 'citetitle')
|
1220
|
+
if (citetitle = node.attr 'citetitle')&.include? '&'
|
1212
1221
|
citetitle = escape_amp citetitle
|
1213
1222
|
end
|
1214
1223
|
end
|
@@ -1760,7 +1769,7 @@ module Asciidoctor
|
|
1760
1769
|
advance_page
|
1761
1770
|
available_h = cursor - caption_h
|
1762
1771
|
end
|
1763
|
-
rendered_w
|
1772
|
+
rendered_w = (image_info.calc_image_dimensions height: (rendered_h = available_h))[0] if rendered_h > available_h
|
1764
1773
|
end
|
1765
1774
|
add_dest_for_block node if node.id
|
1766
1775
|
# NOTE: workaround to fix Prawn not adding fill and stroke commands on page that only has an image;
|
@@ -3608,7 +3617,6 @@ module Asciidoctor
|
|
3608
3617
|
end
|
3609
3618
|
end
|
3610
3619
|
|
3611
|
-
# TODO: prevent content from spilling to next page
|
3612
3620
|
theme_font :title_page do
|
3613
3621
|
if (title_top = @theme.title_page_title_top)
|
3614
3622
|
@y = resolve_top title_top
|
@@ -4403,13 +4411,8 @@ module Asciidoctor
|
|
4403
4411
|
pdf_doc.render_file target
|
4404
4412
|
# QUESTION: restore attributes first?
|
4405
4413
|
@pdfmark&.generate_file target
|
4406
|
-
if (
|
4407
|
-
|
4408
|
-
quality, compliance = quality.split ',', 2
|
4409
|
-
elsif quality.include? '/'
|
4410
|
-
quality, compliance = nil, quality
|
4411
|
-
end
|
4412
|
-
(Optimizer.new quality, pdf_doc.min_version, compliance).optimize_file target
|
4414
|
+
if (optimize = @optimize)
|
4415
|
+
(Optimizer.new optimize[:quality], pdf_doc.min_version, optimize[:compliance]).optimize_file target
|
4413
4416
|
end
|
4414
4417
|
to_file = true
|
4415
4418
|
end
|
@@ -4636,6 +4639,15 @@ module Asciidoctor
|
|
4636
4639
|
(max_height = bounds.height) < preferred_size ? max_height : preferred_size
|
4637
4640
|
end
|
4638
4641
|
|
4642
|
+
def fit_trim_box page_ = page
|
4643
|
+
page_.dictionary.data[:TrimBox].tap do |trim_box|
|
4644
|
+
trim_box[0] += 1e-4
|
4645
|
+
trim_box[1] += 1e-4
|
4646
|
+
trim_box[2] -= 1e-4
|
4647
|
+
trim_box[3] -= 1e-4
|
4648
|
+
end
|
4649
|
+
end
|
4650
|
+
|
4639
4651
|
def font_path font_file, fonts_dir
|
4640
4652
|
# resolve relative to built-in font dir unless path is absolute
|
4641
4653
|
::File.absolute_path font_file, fonts_dir
|
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.3
|
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-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: asciidoctor
|