asciidoctor 2.0.10 → 2.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +89 -5
  3. data/LICENSE +1 -1
  4. data/README-de.adoc +4 -4
  5. data/README-fr.adoc +4 -4
  6. data/README-jp.adoc +4 -4
  7. data/README-zh_CN.adoc +6 -6
  8. data/README.adoc +14 -10
  9. data/asciidoctor.gemspec +3 -3
  10. data/data/locale/attributes-ar.adoc +4 -3
  11. data/data/locale/attributes-bg.adoc +4 -3
  12. data/data/locale/attributes-ca.adoc +6 -5
  13. data/data/locale/attributes-cs.adoc +4 -3
  14. data/data/locale/attributes-da.adoc +6 -5
  15. data/data/locale/attributes-de.adoc +4 -4
  16. data/data/locale/attributes-en.adoc +4 -4
  17. data/data/locale/attributes-es.adoc +6 -5
  18. data/data/locale/attributes-fa.adoc +4 -3
  19. data/data/locale/attributes-fi.adoc +4 -3
  20. data/data/locale/attributes-fr.adoc +6 -5
  21. data/data/locale/attributes-hu.adoc +4 -3
  22. data/data/locale/attributes-id.adoc +4 -3
  23. data/data/locale/attributes-it.adoc +4 -3
  24. data/data/locale/attributes-ja.adoc +4 -3
  25. data/data/locale/{attributes-kr.adoc → attributes-ko.adoc} +4 -3
  26. data/data/locale/attributes-nb.adoc +4 -3
  27. data/data/locale/attributes-nl.adoc +4 -3
  28. data/data/locale/attributes-nn.adoc +4 -3
  29. data/data/locale/attributes-pl.adoc +8 -7
  30. data/data/locale/attributes-pt.adoc +6 -5
  31. data/data/locale/attributes-pt_BR.adoc +6 -5
  32. data/data/locale/attributes-ro.adoc +4 -3
  33. data/data/locale/attributes-ru.adoc +6 -5
  34. data/data/locale/attributes-sr.adoc +4 -4
  35. data/data/locale/attributes-sr_Latn.adoc +4 -4
  36. data/data/locale/attributes-sv.adoc +4 -4
  37. data/data/locale/attributes-tr.adoc +4 -3
  38. data/data/locale/attributes-uk.adoc +6 -5
  39. data/data/locale/attributes-zh_CN.adoc +4 -3
  40. data/data/locale/attributes-zh_TW.adoc +4 -3
  41. data/data/stylesheets/asciidoctor-default.css +22 -20
  42. data/lib/asciidoctor.rb +33 -7
  43. data/lib/asciidoctor/abstract_block.rb +9 -4
  44. data/lib/asciidoctor/abstract_node.rb +16 -6
  45. data/lib/asciidoctor/attribute_list.rb +59 -67
  46. data/lib/asciidoctor/cli/invoker.rb +2 -0
  47. data/lib/asciidoctor/cli/options.rb +3 -3
  48. data/lib/asciidoctor/convert.rb +167 -162
  49. data/lib/asciidoctor/converter.rb +13 -12
  50. data/lib/asciidoctor/converter/docbook5.rb +3 -7
  51. data/lib/asciidoctor/converter/html5.rb +59 -42
  52. data/lib/asciidoctor/converter/manpage.rb +12 -11
  53. data/lib/asciidoctor/converter/template.rb +3 -0
  54. data/lib/asciidoctor/document.rb +23 -38
  55. data/lib/asciidoctor/extensions.rb +2 -2
  56. data/lib/asciidoctor/helpers.rb +17 -9
  57. data/lib/asciidoctor/load.rb +101 -101
  58. data/lib/asciidoctor/parser.rb +26 -23
  59. data/lib/asciidoctor/path_resolver.rb +14 -12
  60. data/lib/asciidoctor/reader.rb +14 -7
  61. data/lib/asciidoctor/rx.rb +5 -4
  62. data/lib/asciidoctor/substitutors.rb +57 -38
  63. data/lib/asciidoctor/syntax_highlighter.rb +8 -5
  64. data/lib/asciidoctor/syntax_highlighter/coderay.rb +1 -1
  65. data/lib/asciidoctor/syntax_highlighter/highlightjs.rb +12 -4
  66. data/lib/asciidoctor/syntax_highlighter/prettify.rb +7 -4
  67. data/lib/asciidoctor/syntax_highlighter/pygments.rb +2 -3
  68. data/lib/asciidoctor/syntax_highlighter/rouge.rb +15 -7
  69. data/lib/asciidoctor/table.rb +49 -20
  70. data/lib/asciidoctor/version.rb +1 -1
  71. data/man/asciidoctor.1 +6 -6
  72. data/man/asciidoctor.adoc +3 -3
  73. metadata +8 -8
@@ -58,7 +58,7 @@ class Table < AbstractBlock
58
58
  @rows = Rows.new
59
59
  @columns = []
60
60
 
