asciidoctor 2.0.15 → 2.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +38 -2
  3. data/LICENSE +1 -1
  4. data/README-de.adoc +3 -3
  5. data/README-fr.adoc +3 -3
  6. data/README-jp.adoc +3 -3
  7. data/README-zh_CN.adoc +3 -3
  8. data/README.adoc +2 -2
  9. data/asciidoctor.gemspec +1 -8
  10. data/data/locale/attributes-th.adoc +23 -0
  11. data/data/locale/attributes-vi.adoc +23 -0
  12. data/data/stylesheets/asciidoctor-default.css +50 -48
  13. data/lib/asciidoctor.rb +7 -7
  14. data/lib/asciidoctor/abstract_block.rb +4 -4
  15. data/lib/asciidoctor/abstract_node.rb +9 -8
  16. data/lib/asciidoctor/block.rb +6 -6
  17. data/lib/asciidoctor/cli/invoker.rb +0 -1
  18. data/lib/asciidoctor/cli/options.rb +22 -22
  19. data/lib/asciidoctor/convert.rb +1 -0
  20. data/lib/asciidoctor/converter.rb +5 -3
  21. data/lib/asciidoctor/converter/docbook5.rb +20 -22
  22. data/lib/asciidoctor/converter/html5.rb +70 -60
  23. data/lib/asciidoctor/converter/manpage.rb +61 -52
  24. data/lib/asciidoctor/converter/template.rb +11 -12
  25. data/lib/asciidoctor/document.rb +22 -37
  26. data/lib/asciidoctor/extensions.rb +10 -10
  27. data/lib/asciidoctor/list.rb +2 -6
  28. data/lib/asciidoctor/load.rb +10 -9
  29. data/lib/asciidoctor/logging.rb +10 -8
  30. data/lib/asciidoctor/parser.rb +122 -141
  31. data/lib/asciidoctor/path_resolver.rb +3 -3
  32. data/lib/asciidoctor/reader.rb +67 -68
  33. data/lib/asciidoctor/rx.rb +2 -1
  34. data/lib/asciidoctor/substitutors.rb +97 -99
  35. data/lib/asciidoctor/syntax_highlighter.rb +8 -11
  36. data/lib/asciidoctor/syntax_highlighter/coderay.rb +2 -1
  37. data/lib/asciidoctor/syntax_highlighter/highlightjs.rb +1 -1
  38. data/lib/asciidoctor/syntax_highlighter/pygments.rb +2 -1
  39. data/lib/asciidoctor/syntax_highlighter/rouge.rb +2 -1
  40. data/lib/asciidoctor/table.rb +17 -19
  41. data/lib/asciidoctor/timings.rb +3 -3
  42. data/lib/asciidoctor/version.rb +1 -1
  43. data/man/asciidoctor.1 +8 -9
  44. data/man/asciidoctor.adoc +7 -6
  45. metadata +7 -61
