asciidoctor-pdf 2.3.10 → 2.3.11

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: 53465d3756b672a087912f7052c98da2174506d348ae415702b6ad0923c35887
4
- data.tar.gz: 81156616786953961b86a747720fdb1c92117a7645df0faba24b02e96bec4635
3
+ metadata.gz: f69f8ddf5bab91f37bd488a5d630c068f028d8d9f80e47ccbd601efeb23cfd4a
4
+ data.tar.gz: 2a66022080892dade89fdfab63e60d08e619ec0cf184a793267871464668cb53
5
5
  SHA512:
6
- metadata.gz: 73d88491443fdafb5086bf4a122c3910631e547ef118b4ff4b23dffcbb315d7fb21a7335fc41db778b0d11bf5f851d3cae9df1b838fa342d3e5cf73cbe0f259d
7
- data.tar.gz: cbd1fe371ed58d54c76770ef7abda45a080bb84dcbece1e5f60bda8a260668538ee5f71b92088b67ea71b9b29ed01cf6746fa9568a123366080a1e2fcdbb1c2e
6
+ metadata.gz: 81129fe018764cbf1a2caa7d34a4a9affaf1e69288252535f9082730a785a8e2daa93eb3aa640d3368c6780c094a275dca5269a11b487764909f3a503bf5dd30
7
+ data.tar.gz: c68746b1ebbb456fd4e501a5815c2e338ffc5f09ec896757efe83a261f54533c7d7f913b251208f7122e6decae21bd51ffcfcee01ddf67682756878c44781ea6
data/CHANGELOG.adoc CHANGED
@@ -5,6 +5,25 @@
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.11 (2024-01-23) - @mojavelinux
9
+
10
+ Enhancements::
11
+
12
+ * upgrade prawn-svg dependency to 0.33.x (PR #2469)
13
+
14
+ Improvements::
15
+
16
+ * extract shared `smallcaps` method from `TextTransform#smallcaps_pcdata` to make it easier to override
17
+ * assign node to `@node` instance variable on table instance to make it easer to access from Prawn::Table extension (#2471)
18
+
19
+ Bug Fixes::
20
+
21
+ * ensure color spaces are set on page before adding running content (#2477)
22
+
23
+ === Details
24
+
25
+ {url-repo}/releases/tag/v2.3.11[git tag] | {url-repo}/compare/v2.3.10\...v2.3.11[full diff]
26
+
8
27
  == 2.3.10 (2023-12-04) - @mojavelinux
9
28
 
10
29
  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.10, 2023-12-04
3
+ v2.3.11, 2024-01-23
4
4
  // Settings:
5
5
  :experimental:
6
6
  :idprefix:
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
38
38
  s.add_runtime_dependency 'matrix', '~> 0.4' # required until prawn >= 2.5.0 is released
39
39
  s.add_runtime_dependency 'prawn-table', '~> 0.2.0'
40
40
  s.add_runtime_dependency 'prawn-templates', '~> 0.1.0'
41
- s.add_runtime_dependency 'prawn-svg', '~> 0.32.0'
41
+ s.add_runtime_dependency 'prawn-svg', '~> 0.33.0'
42
42
  s.add_runtime_dependency 'prawn-icon', '~> 3.0.0'
43
43
  s.add_runtime_dependency 'concurrent-ruby', '~> 1.1'
44
44
  s.add_runtime_dependency 'treetop', '~> 1.6.0'
@@ -166,6 +166,7 @@ module Asciidoctor
166
166
  doc.attributes['outline-title'] = '' if doc.attr_unspecified? 'outline-title'
167
167
  doc.attributes['pagenums'] = '' if doc.attr_unspecified? 'pagenums'
168
168
 
169
+ # NOTE: & prefix required here to pass resolved method as block of on_page_create method
169
170
  on_page_create(&(method :init_page).curry[doc])
170
171
 
171
172
  marked_page_number = page_number
@@ -632,7 +633,7 @@ module Asciidoctor
632
633
  return convert_abstract sect
633
634
  elsif (index_section = sectname == 'index') && @index.empty?
634
635
  # override numbered_title to hide entry from TOC
635
- sect.define_singleton_method :numbered_title, &->(*) { '' }
636
+ sect.define_singleton_method :numbered_title, ->(*) { '' }
636
637
  return
637
638
  end
638
639
  title = sect.numbered_title formal: true
@@ -1809,9 +1810,6 @@ module Asciidoctor
1809
1810
  rendered_w = (svg_obj.resize height: (rendered_h = available_h)).output_width if rendered_h > available_h
1810
1811
  end
1811
1812
  add_dest_for_block node if node.id
1812
- # NOTE: workaround to fix Prawn not adding fill and stroke commands on page that only has an image;
1813
- # breakage occurs when running content (stamps) are added to page
1814
- update_colors if graphic_state.color_space.empty?
1815
1813
  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?
1816
1814
  image_y = y
1817
1815
  # NOTE: prawn-svg does not compute :at for alignment correctly in column box, so resort to our own logic
@@ -1851,9 +1849,6 @@ module Asciidoctor
1851
1849
  rendered_w = (image_info.calc_image_dimensions height: (rendered_h = available_h))[0] if rendered_h > available_h
1852
1850
  end
1853
1851
  add_dest_for_block node if node.id
1854
- # NOTE: workaround to fix Prawn not adding fill and stroke commands on page that only has an image;
1855
- # breakage occurs when running content (stamps) are added to page
1856
- update_colors if graphic_state.color_space.empty?
1857
1852
  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
1853
  image_y = y
1859
1854
  left = bounds.left
@@ -2268,6 +2263,7 @@ module Asciidoctor
2268
2263
 
2269
2264
  left_padding = right_padding = nil
2270
2265
  table table_data, table_settings do
2266
+ instance_variable_set :@node, node
2271
2267
  # NOTE: cell_style must be applied manually to be compatible with both prawn-table 0.2.2 and prawn-table 0.2.3
2272
2268
  cells.style cell_style
2273
2269
  @column_widths = column_widths unless column_widths.empty?
@@ -3590,7 +3586,16 @@ module Asciidoctor
3590
3586
 
3591
3587
  pagenums_enabled = doc.attr? 'pagenums'
3592
3588
  periphery_layout_cache = {}
3593
- # NOTE: this block is invoked during PDF generation, after #write -> #render_file and thus after #convert_document
3589
+ # NOTE: Prawn fails to properly set color spaces on empty pages, but repeater relies on them
3590
+ # prefer simpler fix below call to repeat; keep this workaround in case that workaround stops working
3591
+ #(content_start_page_number..num_pages).each do |pgnum|
3592
+ # next if (disable_on_pages.include? pgnum) || (pg = state.pages[pgnum - 1]).imported_page? || !pg.graphic_state.color_space.empty?
3593
+ # go_to_page pgnum
3594
+ # set_color_space :fill, (color_space graphic_state.fill_color)
3595
+ # set_color_space :stroke, (color_space graphic_state.stroke_color)
3596
+ #end
3597
+ #go_to_page content_start_page_number if page_number != content_start_page_number
3598
+ # NOTE: this block is invoked during PDF generation, during call to #write -> #render_file and thus after #convert_document
3594
3599
  repeat (content_start_page_number..num_pages), dynamic: true do
3595
3600
  pgnum = page_number
3596
3601
  # NOTE: don't write on pages which are imported / inserts (otherwise we can get a corrupt PDF)
@@ -3701,7 +3706,12 @@ module Asciidoctor
3701
3706
  end
3702
3707
  end
3703
3708
  end
3704
-
3709
+ # NOTE: force repeater to consult color spaces on current page instead of the page on which repeater was created
3710
+ # if this stops working, use the commented code above repeat call instead
3711
+ unless (repeater_graphic_state = repeaters[-1].instance_variable_get :@graphic_state).singleton_methods.include? :color_space
3712
+ # NOTE: must convert override method to proc since we're are changing bind argument
3713
+ repeater_graphic_state.define_singleton_method :color_space, (method :page_color_space).to_proc
3714
+ end
3705
3715
  go_to_page prev_page_number
3706
3716
  nil
3707
3717
  end
@@ -4382,7 +4392,6 @@ module Asciidoctor
4382
4392
 
4383
4393
  def start_new_chapter chapter
4384
4394
  start_new_page unless at_page_top?
4385
- # TODO: must call update_colors before advancing to next page if start_new_page is called in ink_chapter_title
4386
4395
  start_new_page if @ppbook && verso_page? && !(chapter.option? 'nonfacing')
4387
4396
  end
4388
4397
 
@@ -5062,6 +5071,10 @@ module Asciidoctor
5062
5071
  nil
5063
5072
  end
5064
5073
 
5074
+ def page_color_space
5075
+ page.graphic_state.color_space
5076
+ end
5077
+
5065
5078
  def remove_tmp_files
5066
5079
  @tmp_files.reject! {|_, path| path ? (unlink_tmp_file path) : true }
5067
5080
  end
@@ -59,12 +59,16 @@ module Asciidoctor
59
59
 
60
60
  def smallcaps_pcdata string
61
61
  if XMLMarkupRx.match? string
62
- string.gsub(PCDATAFilterRx) { $2 ? ($2.tr LowerAlphaChars, SmallCapsChars) : $1 }
62
+ string.gsub(PCDATAFilterRx) { $2 ? (smallcaps $2) : $1 }
63
63
  else
64
- string.tr LowerAlphaChars, SmallCapsChars
64
+ smallcaps string
65
65
  end
66
66
  end
67
67
 
68
+ def smallcaps string
69
+ string.tr LowerAlphaChars, SmallCapsChars
70
+ end
71
+
68
72
  # Apply the text transform to the specified text.
69
73
  #
70
74
  # Supported transform values are "uppercase", "lowercase", or "none" (passed
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module PDF
5
- VERSION = '2.3.10'
5
+ VERSION = '2.3.11'
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.10
4
+ version: 2.3.11
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-04 00:00:00.000000000 Z
12
+ date: 2024-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: asciidoctor
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 0.32.0
90
+ version: 0.33.0
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 0.32.0
97
+ version: 0.33.0
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: prawn-icon
100
100
  requirement: !ruby/object:Gem::Requirement