asciidoctor-pdf 1.5.0.beta.1 → 1.5.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +26 -0
- data/README.adoc +2 -2
- data/asciidoctor-pdf.gemspec +3 -3
- data/bin/asciidoctor-pdf +1 -0
- data/data/fonts/ABOUT-mplus1mn-subset +24 -0
- data/data/fonts/ABOUT-mplus1p-subset +25 -0
- data/data/fonts/ABOUT-notoserif-subset +25 -0
- data/data/fonts/{LICENSE-mplus-testflight-58 → LICENSE-mplus} +2 -2
- data/data/fonts/{LICENSE-noto-2015-06-05 → LICENSE-notoserif} +0 -0
- data/data/fonts/mplus1mn-bold-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-bold-subset.ttf +0 -0
- data/data/fonts/mplus1mn-bold_italic-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-bold_italic-subset.ttf +0 -0
- data/data/fonts/mplus1mn-italic-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-italic-subset.ttf +0 -0
- data/data/fonts/mplus1mn-regular-ascii-conums.ttf +0 -0
- data/data/fonts/mplus1mn-regular-subset.ttf +0 -0
- data/data/fonts/mplus1p-regular-fallback.ttf +0 -0
- data/data/fonts/notoserif-bold-subset.ttf +0 -0
- data/data/fonts/notoserif-bold_italic-subset.ttf +0 -0
- data/data/fonts/notoserif-italic-subset.ttf +0 -0
- data/data/fonts/notoserif-regular-subset.ttf +0 -0
- data/data/themes/base-theme.yml +8 -1
- data/data/themes/default-theme.yml +22 -7
- data/data/themes/default-with-fallback-font-theme.yml +4 -4
- data/docs/theming-guide.adoc +459 -44
- data/lib/asciidoctor-pdf.rb +1 -0
- data/lib/asciidoctor-pdf/asciidoctor_ext.rb +1 -0
- data/lib/asciidoctor-pdf/asciidoctor_ext/abstract_block.rb +1 -0
- data/lib/asciidoctor-pdf/asciidoctor_ext/document.rb +1 -0
- data/lib/asciidoctor-pdf/asciidoctor_ext/image.rb +1 -0
- data/lib/asciidoctor-pdf/asciidoctor_ext/list.rb +1 -0
- data/lib/asciidoctor-pdf/asciidoctor_ext/list_item.rb +1 -0
- data/lib/asciidoctor-pdf/asciidoctor_ext/logging_shim.rb +1 -0
- data/lib/asciidoctor-pdf/asciidoctor_ext/section.rb +1 -0
- data/lib/asciidoctor-pdf/converter.rb +227 -137
- data/lib/asciidoctor-pdf/core_ext.rb +1 -0
- data/lib/asciidoctor-pdf/core_ext/array.rb +1 -0
- data/lib/asciidoctor-pdf/core_ext/hash.rb +1 -0
- data/lib/asciidoctor-pdf/core_ext/numeric.rb +1 -0
- data/lib/asciidoctor-pdf/core_ext/object.rb +1 -0
- data/lib/asciidoctor-pdf/core_ext/quantifiable_stdout.rb +1 -0
- data/lib/asciidoctor-pdf/core_ext/regexp.rb +1 -0
- data/lib/asciidoctor-pdf/core_ext/string.rb +1 -0
- data/lib/asciidoctor-pdf/formatted_text.rb +1 -0
- data/lib/asciidoctor-pdf/formatted_text/formatter.rb +1 -0
- data/lib/asciidoctor-pdf/formatted_text/inline_destination_marker.rb +1 -0
- data/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb +2 -1
- data/lib/asciidoctor-pdf/formatted_text/inline_image_renderer.rb +1 -0
- data/lib/asciidoctor-pdf/formatted_text/inline_text_aligner.rb +1 -0
- data/lib/asciidoctor-pdf/formatted_text/parser.rb +19 -6
- data/lib/asciidoctor-pdf/formatted_text/parser.treetop +2 -3
- data/lib/asciidoctor-pdf/formatted_text/text_background_and_border_renderer.rb +1 -0
- data/lib/asciidoctor-pdf/formatted_text/transform.rb +51 -3
- data/lib/asciidoctor-pdf/implicit_header_processor.rb +1 -0
- data/lib/asciidoctor-pdf/index_catalog.rb +1 -0
- data/lib/asciidoctor-pdf/measurements.rb +1 -0
- data/lib/asciidoctor-pdf/pdf-core_ext.rb +1 -0
- data/lib/asciidoctor-pdf/pdf-core_ext/page.rb +26 -0
- data/lib/asciidoctor-pdf/pdf-core_ext/pdf_object.rb +1 -0
- data/lib/asciidoctor-pdf/pdfmark.rb +1 -0
- data/lib/asciidoctor-pdf/prawn-svg_ext.rb +1 -0
- data/lib/asciidoctor-pdf/prawn-svg_ext/interface.rb +1 -0
- data/lib/asciidoctor-pdf/prawn-table_ext.rb +1 -0
- data/lib/asciidoctor-pdf/prawn-table_ext/cell.rb +1 -0
- data/lib/asciidoctor-pdf/prawn-table_ext/cell/asciidoc.rb +1 -0
- data/lib/asciidoctor-pdf/prawn-table_ext/cell/text.rb +1 -0
- data/lib/asciidoctor-pdf/prawn-templates_ext.rb +1 -0
- data/lib/asciidoctor-pdf/prawn_ext.rb +1 -0
- data/lib/asciidoctor-pdf/prawn_ext/coderay_encoder.rb +6 -5
- data/lib/asciidoctor-pdf/prawn_ext/extensions.rb +11 -17
- data/lib/asciidoctor-pdf/prawn_ext/font/afm.rb +15 -8
- data/lib/asciidoctor-pdf/prawn_ext/formatted_text/fragment.rb +1 -0
- data/lib/asciidoctor-pdf/prawn_ext/images.rb +2 -1
- data/lib/asciidoctor-pdf/roman_numeral.rb +1 -0
- data/lib/asciidoctor-pdf/rouge_ext.rb +1 -0
- data/lib/asciidoctor-pdf/rouge_ext/formatters/prawn.rb +1 -0
- data/lib/asciidoctor-pdf/rouge_ext/themes/asciidoctor_pdf_default.rb +1 -0
- data/lib/asciidoctor-pdf/rouge_ext/themes/bw.rb +1 -0
- data/lib/asciidoctor-pdf/sanitizer.rb +1 -0
- data/lib/asciidoctor-pdf/temporary_path.rb +1 -0
- data/lib/asciidoctor-pdf/theme_loader.rb +13 -13
- data/lib/asciidoctor-pdf/ttfunk_ext.rb +1 -0
- data/lib/asciidoctor-pdf/version.rb +2 -1
- data/lib/asciidoctor/pdf.rb +1 -0
- data/lib/asciidoctor/pdf/version.rb +1 -0
- metadata +15 -15
- data/lib/asciidoctor-pdf/core_ext/ostruct.rb +0 -8
@@ -1,10 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
class Prawn::Font::AFM
|
3
|
+
if defined? ::Asciidoctor::Logging
|
4
|
+
include ::Asciidoctor::Logging
|
5
|
+
else
|
6
|
+
include ::Asciidoctor::LoggingShim
|
7
|
+
end
|
8
|
+
|
2
9
|
FALLBACK_CHARS = {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
10
|
+
?\u200b => '',
|
11
|
+
?\u202f => ?\u00a0,
|
12
|
+
?\u2009 => ' ',
|
13
|
+
?\u25e6 => '-',
|
14
|
+
?\u25aa => ?\u00b7
|
8
15
|
}
|
9
16
|
|
10
17
|
remove_method :normalize_encoding
|
@@ -17,9 +24,9 @@ class Prawn::Font::AFM
|
|
17
24
|
def normalize_encoding text
|
18
25
|
text.encode 'windows-1252', fallback: FALLBACK_CHARS
|
19
26
|
rescue ::Encoding::UndefinedConversionError
|
20
|
-
warn
|
21
|
-
|
22
|
-
text.encode 'windows-1252', undef: :replace, replace:
|
27
|
+
logger.warn %(The following text could not be fully converted to the Windows-1252 character set:
|
28
|
+
#{text.gsub(/^/, '| ').rstrip})
|
29
|
+
text.encode 'windows-1252', undef: :replace, replace: ?\u00ac
|
23
30
|
rescue ::Encoding::InvalidByteSequenceError
|
24
31
|
raise Prawn::Errors::IncompatibleStringEncoding,
|
25
32
|
%(Your document includes text which is not compatible with the Windows-1252 character set.
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Asciidoctor
|
2
3
|
module Prawn
|
3
4
|
module Images
|
@@ -13,7 +14,7 @@ module Images
|
|
13
14
|
if ::String === file && (((opts = opts.dup).delete :format) == 'svg' || (file.downcase.end_with? '.svg'))
|
14
15
|
#opts[:enable_file_requests_with_root] = (::File.dirname file) unless opts.key? :enable_file_requests_with_root
|
15
16
|
#opts[:enable_web_requests] = allow_uri_read if !(opts.key? :enable_web_requests) && (respond_to? :allow_uri_read)
|
16
|
-
#opts[:fallback_font_name] =
|
17
|
+
#opts[:fallback_font_name] = fallback_svg_font_name if !(opts.key? :fallback_font_name) && (respond_to? :fallback_svg_font_name)
|
17
18
|
if (opts.key? :fit) && (fit = opts.delete :fit) && !opts[:width] && !opts[:height]
|
18
19
|
svg (::File.read file), opts do |svg_doc|
|
19
20
|
max_width, max_height = fit
|
@@ -1,6 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'safe_yaml/load'
|
2
3
|
require 'ostruct'
|
3
|
-
require_relative 'core_ext/ostruct'
|
4
4
|
require_relative 'measurements'
|
5
5
|
|
6
6
|
module Asciidoctor
|
@@ -16,12 +16,11 @@ class ThemeLoader
|
|
16
16
|
DataDir = ::File.expand_path(::File.join(::File.dirname(__FILE__), '..', '..', 'data'))
|
17
17
|
ThemesDir = ::File.join DataDir, 'themes'
|
18
18
|
FontsDir = ::File.join DataDir, 'fonts'
|
19
|
-
DefaultThemePath = ::File.expand_path 'default-theme.yml', ThemesDir
|
20
19
|
BaseThemePath = ::File.expand_path 'base-theme.yml', ThemesDir
|
21
20
|
|
22
21
|
VariableRx = /\$([a-z0-9_-]+)/
|
23
22
|
LoneVariableRx = /^\$([a-z0-9_-]+)$/
|
24
|
-
HexColorEntryRx = /^(?<k> *\p{Graph}+): +(?!null$)(?<q>["']?)(?<h>#)?(?<v>[a-
|
23
|
+
HexColorEntryRx = /^(?<k> *\p{Graph}+): +(?!null$)(?<q>["']?)(?<h>#)?(?<v>[a-fA-F0-9]{3,6})\k<q> *(?:#.*)?$/
|
25
24
|
MultiplyDivideOpRx = /(-?\d+(?:\.\d+)?) +([*\/]) +(-?\d+(?:\.\d+)?)/
|
26
25
|
AddSubtractOpRx = /(-?\d+(?:\.\d+)?) +([+\-]) +(-?\d+(?:\.\d+)?)/
|
27
26
|
PrecisionFuncRx = /^(round|floor|ceil)\(/
|
@@ -44,12 +43,12 @@ class ThemeLoader
|
|
44
43
|
|
45
44
|
def self.resolve_theme_file theme_name = nil, theme_path = nil
|
46
45
|
# if .yml extension is given, assume it's a path (don't append -theme.yml)
|
47
|
-
if
|
46
|
+
if theme_name && (theme_name.end_with? '.yml')
|
48
47
|
# FIXME restrict to jail!
|
49
48
|
theme_file = ::File.expand_path theme_name, theme_path
|
50
49
|
theme_path ||= ::File.dirname theme_file
|
51
50
|
else
|
52
|
-
theme_file = ::File.expand_path %(#{theme_name}-theme.yml), (theme_path
|
51
|
+
theme_file = ::File.expand_path %(#{theme_name || 'default'}-theme.yml), (theme_path ||= ThemesDir)
|
53
52
|
end
|
54
53
|
[theme_file, theme_path]
|
55
54
|
end
|
@@ -69,9 +68,10 @@ class ThemeLoader
|
|
69
68
|
load_base_theme
|
70
69
|
else
|
71
70
|
theme_data = load_file theme_file, nil, theme_path
|
72
|
-
unless theme_file ==
|
73
|
-
# QUESTION should we enforce any other fallback values?
|
71
|
+
unless (::File.dirname theme_file) == ThemesDir
|
74
72
|
theme_data.base_align ||= 'left'
|
73
|
+
theme_data.base_line_height ||= 1
|
74
|
+
theme_data.base_font_color ||= '000000'
|
75
75
|
theme_data.code_font_family ||= (theme_data.literal_font_family || 'Courier')
|
76
76
|
theme_data.conum_font_family ||= (theme_data.literal_font_family || 'Courier')
|
77
77
|
end
|
@@ -82,9 +82,9 @@ class ThemeLoader
|
|
82
82
|
|
83
83
|
def self.load_file filename, theme_data = nil, theme_path = nil
|
84
84
|
data = ::File.read filename, encoding: ::Encoding::UTF_8
|
85
|
-
data = data.each_line.map {|
|
86
|
-
|
87
|
-
}.join unless filename ==
|
85
|
+
data = data.each_line.map {|line|
|
86
|
+
line.sub(HexColorEntryRx) { %(#{(m = $~)[:k]}: #{m[:h] || (m[:k].end_with? 'color') ? "'#{m[:v]}'" : m[:v]}) }
|
87
|
+
}.join unless (::File.dirname filename) == ThemesDir
|
88
88
|
yaml_data = ::SafeYAML.load data
|
89
89
|
if ::Hash === yaml_data && (yaml_data.key? 'extends')
|
90
90
|
if (extends = yaml_data.delete 'extends')
|
@@ -93,7 +93,7 @@ class ThemeLoader
|
|
93
93
|
theme_data = theme_data ? (::OpenStruct.new theme_data.to_h.merge load_base_theme.to_h) : load_base_theme
|
94
94
|
next
|
95
95
|
elsif extend_file == 'default' || extend_file == 'default-with-fallback-font'
|
96
|
-
extend_file, extend_theme_path = resolve_theme_file extend_file
|
96
|
+
extend_file, extend_theme_path = resolve_theme_file extend_file, ThemesDir
|
97
97
|
elsif extend_file.start_with? './'
|
98
98
|
extend_file, extend_theme_path = resolve_theme_file extend_file, (::File.dirname filename)
|
99
99
|
else
|
@@ -103,7 +103,7 @@ class ThemeLoader
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
else
|
106
|
-
theme_data ||= (filename ==
|
106
|
+
theme_data ||= ((::File.dirname filename) == ThemesDir ? nil : load_base_theme)
|
107
107
|
end
|
108
108
|
self.new.load yaml_data, theme_data, theme_path
|
109
109
|
end
|
@@ -116,7 +116,7 @@ class ThemeLoader
|
|
116
116
|
|
117
117
|
def process_entry key, val, data
|
118
118
|
key = key.tr '-', '_' if key.include? '-'
|
119
|
-
if key
|
119
|
+
if key.start_with? 'font_'
|
120
120
|
data[key] = val
|
121
121
|
elsif key.start_with? 'admonition_icon_'
|
122
122
|
data[key] = (val || {}).map do |(key2, val2)|
|
data/lib/asciidoctor/pdf.rb
CHANGED
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.5.0.beta.
|
4
|
+
version: 1.5.0.beta.2
|
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: 2019-07-
|
12
|
+
date: 2019-07-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: asciidoctor
|
@@ -93,14 +93,14 @@ dependencies:
|
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2.
|
96
|
+
version: 2.4.0
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 2.
|
103
|
+
version: 2.4.0
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: safe_yaml
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
@@ -177,20 +177,14 @@ dependencies:
|
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 3.
|
181
|
-
- - "!="
|
182
|
-
- !ruby/object:Gem::Version
|
183
|
-
version: 3.4.1
|
180
|
+
version: 3.6.0
|
184
181
|
type: :development
|
185
182
|
prerelease: false
|
186
183
|
version_requirements: !ruby/object:Gem::Requirement
|
187
184
|
requirements:
|
188
185
|
- - "~>"
|
189
186
|
- !ruby/object:Gem::Version
|
190
|
-
version: 3.
|
191
|
-
- - "!="
|
192
|
-
- !ruby/object:Gem::Version
|
193
|
-
version: 3.4.1
|
187
|
+
version: 3.6.0
|
194
188
|
- !ruby/object:Gem::Dependency
|
195
189
|
name: rspec
|
196
190
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,12 +242,19 @@ files:
|
|
248
242
|
- README.adoc
|
249
243
|
- asciidoctor-pdf.gemspec
|
250
244
|
- bin/asciidoctor-pdf
|
251
|
-
- data/fonts/
|
252
|
-
- data/fonts/
|
245
|
+
- data/fonts/ABOUT-mplus1mn-subset
|
246
|
+
- data/fonts/ABOUT-mplus1p-subset
|
247
|
+
- data/fonts/ABOUT-notoserif-subset
|
248
|
+
- data/fonts/LICENSE-mplus
|
249
|
+
- data/fonts/LICENSE-notoserif
|
253
250
|
- data/fonts/mplus1mn-bold-ascii.ttf
|
251
|
+
- data/fonts/mplus1mn-bold-subset.ttf
|
254
252
|
- data/fonts/mplus1mn-bold_italic-ascii.ttf
|
253
|
+
- data/fonts/mplus1mn-bold_italic-subset.ttf
|
255
254
|
- data/fonts/mplus1mn-italic-ascii.ttf
|
255
|
+
- data/fonts/mplus1mn-italic-subset.ttf
|
256
256
|
- data/fonts/mplus1mn-regular-ascii-conums.ttf
|
257
|
+
- data/fonts/mplus1mn-regular-subset.ttf
|
257
258
|
- data/fonts/mplus1p-regular-fallback.ttf
|
258
259
|
- data/fonts/notoserif-bold-subset.ttf
|
259
260
|
- data/fonts/notoserif-bold_italic-subset.ttf
|
@@ -278,7 +279,6 @@ files:
|
|
278
279
|
- lib/asciidoctor-pdf/core_ext/hash.rb
|
279
280
|
- lib/asciidoctor-pdf/core_ext/numeric.rb
|
280
281
|
- lib/asciidoctor-pdf/core_ext/object.rb
|
281
|
-
- lib/asciidoctor-pdf/core_ext/ostruct.rb
|
282
282
|
- lib/asciidoctor-pdf/core_ext/quantifiable_stdout.rb
|
283
283
|
- lib/asciidoctor-pdf/core_ext/regexp.rb
|
284
284
|
- lib/asciidoctor-pdf/core_ext/string.rb
|