asciidoctor-pdf 2.3.18 → 2.3.19
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 +1 -1
- data/lib/asciidoctor/pdf/ext/prawn/formatted_text/box.rb +1 -1
- data/lib/asciidoctor/pdf/ext/prawn-table/cell/asciidoc.rb +7 -3
- data/lib/asciidoctor/pdf/theme_data.rb +57 -0
- data/lib/asciidoctor/pdf/theme_loader.rb +6 -6
- data/lib/asciidoctor/pdf/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: 465fb67274afdfc25ce6bddf7a7f0f8a7079bcc828d11cd86472c30f62b6cf5c
|
4
|
+
data.tar.gz: e034a8cbedf9329cdd48d2cc03063ca146ae9cf1ed28e2417b878ce14b4ca680
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8da14edb4931a36dcfe223d1ccbe9dbaf6aa3c0a443818412062850158a5c7f15eebb6b3cbe39824440b9c9613d232ee2537a5d77ec156d491e8e619139694a
|
7
|
+
data.tar.gz: 991f86d8acdddb6e4ec1773d5db27fce3673ec4f8a0c4b7889a6095ef69c52d1e08b0dc63fcdde797beaf4f4d12bea49f11595f67e576d5da7594386f9c76f6e
|
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.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
|
+
|
8
24
|
== 2.3.18 (2024-07-27) - @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.3.
|
3
|
+
v2.3.19, 2024-10-11
|
4
4
|
// Settings:
|
5
5
|
:experimental:
|
6
6
|
:idprefix:
|
@@ -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
|
-
|
77
|
-
|
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
|
-
|
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
|
-
(
|
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, (
|
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 ||=
|
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 =
|
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 ||
|
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
|
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.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-
|
12
|
+
date: 2024-10-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: asciidoctor
|
@@ -325,6 +325,7 @@ files:
|
|
325
325
|
- lib/asciidoctor/pdf/sanitizer.rb
|
326
326
|
- lib/asciidoctor/pdf/section_info_by_page.rb
|
327
327
|
- lib/asciidoctor/pdf/text_transformer.rb
|
328
|
+
- lib/asciidoctor/pdf/theme_data.rb
|
328
329
|
- lib/asciidoctor/pdf/theme_loader.rb
|
329
330
|
- lib/asciidoctor/pdf/version.rb
|
330
331
|
homepage: https://asciidoctor.org/docs/asciidoctor-pdf
|
@@ -350,7 +351,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
350
351
|
- !ruby/object:Gem::Version
|
351
352
|
version: '0'
|
352
353
|
requirements: []
|
353
|
-
rubygems_version: 3.5.
|
354
|
+
rubygems_version: 3.5.16
|
354
355
|
signing_key:
|
355
356
|
specification_version: 4
|
356
357
|
summary: Converts AsciiDoc documents to PDF using Asciidoctor and Prawn
|