asciidoctor-pdf 1.5.0.beta.3 → 1.5.0.beta.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a069bf48fbe99050934610c30657128be8730eb5efcfc05cb63501374e904fbd
4
- data.tar.gz: b2975922d3e8da6f7da239285fab79d285ec1a57b3870af130aa248c01475445
3
+ metadata.gz: 5128f12524a44fcbb19f0127e8bf0ec546f0287e80fae2bb6ccb70a1a69a2a7e
4
+ data.tar.gz: fa168da5cd4a10528e3bb732467d2f129d64fdaf26d182b874ccf6a70729bc51
5
5
  SHA512:
6
- metadata.gz: 005bb7e4b493d6adae9b3fef48b94caeacea1a84e47ae5209c0562a5d9ba10131a71cba011b35f1f09de57850ccea7fe5456d1d59906f0a76d2a3a63e70f4c7f
7
- data.tar.gz: ea0f6d4a02d5ef32e4fb467e8793e1b4da458391eca2f678d0dbc1e9a52c22987843b1ebf6260d41cb4ae27780f6cde686a2c64bda24817ac83e978a8050a83c
6
+ metadata.gz: b91e25292d981f9409298c7ad49acd41e9c259e56dde1935d7e03d54326ee8aca9c0ef9a02532aab172c42da1fd7bbcad943c047a523af3990486ae05f1d2acc
7
+ data.tar.gz: 3034f7607666738c74c47bca7f6400568030e100a4e2bc5ca2de268ab4c2d0ba94afc531b20c0ed72b5d04a592a22735eb95b6846d7a93c2c467799bf96d1092
@@ -5,6 +5,17 @@
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/master[commit history] on GitHub.
7
7
 