61
- @has_header_option = attributes['header-option'] ? true : false
61
+ @has_header_option = false
62
62
 
63
63
  # smells like we need a utility method here
64
64
  # to resolve an integer width from potential bogus input
@@ -154,22 +154,19 @@ class Table < AbstractBlock
154
154
  # returns nothing
155
155
  def partition_header_footer(attrs)
156
156
  # set rowcount before splitting up body rows
157
- @attributes['rowcount'] = @rows.body.size
158
-
159
- num_body_rows = @rows.body.size
160
- if num_body_rows > 0 && @has_header_option
161
- head = @rows.body.shift
162
- num_body_rows -= 1
163
- # styles aren't applied to header row
164
- head.each {|c| c.style = nil }
165
- # QUESTION why does AsciiDoc use an array for head? is it
166
- # possible to have more than one based on the syntax?
167
- @rows.head = [head]
157
+ num_body_rows = @attributes['rowcount'] = (body = @rows.body).size
158
+
159
+ if num_body_rows > 0
160
+ if @has_header_option
161
+ @rows.head = [body.shift.map {|cell| cell.reinitialize true }]
162
+ num_body_rows -= 1
163
+ elsif @has_header_option.nil?
164
+ @has_header_option = false
165
+ body.unshift(body.shift.map {|cell| cell.reinitialize false })
166
+ end
168
167
  end
169
168
 
170
- if num_body_rows > 0 && attrs['footer-option']
171
- @rows.foot = [@rows.body.pop]
172
- end
169
+ @rows.foot = [body.pop] if num_body_rows > 0 && attrs['footer-option']
173
170
 
174
171
  nil
175
172
  end
@@ -232,14 +229,23 @@ class Table::Cell < AbstractBlock
232
229
  # Public: An alias to the parent block (which is always a Column)
233
230
  alias column parent
234
231
 
235
- # Internal: Returns the nested Document in an AsciiDoc table cell (only set when style is :asciidoc)
232
+ # Public: Returns the nested Document in an AsciiDoc table cell (only set when style is :asciidoc)
236
233
  attr_reader :inner_document
237
234
 
238
235
  def initialize column, cell_text, attributes = {}, opts = {}
239
236
  super column, :table_cell
237
+ @cursor = @reinitialize_args = nil
240
238
  @source_location = opts[:cursor].dup if @document.sourcemap
239
+ # NOTE: column is always set when parsing; may not be set when building table from the API
241
240
  if column
242
- cell_style = column.attributes['style'] unless (in_header_row = column.table.header_row?)
241
+ if (in_header_row = column.table.header_row?)
242
+ if (cell_style = column.style || attributes&.[]('style')) == :asciidoc || cell_style == :literal
243
+ @reinitialize_args = [column, cell_text, attributes&.merge, opts]
244
+ end
245
+ cell_style = nil
246
+ else
247
+ cell_style = column.style
248
+ end
243
249
  # REVIEW feels hacky to inherit all attributes from column
244
250
  update_attributes column.attributes
245
251
  end
@@ -306,8 +312,12 @@ class Table::Cell < AbstractBlock
306
312
  @content_model = :verbatim
307
313
  @subs = BASIC_SUBS
308
314
  else
309
- if normal_psv && (cell_text.start_with? '[[') && LeadingInlineAnchorRx =~ cell_text
310
- Parser.catalog_inline_anchor $1, $2, self, opts[:cursor], @document
315
+ if normal_psv
316
+ if in_header_row
317
+ @cursor = opts[:cursor] # used in deferred catalog_inline_anchor call
318
+ else
319
+ catalog_inline_anchor cell_text, opts[:cursor]
320
+ end
311
321
  end
312
322
  @content_model = :simple
313
323
  @subs = NORMAL_SUBS
@@ -316,6 +326,25 @@ class Table::Cell < AbstractBlock
316
326
  @style = cell_style
317
327
  end
318
328
 
329
+ def reinitialize has_header
330
+ if has_header
331
+ @reinitialize_args = nil
332
+ elsif @reinitialize_args
333
+ return Table::Cell.new(*@reinitialize_args)
334
+ else
335
+ @style = @attributes['style']
336
+ end
337
+ catalog_inline_anchor if @cursor
338
+ self
339
+ end
340
+
341
+ def catalog_inline_anchor cell_text = @text, cursor = nil
342
+ cursor, @cursor = @cursor, nil unless cursor
343
+ if (cell_text.start_with? '[[') && LeadingInlineAnchorRx =~ cell_text
344
+ Parser.catalog_inline_anchor $1, $2, self, cursor, @document
345
+ end
346
+ end
347
+
319
348
  # Public: Get the String text of this cell with substitutions applied.
320
349
  #
321
350
  # Used for cells in the head row as well as text-only (non-AsciiDoc) cells in
@@ -339,7 +368,7 @@ class Table::Cell < AbstractBlock
339
368
 
340
369
  # Public: Handles the body data (tbody, tfoot), applying styles and partitioning into paragraphs
