asciidoctor 2.0.12 → 2.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -562,7 +562,9 @@ class Document < AbstractBlock
562
562
  # returns the next number in the sequence for the specified counter
563
563
  def counter name, seed = nil
564
564
  return @parent_document.counter name, seed if @parent_document
565
- if (attr_seed = !(attr_val = @attributes[name]).nil_or_empty?) && (@counters.key? name)
565
+ if attribute_locked? name
566
+ @attributes[name]
567
+ elsif (attr_seed = !(attr_val = @attributes[name]).nil_or_empty?) && (@counters.key? name)
566
568
  @attributes[name] = @counters[name] = Helpers.nextval attr_val
567
569
  elsif seed
568
570
  @attributes[name] = @counters[name] = seed == seed.to_i.to_s ? seed.to_i : seed
@@ -1021,8 +1021,6 @@ module Extensions
1021
1021
  else
1022
1022
  @docinfo_processor_extensions
1023
1023
  end
1024
- else
1025
- nil
1026
1024
  end
1027
1025
  end
1028
1026
 
@@ -274,13 +274,10 @@ module Helpers
274
274
  def nextval current
275
275
  if ::Integer === current
276
276
  current + 1
277
+ elsif (intval = current.to_i).to_s == current.to_s
278
+ intval + 1
277
279
  else
278
- intval = current.to_i
279
- if intval.to_s != current.to_s
280
- (current[0].ord + 1).chr
281
- else
282
- intval + 1
283
- end
280
+ current.succ
284
281
  end
285
282
  end
286
283
 
@@ -20,8 +20,8 @@ module Asciidoctor
20
20
  timings.start :read
21
21
  end
22
22
 
23
- if (logger = options[:logger]) && logger != LoggerManager.logger
24
- LoggerManager.logger = logger
23
+ if (options.key? :logger) && (logger = options[:logger]) != LoggerManager.logger
24
+ LoggerManager.logger = logger || NullLogger.new
25
25
  end
26
26
 
27
27
  if !(attrs = options[:attributes])
@@ -119,7 +119,7 @@ class Parser
119
119
  # returns the Hash of orphan block attributes captured above the header
120
120
  def self.parse_document_header(reader, document)
121
121
  # capture lines of block-level metadata and plow away comment lines that precede first block
122
- block_attrs = parse_block_metadata_lines reader, document
122
+ block_attrs = reader.skip_blank_lines ? (parse_block_metadata_lines reader, document) : {}
123
123
  doc_attrs = document.attributes
124
124
 
125
125
  # special case, block title is not allowed above document title,
@@ -215,9 +215,6 @@ class Parser
215
215
  name_section = initialize_section reader, document, {}
216
216
  name_section_buffer = (reader.read_lines_until break_on_blank_lines: true, skip_line_comments: true).map {|l| l.lstrip }.join ' '
217
217
  if ManpageNamePurposeRx =~ name_section_buffer
218
- doc_attrs['manname-title'] ||= name_section.title
219
- doc_attrs['manname-id'] = name_section.id if name_section.id
220
- doc_attrs['manpurpose'] = $2
221
218
  if (manname = $1).include? ATTR_REF_HEAD
222
219
  manname = document.sub_attributes manname
223
220
  end
@@ -226,8 +223,14 @@ class Parser
226
223
  else
227
224
  mannames = [manname]
228
225
  end
226
+ if (manpurpose = $2).include? ATTR_REF_HEAD
227
+ manpurpose = document.sub_attributes manpurpose
228
+ end
229
+ doc_attrs['manname-title'] ||= name_section.title
230
+ doc_attrs['manname-id'] = name_section.id if name_section.id
229
231
  doc_attrs['manname'] = manname
230
232
  doc_attrs['mannames'] = mannames
233
+ doc_attrs['manpurpose'] = manpurpose
231
234
  if document.backend == 'manpage'
232
235
  doc_attrs['docname'] = manname