@@ -99,9 +99,10 @@ module SyntaxHighlighter
99
99
  raise ::NotImplementedError, %(#{SyntaxHighlighter} subclass #{self.class} must implement the ##{__method__} method since #write_stylesheet? returns true)
100
100
  end
101
101
 
102
- private_class_method def self.included into
102
+ def self.included into
103
103
  into.extend Config
104
- end || :included
104
+ end
105
+ private_class_method :included # use separate declaration for Ruby 2.0.x
105
106
 
106
107
  module Config
107
108
  # Public: Statically register the current class in the registry for the specified names.
@@ -152,7 +153,7 @@ module SyntaxHighlighter
152
153
  end
153
154
 
154
155
  private
155
-
156
+
156
157
  def registry
157
158
  raise ::NotImplementedError, %(#{Factory} subclass #{self.class} must implement the ##{__method__} method)
158
159
  end
@@ -166,19 +167,17 @@ module SyntaxHighlighter
166
167
  end
167
168
 
168
169
  private
169
-
170
- def registry
171
- @registry
172
- end
170
+
171
+ attr_reader :registry
173
172
  end
174
173
 
175
174
  module DefaultFactory
176
175
  include Factory
177
176
 
178
- private
179
-
180
177
  @@registry = {}
181
178
 
179
+ private
180
+
182
181
  def registry
183
182
  @@registry
184
183
  end
@@ -216,8 +215,6 @@ module SyntaxHighlighter
216
215
  'rouge' => %(#{__dir__}/syntax_highlighter/rouge),
217
216
  }
218
217
 
219
- private
220
-
221
218
  @@mutex = ::Mutex.new
222
219
  end
223
220
  end
@@ -78,7 +78,8 @@ class SyntaxHighlighter::CodeRayAdapter < SyntaxHighlighter::Base
78
78
  end
79
79
 
80
80
  extend Styles # exports static methods
81
- include Loader, Styles # adds methods to instance
81
+ include Styles # adds methods to instance
82
+ include Loader # adds methods to instance
82
83
 
83
84
  CodeCellStartTagCs = '<td class="code"><pre>'
84
85
 
@@ -9,7 +9,7 @@ class SyntaxHighlighter::HighlightJsAdapter < SyntaxHighlighter::Base
9
9
  end
10
10
 
11
11
  def format node, lang, opts
12
- super node, lang, (opts.merge transform: proc {|_, code| code['class'] = %(language-#{lang || 'none'} hljs) } )
12
+ super node, lang, (opts.merge transform: proc {|_, code| code['class'] = %(language-#{lang || 'none'} hljs) })
13
13
  end
14
14
 
15
15
  def docinfo? location
@@ -129,7 +129,8 @@ class SyntaxHighlighter::PygmentsAdapter < SyntaxHighlighter::Base
129
129
  end
130
130
 
131
131
  extend Styles # exports static methods
132
- include Loader, Styles # adds methods to instance
132
+ include Styles # adds methods to instance
133
+ include Loader # adds methods to instance
133
134
 
134
135
  CodeCellStartTagCs = '<td class="code">'
135
136
  LinenoColumnStartTagsCs = '<td class="linenos"><div class="linenodiv"><pre>'
@@ -133,7 +133,8 @@ class SyntaxHighlighter::RougeAdapter < SyntaxHighlighter::Base
133
133
  end
134
134
 
135
135
  extend Styles # exports static methods
136
- include Loader, Styles # adds methods to instance
136
+ include Styles # adds methods to instance
137
+ include Loader # adds methods to instance
137
138
 
138
139
  CodeCellStartTagCs = '<td class="code">'
139
140
 
@@ -259,7 +259,8 @@ class Table::Cell < AbstractBlock
259
259
  cell_style = attributes['style'] || cell_style unless in_header_row
260
260
  update_attributes attributes
261
261
  end
262
- if cell_style == :asciidoc
262
+ case cell_style
263
+ when :asciidoc
263
264
  asciidoc = true
264
265
  inner_document_cursor = opts[:cursor]
265
266
  if (cell_text = cell_text.rstrip).start_with? LF
@@ -270,7 +271,7 @@ class Table::Cell < AbstractBlock
270
271
  else
271
272
  cell_text = cell_text.lstrip
272
273
  end
273
- elsif cell_style == :literal
274
+ when :literal
274
275
  literal = true
275
276
  cell_text = cell_text.rstrip
276
277
  # QUESTION should we use same logic as :asciidoc cell? strip leading space if text doesn't start with newline?
@@ -357,14 +358,10 @@ class Table::Cell < AbstractBlock
357
358
  apply_subs @text, @subs
358
359
  end
359
360
 
360
- # Public: Set the String text.
361
+ # Public: Set the String text for this cell.
361
362
  #
362
363
  # This method shouldn't be used for cells that have the AsciiDoc style.
363
- #
364
- # Returns the new String text assigned to this Cell
365
- def text= val
366
- @text = val
367
- end
364
+ attr_writer :text
368
365
 
369
366
  # Public: Handles the body data (tbody, tfoot), applying styles and partitioning into paragraphs
370
367
  #
@@ -406,7 +403,7 @@ class Table::Cell < AbstractBlock
406
403
  end
407
404
 
408
405
  def to_s
409
- "#{super.to_s} - [text: #@text, colspan: #{@colspan || 1}, rowspan: #{@rowspan || 1}, attributes: #@attributes]"
406
+ %(#{super} - [text: #{@text}, colspan: #{@colspan || 1}, rowspan: #{@rowspan || 1}, attributes: #{@attributes}])
410
407
  end
411
408
  end
412
409
 
@@ -534,12 +531,13 @@ class Table::ParserContext
534
531
  #
535
532
  # returns true if the buffer has unclosed quotes, false if it doesn't or it
536
533
  # isn't quoted data
537
- def buffer_has_unclosed_quotes? append = nil
538
- if (record = append ? (@buffer + append).strip : @buffer.strip) == '"'
534
+ def buffer_has_unclosed_quotes? append = nil, q = '"'
535
+ if (record = append ? (@buffer + append).strip : @buffer.strip) == q
539
536
  true
540
- elsif record.start_with? '"'
541
- if ((trailing_quote = record.end_with? '"') && (record.end_with? '""')) || (record.start_with? '""')
542
- ((record = record.gsub '""', '').start_with? '"') && !(record.end_with? '"')
537
+ elsif record.start_with? q
538
+ qq = q + q
539
+ if ((trailing_quote = record.end_with? q) && (record.end_with? qq)) || (record.start_with? qq)
540
+ ((record = record.gsub qq, '').start_with? q) && !(record.end_with? q)
543
541
  else
544
542
  !trailing_quote
545
543
  end
@@ -632,20 +630,20 @@ class Table::ParserContext
632
630
  @buffer = ''
633
631
  cellspec = nil
634
632
  repeat = 1
635
- if @format == 'csv' && !cell_text.empty? && cell_text.include?('"')
633
+ if @format == 'csv' && !cell_text.empty? && (cell_text.include? (q = '"'))
636
634
  # this may not be perfect logic, but it hits the 99%
637
- if cell_text.start_with?('"') && cell_text.end_with?('"')
635
+ if (cell_text.start_with? q) && (cell_text.end_with? q)
638
636
  # unquote
639
637
  if (cell_text = cell_text.slice(1, cell_text.length - 2))
640
638
  # trim whitespace and collapse escaped quotes
641
- cell_text = cell_text.strip.squeeze('"')
639
+ cell_text = cell_text.strip.squeeze q
642
640
  else
643
641
  logger.error message_with_context 'unclosed quote in CSV data; setting cell to empty', source_location: @reader.cursor_at_prev_line
644
642
  cell_text = ''
645
643
  end
646
644
  else
647
645
  # collapse escaped quotes
648
- cell_text = cell_text.squeeze('"')
646
+ cell_text = cell_text.squeeze q
649
647
  end
650
648
  end
651
649
  end
@@ -664,7 +662,7 @@ class Table::ParserContext
664
662
  # QUESTION is this right for cells that span columns?
665
663
  unless (column = @table.columns[@current_row.size])
666
664
  logger.error message_with_context 'dropping cell because it exceeds specified number of columns', source_location: @reader.cursor_before_mark
667
- return
665
+ return nil
668
666
  end
669
667
  end
670
668
 
@@ -49,9 +49,9 @@ module Asciidoctor
49
49
 
50
50
  def print_report to = $stdout, subject = nil
51
51
  to.puts %(Input file: #{subject}) if subject
52
- to.puts %( Time to read and parse source: #{'%05.5f' % read_parse.to_f})
53
- to.puts %( Time to convert document: #{'%05.5f' % convert.to_f})
54
- to.puts %( Total time (read, parse and convert): #{'%05.5f' % read_parse_convert.to_f})
52
+ to.puts %( Time to read and parse source: #{sprintf '%05.5f', read_parse.to_f})
53
+ to.puts %( Time to convert document: #{sprintf '%05.5f', convert.to_f})
54
+ to.puts %( Total time (read, parse and convert): #{sprintf '%05.5f', read_parse_convert.to_f})
55
55
  end
56
56
 
57
57
  private
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Asciidoctor
3
- VERSION = '2.0.15'
3
+ VERSION = '2.0.16'
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.15
5
- .\" Date: 2021-04-27
4
+ .\" Generator: Asciidoctor 2.0.16
5
+ .\" Date: 2021-08-03
6
6
  .\" Manual: Asciidoctor Manual
7
- .\" Source: Asciidoctor 2.0.15
7
+ .\" Source: Asciidoctor 2.0.16
8
8
  .\" Language: English
9
9
  .\"
10
- .TH "ASCIIDOCTOR" "1" "2021-04-27" "Asciidoctor 2.0.15" "Asciidoctor Manual"
10
+ .TH "ASCIIDOCTOR" "1" "2021-08-03" "Asciidoctor 2.0.16" "Asciidoctor Manual"
11
11
  .ie \n(.g .ds Aq \(aq
12
12
  .el .ds Aq '
13
13
  .ss \n[.ss] 0
@@ -109,11 +109,10 @@ This name is also used to build the full path to the custom converter templates.
109
109
  If a template engine is not specified, it will be auto\-detected based on the file extension of the custom converter templates found.
110
110
  .RE
111
111
  .sp
112
- \fB\-e, \-\-eruby\fP
112
+ \fB\-e, \-\-embedded\fP
113
113
  .RS 4
114
- Specifies the eRuby implementation to use for executing the custom converter templates written in ERB.
115
- Supported values are \fIerb\fP and \fIerubis\fP.
116
- Defaults to \fIerb\fP.
114
+ Output an embeddable document, which excludes the header, the footer, and everything outside the body of the document.
115
+ This option is useful for producing documents that can be inserted into an external template.
117
116
  .RE
118
117
  .sp
119
118
  \fB\-I, \-\-load\-path\fP=\fIDIRECTORY\fP
@@ -257,7 +256,7 @@ Refer to the \fBAsciidoctor\fP issue tracker at \c
257
256
  .URL "http://discuss.asciidoctor.org" "" ""
258
257
  .SH "COPYING"
259
258
  .sp
260
- Copyright (C) 2012\-2021 Dan Allen, Ryan Waldron, and the Asciidoctor Project.
259
+ Copyright (C) 2012\-present Dan Allen, Ryan Waldron, and the Asciidoctor Project.
261
260
  Free use of this software is granted under the terms of the MIT License.
262
261
  .SH "AUTHORS"
263
262
  .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.15
4
+ :release-version: 2.0.16
5
5
  :man manual: Asciidoctor Manual
6
6
  :man source: Asciidoctor {release-version}
7
7
  :page-layout: base
@@ -22,6 +22,7 @@ If _FILE_ is _-_ then the AsciiDoc source is read from standard input.
22
22
 
23
23
  == OPTIONS
24
24
 
25
+ // tag::options[]
25
26
  === Security Settings
26
27
 
27
28
  *-B, --base-dir*=_DIR_::
@@ -79,10 +80,9 @@ This option may be specified more than once.
79
80
  This name is also used to build the full path to the custom converter templates.
80
81
  If a template engine is not specified, it will be auto-detected based on the file extension of the custom converter templates found.
81
82
 
82
- *-e, --eruby*::
83
- Specifies the eRuby implementation to use for executing the custom converter templates written in ERB.
84
- Supported values are _erb_ and _erubis_.
85
- Defaults to _erb_.
83
+ *-e, --embedded*::
84
+ Output an embeddable document, which excludes the header, the footer, and everything outside the body of the document.
85
+ This option is useful for producing documents that can be inserted into an external template.
86
86
 
87
87
  *-I, --load-path*=_DIRECTORY_::
88
88
  Add the specified directory to the load path, so that _-r_ can load extensions from outside the default Ruby load path.
@@ -155,6 +155,7 @@ Matching templates found in subsequent directories override ones previously disc
155
155
  Print program version number.
156
156
  +
157
157
  *-v* can also be used if no source files are specified.
158
+ // end::options[]
158
159
 
159
160
  == ENVIRONMENT
160
161
 
@@ -192,5 +193,5 @@ Refer to the *Asciidoctor* issue tracker at https://github.com/asciidoctor/ascii
192
193
 
193
194
  == COPYING
194
195
 
195
- Copyright \(C) 2012-2021 Dan Allen, Ryan Waldron, and the Asciidoctor Project.
196
+ Copyright \(C) 2012-present Dan Allen, Ryan Waldron, and the Asciidoctor Project.
196
197
  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.15
4
+ version: 2.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Allen
@@ -13,36 +13,8 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2021-04-27 00:00:00.000000000 Z
16
+ date: 2021-08-03 00:00:00.000000000 Z
17
17
  dependencies:
18
- - !ruby/object:Gem::Dependency
19
- name: asciimath
20
- requirement: !ruby/object:Gem::Requirement
21
- requirements:
22
- - - "~>"
23
- - !ruby/object:Gem::Version
24
- version: 2.0.0
25
- type: :development
26
- prerelease: false
27
- version_requirements: !ruby/object:Gem::Requirement
28
- requirements:
29
- - - "~>"
30
- - !ruby/object:Gem::Version
31
- version: 2.0.0
32
- - !ruby/object:Gem::Dependency
33
- name: coderay
34
- requirement: !ruby/object:Gem::Requirement
35
- requirements:
36
- - - "~>"
37
- - !ruby/object:Gem::Version
38
- version: 1.1.0
39
- type: :development
40
- prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
- requirements:
43
- - - "~>"
44
- - !ruby/object:Gem::Version
45
- version: 1.1.0
46
18
  - !ruby/object:Gem::Dependency
47
19
  name: concurrent-ruby
48
20
  requirement: !ruby/object:Gem::Requirement
@@ -105,14 +77,14 @@ dependencies:
105
77
  requirements:
106
78
  - - "~>"
107
79
  - !ruby/object:Gem::Version
108
- version: 5.11.0
80
+ version: 5.14.0
109
81
  type: :development
110
82
  prerelease: false
111
83
  version_requirements: !ruby/object:Gem::Requirement
112
84
  requirements:
113
85
  - - "~>"
114
86
  - !ruby/object:Gem::Version
115
- version: 5.11.0
87
+ version: 5.14.0
116
88
  - !ruby/object:Gem::Dependency
117
89
  name: nokogiri
118
90
  requirement: !ruby/object:Gem::Requirement
@@ -141,34 +113,6 @@ dependencies:
141
113
  - - "~>"
142
114
  - !ruby/object:Gem::Version
143
115
  version: 12.3.0
144
- - !ruby/object:Gem::Dependency
145
- name: rouge
146
- requirement: !ruby/object:Gem::Requirement
147
- requirements:
148
- - - "~>"
149
- - !ruby/object:Gem::Version
150
- version: 3.26.0
151
- type: :development
152
- prerelease: false
153
- version_requirements: !ruby/object:Gem::Requirement
154
- requirements:
155
- - - "~>"
156
- - !ruby/object:Gem::Version
157
- version: 3.26.0
158
- - !ruby/object:Gem::Dependency
159
- name: rspec-expectations
160
- requirement: !ruby/object:Gem::Requirement
161
- requirements:
162
- - - "~>"
163
- - !ruby/object:Gem::Version
164
- version: 3.8.0
165
- type: :development
166
- prerelease: false
167
- version_requirements: !ruby/object:Gem::Requirement
168
- requirements:
169
- - - "~>"
170
- - !ruby/object:Gem::Version
171
- version: 3.8.0
172
116
  - !ruby/object:Gem::Dependency
173
117
  name: slim
174
118
  requirement: !ruby/object:Gem::Requirement
@@ -244,8 +188,10 @@ files:
244
188
  - data/locale/attributes-sr.adoc
245
189
  - data/locale/attributes-sr_Latn.adoc
246
190
  - data/locale/attributes-sv.adoc
191
+ - data/locale/attributes-th.adoc
247
192
  - data/locale/attributes-tr.adoc
248
193
  - data/locale/attributes-uk.adoc
194
+ - data/locale/attributes-vi.adoc
249
195
  - data/locale/attributes-zh_CN.adoc
250
196
  - data/locale/attributes-zh_TW.adoc
251
197
  - data/locale/attributes.adoc
@@ -325,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
325
271
  - !ruby/object:Gem::Version
326
272
  version: '0'
327
273
  requirements: []
328
- rubygems_version: 3.2.15
274
+ rubygems_version: 3.2.22
329
275
  signing_key:
330
276
  specification_version: 4
331
277
  summary: An implementation of the AsciiDoc text processor and publishing toolchain