asciidoctor-pdf 1.6.0 → 1.6.1

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: 9eb29c07e685f0e9311739976e4acf42e1715c321e5ba839a165555c6837b38d
4
- data.tar.gz: c8df7e1c5f122da8cada51fcfc5839198e9ae0763cb67c2804042654f753c782
3
+ metadata.gz: 38535fd62633525b00cea5277158ac23dbbd1bf515ee577ff867d7a498149b19
4
+ data.tar.gz: 24b2f3f50bb62f71416ce783fdd173e7574680ca445e4cd724f265086b2e8978
5
5
  SHA512:
6
- metadata.gz: 517992eee9855bc16ab8d08a5a6f90f664b38fcfe3cb05d1577154653a9b60ecd171d6e364285ccce25f07605f8ce735ece3983995aa7769a904e753a3be2722
7
- data.tar.gz: 02de3635d132c68a200f01c633881c6827dbe3eab00e111e7a4a4bf507e58bcdb59dabc438cd0d763981cdb8ba6241d8d81a78a32760d135985f244221b11a83
6
+ metadata.gz: cb5e3a7117b597b3cc2f31ee013adbbf2415d6fa36893b5375e6a2aabffcdff456c72ecce0800a1cff43a637259c1c94321338fc626bb936c38841ce87909015
7
+ data.tar.gz: 7a18ab5e3d91cd6c9e1a99d2bd6885beaf329a249144e82a37fbfecbd784aae3758760c9695a82ef44304c951892d76113aad6737c11f720f888a552f00e18ab
data/CHANGELOG.adoc CHANGED
@@ -5,6 +5,16 @@
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 {uri-repo}/commits/v1.6.x[commit history] on GitHub.
7
7
 