341
370
  #
342
- # This method should not be used for cells in the head row or that have the literal or verse style.
371
+ # This method should not be used for cells in the head row or that have the literal style.
343
372
  #
344
373
  # Returns the converted String for this Cell
345
374
  def content
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Asciidoctor
3
- VERSION = '2.0.10'
3
+ VERSION = '2.0.11'
4
4
  end
@@ -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.10
5
- .\" Date: 2019-05-31
4
+ .\" Generator: Asciidoctor 2.0.11
5
+ .\" Date: 2020-11-02
6
6
  .\" Manual: Asciidoctor Manual
7
- .\" Source: Asciidoctor 2.0.10
7
+ .\" Source: Asciidoctor 2.0.11
8
8
  .\" Language: English
9
9
  .\"
10
- .TH "ASCIIDOCTOR" "1" "2019-05-31" "Asciidoctor 2.0.10" "Asciidoctor Manual"
10
+ .TH "ASCIIDOCTOR" "1" "2020-11-02" "Asciidoctor 2.0.11" "Asciidoctor Manual"
11
11
  .ie \n(.g .ds Aq \(aq
12
12
  .el .ds Aq '
13
13
  .ss \n[.ss] 0
@@ -77,7 +77,7 @@ This option may be specified more than once.
77
77
  .sp
78
78
  \fB\-b, \-\-backend\fP=\fIBACKEND\fP
79
79
  .RS 4
80
- Backend output file format: \fIhtml5\fP, \fIdocbook5\fP, \fIdocbook45\fP, and \fImanpage\fP are supported out of the box.
80
+ Backend output file format: \fIhtml5\fP, \fIdocbook5\fP, and \fImanpage\fP are supported out of the box.
81
81
  You can also use the backend alias names \fIhtml\fP (aliased to \fIhtml5\fP) or \fIdocbook\fP (aliased to \fIdocbook5\fP).
82
82
  Other values can be passed, but if Asciidoctor cannot resolve the backend to a converter, it will fail.
83
83
  Defaults to \fIhtml5\fP.
@@ -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\-2019 Dan Allen, Ryan Waldron, and the Asciidoctor Project.
260
+ Copyright (C) 2012\-2020 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
@@ -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.10
4
+ :release-version: 2.0.11
5
5
  :man manual: Asciidoctor Manual
6
6
  :man source: Asciidoctor {release-version}
7
7
  :page-layout: base
@@ -53,7 +53,7 @@ Values containing spaces should be enclosed in quotes.
53
53
  This option may be specified more than once.
54
54
 
55
55
  *-b, --backend*=_BACKEND_::
56
- Backend output file format: _html5_, _docbook5_, _docbook45_, and _manpage_ are supported out of the box.
56
+ Backend output file format: _html5_, _docbook5_, and _manpage_ are supported out of the box.
57
57
  You can also use the backend alias names _html_ (aliased to _html5_) or _docbook_ (aliased to _docbook5_).
58
58
  Other values can be passed, but if Asciidoctor cannot resolve the backend to a converter, it will fail.
59
59
  Defaults to _html5_.
@@ -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-2019 Dan Allen, Ryan Waldron, and the Asciidoctor Project.
195
+ Copyright \(C) 2012-2020 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.10
4
+ version: 2.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Allen
@@ -72,19 +72,19 @@ dependencies:
72
72
  - !ruby/object:Gem::Version
73
73
  version: 3.1.0
74
74
  - !ruby/object:Gem::Dependency
75
- name: erubis
75
+ name: erubi
76
76
  requirement: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
- version: 2.7.0
80
+ version: 1.9.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: 2.7.0
87
+ version: 1.9.0
88
88
  - !ruby/object:Gem::Dependency
89
89
  name: haml
90
90
  requirement: !ruby/object:Gem::Requirement
@@ -147,14 +147,14 @@ dependencies:
147
147
  requirements:
148
148
  - - "~>"
149
149
  - !ruby/object:Gem::Version
150
- version: 3.3.0
150
+ version: 3.15.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.3.0
157
+ version: 3.15.0
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: rspec-expectations
160
160
  requirement: !ruby/object:Gem::Requirement
@@ -231,7 +231,7 @@ files:
231
231
  - data/locale/attributes-id.adoc
232
232
  - data/locale/attributes-it.adoc
233
233
  - data/locale/attributes-ja.adoc
234
- - data/locale/attributes-kr.adoc
234
+ - data/locale/attributes-ko.adoc
235
235
  - data/locale/attributes-nb.adoc
236
236
  - data/locale/attributes-nl.adoc
237
237
  - data/locale/attributes-nn.adoc
@@ -324,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
324
324
  - !ruby/object:Gem::Version
325
325
  version: '0'
326
326
  requirements: []
327
- rubygems_version: 3.0.3
327
+ rubygems_version: 3.0.6
328
328
  signing_key:
329
329
  specification_version: 4
330
330
  summary: An implementation of the AsciiDoc text processor and publishing toolchain