233
236
  doc_attrs['outfilesuffix'] = %(.#{manvolnum})
@@ -327,7 +330,7 @@ class Parser
327
330
  if current_level == 0
328
331
  part = book
329
332
  elsif current_level == 1 && section.special
330
- # NOTE technically preface and abstract sections are only permitted in the book doctype
333
+ # NOTE technically preface sections are only permitted in the book doctype
331
334
  unless (sectname = section.sectname) == 'appendix' || sectname == 'preface' || sectname == 'abstract'
332
335
  expected_next_level = nil
333
336
  end
@@ -44,11 +44,11 @@ class Reader
44
44
  @file = nil
45
45
  @dir = '.'
46
46
  @path = '<stdin>'
47
- @lineno = 1 # IMPORTANT lineno assignment must proceed prepare_lines call!
47
+ @lineno = 1
48
48
  elsif ::String === cursor
49
49
  @file = cursor
50
50
  @dir, @path = ::File.split @file
51
- @lineno = 1 # IMPORTANT lineno assignment must proceed prepare_lines call!
51
+ @lineno = 1
52
52
  else
53
53
  if (@file = cursor.file)
54
54
  @dir = cursor.dir || (::File.dirname @file)
@@ -57,7 +57,7 @@ class Reader
57
57
  @dir = cursor.dir || '.'
58
58
  @path = cursor.path || '<stdin>'
59
59
  end
60
- @lineno = cursor.lineno || 1 # IMPORTANT lineno assignment must proceed prepare_lines call!
60
+ @lineno = cursor.lineno || 1
61
61
  end
62
62
  @lines = prepare_lines data, opts
63
63
  @source_lines = @lines.drop 0
@@ -718,7 +718,7 @@ class PreprocessorReader < Reader
718
718
  end
719
719
 
720
720
  # effectively fill the buffer
721
- if (@lines = prepare_lines data, normalize: @process_lines || :chomp, condense: @process_lines, indent: attributes['indent']).empty?
721
+ if (@lines = prepare_lines data, normalize: @process_lines || :chomp, condense: false, indent: attributes['indent']).empty?
722
722
  pop_include
723
723
  else
724
724
  # FIXME we eventually want to handle leveloffset without affecting the lines
@@ -809,7 +809,6 @@ class PreprocessorReader < Reader
809
809
  end
810
810
 
811
811
  if opts.fetch :condense, true
812
- result.shift && @lineno += 1 while (first = result[0]) && first.empty?
813
812
  result.pop while (last = result[-1]) && last.empty?
814
813
  end
815
814
 
@@ -1138,9 +1137,10 @@ class PreprocessorReader < Reader
1138
1137
  else
1139
1138
  select = base_select = wildcard = inc_tags.delete '**'
1140
1139
  end
1140
+ elsif inc_tags.key? '*'
1141
+ select = base_select = !(wildcard = inc_tags.delete '*')
1141
1142
  else
1142
- select = base_select = !(inc_tags.value? true)
1143
- wildcard = inc_tags.delete '*'
1143
+ select = base_select = false
1144
1144
  end
1145
1145
  begin
1146
1146
  reader.call inc_path, read_mode do |f|
@@ -133,10 +133,10 @@ class SyntaxHighlighter::PygmentsAdapter < SyntaxHighlighter::Base
133
133
 
134
134
  CodeCellStartTagCs = '<td class="code">'
135
135
  LinenoColumnStartTagsCs = '<td class="linenos"><div class="linenodiv"><pre>'
136
- LinenoSpanTagCs = '<span class="lineno">\1</span>'
136
+ LinenoSpanTagCs = '<span class="lineno">\1 </span>'
137
137
  PreTagCs = '<pre>\1</pre>'
138
138
  StyledLinenoColumnStartTagsRx = /<td><div class="linenodiv" style="[^"]+?"><pre style="[^"]+?">/
139
- StyledLinenoSpanTagRx = %r(<span style="background-color: #f0f0f0; padding: 0 5px 0 5px">( *\d+ )</span>)
139
+ StyledLinenoSpanTagRx = %r((?<=^|<span></span>)<span style="[^"]+">( *\d+) ?</span>)
140
140
  WRAPPER_CLASS = 'lineno' # doesn't appear in output; Pygments appends "table" to this value to make nested table class
141
141
  # NOTE <pre> has style attribute when pygments-css=style
142
142
  # NOTE <div> has trailing newline when pygments-linenums-mode=table
@@ -13,34 +13,16 @@ class SyntaxHighlighter::RougeAdapter < SyntaxHighlighter::Base
13
13
  end
14
14
 
15
15
  def highlight node, source, lang, opts
16
- if lang.include? '?'
17
- # NOTE cgi-style options only properly supported in Rouge >= 2.1
18
- if (lexer = ::Rouge::Lexer.find_fancy lang)
19
- unless lexer.tag != 'php' || (node.option? 'mixed') || ((lexer_opts = lexer.options).key? 'start_inline')
20
- lexer = lexer.class.new lexer_opts.merge 'start_inline' => true
21
- end
22
- end
23
- elsif (lexer = ::Rouge::Lexer.find lang)
24
- lexer = lexer.tag == 'php' && !(node.option? 'mixed') ? (lexer.new start_inline: true) : lexer.new
25
- end if lang
26
- lexer ||= ::Rouge::Lexers::PlainText.new
27
16
  @style ||= (style = opts[:style]) && (style_available? style) || DEFAULT_STYLE
28
- if opts[:css_mode] == :class
29
- @requires_stylesheet = true
30
- formatter = ::Rouge::Formatters::HTML.new inline_theme: @style
17
+ @requires_stylesheet = true if opts[:css_mode] == :class
18
+ lexer = create_lexer node, source, lang, opts
19
+ formatter = create_formatter node, source, lang, opts
20
+ highlighted = formatter.format lexer.lex source
21
+ if opts[:number_lines] && opts[:callouts]
22
+ [highlighted, (idx = highlighted.index CodeCellStartTagCs) ? idx + CodeCellStartTagCs.length : nil]
31
23
  else
32
- formatter = ::Rouge::Formatters::HTMLInline.new (::Rouge::Theme.find @style).new
33
- end
34
- if (highlight_lines = opts[:highlight_lines])
35
- formatter = RougeExt::Formatters::HTMLLineHighlighter.new formatter, lines: highlight_lines
36
- end
37
- if opts[:number_lines]
38
- formatter = RougeExt::Formatters::HTMLTable.new formatter, start_line: opts[:start_line_number]
39
- if opts[:callouts]
40
- return [(highlighted = formatter.format lexer.lex source), (idx = highlighted.index CodeCellStartTagCs) ? idx + CodeCellStartTagCs.length : nil]
41
- end
24
+ highlighted
42
25
  end
43
- formatter.format lexer.lex source
44
26
  end
45
27
 
46
28
  def format node, lang, opts
@@ -75,6 +57,30 @@ class SyntaxHighlighter::RougeAdapter < SyntaxHighlighter::Base
75
57
  ::File.write (::File.join to_dir, (stylesheet_basename @style)), (read_stylesheet @style), mode: FILE_WRITE_MODE
76
58
  end
77
59
 
60
+ def create_lexer node, source, lang, opts
61
+ if lang.include? '?'
62
+ # NOTE cgi-style options only properly supported in Rouge >= 2.1
63
+ if (lexer = ::Rouge::Lexer.find_fancy lang)
64
+ unless lexer.tag != 'php' || (node.option? 'mixed') || ((lexer_opts = lexer.options).key? 'start_inline')
65
+ lexer = lexer.class.new lexer_opts.merge 'start_inline' => true
66
+ end
67
+ end
68
+ elsif (lexer = ::Rouge::Lexer.find lang)
69
+ lexer = lexer.tag == 'php' && !(node.option? 'mixed') ? (lexer.new start_inline: true) : lexer.new
70
+ end if lang
71
+ lexer || ::Rouge::Lexers::PlainText.new
72
+ end
73
+
74
+ def create_formatter node, source, lang, opts
75
+ formatter = opts[:css_mode] == :class ?
76
+ (::Rouge::Formatters::HTML.new inline_theme: @style) :
77
+ (::Rouge::Formatters::HTMLInline.new (::Rouge::Theme.find @style).new)
78
+ if (highlight_lines = opts[:highlight_lines])
79
+ formatter = RougeExt::Formatters::HTMLLineHighlighter.new formatter, lines: highlight_lines
80
+ end
81
+ opts[:number_lines] ? (RougeExt::Formatters::HTMLTable.new formatter, start_line: opts[:start_line_number]) : formatter
82
+ end
83
+
78
84
  module Loader
79
85
  private
80
86
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Asciidoctor
3
- VERSION = '2.0.12'
3
+ VERSION = '2.0.13'
4
4
  end
data/man/asciidoctor.1 CHANGED
@@ -1,13 +1,13 @@
1
1
  '\" t
2
2
  .\" Title: asciidoctor
3
3
  .\" Author: Dan Allen, Sarah White, Ryan Waldron
4
- .\" Generator: Asciidoctor 2.0.12
5
- .\" Date: 2020-11-10
4
+ .\" Generator: Asciidoctor 2.0.13
5
+ .\" Date: 2021-04-10
6
6
  .\" Manual: Asciidoctor Manual
7
- .\" Source: Asciidoctor 2.0.12
7
+ .\" Source: Asciidoctor 2.0.13
8
8
  .\" Language: English
9
9
  .\"
10
- .TH "ASCIIDOCTOR" "1" "2020-11-10" "Asciidoctor 2.0.12" "Asciidoctor Manual"
10
+ .TH "ASCIIDOCTOR" "1" "2021-04-10" "Asciidoctor 2.0.13" "Asciidoctor Manual"
11
11
  .ie \n(.g .ds Aq \(aq
12
12
  .el .ds Aq '
13
13
  .ss \n[.ss] 0
@@ -188,7 +188,7 @@ Include backtrace information when reporting errors.
188
188
  .sp
189
189
  \fB\-v, \-\-verbose\fP
190
190
  .RS 4
191
- Verbosely print processing information to stderr, including debug\-level log messages.
191
+ Sets log level to DEBUG so application messages logged at INFO or DEBUG level are printed to stderr.
192
192
  .RE
193
193
  .sp
194
194
  \fB\-w, \-\-warnings\fP
@@ -220,7 +220,7 @@ Print program version number.
220
220
  \fBAsciidoctor\fP honors the \fBSOURCE_DATE_EPOCH\fP environment variable.
221
221
  If this variable is assigned an integer value, that value is used as the epoch of all input documents and as the local date and time.
222
222
  See \c
223
- .URL "https://reproducible\-builds.org/specs/source\-date\-epoch/" "" " "
223
+ .URL "https://reproducible\-builds.org/specs/source\-date\-epoch/" "" ""
224
224
  for more information about this environment variable.
225
225
  .SH "EXIT STATUS"
226
226
  .sp
@@ -257,7 +257,7 @@ Refer to the \fBAsciidoctor\fP issue tracker at \c
257
257
  .URL "http://discuss.asciidoctor.org" "" ""
258
258
  .SH "COPYING"
259
259
  .sp
260
- Copyright (C) 2012\-2020 Dan Allen, Ryan Waldron, and the Asciidoctor Project.
260
+ Copyright (C) 2012\-2021 Dan Allen, Ryan Waldron, and the Asciidoctor Project.
261
261
  Free use of this software is granted under the terms of the MIT License.
262
262
  .SH "AUTHORS"
263
263
  .sp
data/man/asciidoctor.adoc CHANGED
@@ -1,7 +1,7 @@
1
1
  = asciidoctor(1)
2
2
  Dan Allen; Sarah White; Ryan Waldron
3
3
  :doctype: manpage
4
- :release-version: 2.0.12
4
+ :release-version: 2.0.13
5
5
  :man manual: Asciidoctor Manual
6
6
  :man source: Asciidoctor {release-version}
7
7
  :page-layout: base
@@ -136,7 +136,7 @@ Matching templates found in subsequent directories override ones previously disc
136
136
  Include backtrace information when reporting errors.
137
137
 
138
138
  *-v, --verbose*::
139
- Verbosely print processing information to stderr, including debug-level log messages.
139
+ Sets log level to DEBUG so application messages logged at INFO or DEBUG level are printed to stderr.
140
140
 
141
141
  *-w, --warnings*::
142
142
  Turn on script warnings (applies to executed code).
@@ -192,5 +192,5 @@ Refer to the *Asciidoctor* issue tracker at https://github.com/asciidoctor/ascii
192
192
 
193
193
  == COPYING
194
194
 
195
- Copyright \(C) 2012-2020 Dan Allen, Ryan Waldron, and the Asciidoctor Project.
195
+ Copyright \(C) 2012-2021 Dan Allen, Ryan Waldron, and the Asciidoctor Project.
196
196
  Free use of this software is granted under the terms of the MIT License.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.12
4
+ version: 2.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Allen
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2020-11-10 00:00:00.000000000 Z
16
+ date: 2021-04-10 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: asciimath
@@ -21,14 +21,14 @@ dependencies:
21
21
  requirements:
22
22
  - - "~>"
23
23
  - !ruby/object:Gem::Version
24
- version: 1.0.0
24
+ version: 2.0.0
25
25
  type: :development
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
28
28
  requirements:
29
29
  - - "~>"
30
30
  - !ruby/object:Gem::Version
31
- version: 1.0.0
31
+ version: 2.0.0
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: coderay
34
34
  requirement: !ruby/object:Gem::Requirement
@@ -77,28 +77,28 @@ dependencies:
77
77
  requirements:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
- version: 1.9.0
80
+ version: 1.10.0
81
81
  type: :development
82
82
  prerelease: false
83
83
  version_requirements: !ruby/object:Gem::Requirement
84
84
  requirements:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
- version: 1.9.0
87
+ version: 1.10.0
88
88
  - !ruby/object:Gem::Dependency
89
89
  name: haml
90
90
  requirement: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - "~>"
93
93
  - !ruby/object:Gem::Version
94
- version: 5.0.0
94
+ version: 5.2.0
95
95
  type: :development
96
96
  prerelease: false
97
97
  version_requirements: !ruby/object:Gem::Requirement
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: 5.0.0
101
+ version: 5.2.0
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: minitest
104
104
  requirement: !ruby/object:Gem::Requirement
@@ -147,14 +147,14 @@ dependencies:
147
147
  requirements:
148
148
  - - "~>"
149
149
  - !ruby/object:Gem::Version
150
- version: 3.15.0
150
+ version: 3.26.0
151
151
  type: :development
152
152
  prerelease: false
153
153
  version_requirements: !ruby/object:Gem::Requirement
154
154
  requirements:
155
155
  - - "~>"
156
156
  - !ruby/object:Gem::Version
157
- version: 3.15.0
157
+ version: 3.26.0
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: rspec-expectations
160
160
  requirement: !ruby/object:Gem::Requirement
@@ -175,14 +175,14 @@ dependencies:
175
175
  requirements:
176
176
  - - "~>"
177
177
  - !ruby/object:Gem::Version
178
- version: 4.0.0
178
+ version: 4.1.0
179
179
  type: :development
180
180
  prerelease: false
181
181
  version_requirements: !ruby/object:Gem::Requirement
182
182
  requirements:
183
183
  - - "~>"
184
184
  - !ruby/object:Gem::Version
185
- version: 4.0.0
185
+ version: 4.1.0
186
186
  - !ruby/object:Gem::Dependency
187
187
  name: tilt
188
188
  requirement: !ruby/object:Gem::Requirement
@@ -217,6 +217,7 @@ files:
217
217
  - asciidoctor.gemspec
218
218
  - bin/asciidoctor
219
219
  - data/locale/attributes-ar.adoc
220
+ - data/locale/attributes-be.adoc
220
221
  - data/locale/attributes-bg.adoc
221
222
  - data/locale/attributes-ca.adoc
222
223
  - data/locale/attributes-cs.adoc
@@ -324,7 +325,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
324
325
  - !ruby/object:Gem::Version
325
326
  version: '0'
326
327
  requirements: []
327
- rubygems_version: 3.1.4
328
+ rubygems_version: 3.2.15
328
329
  signing_key:
329
330
  specification_version: 4
330
331
  summary: An implementation of the AsciiDoc text processor and publishing toolchain