asciidoctor-pdf 1.5.0.alpha.12 → 1.5.0.alpha.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +325 -0
- data/Gemfile +1 -1
- data/README.adoc +97 -43
- data/asciidoctor-pdf.gemspec +7 -6
- data/data/fonts/mplus1mn-bold-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-bold_italic-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-italic-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-regular-ascii-conums.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/default-theme.yml +22 -13
- data/docs/theming-guide.adoc +276 -110
- data/lib/asciidoctor-pdf/asciidoctor_ext/image.rb +7 -7
- data/lib/asciidoctor-pdf/asciidoctor_ext/list.rb +24 -1
- data/lib/asciidoctor-pdf/asciidoctor_ext/list_item.rb +3 -3
- data/lib/asciidoctor-pdf/asciidoctor_ext/section.rb +11 -3
- data/lib/asciidoctor-pdf/converter.rb +614 -401
- data/lib/asciidoctor-pdf/core_ext.rb +1 -0
- data/lib/asciidoctor-pdf/core_ext/array.rb +2 -2
- data/lib/asciidoctor-pdf/core_ext/numeric.rb +1 -1
- data/lib/asciidoctor-pdf/core_ext/ostruct.rb +10 -2
- data/lib/asciidoctor-pdf/core_ext/string.rb +11 -0
- data/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb +2 -2
- data/lib/asciidoctor-pdf/formatted_text/inline_image_renderer.rb +5 -5
- data/lib/asciidoctor-pdf/formatted_text/transform.rb +6 -4
- data/lib/asciidoctor-pdf/implicit_header_processor.rb +1 -1
- data/lib/asciidoctor-pdf/pdf_core_ext/page.rb +1 -1
- data/lib/asciidoctor-pdf/prawn_ext/coderay_encoder.rb +3 -3
- data/lib/asciidoctor-pdf/prawn_ext/extensions.rb +77 -28
- data/lib/asciidoctor-pdf/prawn_ext/font/afm.rb +5 -4
- data/lib/asciidoctor-pdf/prawn_ext/images.rb +1 -1
- data/lib/asciidoctor-pdf/roman_numeral.rb +11 -4
- data/lib/asciidoctor-pdf/rouge_ext/formatters/prawn.rb +9 -9
- data/lib/asciidoctor-pdf/theme_loader.rb +16 -3
- data/lib/asciidoctor-pdf/version.rb +1 -1
- metadata +18 -9
@@ -14,7 +14,7 @@ class ThemeLoader
|
|
14
14
|
VariableRx = /\$([a-z0-9_]+)/
|
15
15
|
LoneVariableRx = /^\$([a-z0-9_]+)$/
|
16
16
|
HexColorEntryRx = /^(?<k>[[:blank:]]*[[:graph:]]+): +(?!null$)(?<q>["']?)#?(?<v>\w{3,6})\k<q> *(?:#.*)?$/
|
17
|
-
MeasurementValueRx = /(?<=^| |\()(-?\d+(?:\.\d+)?)(in|mm|cm|pt)(?=$| |\))/
|
17
|
+
MeasurementValueRx = /(?<=^| |\()(-?\d+(?:\.\d+)?)(in|mm|cm|pt|px)(?=$| |\))/
|
18
18
|
MultiplyDivideOpRx = /(-?\d+(?:\.\d+)?) +([*\/]) +(-?\d+(?:\.\d+)?)/
|
19
19
|
AddSubtractOpRx = /(-?\d+(?:\.\d+)?) +([+\-]) +(-?\d+(?:\.\d+)?)/
|
20
20
|
PrecisionFuncRx = /^(round|floor|ceil)\(/
|
@@ -68,19 +68,30 @@ class ThemeLoader
|
|
68
68
|
if theme_file == BaseThemePath
|
69
69
|
theme_data
|
70
70
|
else
|
71
|
-
# QUESTION should we do any post-load calculations or defaults?
|
72
71
|
load_file theme_file, theme_data
|
73
72
|
end
|
74
73
|
end
|
75
74
|
|
76
75
|
def self.load_file filename, theme_data = nil
|
77
|
-
raw_data = (::IO.read filename).each_line.map {|l| l.sub HexColorEntryRx, '\k<k>: \'\k<v>\'' }.join
|
76
|
+
raw_data = (::IO.read filename, encoding: ::Encoding::UTF_8).each_line.map {|l| l.sub HexColorEntryRx, '\k<k>: \'\k<v>\'' }.join
|
78
77
|
self.new.load((::SafeYAML.load raw_data), theme_data)
|
79
78
|
end
|
80
79
|
|
81
80
|
def load hash, theme_data = nil
|
82
81
|
theme_data ||= ::OpenStruct.new
|
82
|
+
return theme_data unless ::Hash === hash
|
83
83
|
hash.inject(theme_data) {|data, (key, val)| process_entry key, val, data }
|
84
|
+
# NOTE remap legacy running content keys (e.g., header_recto_content_left => header_recto_left_content)
|
85
|
+
%w(header_recto header_verso footer_recto footer_verso).each do |periphery_face|
|
86
|
+
%w(left center right).each do |align|
|
87
|
+
if (val = theme_data.delete %(#{periphery_face}_content_#{align}))
|
88
|
+
theme_data[%(#{periphery_face}_#{align}_content)] = val
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
theme_data.base_align ||= 'left'
|
93
|
+
# QUESTION should we do any other post-load calculations or defaults?
|
94
|
+
theme_data
|
84
95
|
end
|
85
96
|
|
86
97
|
private
|
@@ -147,6 +158,8 @@ class ThemeLoader
|
|
147
158
|
val * (72 / 25.4)
|
148
159
|
when 'cm'
|
149
160
|
val * (720 / 25.4)
|
161
|
+
when 'px'
|
162
|
+
val * 0.75
|
150
163
|
else
|
151
164
|
val # default unit is pt
|
152
165
|
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.5.0.alpha.
|
4
|
+
version: 1.5.0.alpha.13
|
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: 2016-
|
12
|
+
date: 2016-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -91,30 +91,36 @@ dependencies:
|
|
91
91
|
name: prawn-svg
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.21.0
|
97
|
+
- - "<"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 0.26.0
|
97
100
|
type: :runtime
|
98
101
|
prerelease: false
|
99
102
|
version_requirements: !ruby/object:Gem::Requirement
|
100
103
|
requirements:
|
101
|
-
- -
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 0.21.0
|
107
|
+
- - "<"
|
102
108
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
109
|
+
version: 0.26.0
|
104
110
|
- !ruby/object:Gem::Dependency
|
105
111
|
name: prawn-icon
|
106
112
|
requirement: !ruby/object:Gem::Requirement
|
107
113
|
requirements:
|
108
114
|
- - '='
|
109
115
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
116
|
+
version: 1.2.0
|
111
117
|
type: :runtime
|
112
118
|
prerelease: false
|
113
119
|
version_requirements: !ruby/object:Gem::Requirement
|
114
120
|
requirements:
|
115
121
|
- - '='
|
116
122
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
123
|
+
version: 1.2.0
|
118
124
|
- !ruby/object:Gem::Dependency
|
119
125
|
name: safe_yaml
|
120
126
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,10 +172,12 @@ executables:
|
|
166
172
|
- asciidoctor-pdf
|
167
173
|
extensions: []
|
168
174
|
extra_rdoc_files:
|
169
|
-
-
|
175
|
+
- CHANGELOG.adoc
|
170
176
|
- LICENSE.adoc
|
171
177
|
- NOTICE.adoc
|
178
|
+
- README.adoc
|
172
179
|
files:
|
180
|
+
- CHANGELOG.adoc
|
173
181
|
- Gemfile
|
174
182
|
- LICENSE.adoc
|
175
183
|
- NOTICE.adoc
|
@@ -204,6 +212,7 @@ files:
|
|
204
212
|
- lib/asciidoctor-pdf/core_ext/numeric.rb
|
205
213
|
- lib/asciidoctor-pdf/core_ext/ostruct.rb
|
206
214
|
- lib/asciidoctor-pdf/core_ext/quantifiable_stdout.rb
|
215
|
+
- lib/asciidoctor-pdf/core_ext/string.rb
|
207
216
|
- lib/asciidoctor-pdf/formatted_text.rb
|
208
217
|
- lib/asciidoctor-pdf/formatted_text/formatter.rb
|
209
218
|
- lib/asciidoctor-pdf/formatted_text/inline_destination_marker.rb
|