8
+ == 1.5.0.beta.4 (2019-09-04) - @mojavelinux
9
+
10
+ * always use ; as delimiter to separate multiple font dirs to be compatible with JAR paths (#1250)
11
+ * preserve hyphens in role names in theme file (#1254)
12
+ * allow second arg of outlinelevels attribute to control expand depth of outline (#1224)
13
+ * allow font catalog and font fallbacks to be defined as flat keys in the theme file (#1243)
14
+ * don't crash when adding indentation guards to source highlighted with Pygments (#1246)
15
+ * don't override font color of formatted text in toc (#1247)
16
+ * prevent toc from overrunning first page of content by reserving more space for the page number (#1242)
17
+ * allow number of digits reserved for page number in the toc to be adjusted using toc-max-pagenum-digits attribute (#1242)
18
+
8
19
  == 1.5.0.beta.3 (2019-08-30) - @mojavelinux
9
20
 
10
21
  * allow multiple font dirs to be specified using the pdf-fontsdir attribute (#80)
@@ -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.5.0.beta.3, 2019-08-30
3
+ v1.5.0.beta.4, 2019-09-04
4
4
  // Settings:
5
5
  :experimental:
6
6
  :idprefix:
@@ -24,7 +24,7 @@ endif::[]
24
24
  :project-name: Asciidoctor PDF
25
25
  :project-handle: asciidoctor-pdf
26
26
  // Variables:
27
- :release-version: 1.5.0.beta.3
27
+ :release-version: 1.5.0.beta.4
28
28
  // URIs:
29
29
  :uri-asciidoctor: http://asciidoctor.org
30
30
  :uri-gem: http://rubygems.org/gems/asciidoctor-pdf
@@ -151,6 +151,39 @@ Then, install the gem from RubyGems.org using the following command:
151
151
 
152
152
  $ gem install asciidoctor-pdf --pre
153
153
 
154
+ ==== Installation Troubleshooting
155
+
156
+ If you get a permission error while installing the gem, such as the one below, it's likely you're attempting to install the gem directly into your system.
157
+ Installing gems for tech writing directly into your system is not recommended.
158
+
159
+ .Permission error when attempting to install as a system gem
160
+ ....
161
+ ERROR: While executing gem ... (Gem::FilePermissionError)
162
+ You don't have write permissions for the /Library/Ruby/Gems/2.x.x directory.
163
+ ....
164
+
165
+ A better practice (and one that will ensure your sanity) is to ignore any version of Ruby installed on your system and use https://rvm.io[RVM] to manage the Ruby installation instead.
166
+ The benefit of this approach is that a) Ruby is guaranteed to be set up correctly, b) installing gems will in no way interfere with the operation of your system, and c) any bin scripts provided by the installed gems will be available on your PATH.
167
+ All files are managed in user space (aka your home or user directory).
168
+ If something gets messed up, you can simply remove the [.path]_$HOME/.rvm_ folder and start over.
169
+
170
+ To learn how to install RVM, follow the https://asciidoctor.org/docs/install-asciidoctor-macos/#rvm-procedure-recommended[RVM installation procedure] covered in the Asciidoctor documentation.
171
+ Once you have installed RVM and used it to install Ruby, make sure to activate the Ruby managed by RVM using `rvm use default` or a specific Ruby version like `rvm use 2.6`.
172
+ (You'll need to do this each time you open a new terminal).
173
+
174
+ After installing the gem, you can see where it was installed using the following command:
175
+
176
+ $ gem which asciidoctor-pdf
177
+
178
+ To see where the bin script is located, use this command:
179
+
180
+ $ command -v asciidoctor-pdf
181
+
182
+ Both paths should be underneath the [.path]_$HOME/.rvm_ directory.
183
+ If not, check your RVM setup.
184
+
185
+ ==== Install a Syntax Highlighter (optional)
186
+
154
187
  If you want to syntax highlight source listings, you'll also want to install Rouge, Pygments, or CodeRay.
155
188
  Choose one (or more) of the following:
156
189
 
@@ -734,7 +734,7 @@ Cannot be styled as italic, bold or bold_italic.
734
734
  Used as the fallback font in the `default-with-fallback-font` theme.
735
735
 
736
736
  TIP: If you want to specify the location of custom fonts using the `pdf-fontsdir` attribute, yet still be able to use the bundled fonts, you need to refer to the bundled fonts using the `GEM_FONTS_DIR` token.
737
- To do so, you can either a) prefix the path of the bundled font in the theme file with the segment `GEM_FONTS_DIR` (e.g., `GEM_FONTS_DIR/mplus1p-regular-fallback.ttf`, or b) include `GEM_FONT_DIR` in the value of the `pdf-fontsdir` attribute, separated from the location of your custom fonts by the path separator (e.g., `path/to/fonts:GEM_FONTS_DIR`).
737
+ To do so, you can either a) prefix the path of the bundled font in the theme file with the segment `GEM_FONTS_DIR` (e.g., `GEM_FONTS_DIR/mplus1p-regular-fallback.ttf`, or b) include `GEM_FONT_DIR` in the value of the `pdf-fontsdir` attribute, separated from the location of your custom fonts by a semi-colon (e.g., `path/to/your/fonts;GEM_FONTS_DIR`).
738
738
 
739
739
  === Custom Fonts
740
740
 
@@ -792,13 +792,13 @@ When you execute Asciidoctor PDF, specify the directory where the fonts reside u
792
792
 
793
793
  $ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir=path/to/fonts document.adoc
794
794
 
795
- You can specify multiple directories by separating the entries with the path separator (`:` for Unix, `;` for Windows).
795
+ You can specify multiple directories by separating the entries with a semi-colon:
796
796
 
797
- $ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir=path/to/fonts:path/to/more-fonts document.adoc
797
+ $ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir=path/to/fonts;path/to/more-fonts document.adoc
798
798
 
799
799
  To include the bundled fonts in the search, use the `GEM_FONTS_DIR` token:
800
800
 
801
- $ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir=path/to/fonts:GEM_FONTS_DIR document.adoc
801
+ $ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir=path/to/fonts;GEM_FONTS_DIR document.adoc
802
802
 
803
803
  TIP: When Asciidoctor PDF creates the PDF, it only embeds the glyphs from the font that are needed to render the characters present in the document.
804
804
  Effectively, it subsets the font.
@@ -4077,7 +4077,7 @@ If you use images in your theme, image paths are resolved relative to this direc
4077
4077
  If `pdf-theme` ends with `.yml`, and `pdf-themesdir` is not specified, then `pdf-themesdir` defaults to the directory of the path specified by `pdf-theme`.
4078
4078
 
4079
4079
  pdf-fontsdir:: The directory or directories where the fonts used by your theme, if any, are located.
4080
- Multiple entries must be separated by path separator (`:` for Unix, `;` for Windows).
4080
+ Multiple entries must be separated by a semi-colon.
4081
4081
  _Specifying an absolute path is recommended._
4082
4082
 
4083
4083
  Let's assume that you've put your theme files inside a directory named `resources` with the following layout:
@@ -4146,8 +4146,8 @@ These settings override equivalent keys defined in the theme file, where applica
4146
4146
  |screen {vbar} print {vbar} prepress
4147
4147
  |:media: prepress
4148
4148
 
4149
- |outlinelevels
4150
- |number (default: same as _toclevels_)
4149
+ |outlinelevels^[10]^
4150
+ |Integer {vbar} Integer:Integer (default: same as _toclevels_)
4151
4151
  |:outlinelevels: 2
4152
4152
 
4153
4153
  |page-background-image^[4]^
@@ -4201,6 +4201,10 @@ These settings override equivalent keys defined in the theme file, where applica
4201
4201
  |title-page-background-image
4202
4202
  |path^[2]^ {vbar} image macro^[3]^
4203
4203
  |:title-page-background-image: image:title-bg.jpg[]
4204
+
4205
+ |toc-max-pagenum-digits^[9]^
4206
+ |Integer (default: 3)
4207
+ |:toc-max-pagenum-digits: 4
4204
4208
  |===
4205
4209
 
4206
4210
  . `<face>` can be `front` or `back`.
@@ -4221,6 +4225,9 @@ The value of this attribute overrides the `base-align` key set by the theme.
4221
4225
  For more fine-grained control, you should customize using the theme.
4222
4226
  . The title page is only enabled by default for the book doctype.
4223
4227
  To force the title page to be used for other doctypes, set the `title-page` attribute in the document header.
4228
+ . If the TOC overlaps the first page of content, increase this number.
4229
+ . The second number in the value of `outlinelevels` is the number of levels of the outline to expand (e.g., `3:1`).
4230
+ If the second number is not present, all levels are expanded.
4224
4231
 
4225
4232
  == Publishing Mode
4226
4233
 
@@ -122,6 +122,7 @@ class Converter < ::Prawn::Document
122
122
  doc.attributes['data-uri'] = ((doc.instance_variable_get :@attribute_overrides) || {})['data-uri'] = ''
123
123
  end
124
124
  @capabilities = {
125
+ honors_literal_cell_style: AsciidoctorVersion >= (::Gem::Version.create '1.5.6'),
125
126
  special_sectnums: AsciidoctorVersion >= (::Gem::Version.create '1.5.7'),
126
127
  syntax_highlighter: AsciidoctorVersion >= (::Gem::Version.create '2.0.0'),
127
128
  }
@@ -209,7 +210,10 @@ class Converter < ::Prawn::Document
209
210
  toc_page_nums = page_number
210
211
  toc_end = nil
211
212
  dry_run do
212
- toc_page_nums = layout_toc doc, num_toc_levels, toc_page_nums, 0, toc_start
213
+ pagenum_width = theme_font(:doc) { rendered_width_of_string '0' * (doc.attr 'toc-max-pagenum-digits', 3).to_i }
214
+ indent 0, pagenum_width do
215
+ toc_page_nums = layout_toc doc, num_toc_levels, toc_page_nums, 0, toc_start
216
+ end
213
217
  move_down @theme.block_margin_bottom unless insert_title_page
214
218
  toc_end = @y
215
219
  end
@@ -275,7 +279,7 @@ class Converter < ::Prawn::Document
275
279
  end
276
280
  end
277
281
 
278
- add_outline doc, (doc.attr 'outlinelevels', num_toc_levels).to_i, toc_page_nums, num_front_matter_pages[1]
282
+ add_outline doc, (doc.attr 'outlinelevels', num_toc_levels), toc_page_nums, num_front_matter_pages[1]
279
283
  if state.pages.size > 0 && (initial_zoom = @theme.page_initial_zoom)
280
284
  case initial_zoom.to_sym
281
285
  when :Fit
@@ -320,7 +324,7 @@ class Converter < ::Prawn::Document
320
324
  @ppbook = nil
321
325
  end
322
326
  # QUESTION should ThemeLoader handle registering fonts instead?
323
- register_fonts theme.font_catalog, (doc.attr 'pdf-fontsdir', ThemeLoader::FontsDir)
327
+ register_fonts theme.font_catalog, (doc.attr 'pdf-fontsdir', 'GEM_FONTS_DIR')
324
328
  default_kerning theme.base_font_kerning != 'none'
325
329
  @fallback_fonts = [*theme.font_fallbacks]
326
330
  @allow_uri_read = doc.attr? 'allow-uri-read'
@@ -1688,7 +1692,7 @@ class Converter < ::Prawn::Document
1688
1692
  conum_mapping ? (restore_conums fragments, conum_mapping) : fragments
1689
1693
  else
1690
1694
  # NOTE only format if we detect a need (callouts or inline formatting)
1691
- (XMLMarkupRx.match? source_string) ? (text_formatter.format source_string) : [{ text: source_string }]
1695
+ (XMLMarkupRx.match? source_string) ? (text_formatter.format source_string) : [text: source_string]
1692
1696
  end
1693
1697
 
1694
1698
  node.subs.replace prev_subs if prev_subs
@@ -1807,8 +1811,7 @@ class Converter < ::Prawn::Document
1807
1811
  # append conums to appropriate lines, then flatten to an array of fragments
1808
1812
  lines.flat_map.with_index do |line, cur_line_num|
1809
1813
  last_line = cur_line_num == last_line_num
1810
- # NOTE use ::String.new to ensure string is not frozen
1811
- line.unshift text: (::String.new %(#{(cur_line_num + linenums).to_s.rjust pad_size} )), color: linenum_color if linenums
1814
+ line.unshift text: %(#{(cur_line_num + linenums).to_s.rjust pad_size} ), color: linenum_color if linenums
1812
1815
  if (conums = conum_mapping.delete cur_line_num)
1813
1816
  line << { text: ' ' * num_trailing_spaces } if last_line && num_trailing_spaces > 0
1814
1817
  conum_text = conums.map {|num| conum_glyph num }.join ' '
@@ -1928,8 +1931,7 @@ class Converter < ::Prawn::Document
1928
1931
  end
1929
1932
  cell_line_metrics = calc_line_metrics theme.base_line_height
1930
1933
  when :literal
1931
- # FIXME core should not substitute in this case
1932
- cell_data[:content] = guard_indentation cell.instance_variable_get :@text
1934
+ cell_data[:content] = @capabilities[:honors_literal_cell_style] ? (guard_indentation cell.text) : (guard_indentation cell.instance_variable_get :@text)
1933
1935
  # NOTE the absence of the inline_format option implies it's disabled
1934
1936
  # QUESTION should we use literal_font_*, code_font_*, or introduce another category?
1935
1937
  cell_data[:font] = theme.code_font_family
@@ -2849,9 +2851,7 @@ class Converter < ::Prawn::Document
2849
2851
  (font_styles << :underline) : font_styles)
2850
2852
  }
2851
2853
  (sect_title_fragments = text_formatter.format sect_title).each do |fragment|
2852
- fragment.update sect_title_format_override do |key, old_val, new_val|
2853
- key == :styles ? (old_val.merge new_val) : new_val
2854
- end
2854
+ fragment.update(sect_title_format_override) {|k, oval, nval| k == :styles ? (oval.merge nval) : oval }
2855
2855
  end
2856
2856
  pgnum_label_width = rendered_width_of_string pgnum_label
2857
2857
  indent 0, pgnum_label_width do
@@ -3256,6 +3256,17 @@ class Converter < ::Prawn::Document
3256
3256
  end
3257
3257
 
3258
3258
  def add_outline doc, num_levels = 2, toc_page_nums = [], num_front_matter_pages = 0
3259
+ if ::String === num_levels
3260
+ if num_levels.include? ':'
3261
+ num_levels, expand_levels = num_levels.split ':', 2
3262
+ num_levels = num_levels.empty? ? (doc.attr 'toclevels', 2).to_i : num_levels.to_i
3263
+ expand_levels = expand_levels.to_i
3264
+ else
3265
+ num_levels = expand_levels = num_levels.to_i
3266
+ end
3267
+ else
3268
+ expand_levels = num_levels
3269
+ end
3259
3270
  front_matter_counter = RomanNumeral.new 0, :lower
3260
3271
  pagenum_labels = {}
3261
3272
 
@@ -3278,7 +3289,7 @@ class Converter < ::Prawn::Document
3278
3289
  page title: toc_title, destination: (document.dest_top toc_page_nums.first)
3279
3290
  end
3280
3291
  # QUESTION any way to get add_outline_level to invoke in the context of the outline?
3281
- document.add_outline_level self, doc.sections, num_levels
3292
+ document.add_outline_level self, doc.sections, num_levels, expand_levels
3282
3293
  end
3283
3294
 
3284
3295
  catalog.data[:PageLabels] = state.store.ref Nums: pagenum_labels.flatten
@@ -3286,16 +3297,15 @@ class Converter < ::Prawn::Document
3286
3297
  nil
3287
3298
  end
3288
3299
 
3289
- # FIXME only nest inside root node if doctype=article
3290
- def add_outline_level outline, sections, num_levels
3300
+ def add_outline_level outline, sections, num_levels, expand_levels
3291
3301
  sections.each do |sect|
3292
3302
  sect_title = sanitize sect.numbered_title formal: true
3293
3303
  sect_destination = sect.attr 'pdf-destination'
3294
3304
  if (level = sect.level) == num_levels || !sect.sections?
3295
3305
  outline.page title: sect_title, destination: sect_destination
3296
3306
  elsif level <= num_levels
3297
- outline.section sect_title, { destination: sect_destination } do
3298
- add_outline_level outline, sect.sections, num_levels
3307
+ outline.section sect_title, destination: sect_destination, closed: expand_levels < 1 do
3308
+ add_outline_level outline, sect.sections, num_levels, (expand_levels - 1)
3299
3309
  end
3300
3310
  end
3301
3311
  end
@@ -3318,8 +3328,8 @@ class Converter < ::Prawn::Document
3318
3328
 
3319
3329
  def register_fonts font_catalog, fonts_dir
3320
3330
  return unless font_catalog
3321
- dirs = (fonts_dir.split ::File::PATH_SEPARATOR, -1).map do |dir|
3322
- dir.empty? || dir == 'GEM_FONTS_DIR' ? ThemeLoader::FontsDir : dir
3331
+ dirs = (fonts_dir.split ';', -1).map do |dir|
3332
+ dir == 'GEM_FONTS_DIR' || dir.empty? ? ThemeLoader::FontsDir : dir
3323
3333
  end
3324
3334
  font_catalog.each do |key, styles|
3325
3335
  styles = styles.reduce({}) do |accum, (style, path)|
@@ -3480,10 +3490,10 @@ class Converter < ::Prawn::Document
3480
3490
  arranger = ::Prawn::Text::Formatted::Arranger.new self
3481
3491
  by_line = arranger.consumed = []
3482
3492
  fragments.each do |fragment|
3483
- if (txt = fragment[:text]) == LF
3493
+ if (text = fragment[:text]) == LF
3484
3494
  by_line << fragment
3485
- elsif txt.include? LF
3486
- txt.scan(LineScanRx) do |line|
3495
+ elsif text.include? LF
3496
+ text.scan(LineScanRx) do |line|
3487
3497
  by_line << (line == LF ? { text: LF } : (fragment.merge text: line))
3488
3498
  end
3489
3499
  else
@@ -3576,8 +3586,11 @@ class Converter < ::Prawn::Document
3576
3586
  start_of_line = true
3577
3587
  fragments.each do |fragment|
3578
3588
  next if (text = fragment[:text]).empty?
3579
- text[0] = GuardedIndent if start_of_line && (text.start_with? ' ')
3580
- text.gsub! InnerIndent, GuardedInnerIndent if text.include? InnerIndent
3589
+ if start_of_line && (text.start_with? ' ')
3590
+ fragment[:text] = GuardedIndent + (((text = text.slice 1, text.length).include? InnerIndent) ? (text.gsub InnerIndent, GuardedInnerIndent) : text)
3591
+ elsif text.include? InnerIndent
3592
+ fragment[:text] = text.gsub InnerIndent, GuardedInnerIndent
3593
+ end
3581
3594
  start_of_line = text.end_with? LF
3582
3595
  end
3583
3596
  fragments
@@ -113,40 +113,39 @@ class ThemeLoader
113
113
  end
114
114
 
115
115
  def load hash, theme_data = nil, theme_dir = nil
116
- ::Hash === hash ? hash.reduce(theme_data || ::OpenStruct.new) {|data, (key, val)| process_entry key, val, data } : (theme_data || ::OpenStruct.new)
116
+ ::Hash === hash ? hash.reduce(theme_data || ::OpenStruct.new) {|data, (key, val)| process_entry key, val, data, true } : (theme_data || ::OpenStruct.new)
117
117
  end
118
118
 
119
119
  private
120
120
 
121
- def process_entry key, val, data
122
- key = key.tr '-', '_' if key.include? '-'
121
+ def process_entry key, val, data, normalize_key = false
122
+ key = key.tr '-', '_' if normalize_key && (key.include? '-')
123
123
  if key == 'font'
124
124
  val.each do |subkey, subval|
125
- if subkey == 'catalog' && ::Hash === subval
126
- subval = subval.reduce({}) do |accum, (name, styles)|
127
- if ::Hash === styles
128
- accum[name] = styles.reduce({}) do |subaccum, (style, path)|
129
- if (path.start_with? 'GEM_FONTS_DIR') && (sep = path[13])
130
- path = %(#{FontsDir}#{sep}#{path.slice 14, path.length})
131
- end
132
- subaccum[style] = expand_vars path, data
133
- subaccum
134
- end
135
- else
136
- accum[name] = styles
137
- end
138
- accum
125
+ process_entry %(#{key}_#{subkey}), subval, data if subkey == 'catalog' || subkey == 'fallbacks'
126
+ end if ::Hash === val
127
+ elsif key == 'font_catalog'
128
+ data[key] = ::Hash === val ? val.reduce({}) {|accum, (name, styles)|
129
+ accum[name] = styles.reduce({}) do |subaccum, (style, path)|
130
+ if (path.start_with? 'GEM_FONTS_DIR') && (sep = path[13])
131
+ path = %(#{FontsDir}#{sep}#{path.slice 14, path.length})
139
132
  end
140
- end
141
- data[%(font_#{subkey})] = subval
142
- end
133
+ subaccum[style] = expand_vars path, data
134
+ subaccum
135
+ end if ::Hash === styles
136
+ accum
137
+ } : {}
138
+ elsif key == 'font_fallbacks'
139
+ data[key] = ::Array === val ? val.map {|name| expand_vars name.to_s, data } : []
143
140
  elsif key.start_with? 'admonition_icon_'
144
- data[key] = (val || {}).map do |(key2, val2)|
141
+ data[key] = val ? val.map {|(key2, val2)|
145
142
  key2 = key2.tr '-', '_' if key2.include? '-'
146
143
  [key2.to_sym, (key2.end_with? '_color') ? to_color(evaluate val2, data) : (evaluate val2, data)]
147
- end.to_h
144
+ }.to_h : {}
148
145
  elsif ::Hash === val
149
- val.each {|subkey, subval| process_entry %(#{key}_#{subkey}), subval, data }
146
+ val.each do |subkey, subval|
147
+ process_entry %(#{key}_#{key == 'role' || !(subkey.include? '-') ? subkey : (subkey.tr '-', '_')}), subval, data
148
+ end
150
149
  elsif key.end_with? '_color'
151
150
  # QUESTION do we really need to evaluate_math in this case?
152
151
  data[key] = to_color(evaluate val, data)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  module Asciidoctor
3
3
  module PDF
4
- VERSION = '1.5.0.beta.3'
4
+ VERSION = '1.5.0.beta.4'
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.3
4
+ version: 1.5.0.beta.4
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-08-30 00:00:00.000000000 Z
12
+ date: 2019-09-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: asciidoctor
@@ -334,7 +334,6 @@ files:
334
334
  - lib/asciidoctor-pdf/formatted_text/parser.treetop
335
335
  - lib/asciidoctor-pdf/formatted_text/text_background_and_border_renderer.rb
336
336
  - lib/asciidoctor-pdf/formatted_text/transform.rb
337
- - lib/asciidoctor-pdf/implicit_header_processor.rb
338
337
  - lib/asciidoctor-pdf/index_catalog.rb
339
338
  - lib/asciidoctor-pdf/measurements.rb
340
339
  - lib/asciidoctor-pdf/pdf-core_ext.rb
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'asciidoctor/extensions'
3
-
4
- module Asciidoctor
5
- module PDF
6
- # An include processor that skips the implicit author line below
7
- # the document title within include documents.
8
- class ImplicitHeaderProcessor < ::Asciidoctor::Extensions::IncludeProcessor
9
- def process doc, reader, target, attributes
10
- return reader unless File.exist? target
11
- ::File.open target, 'r' do |fd|
12
- # FIXME handle case where doc id is specified above title
13
- if (first_line = fd.readline) && (first_line.start_with? '= ')
14
- # HACK reset counters for each article for Editions
15
- if doc.attr? 'env', 'editions'
16
- doc.counters.each do |counter_key, counter_val|
17
- doc.attributes.delete counter_key
18
- end
19
- doc.counters.clear
20
- end
21
- if (second_line = fd.readline)
22
- if AuthorInfoLineRx =~ second_line
23
- # FIXME temporary hack to set author and e-mail attributes; this should handle all attributes in header!
24
- author = [$1, $2, $3].compact.join ' '
25
- email = $4
26
- reader.push_include fd.readlines, target, target, 3, attributes unless fd.eof?
27
- reader.push_include first_line, target, target, 1, attributes
28
- lines = [%(:author: #{author})]
29
- lines << %(:email: #{email}) if email
30
- reader.push_include lines, target, target, 2, attributes
31
- else
32
- lines = [second_line]
33
- lines += fd.readlines unless fd.eof?
34
- reader.push_include lines, target, target, 2, attributes
35
- reader.push_include first_line, target, target, 1, attributes
36
- end
37
- else
38
- reader.push_include first_line, target, target, 1, attributes
39
- end
40
- else
41
- lines = [first_line]
42
- lines += fd.readlines unless fd.eof?
43
- reader.push_include lines, target, target, 1, attributes
44
- end
45
- end
46
- reader
47
- end
48
-
49
- def handles? target
50
- # FIXME should not require this hack to skip processing bio
51
- !(target.end_with? 'bio.adoc') && ((target.end_with? '.adoc') || (target.end_with? '.asciidoc'))
52
- end
53
-
54
- # FIXME this method shouldn't be required
55
- def update_config config
56
- (@config ||= {}).update config
57
- end
58
- end
59
- end
60
- end
61
-
62
- Asciidoctor::Extensions.register :pdf do
63
- include_processor Asciidoctor::PDF::ImplicitHeaderProcessor if @document.backend == 'pdf'
64
- end