asciidoctor-pdf 1.5.0.beta.6 → 1.5.0.beta.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -110,7 +110,7 @@ class Prawn < Formatter
110
110
  def create_fragment tok, val = nil
111
111
  fragment = val ? { text: val } : {}
112
112
  if (style_rules = @theme.style_for tok)
113
- if (bg = normalize_color style_rules.bg) && bg != @background_color
113
+ if (bg = normalize_color style_rules.bg) && bg != background_color
114
114
  fragment[:background_color] = bg
115
115
  fragment[:callback] = @background_colorizer
116
116
  if LineOrientedTokens.include? tok
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- # regenerate parser.rb using `tt parser.treetop`
3
2
  # Autogenerated from a Treetop grammar. Edits may be lost.
4
3
 
5
4
 
@@ -1,4 +1,4 @@
1
- # regenerate parser.rb using `tt parser.treetop`
1
+ # frozen_string_literal: true
2
2
  module Asciidoctor
3
3
  module PDF
4
4
  module FormattedText
@@ -24,7 +24,6 @@ class Transform
24
24
  'font_color' => :color,
25
25
  'font_family' => :font,
26
26
  'font_size' => :size,
27
- 'font_style' => :styles,
28
27
  }
29
28
  #DummyText = ?\u0000
30
29
 
@@ -83,16 +82,22 @@ class Transform
83
82
  callback: mark_bg_color && [TextBackgroundAndBorderRenderer],
84
83
  }.compact,
85
84
  }
85
+ revise_roles = [].to_set
86
86
  theme.each_pair.reduce @theme_settings do |accum, (key, val)|
87
87
  if (key = key.to_s).start_with? 'role_'
88
88
  role, key = (key.slice 5, key.length).split '_', 2
89
89
  if (prop = ThemeKeyToFragmentProperty[key])
90
- val = to_styles val if prop == :styles
91
90
  (accum[role] ||= {})[prop] = val
91
+ elsif key == 'font_style' || key == 'text_decoration'
92
+ revise_roles << role
92
93
  end
93
94
  end
94
95
  accum
95
96
  end
97
+ revise_roles.reduce @theme_settings do |accum, role|
98
+ (accum[role] ||= {})[:styles] = to_styles theme[%(role_#{role}_font_style)], theme[%(role_#{role}_text_decoration)]
99
+ accum
100
+ end
96
101
  unless @theme_settings.key? 'big'
97
102
  if (base_font_size_large = theme.base_font_size_large)
98
103
  @theme_settings['big'] = { size: %(#{(base_font_size_large / theme.base_font_size.to_f).round 4}em) }
@@ -354,8 +359,6 @@ class Transform
354
359
  styles = [:italic].to_set
355
360
  when 'bold_italic'
356
361
  styles = [:bold, :italic].to_set
357
- else
358
- styles = nil
359
362
  end
360
363
  if (style = TextDecorationTable[text_decoration])
361
364
  styles ? (styles << style) : [style].to_set
@@ -3,8 +3,16 @@ require 'rghost'
3
3
  module Asciidoctor
4
4
  module PDF
5
5
  class Optimizer
6
+ (QUALITY_NAMES = {
7
+ 'default' => :default,
8
+ 'screen' => :screen,
9
+ 'ebook' => :ebook,
10
+ 'printer' => :printer,
11
+ 'prepress' => :prepress,
12
+ }).default = :default
13
+
6
14
  def initialize quality = 'default', compatibility_level = '1.4'
7
- @quality = quality.empty? ? :default : quality.to_sym
15
+ @quality = QUALITY_NAMES[quality]
8
16
  @compatibility_level = compatibility_level
9
17
  end
10
18
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  module Asciidoctor
3
3
  module PDF
4
- VERSION = '1.5.0.beta.6'
4
+ VERSION = '1.5.0.beta.7'
5
5
  end
6
6
  Pdf = PDF unless const_defined? :Pdf, false
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: 1.5.0.beta.6
4
+ version: 1.5.0.beta.7
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-10-12 00:00:00.000000000 Z
12
+ date: 2019-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: asciidoctor
@@ -274,6 +274,7 @@ description: An extension for Asciidoctor that converts AsciiDoc documents to PD
274
274
  email: dan@opendevise.com
275
275
  executables:
276
276
  - asciidoctor-pdf
277
+ - asciidoctor-pdf-optimize
277
278
  extensions: []
278
279
  extra_rdoc_files: []
279
280
  files:
@@ -284,6 +285,7 @@ files:
284
285
  - README.adoc
285
286
  - asciidoctor-pdf.gemspec
286
287
  - bin/asciidoctor-pdf
288
+ - bin/asciidoctor-pdf-optimize
287
289
  - data/fonts/ABOUT-mplus1mn-subset
288
290
  - data/fonts/ABOUT-mplus1p-subset
289
291
  - data/fonts/ABOUT-notoserif-subset