8
+ == 1.6.1 (2021-09-04) - @mojavelinux
9
+
10
+ Enhancements::
11
+
12
+ * align footnotes block to the bottom of the page it is placed on (#1833)
13
+
14
+ Bug Fixes::
15
+
16
+ * patch Prawn to preserve leading null character when running on Ruby 3; preserves inline anchors when text is split by page (#1963)
17
+
8
18
  == 1.6.0 (2021-05-10) - @mojavelinux
9
19
 
10
20
  Enhancements::
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
- v1.6.0, 2021-05-10
3
+ v1.6.1, 2021-09-04
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: 1.6.x
27
- :release-version: 1.6.0
27
+ :release-version: 1.6.1
28
28
  // URIs:
29
29
  :url-asciidoctor: http://asciidoctor.org
30
30
  :url-gem: http://rubygems.org/gems/asciidoctor-pdf
@@ -134,7 +134,7 @@ If you want to <<Enable Stream Compression,optimize the pdf>> using rghost or he
134
134
 
135
135
  or the hexapdf gem:
136
136
 
137
- $ gem install hexpadf
137
+ $ gem install hexapdf
138
138
 
139
139
  Similarly, if you want to use the hyphen option you will need to install the `text-hyphen` gem:
140
140
 
@@ -5409,12 +5409,12 @@ You may need to scale the glyph so it fits properly in the art box.
5409
5409
  IMPORTANT: If you're copying a non-visible character, be sure to set the width to 0 using menu:Metrics[Set Width...], enter 0 into *Set Width To*, then click btn:[OK].
5410
5410
 
5411
5411
  When you're done, save the font with the old-style kern table enabled.
5412
- To do so, select menu:File[Generate Fonts...], click btn:[Options], and make sure only the following options are selected (equivalent to the flags 0x90 + 0x08):
5412
+ To do so, select menu:File[Generate Fonts...], select *TrueType*, click btn:[Options], make sure _only_ the following options are checked (equivalent to the flags 0x90 + 0x08):
5413
5413
 
5414
5414
  * [x] OpenType
5415
5415
  ** [x] Old style 'kern'
5416
5416
 
5417
- Then click btn:[Generate] to generate and save the font.
5417
+ Then click btn:[OK], then uncheck *Validate Before Saving*, and finally click btn:[Generate] to generate and save the font.
5418
5418
 
5419
5419
  Your font file is now ready to be used with Asciidoctor PDF.
5420
5420
 
@@ -607,13 +607,18 @@ module Asciidoctor
607
607
  def layout_footnotes node
608
608
  return if (fns = (doc = node.document).footnotes - @footnotes).empty?
609
609
  theme_margin :footnotes, :top
610
- theme_font :footnotes do
611
- (title = doc.attr 'footnotes-title') && (layout_caption title, category: :footnotes)
612
- item_spacing = @theme.footnotes_item_spacing || 0
613
- fns.each do |fn|
614
- layout_prose %(<a id="_footnotedef_#{index = fn.index}">#{DummyText}</a>[<a anchor="_footnoteref_#{index}">#{index}</a>] #{fn.text}), margin_bottom: item_spacing, hyphenate: true
610
+ with_dry_run do |box_height = nil|
611
+ if box_height && (delta = cursor - box_height) > 0
612
+ move_down delta
613
+ end
614
+ theme_font :footnotes do
615
+ (title = doc.attr 'footnotes-title') && (layout_caption title, category: :footnotes)
616
+ item_spacing = @theme.footnotes_item_spacing
617
+ fns.each do |fn|
618
+ layout_prose %(<a id="_footnotedef_#{index = fn.index}">#{DummyText}</a>[<a anchor="_footnoteref_#{index}">#{index}</a>] #{fn.text}), margin_bottom: item_spacing, hyphenate: true
619
+ end
620
+ @footnotes += fns unless scratch?
615
621
  end
616
- @footnotes += fns
617
622
  end
618
623
  nil
619
624
  end
@@ -76,6 +76,27 @@ module Asciidoctor
76
76
  reference_bounds.height
77
77
  end
78
78
 
79
+ # workaround for https://github.com/prawnpdf/prawn/issues/1121
80
+ def generate_margin_box
81
+ page_w, page_h = (page = state.page).dimensions.slice 2, 2
82
+ page_m = page.margins
83
+ prev_margin_box, @margin_box = @margin_box, (::Prawn::Document::BoundingBox.new self, nil, [page_m[:left], page_h - page_m[:top]], width: page_w - page_m[:left] - page_m[:right], height: page_h - page_m[:top] - page_m[:bottom])
84
+
85
+ # update bounding box if not flowing from the previous page
86
+ unless @bounding_box&.parent
87
+ prev_margin_box = @bounding_box
88
+ @bounding_box = @margin_box
89
+ end
90
+
91
+ # maintains indentation settings across page breaks
92
+ if prev_margin_box
93
+ @margin_box.add_left_padding prev_margin_box.total_left_padding
94
+ @margin_box.add_right_padding prev_margin_box.total_right_padding
95
+ end
96
+
97
+ nil
98
+ end
99
+
79
100
  # Set the margins for the current page.
80
101
  #
81
102
  def set_page_margin margin
@@ -882,6 +903,11 @@ module Asciidoctor
882
903
  [(whole_pages * full_page_height + partial_page_height), whole_pages, partial_page_height]
883
904
  end
884
905
 
906
+ def with_dry_run &block
907
+ total_height, = dry_run(&block)
908
+ instance_exec total_height, &block
909
+ end
910
+
885
911
  # Attempt to keep the objects generated in the block on the same page
886
912
  #
887
913
  # TODO: short-circuit nested usage
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ Prawn::Text::Formatted::Arranger.prepend (Module.new do
4
+ def initialize *_args
5
+ super
6
+ @dummy_text = ?\u0000
7
+ end
8
+
9
+ def next_string
10
+ if (string = super) == @dummy_text
11
+ def string.lstrip!; end
12
+ end
13
+ string
14
+ end
15
+ end)
@@ -4,6 +4,7 @@
4
4
  require_relative 'prawn/font_metric_cache'
5
5
  require_relative 'prawn/font/afm'
6
6
  require_relative 'prawn/images'
7
+ require_relative 'prawn/formatted_text/arranger'
7
8
  require_relative 'prawn/formatted_text/box'
8
9
  require_relative 'prawn/formatted_text/fragment'
9
10
  require_relative 'prawn/extensions'
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module PDF
5
- VERSION = '1.6.0'
5
+ VERSION = '1.6.1'
6
6
  end
7
7
  Pdf = PDF unless const_defined? :Pdf, false
8
8
  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: 1.6.0
4
+ version: 1.6.1
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: 2021-05-10 00:00:00.000000000 Z
12
+ date: 2021-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: asciidoctor
@@ -298,6 +298,7 @@ files:
298
298
  - lib/asciidoctor/pdf/ext/prawn/extensions.rb
299
299
  - lib/asciidoctor/pdf/ext/prawn/font/afm.rb
300
300
  - lib/asciidoctor/pdf/ext/prawn/font_metric_cache.rb
301
+ - lib/asciidoctor/pdf/ext/prawn/formatted_text/arranger.rb
301
302
  - lib/asciidoctor/pdf/ext/prawn/formatted_text/box.rb
302
303
  - lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb
303
304
  - lib/asciidoctor/pdf/ext/prawn/images.rb
@@ -349,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
350
  - !ruby/object:Gem::Version
350
351
  version: '0'
351
352
  requirements: []
352
- rubygems_version: 3.2.15
353
+ rubygems_version: 3.2.22
353
354
  signing_key:
354
355
  specification_version: 4
355
356
  summary: Converts AsciiDoc documents to PDF using Asciidoctor and Prawn