asciidoctor-pdf 2.3.0 → 2.3.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 +4 -4
- data/CHANGELOG.adoc +21 -0
- data/README.adoc +4 -4
- data/asciidoctor-pdf.gemspec +1 -1
- data/lib/asciidoctor/pdf/converter.rb +11 -11
- data/lib/asciidoctor/pdf/ext/asciidoctor/section.rb +7 -4
- data/lib/asciidoctor/pdf/ext/prawn/extensions.rb +6 -15
- data/lib/asciidoctor/pdf/formatted_text/transform.rb +4 -2
- data/lib/asciidoctor/pdf/optimizer.rb +1 -0
- data/lib/asciidoctor/pdf/theme_loader.rb +1 -0
- data/lib/asciidoctor/pdf/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d88e98bb4e7e4afe22f1911c28813edbfe65af757b2cfb5899c754aa811ac12
|
4
|
+
data.tar.gz: 931e8ad9378ec457be0566cae2a43d5dddce06d5f821251bf842fc429b689a08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b530895e85531f879ad2bf1b8672281e0bc4af53cba666817d5d01349022fc0beaffe758b9def65e82db79f7e86c6bed9fcb70688e65ada7ecb993b5597f748
|
7
|
+
data.tar.gz: d97b859cccfb0ff54e65f4ccae7fc4a604c3ccb33a2727d08e2a523896ec045777999397ee506959173b404d13d2b253456943ef93b390f192ed831f4418a170
|
data/CHANGELOG.adoc
CHANGED
@@ -5,6 +5,27 @@
|
|
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.1 (2022-09-17) - @mojavelinux
|
9
|
+
|
10
|
+
Improvements::
|
11
|
+
|
12
|
+
* provide a fallback value for `base-font-size` when loading theme (#2343)
|
13
|
+
|
14
|
+
Bug Fixes::
|
15
|
+
|
16
|
+
* fix crash when smallcaps text transform is applied to a phrase (#2339)
|
17
|
+
* don't add chapter signifier if `chapter-signifier` is unset (#2328)
|
18
|
+
* don't add part signifier if `part-signifier` is unset (#2328)
|
19
|
+
* don't include bottom margin when computing heading height if `heading-min-height-after` theme key is empty (#2326)
|
20
|
+
* draw border on heading (section title or discrete heading) if it is advanced to next page (#2322)
|
21
|
+
* arrange heading even if section is empty
|
22
|
+
* ensure `heading-min-height-after` theme key is ignored if section is empty or discrete heading is last child
|
23
|
+
* don't force justify first line of abstract if it ends with a hard break
|
24
|
+
|
25
|
+
=== Details
|
26
|
+
|
27
|
+
{url-repo}/releases/tag/v2.3.1[git tag] | {url-repo}/compare/v2.3.0\...v2.3.1[full diff]
|
28
|
+
|
8
29
|
== 2.3.0 (2022-08-16) - @mojavelinux
|
9
30
|
|
10
31
|
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
|
-
v2.3.
|
3
|
+
v2.3.1, 2022-09-17
|
4
4
|
// Settings:
|
5
5
|
:experimental:
|
6
6
|
:idprefix:
|
@@ -37,9 +37,9 @@ image:{url-project-repo}/workflows/CI/badge.svg[Build Status (GitHub Actions),li
|
|
37
37
|
image:https://img.shields.io/gem/v/asciidoctor-pdf.svg[Latest Release, link={url-gem}]
|
38
38
|
endif::[]
|
39
39
|
|
40
|
-
Asciidoctor PDF is a native PDF converter for AsciiDoc that
|
41
|
-
It bypasses the
|
42
|
-
Instead, you
|
40
|
+
Asciidoctor PDF is a native PDF converter for AsciiDoc that serves the `pdf` backend.
|
41
|
+
It bypasses the step of generating an intermediary format such as DocBook, Apache FO, or LaTeX in order to produce PDF.
|
42
|
+
Instead, you use Asciidoctor PDF to convert your documents directly from AsciiDoc to PDF with Asciidoctor.
|
43
43
|
The aim of this library is to take the pain out of creating PDF documents from AsciiDoc.
|
44
44
|
|
45
45
|
[NOTE]
|
data/asciidoctor-pdf.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.name = 'asciidoctor-pdf'
|
9
9
|
s.version = Asciidoctor::PDF::VERSION
|
10
10
|
s.summary = 'Converts AsciiDoc documents to PDF using Asciidoctor and Prawn'
|
11
|
-
s.description = 'An
|
11
|
+
s.description = 'An add-on converter for Asciidoctor that converts AsciiDoc documents to PDF using the Prawn PDF generation library.'
|
12
12
|
s.authors = ['Dan Allen', 'Sarah White']
|
13
13
|
s.email = 'dan@opendevise.com'
|
14
14
|
s.homepage = 'https://asciidoctor.org/docs/asciidoctor-pdf'
|
@@ -630,7 +630,6 @@ module Asciidoctor
|
|
630
630
|
sect.remove
|
631
631
|
return
|
632
632
|
end
|
633
|
-
|
634
633
|
title = sect.numbered_title formal: true
|
635
634
|
sep = (sect.attr 'separator') || (sect.document.attr 'title-separator') || ''
|
636
635
|
if !sep.empty? && (title.include? (sep = %(#{sep} )))
|
@@ -655,7 +654,7 @@ module Asciidoctor
|
|
655
654
|
start_new_chapter sect
|
656
655
|
end
|
657
656
|
end
|
658
|
-
arrange_heading sect, title, hopts unless hidden || started_new || at_page_top?
|
657
|
+
arrange_heading sect, title, hopts unless hidden || started_new || at_page_top?
|
659
658
|
# QUESTION: should we store pdf-page-start, pdf-anchor & pdf-destination in internal map?
|
660
659
|
sect.set_attr 'pdf-page-start', (start_pgnum = page_number)
|
661
660
|
# QUESTION: should we just assign the section this generated id?
|
@@ -881,8 +880,7 @@ module Asciidoctor
|
|
881
880
|
if (doc = node.document).attr? 'icons'
|
882
881
|
if !(has_icon = node.attr? 'icon') && (doc.attr 'icons') == 'font'
|
883
882
|
icons = 'font'
|
884
|
-
|
885
|
-
icon_data = admonition_icon_data label_text
|
883
|
+
icon_data = admonition_icon_data type.to_sym
|
886
884
|
icon_size = icon_data[:size] || 24
|
887
885
|
label_width = label_min_width || (icon_size * 1.5)
|
888
886
|
elsif (icon_path = has_icon || !(icon_path = (@theme[%(admonition_icon_#{type})] || {})[:image]) ?
|
@@ -2848,13 +2846,15 @@ module Asciidoctor
|
|
2848
2846
|
advance_page if orphaned
|
2849
2847
|
else
|
2850
2848
|
theme_font :heading, level: (hlevel = opts[:level]) do
|
2849
|
+
if (space_below = ::Numeric === min_height_after ? min_height_after : 0) > 0 && (node.context == :section ? node.blocks? : !node.last_child?)
|
2850
|
+
space_below += @theme[%(heading_h#{hlevel}_margin_bottom)] || @theme.heading_margin_bottom
|
2851
|
+
else
|
2852
|
+
space_below = 0
|
2853
|
+
end
|
2851
2854
|
h_padding_t, h_padding_r, h_padding_b, h_padding_l = expand_padding_value @theme[%(heading_h#{hlevel}_padding)]
|
2852
2855
|
h_fits = indent h_padding_l, h_padding_r do
|
2853
|
-
|
2854
|
-
(@theme[%(heading_h#{hlevel}_margin_top)] || @theme.heading_margin_top) +
|
2855
|
-
(@theme[%(heading_h#{hlevel}_margin_bottom)] || @theme.heading_margin_bottom) + h_padding_t + h_padding_b
|
2856
|
-
heading_h += min_height_after if min_height_after && (node.context == :section ? node.blocks? : !node.last_child?)
|
2857
|
-
cursor >= heading_h
|
2856
|
+
cursor >= (height_of_typeset_text title, inline_format: true, text_transform: @text_transform) +
|
2857
|
+
h_padding_t + h_padding_b + (@theme[%(heading_h#{hlevel}_margin_top)] || @theme.heading_margin_top) + space_below
|
2858
2858
|
end
|
2859
2859
|
advance_page unless h_fits
|
2860
2860
|
end
|
@@ -3248,8 +3248,8 @@ module Asciidoctor
|
|
3248
3248
|
align: @base_text_align.to_sym,
|
3249
3249
|
}.merge(opts)
|
3250
3250
|
end
|
3251
|
-
if h_category && @theme[%(#{h_category}_border_width)] &&
|
3252
|
-
|
3251
|
+
if h_category && @theme[%(#{h_category}_border_width)] && (@theme[%(#{h_category}_border_color)] || @theme.base_border_color)
|
3252
|
+
start_cursor = bounds.top unless page_number == start_page_number
|
3253
3253
|
float do
|
3254
3254
|
bounding_box [bounds.left, start_cursor], width: bounds.width, height: start_cursor - cursor do
|
3255
3255
|
theme_fill_and_stroke_bounds h_category
|
@@ -4,16 +4,19 @@ class Asciidoctor::Section
|
|
4
4
|
def numbered_title opts = {}
|
5
5
|
@cached_numbered_title ||= nil
|
6
6
|
unless @cached_numbered_title
|
7
|
-
|
7
|
+
doc = @document
|
8
|
+
if @numbered && !@caption && (slevel = @level) <= (doc.attr 'sectnumlevels', 3).to_i
|
8
9
|
@is_numbered = true
|
9
|
-
if
|
10
|
+
if doc.doctype == 'book'
|
10
11
|
case slevel
|
11
12
|
when 0
|
12
13
|
@cached_numbered_title = %(#{sectnum nil, ':'} #{title})
|
13
|
-
|
14
|
+
signifier = doc.attributes['part-signifier'] || ((doc.attr_unspecified? 'part-signifier') ? 'Part' : '')
|
15
|
+
@cached_formal_numbered_title = %(#{signifier}#{signifier.empty? ? '' : ' '}#{@cached_numbered_title})
|
14
16
|
when 1
|
15
17
|
@cached_numbered_title = %(#{sectnum} #{title})
|
16
|
-
|
18
|
+
signifier = doc.attributes['chapter-signifier'] || ((doc.attr_unspecified? 'chapter-signifier') ? 'Chapter' : '')
|
19
|
+
@cached_formal_numbered_title = %(#{signifier}#{signifier.empty? ? '' : ' '}#{@cached_numbered_title})
|
17
20
|
else
|
18
21
|
@cached_formal_numbered_title = @cached_numbered_title = %(#{sectnum} #{title})
|
19
22
|
end
|
@@ -500,22 +500,13 @@ module Asciidoctor
|
|
500
500
|
end
|
501
501
|
if first_line_text_transform
|
502
502
|
# NOTE: applying text transform here could alter the wrapping, so isolate first line and shrink it to fit
|
503
|
-
|
504
|
-
|
505
|
-
original_fragments, fragments = fragments, []
|
506
|
-
original_fragments.reduce '' do |traced, fragment|
|
507
|
-
fragments << fragment
|
508
|
-
# NOTE: we could just do a length comparison here
|
509
|
-
if (traced += fragment[:text]).start_with? first_line_text
|
510
|
-
fragment[:text] = fragment[:text][0...-(traced.length - first_line_text.length)]
|
511
|
-
break
|
512
|
-
end
|
513
|
-
traced
|
514
|
-
end
|
515
|
-
end
|
516
|
-
fragments.each {|fragment| fragment[:text] = transform_text fragment[:text], first_line_text_transform }
|
503
|
+
first_line_fragments = (box.instance_variable_get :@arranger).consumed
|
504
|
+
fragments = first_line_fragments.map {|fragment| fragment.merge text: (transform_text fragment[:text], first_line_text_transform) }
|
517
505
|
first_line_options[:overflow] = :shrink_to_fit
|
518
|
-
|
506
|
+
if remaining_fragments
|
507
|
+
@final_gap = true
|
508
|
+
first_line_options[:force_justify] = true if first_line_options[:align] == :justify && first_line_fragments[-1][:text] != ?\n
|
509
|
+
end
|
519
510
|
end
|
520
511
|
if text_indent
|
521
512
|
indent(text_indent) { fill_formatted_text_box fragments, first_line_options }
|
@@ -176,8 +176,10 @@ module Asciidoctor
|
|
176
176
|
end
|
177
177
|
if (text_transform = fragment.delete :text_transform)
|
178
178
|
text = (text_chunks = extract_text pcdata).join
|
179
|
-
|
180
|
-
restore_text pcdata, text_chunks.each_with_object
|
179
|
+
chars = (StringIO.new transform_text text, text_transform).each_char
|
180
|
+
restore_text pcdata, (text_chunks.each_with_object [] do |chunk, accum|
|
181
|
+
accum << chunk.length.times.map { chars.next }.join
|
182
|
+
end)
|
181
183
|
end
|
182
184
|
# NOTE: decorate child fragments with inherited properties from this element
|
183
185
|
apply pcdata, fragments, fragment
|
@@ -83,6 +83,7 @@ module Asciidoctor
|
|
83
83
|
theme_data.base_text_align ||= 'left'
|
84
84
|
theme_data.base_line_height ||= 1
|
85
85
|
theme_data.base_font_color ||= '000000'
|
86
|
+
theme_data.base_font_size ||= 12
|
86
87
|
theme_data.code_font_family ||= (theme_data.codespan_font_family || 'Courier')
|
87
88
|
theme_data.conum_font_family ||= (theme_data.codespan_font_family || 'Courier')
|
88
89
|
if (heading_font_family = theme_data.heading_font_family)
|
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.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: 2022-
|
12
|
+
date: 2022-09-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: asciidoctor
|
@@ -193,8 +193,8 @@ dependencies:
|
|
193
193
|
- - "~>"
|
194
194
|
- !ruby/object:Gem::Version
|
195
195
|
version: 1.4.0
|
196
|
-
description: An
|
197
|
-
using the Prawn PDF library.
|
196
|
+
description: An add-on converter for Asciidoctor that converts AsciiDoc documents
|
197
|
+
to PDF using the Prawn PDF generation library.
|
198
198
|
email: dan@opendevise.com
|
199
199
|
executables:
|
200
200
|
- asciidoctor-pdf
|