asciidoctor-pdf 2.3.9 → 2.3.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8c0a40b569d9103d197f7063f91e12ef370e22fe2b591cc628097ae78ac8dc2
4
- data.tar.gz: af5b79bc2a7ce74f9bddd471bc6751c56ef0119b7c417a7bd5473d2f13638fbd
3
+ metadata.gz: 53465d3756b672a087912f7052c98da2174506d348ae415702b6ad0923c35887
4
+ data.tar.gz: 81156616786953961b86a747720fdb1c92117a7645df0faba24b02e96bec4635
5
5
  SHA512:
6
- metadata.gz: c2b0972adc236388028ecbd29af29f0bbd18889a2bd7229b2508769831db3882fd6123b500be4a11ce317c569e35fb5531dfafb1ffa7cd0a892199df50dcd33f
7
- data.tar.gz: 25c2b33f2c6427ad23fbbb0215b8c9a0f0bc84312d6751b13a5ee664db9e7b44e2c4bbaab419d0e89e266644cb0714175c18b2d80da69396dfc32459a54f9ff4
6
+ metadata.gz: 73d88491443fdafb5086bf4a122c3910631e547ef118b4ff4b23dffcbb315d7fb21a7335fc41db778b0d11bf5f851d3cae9df1b838fa342d3e5cf73cbe0f259d
7
+ data.tar.gz: cbd1fe371ed58d54c76770ef7abda45a080bb84dcbece1e5f60bda8a260668538ee5f71b92088b67ea71b9b29ed01cf6746fa9568a123366080a1e2fcdbb1c2e
data/CHANGELOG.adoc CHANGED
@@ -5,6 +5,20 @@
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.10 (2023-12-04) - @mojavelinux
9
+
10
+ Bug Fixes::
11
+
12
+ * show dot leaders in TOC entry if toclevels is increased for a given section (#2441)
13
+ * decouple tests from path of PWD (#2444)
14
+ * consider inherited styles when analyzing glyphs for fallback font support (#2463)
15
+ * add fallback character for placeholder character when using AFM font (#2453)
16
+ * don't advance image that's first child of block at top of page if image is taller than page (#2012)
17
+
18
+ === Details
19
+
20
+ {url-repo}/releases/tag/v2.3.10[git tag] | {url-repo}/compare/v2.3.9\...v2.3.10[full diff]
21
+
8
22
  == 2.3.9 (2023-06-28) - @mojavelinux
9
23
 
10
24
  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.9, 2023-06-28
3
+ v2.3.10, 2023-12-04
4
4
  // Settings:
5
5
  :experimental:
6
6
  :idprefix:
@@ -377,7 +377,7 @@ module Asciidoctor
377
377
  if (rotated_page_margin = resolve_page_margin (doc.attr 'pdf-page-margin-rotated') || theme.page_margin_rotated)
378
378
  rotated_page_margin = expand_margin_value rotated_page_margin
379
379
  @edge_shorthand_cache = nil
380
- @page_margin[PageLayouts[(PageLayouts.index page.layout) - 1]] = { recto: rotated_page_margin, verso: rotated_page_margin.dup }
380
+ @page_margin[PageLayouts[(PageLayouts.index page.layout) - 1]] = { recto: rotated_page_margin, verso: (rotated_page_margin.drop 0) }
381
381
  end
382
382
  if @media == 'prepress'
383
383
  @ppbook = doc.doctype == 'book'
@@ -1048,7 +1048,7 @@ module Asciidoctor
1048
1048
  else
1049
1049
  highlighter = nil
1050
1050
  end
1051
- saved_subs = (subs = node.subs).dup
1051
+ saved_subs = (subs = node.subs).drop 0
1052
1052
  callouts_enabled = subs.include? :callouts
1053
1053
  highlight_idx = subs.index :highlight
1054
1054
  # NOTE: scratch? here only applies if listing block is nested inside another block
@@ -1069,9 +1069,9 @@ module Asciidoctor
1069
1069
  source_string = expand_tabs node.content
1070
1070
  else
1071
1071
  if callouts_enabled
1072
- saved_lines = node.lines.dup
1072
+ saved_lines = node.lines.drop 0
1073
1073
  subs.delete :callouts
1074
- prev_subs = subs.dup
1074
+ prev_subs = subs.drop 0
1075
1075
  subs.clear
1076
1076
  source_string, conum_mapping = extract_conums node.content
1077
1077
  node.lines.replace (source_string.split LF)
@@ -1421,7 +1421,7 @@ module Asciidoctor
1421
1421
  term_inline_format = (term_font_styles = font_styles).empty? ? true : [inherited: { styles: term_font_styles }]
1422
1422
  term_line_metrics = calc_line_metrics @base_line_height
1423
1423
  term_padding_no_blocks = [term_line_metrics.padding_top, 10, term_line_metrics.padding_bottom, 10]
1424
- (term_padding = term_padding_no_blocks.dup)[2] += @theme.prose_margin_bottom * 0.5
1424
+ (term_padding = (term_padding_no_blocks.drop 0))[2] += @theme.prose_margin_bottom * 0.5
1425
1425
  desc_padding = [0, 10, 0, 10]
1426
1426
  term_kerning = default_kerning?
1427
1427
  end
@@ -1802,7 +1802,7 @@ module Asciidoctor
1802
1802
  end
1803
1803
  # NOTE: shrink image so it fits within available space; group image & caption
1804
1804
  if (rendered_h = svg_size.output_height) > (available_h = cursor - caption_h)
1805
- unless pinned || at_page_top?
1805
+ unless pinned || at_page_top? || (node.first_child? && (node.parent.attr? 'pdf-at-top'))
1806
1806
  advance_page
1807
1807
  available_h = cursor - caption_h
1808
1808
  end
@@ -1844,7 +1844,7 @@ module Asciidoctor
1844
1844
  rendered_w, rendered_h = image_info.calc_image_dimensions width: (width || [available_w, actual_w].min)
1845
1845
  # NOTE: shrink image so it fits within available space; group image & caption
1846
1846
  if rendered_h > (available_h = cursor - caption_h)
1847
- unless pinned || at_page_top?
1847
+ unless pinned || at_page_top? || (node.first_child? && (node.parent.attr? 'pdf-at-top'))
1848
1848
  advance_page
1849
1849
  available_h = cursor - caption_h
1850
1850
  end
@@ -2030,15 +2030,15 @@ module Asciidoctor
2030
2030
  head_rows = node.rows[:head]
2031
2031
  body_rows = node.rows[:body]
2032
2032
  #if (hrows = node.attr 'hrows') && (shift_rows = hrows.to_i - head_rows.size) > 0
2033
- # head_rows = head_rows.dup
2034
- # body_rows = body_rows.dup
2033
+ # head_rows = head_rows.drop 0
2034
+ # body_rows = body_rows.drop 0
2035
2035
  # shift_rows.times { head_rows << body_rows.shift unless body_rows.empty? }
2036
2036
  #end
2037
2037
  theme_font :table_head do
2038
2038
  table_header_size = head_rows.size
2039
2039
  head_font_info = font_info
2040
2040
  head_line_metrics = calc_line_metrics theme.table_head_line_height || theme.table_cell_line_height || @base_line_height
2041
- head_cell_padding = ((head_cell_padding = theme.table_head_cell_padding) ? (expand_padding_value head_cell_padding) : body_cell_padding).dup
2041
+ head_cell_padding = (theme.table_head_cell_padding ? (expand_padding_value theme.table_head_cell_padding) : body_cell_padding).drop 0
2042
2042
  head_cell_padding[0] += head_line_metrics.padding_top
2043
2043
  head_cell_padding[2] += head_line_metrics.padding_bottom
2044
2044
  # QUESTION: why doesn't text transform inherit from table?
@@ -2149,7 +2149,7 @@ module Asciidoctor
2149
2149
  cell_data = { content: asciidoc_cell, source_location: cell.source_location }
2150
2150
  end
2151
2151
  if cell_line_metrics
2152
- cell_padding = body_cell_padding.dup
2152
+ cell_padding = body_cell_padding.drop 0
2153
2153
  cell_padding[0] += cell_line_metrics.padding_top
2154
2154
  cell_padding[2] += cell_line_metrics.padding_bottom
2155
2155
  cell_data[:leading] = cell_line_metrics.leading
@@ -3861,7 +3861,7 @@ module Asciidoctor
3861
3861
  font_style: dot_leader_font_style,
3862
3862
  font_size: font_size,
3863
3863
  levels: ((dot_leader_l = @theme.toc_dot_leader_levels) == 'none' ? ::Set.new :
3864
- (dot_leader_l && dot_leader_l != 'all' ? dot_leader_l.to_s.split.map(&:to_i).to_set : (0..num_levels).to_set)),
3864
+ (dot_leader_l && dot_leader_l != 'all' ? dot_leader_l.to_s.split.map(&:to_i).to_set : nil)),
3865
3865
  text: (dot_leader_text = @theme.toc_dot_leader_content || DotLeaderTextDefault),
3866
3866
  width: dot_leader_text.empty? ? 0 : (rendered_width_of_string dot_leader_text),
3867
3867
  # TODO: spacer gives a little bit of room between dots and page number
@@ -3935,7 +3935,7 @@ module Asciidoctor
3935
3935
  end_cursor = cursor
3936
3936
  move_cursor_to start_cursor
3937
3937
  # NOTE: we're guaranteed to be on the same page as the final line of the entry
3938
- if dot_leader[:width] > 0 && (dot_leader[:levels].include? entry_level.pred)
3938
+ if dot_leader[:width] > 0 && (dot_leader[:levels] ? (dot_leader[:levels].include? entry_level.pred) : true)
3939
3939
  pgnum_label_width = rendered_width_of_string pgnum_label
3940
3940
  pgnum_label_font_settings = { color: @font_color, font: font_family, size: @font_size, styles: font_styles }
3941
3941
  save_font do
@@ -4909,7 +4909,7 @@ module Asciidoctor
4909
4909
  end
4910
4910
 
4911
4911
  def init_float_box _node, block_width, block_height, float_to
4912
- gap = ::Array === (gap = @theme.image_float_gap) ? gap.dup : [gap, gap]
4912
+ gap = ::Array === (gap = @theme.image_float_gap) ? (gap.drop 0) : [gap, gap]
4913
4913
  float_w = block_width + (gap[0] ||= 12)
4914
4914
  float_h = block_height + (gap[1] ||= 6)
4915
4915
  box_l = bounds.left + (float_to == 'right' ? 0 : float_w)
@@ -13,6 +13,10 @@ Asciidoctor::AbstractBlock.prepend (Module.new do
13
13
  blocks[-1]
14
14
  end
15
15
 
16
+ def first_child?
17
+ self == parent.blocks[0]
18
+ end
19
+
16
20
  def last_child?
17
21
  self == parent.blocks[-1]
18
22
  end
@@ -1002,9 +1002,16 @@ module Asciidoctor
1002
1002
  # start_new_page. Using start_new_page can mangle the calculation of content block's extent.
1003
1003
  #
1004
1004
  def arrange_block node, &block
1005
- keep_together = (node.option? 'unbreakable') && !at_page_top?
1005
+ if at_page_top?
1006
+ at_top = true
1007
+ else
1008
+ at_top = true if node.first_child? && (node.parent.attr? 'pdf-at-top')
1009
+ keep_together = true if node.option? 'unbreakable'
1010
+ end
1011
+ node.set_attr 'pdf-at-top', '' if at_top
1006
1012
  doc = node.document
1007
1013
  block_for_scratch = proc do
1014
+ at_top = node.set_attr 'pdf-at-top', '' if !at_top && at_page_top?
1008
1015
  push_scratch doc
1009
1016
  instance_exec(&block)
1010
1017
  ensure
@@ -1012,6 +1019,8 @@ module Asciidoctor
1012
1019
  end
1013
1020
  extent = dry_run keep_together: keep_together, onto: [self, keep_together], &block_for_scratch
1014
1021
  scratch? ? block_for_scratch.call : (yield extent)
1022
+ ensure
1023
+ node.remove_attr 'pdf-at-top' if at_top
1015
1024
  end
1016
1025
 
1017
1026
  # This method installs an on_page_create_callback that stops processing if the first page is
@@ -7,6 +7,7 @@ class Prawn::Font::AFM
7
7
  ?\u200b => '',
8
8
  ?\u202f => ?\u00a0,
9
9
  ?\u2009 => ' ',
10
+ ?\u2063 => ?\u00ad,
10
11
  ?\u25e6 => '-',
11
12
  ?\u25aa => ?\u00b7,
12
13
  }
@@ -32,21 +32,26 @@ Prawn::Text::Formatted::Box.prepend (Module.new do
32
32
  end
33
33
  end
34
34
 
35
- # TODO: remove when upgrading to prawn-2.5.0
35
+ # help Prawn correctly resolve which font to analyze, including the font style
36
36
  def analyze_glyphs_for_fallback_font_support fragment_hash
37
37
  fragment_font = fragment_hash[:font] || (original_font = @document.font.family)
38
+ effective_font_styles = @document.font_styles
39
+ fragment_font_opts = {}
38
40
  if (fragment_font_styles = fragment_hash[:styles])
39
- if fragment_font_styles.include? :bold
40
- fragment_font_opts = { style: (fragment_font_styles.include? :italic) ? :bold_italic : :bold }
41
- elsif fragment_font_styles.include? :italic
42
- fragment_font_opts = { style: :italic }
41
+ effective_font_styles.merge fragment_font_styles
42
+ if effective_font_styles.include? :bold
43
+ fragment_font_opts[:style] = (effective_font_styles.include? :italic) ? :bold_italic : :bold
44
+ elsif effective_font_styles.include? :italic
45
+ fragment_font_opts[:style] = :italic
43
46
  end
47
+ elsif !effective_font_styles.empty?
48
+ fragment_font_opts[:style] = @document.resolve_font_style effective_font_styles
44
49
  end
45
- fallback_fonts = @fallback_fonts.dup
50
+ fallback_fonts = @fallback_fonts.drop 0
46
51
  font_glyph_pairs = []
47
52
  @document.save_font do
48
53
  fragment_hash[:text].each_char do |char|
49
- font_glyph_pairs << [(find_font_for_this_glyph char, fragment_font, fragment_font_opts || {}, fallback_fonts.dup), char]
54
+ font_glyph_pairs << [(find_font_for_this_glyph char, fragment_font, fragment_font_opts, (fallback_fonts.drop 0)), char]
50
55
  end
51
56
  end
52
57
  # NOTE: don't add a :font to fragment if it wasn't there originally
@@ -61,7 +66,7 @@ Prawn::Text::Formatted::Box.prepend (Module.new do
61
66
  current_font
62
67
  elsif fallback_fonts_to_check.empty?
63
68
  if logger.info? && !doc.scratch?
64
- fonts_checked = @fallback_fonts.dup.unshift original_font
69
+ fonts_checked = [original_font].concat @fallback_fonts
65
70
  missing_chars = (doc.instance_variable_defined? :@missing_chars) ?
66
71
  (doc.instance_variable_get :@missing_chars) : (doc.instance_variable_set :@missing_chars, {})
67
72
  previous_fonts_checked = (missing_chars[char] ||= [])
@@ -136,7 +136,7 @@ module Rouge
136
136
  fragment[:color] = fg
137
137
  end
138
138
  if style_rules[:bold]
139
- fragment[:styles] = style_rules[:italic] ? BoldItalicStyle.dup : BoldStyle.dup
139
+ fragment[:styles] = (style_rules[:italic] ? BoldItalicStyle : BoldStyle).dup
140
140
  elsif style_rules[:italic]
141
141
  fragment[:styles] = ItalicStyle.dup
142
142
  end
@@ -379,7 +379,7 @@ module Asciidoctor
379
379
  if fragment
380
380
  fragment = fragment.dup
381
381
  fragment[:styles] = fragment[:styles].dup if fragment.key? :styles
382
- fragment[:callback] = fragment[:callback].dup if fragment.key? :callback
382
+ fragment[:callback] = fragment[:callback].drop 0 if fragment.key? :callback
383
383
  else
384
384
  fragment = {}
385
385
  end
@@ -11,7 +11,7 @@ File.singleton_class.alias_method :exists?, :exist? unless File.respond_to? :exi
11
11
 
12
12
  RGhost::GSAlone.prepend (Module.new do
13
13
  def initialize params, debug
14
- (@params = params.dup).push(*(@params.pop.split File::PATH_SEPARATOR))
14
+ (@params = params.drop 0).push(*(@params.pop.split File::PATH_SEPARATOR))
15
15
  @debug = debug
16
16
  end
17
17
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module PDF
5
- VERSION = '2.3.9'
5
+ VERSION = '2.3.10'
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.9
4
+ version: 2.3.10
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-06-28 00:00:00.000000000 Z
12
+ date: 2023-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: asciidoctor