asciidoctor-pdf 2.3.17 → 2.3.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 493c0b612bcd07229becd5c1c53decdeaec3aeff63851556901c942257b091a9
4
- data.tar.gz: 609bd614ebf487afc8b078b63a6b7e2e34d9f4377fecd0bffc718b673d63c6e1
3
+ metadata.gz: 465fb67274afdfc25ce6bddf7a7f0f8a7079bcc828d11cd86472c30f62b6cf5c
4
+ data.tar.gz: e034a8cbedf9329cdd48d2cc03063ca146ae9cf1ed28e2417b878ce14b4ca680
5
5
  SHA512:
6
- metadata.gz: 6bb6846fa124db582fe86992eace65b4d1263403971198f8d78cf8f2f33556dfdb3104ccff0f15dd27c316d94d65c3b3dd554f7b6e9527cfaf5ccffca8f642b5
7
- data.tar.gz: 4fba487e7098185b900a2a6dbcafdf7e29ab345945562f832841ef4d06acfca76dc3d11f1c8b0fd80cc636f8102ae2239656049dee0ddd7861adff020ae1edde
6
+ metadata.gz: a8da14edb4931a36dcfe223d1ccbe9dbaf6aa3c0a443818412062850158a5c7f15eebb6b3cbe39824440b9c9613d232ee2537a5d77ec156d491e8e619139694a
7
+ data.tar.gz: 991f86d8acdddb6e4ec1773d5db27fce3673ec4f8a0c4b7889a6095ef69c52d1e08b0dc63fcdde797beaf4f4d12bea49f11595f67e576d5da7594386f9c76f6e
data/CHANGELOG.adoc CHANGED
@@ -5,6 +5,36 @@
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.19 (2024-10-11) - @mojavelinux
9
+
10
+ Improvements::
11
+
12
+ * replace OpenStruct with internal ThemeData class for storing theme data (#2535)
13
+
14
+ Bug Fixes::
15
+
16
+ * support horizontal alignment on AsciiDoc table cell that only contains paragraphs (#2358)
17
+ * don't allow AsciiDoc table cell to overrun bottom of page on which it fits (#2538)
18
+ * don't look for NULL glyph in fallback font as this can impact line height (#2541)
19
+
20
+ === Details
21
+
22
+ {url-repo}/releases/tag/v2.3.19[git tag] | {url-repo}/compare/v2.3.18\...v2.3.19[full diff]
23
+
24
+ == 2.3.18 (2024-07-27) - @mojavelinux
25
+
26
+ Bug Fixes::
27
+
28
+ * position foreground image correctly when page layout changes (#2528)
29
+
30
+ Compliance::
31
+
32
+ * release lock on version of rexml (pulled in by asciidoctor-diagram and prawn-svg) now that incompatibility is resolved
33
+
34
+ === Details
35
+
36
+ {url-repo}/releases/tag/v2.3.18[git tag] | {url-repo}/compare/v2.3.17\...v2.3.18[full diff]
37
+
8
38
  == 2.3.17 (2024-06-01) - @mojavelinux
9
39
 
10
40
  Improvements::
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.17, 2024-06-01
3
+ v2.3.19, 2024-10-11
4
4
  // Settings:
5
5
  :experimental:
6
6
  :idprefix:
@@ -42,7 +42,6 @@ Gem::Specification.new do |s|
42
42
  s.add_runtime_dependency 'prawn-svg', '~> 0.34.0'
43
43
  s.add_runtime_dependency 'prawn-icon', '~> 3.0.0'
44
44
  s.add_runtime_dependency 'concurrent-ruby', '~> 1.1'
45
- s.add_runtime_dependency 'rexml', '3.2.6' # lock rexml to 3.2.6 since 3.2.7 and up breaks Ruby
46
45
  s.add_runtime_dependency 'treetop', '~> 1.6.0'
47
46
 
48
47
  s.add_development_dependency 'rake', '~> 13.0.0'
@@ -4397,14 +4397,17 @@ module Asciidoctor
4397
4397
  if (first_page = (has_front_cover ? (pages.slice 1, pages.size) : pages).find {|it| !it.imported_page? }) &&
4398
4398
  (first_page_num = (pages.index first_page) + 1) &&
4399
4399
  (fg_image = resolve_background_image doc, @theme, 'page-foreground-image') && fg_image[0]
4400
- go_to_page first_page_num
4401
- create_stamp 'foreground-image' do
4402
- canvas { image fg_image[0], ({ position: :center, vposition: :center }.merge fg_image[1]) }
4403
- end
4404
- stamp 'foreground-image'
4405
- (first_page_num.next..page_count).each do |num|
4400
+ stamps = ::Set.new
4401
+ (first_page_num..page_count).each do |num|
4406
4402
  go_to_page num
4407
- stamp 'foreground-image' unless page.imported_page?
4403
+ next if page.imported_page?
4404
+ unless stamps.include? (stamp_name = %(foreground-image-#{page.layout}))
4405
+ create_stamp stamp_name do
4406
+ canvas { image fg_image[0], ({ position: :center, vposition: :center }.merge fg_image[1]) }
4407
+ end
4408
+ stamps << stamp_name
4409
+ end
4410
+ stamp stamp_name
4408
4411
  end
4409
4412
  end
4410
4413
  end
@@ -61,8 +61,8 @@ Prawn::Text::Formatted::Box.prepend (Module.new do
61
61
  form_fragments_from_like_font_glyph_pairs font_glyph_pairs, fragment_hash
62
62
  end
63
63
 
64
- # TODO: remove once Prawn 2.5 is released
65
64
  def find_font_for_this_glyph char, current_font, current_font_opts = {}, fallback_fonts_to_check = [], original_font = current_font
65
+ return current_font if char == ?\u0000 # never look for NUL character in fallback fonts as it's not rendered
66
66
  (doc = @document).font current_font, current_font_opts
67
67
  if doc.font.glyph_present? char
68
68
  current_font
@@ -73,9 +73,8 @@ module Prawn
73
73
  end
74
74
  # NOTE: draw_bounded_content automatically adds FPTolerance to width and height
75
75
  pdf.bounds.instance_variable_set :@width, spanned_content_width
76
- padding_adjustment = content.context == :document ? padding_bottom : 0
77
- # NOTE: we've already reserved the space, so just let the box stretch to bottom of the content area
78
- pdf.bounds.instance_variable_set :@height, (pdf.y - pdf.page.margins[:bottom] - padding_adjustment)
76
+ # NOTE: we've already reserved the space, so just let the box stretch to the maximum that could fit on a page
77
+ pdf.bounds.instance_variable_set :@height, (pdf.margin_box.height - padding_top - padding_bottom)
79
78
  if @valign != :top && (excess_y = spanned_content_height - natural_content_height) > 0
80
79
  # QUESTION: could this cause a unexpected page overrun?
81
80
  pdf.move_down(@valign == :center ? (excess_y.fdiv 2) : excess_y)
@@ -116,11 +115,16 @@ module Prawn
116
115
  font_size = font_info[:size]
117
116
  end
118
117
  font_style ||= font_info[:style]
118
+ if (@align == :center || @align == :right) && content.blocks.map(&:context).uniq == [:paragraph]
119
+ prev_text_align = pdf.instance_variable_get :@base_text_align
120
+ pdf.instance_variable_set :@base_text_align, @align
121
+ end
119
122
  pdf.font font_family, size: font_size, style: font_style do
120
123
  yield
121
124
  ensure
122
125
  pdf.font_color = prev_font_color if prev_font_color
123
126
  pdf.font_scale = prev_font_scale if prev_font_scale
127
+ pdf.instance_variable_set :@base_text_align, prev_text_align if prev_text_align
124
128
  end
125
129
  end
126
130
  end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Asciidoctor
4
+ module PDF
5
+ class ThemeData
6
+ attr_reader :table
7
+
8
+ def initialize data = nil
9
+ @table = (data || {}).transform_keys(&:to_sym)
10
+ end
11
+
12
+ def [] name
13
+ @table[name.to_sym]
14
+ end
15
+
16
+ def []= name, value
17
+ @table[name.to_sym] = value
18
+ end
19
+
20
+ def each_pair &block
21
+ @table.each_pair(&block)
22
+ end
23
+
24
+ def eql? other
25
+ @table.to_h.eql? other.to_h
26
+ end
27
+
28
+ def delete_field name
29
+ @table.delete name
30
+ end
31
+
32
+ def dup
33
+ ThemeData.new @table
34
+ end
35
+
36
+ def method_missing name, *args
37
+ if (name_str = name.to_s).end_with? '='
38
+ @table[name_str.chop.to_sym] = args[0]
39
+ else
40
+ @table[name]
41
+ end
42
+ end
43
+
44
+ def respond_to? name, _include_all = false
45
+ @table.key? name.to_sym
46
+ end
47
+
48
+ def respond_to_missing? name, _include_all = false
49
+ @table.key? name.to_sym
50
+ end
51
+
52
+ def to_h
53
+ @table
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ostruct'
3
+ require_relative 'theme_data'
4
4
  require_relative 'measurements'
5
5
 
6
6
  module Asciidoctor
@@ -69,7 +69,7 @@ module Asciidoctor
69
69
  # NOTE: base theme is loaded "as is" (no post-processing)
70
70
  def self.load_base_theme
71
71
  ::File.open BaseThemePath, mode: 'r:UTF-8' do |io|
72
- (::OpenStruct.new ::YAML.safe_load io, filename: BaseThemePath).tap {|theme| theme.__dir__ = ThemesDir }
72
+ (ThemeData.new ::YAML.safe_load io, filename: BaseThemePath).tap {|theme| theme.__dir__ = ThemesDir }
73
73
  end
74
74
  end
75
75
 
@@ -78,7 +78,7 @@ module Asciidoctor
78
78
  if theme_path == BaseThemePath
79
79
  load_base_theme
80
80
  else
81
- theme_data = load_file theme_path, (::OpenStruct.new base_font_size: 12), theme_dir
81
+ theme_data = load_file theme_path, (ThemeData.new base_font_size: 12), theme_dir
82
82
  unless (::File.dirname theme_path) == ThemesDir
83
83
  theme_data.base_text_align ||= 'left'
84
84
  theme_data.base_line_height ||= 1
@@ -102,12 +102,12 @@ module Asciidoctor
102
102
  line.sub(HexColorEntryRx) { %(#{(m = $~)[:k]}: #{m[:h] || (m[:k].end_with? 'color') ? "'#{m[:v]}'" : m[:v]}) }
103
103
  end.join unless (::File.dirname filename) == ThemesDir
104
104
  yaml_data = ::YAML.safe_load data, aliases: true, filename: filename
105
- (loaded = (theme_data ||= ::OpenStruct.new).__loaded__ ||= ::Set.new).add filename
105
+ (loaded = (theme_data ||= ThemeData.new).__loaded__ ||= ::Set.new).add filename
106
106
  if ::Hash === yaml_data && (extends = yaml_data.delete 'extends')
107
107
  (Array extends).each do |extend_path|
108
108
  extend_path = extend_path.slice 0, extend_path.length - 11 if (force = extend_path.end_with? ' !important')
109
109
  if extend_path == 'base'
110
- theme_data = ::OpenStruct.new theme_data.to_h.merge load_base_theme.to_h if (loaded.add? 'base') || force
110
+ theme_data = ThemeData.new theme_data.to_h.merge load_base_theme.to_h if (loaded.add? 'base') || force
111
111
  next
112
112
  elsif BundledThemeNames.include? extend_path
113
113
  extend_path, extend_theme_dir = resolve_theme_file extend_path, ThemesDir
@@ -123,7 +123,7 @@ module Asciidoctor
123
123
  end
124
124
 
125
125
  def load hash, theme_data = nil
126
- ::Hash === hash ? hash.reduce(theme_data || ::OpenStruct.new) {|data, (key, val)| process_entry key, val, data, true } : (theme_data || ::OpenStruct.new)
126
+ ::Hash === hash ? hash.reduce(theme_data || ThemeData.new) {|data, (key, val)| process_entry key, val, data, true } : (theme_data || ThemeData.new)
127
127
  end
128
128
 
129
129
  private
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module PDF
5
- VERSION = '2.3.17'
5
+ VERSION = '2.3.19'
6
6
  end
7
7
  end
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.17
4
+ version: 2.3.19
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: 2024-06-01 00:00:00.000000000 Z
12
+ date: 2024-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: asciidoctor
@@ -137,20 +137,6 @@ dependencies:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
139
  version: '1.1'
140
- - !ruby/object:Gem::Dependency
141
- name: rexml
142
- requirement: !ruby/object:Gem::Requirement
143
- requirements:
144
- - - '='
145
- - !ruby/object:Gem::Version
146
- version: 3.2.6
147
- type: :runtime
148
- prerelease: false
149
- version_requirements: !ruby/object:Gem::Requirement
150
- requirements:
151
- - - '='
152
- - !ruby/object:Gem::Version
153
- version: 3.2.6
154
140
  - !ruby/object:Gem::Dependency
155
141
  name: treetop
156
142
  requirement: !ruby/object:Gem::Requirement
@@ -339,6 +325,7 @@ files:
339
325
  - lib/asciidoctor/pdf/sanitizer.rb
340
326
  - lib/asciidoctor/pdf/section_info_by_page.rb
341
327
  - lib/asciidoctor/pdf/text_transformer.rb
328
+ - lib/asciidoctor/pdf/theme_data.rb
342
329
  - lib/asciidoctor/pdf/theme_loader.rb
343
330
  - lib/asciidoctor/pdf/version.rb
344
331
  homepage: https://asciidoctor.org/docs/asciidoctor-pdf
@@ -364,7 +351,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
364
351
  - !ruby/object:Gem::Version
365
352
  version: '0'
366
353
  requirements: []
367
- rubygems_version: 3.5.9
354
+ rubygems_version: 3.5.16
368
355
  signing_key:
369
356
  specification_version: 4
370
357
  summary: Converts AsciiDoc documents to PDF using Asciidoctor and Prawn