asciidoctor 2.0.23 → 2.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +37 -1
- data/README-de.adoc +2 -2
- data/README-fr.adoc +2 -2
- data/README-jp.adoc +2 -2
- data/README-zh_CN.adoc +2 -2
- data/README.adoc +2 -2
- data/asciidoctor.gemspec +3 -2
- data/data/locale/attributes-pt_BR.adoc +1 -1
- data/data/stylesheets/asciidoctor-default.css +1 -1
- data/lib/asciidoctor/abstract_node.rb +1 -9
- data/lib/asciidoctor/callouts.rb +1 -1
- data/lib/asciidoctor/cli/options.rb +1 -1
- data/lib/asciidoctor/converter/docbook5.rb +5 -2
- data/lib/asciidoctor/converter.rb +2 -2
- data/lib/asciidoctor/document.rb +2 -2
- data/lib/asciidoctor/extensions.rb +4 -4
- data/lib/asciidoctor/helpers.rb +20 -0
- data/lib/asciidoctor/logging.rb +16 -5
- data/lib/asciidoctor/parser.rb +1 -1
- data/lib/asciidoctor/reader.rb +34 -26
- data/lib/asciidoctor/substitutors.rb +6 -6
- data/lib/asciidoctor/syntax_highlighter/coderay.rb +3 -2
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +3 -3
- data/man/asciidoctor.adoc +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b219565eafae2806084f9fee67def534a864eaaebc7891dced5d5f4cd238abb
|
4
|
+
data.tar.gz: 51137dfb8f450991351e82b0da3d15ad923209dad72606ab2a5b868a78c6e1a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 141b60fe34a662b4924f873985be200c1e5f9b574e44aa7336ec7febed0d3a4fbe8b8e8619441da2f7fdca51a17a0689155634cbde1fc63478c9dae6fd41d382
|
7
|
+
data.tar.gz: 814788310c10bf2cdda6e7cde44a43fcd83702aea854aa48d9e51b3af77e9ec13c0966dbf73f298eb8d39ff84fe8aa5d01881283016ea49c3609c3bf065a663c
|
data/CHANGELOG.adoc
CHANGED
@@ -16,6 +16,43 @@ For an even more detailed look at what has changed, refer to the {url-repo}/comm
|
|
16
16
|
This project utilizes semantic versioning.
|
17
17
|
|
18
18
|
// tag::compact[]
|
19
|
+
== 2.0.24 (2025-10-13) - @mojavelinux
|
20
|
+
|
21
|
+
Compliance::
|
22
|
+
|
23
|
+
* Support link attribute on inline image macro when converting to DocBook (#4385)
|
24
|
+
* Add magic comment `backticks_javascript: true` to achieve compatibility with Opal 2.0 (#4775) (*@janbiedermann*)
|
25
|
+
* Extract the require logic of the OpenURI library for Asciidoctor.js compatibility (#4244) (*@ggrossetie*)
|
26
|
+
|
27
|
+
Improvements::
|
28
|
+
|
29
|
+
* Suppress warning about loading logger from stdlib when using Ruby 3.4 (#4769)
|
30
|
+
* Log error if unterminated preprocessor conditional directive is detected (#3545)
|
31
|
+
* Coerce names passed to the `positional_attrs` directive on an extension to strings (#4674)
|
32
|
+
* Ignore `SOURCE_DATE_EPOCH` environment variable if value is empty instead of exiting with non-zero exit code (#4631)
|
33
|
+
* Change Brazilian Portuguese translation for toc-title (#4653) (*@giflw*)
|
34
|
+
|
35
|
+
Bug Fixes::
|
36
|
+
|
37
|
+
* Consider `convert_` prefix when looking for missing convert method in converter (#4669) (*@eugoka*)
|
38
|
+
* Don't push conditional onto stack if conditional preprocessor directive is invalid when skipping lines (#4603)
|
39
|
+
* Only style code tag as block element when inside pre in listing block; not inside verse block (#4610)
|
40
|
+
* Pass kwargs to Logger superclass and only assign defaults when kwarg is not specified (#4773)
|
41
|
+
* Don't add role=include to link macro that replaces include directive when running in compat mode (#4608)
|
42
|
+
|
43
|
+
Documentation::
|
44
|
+
|
45
|
+
* Rewrite documentation for how to create a custom converter from scratch and make examples more thorough (#4699)
|
46
|
+
|
47
|
+
Build / Infrastructure::
|
48
|
+
|
49
|
+
* Fix classification of several substitution tests (#4691) (*@scouten*)
|
50
|
+
|
51
|
+
=== Details
|
52
|
+
|
53
|
+
{url-repo}/releases/tag/v2.0.24[git tag] | {url-repo}/compare/v2.0.23\...v2.0.24[full diff]
|
54
|
+
// end::compact[]
|
55
|
+
|
19
56
|
== 2.0.23 (2024-05-17) - @mojavelinux
|
20
57
|
|
21
58
|
Compliance::
|
@@ -38,7 +75,6 @@ Bug Fixes::
|
|
38
75
|
=== Details
|
39
76
|
|
40
77
|
{url-repo}/releases/tag/v2.0.23[git tag] | {url-repo}/compare/v2.0.22\...v2.0.23[full diff]
|
41
|
-
// end::compact[]
|
42
78
|
|
43
79
|
== 2.0.22 (2024-03-08) - @mojavelinux
|
44
80
|
|
data/README-de.adoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Asciidoctor
|
2
2
|
Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
|
3
|
-
v2.0.
|
3
|
+
v2.0.24, 2025-10-13
|
4
4
|
// settings:
|
5
5
|
:idprefix:
|
6
6
|
:idseparator: -
|
@@ -16,7 +16,7 @@ ifdef::env-github[]
|
|
16
16
|
:warning-caption: :warning:
|
17
17
|
endif::[]
|
18
18
|
// Variables:
|
19
|
-
:release-version: 2.0.
|
19
|
+
:release-version: 2.0.24
|
20
20
|
// URIs:
|
21
21
|
:uri-org: https://github.com/asciidoctor
|
22
22
|
:uri-repo: {uri-org}/asciidoctor
|
data/README-fr.adoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Asciidoctor
|
2
2
|
Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
|
3
|
-
v2.0.
|
3
|
+
v2.0.24, 2025-10-13
|
4
4
|
// settings:
|
5
5
|
:idprefix:
|
6
6
|
:idseparator: -
|
@@ -16,7 +16,7 @@ ifdef::env-github[]
|
|
16
16
|
:warning-caption: :warning:
|
17
17
|
endif::[]
|
18
18
|
// Variables:
|
19
|
-
:release-version: 2.0.
|
19
|
+
:release-version: 2.0.24
|
20
20
|
// URIs:
|
21
21
|
:uri-org: https://github.com/asciidoctor
|
22
22
|
:uri-repo: {uri-org}/asciidoctor
|
data/README-jp.adoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Asciidoctor
|
2
2
|
Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
|
3
|
-
v2.0.
|
3
|
+
v2.0.24, 2025-10-13
|
4
4
|
// settings:
|
5
5
|
:idprefix:
|
6
6
|
:idseparator: -
|
@@ -16,7 +16,7 @@ ifdef::env-github[]
|
|
16
16
|
:warning-caption: :warning:
|
17
17
|
endif::[]
|
18
18
|
// Variables:
|
19
|
-
:release-version: 2.0.
|
19
|
+
:release-version: 2.0.24
|
20
20
|
// URIs:
|
21
21
|
:uri-org: https://github.com/asciidoctor
|
22
22
|
:uri-repo: {uri-org}/asciidoctor
|
data/README-zh_CN.adoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Asciidoctor
|
2
2
|
Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
|
3
|
-
v2.0.
|
3
|
+
v2.0.24, 2025-10-13
|
4
4
|
// settings:
|
5
5
|
:page-layout: base
|
6
6
|
:idprefix:
|
@@ -17,7 +17,7 @@ ifdef::env-github[]
|
|
17
17
|
:warning-caption: :warning:
|
18
18
|
endif::[]
|
19
19
|
// Variables:
|
20
|
-
:release-version: 2.0.
|
20
|
+
:release-version: 2.0.24
|
21
21
|
// URIs:
|
22
22
|
:uri-org: https://github.com/asciidoctor
|
23
23
|
:uri-repo: {uri-org}/asciidoctor
|
data/README.adoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Asciidoctor
|
2
2
|
Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
|
3
|
-
v2.0.
|
3
|
+
v2.0.24, 2025-10-13
|
4
4
|
// settings:
|
5
5
|
:idprefix:
|
6
6
|
:idseparator: -
|
@@ -16,7 +16,7 @@ ifdef::env-github[]
|
|
16
16
|
:warning-caption: :warning:
|
17
17
|
endif::[]
|
18
18
|
// Variables:
|
19
|
-
:release-version: 2.0.
|
19
|
+
:release-version: 2.0.24
|
20
20
|
// URLs:
|
21
21
|
:url-org: https://github.com/asciidoctor
|
22
22
|
:url-repo: {url-org}/asciidoctor
|
data/asciidoctor.gemspec
CHANGED
@@ -19,7 +19,8 @@ Gem::Specification.new do |s|
|
|
19
19
|
'bug_tracker_uri' => 'https://github.com/asciidoctor/asciidoctor/issues',
|
20
20
|
'changelog_uri' => 'https://github.com/asciidoctor/asciidoctor/blob/HEAD/CHANGELOG.adoc',
|
21
21
|
'mailing_list_uri' => 'https://chat.asciidoctor.org',
|
22
|
-
'source_code_uri' => 'https://github.com/asciidoctor/asciidoctor'
|
22
|
+
'source_code_uri' => 'https://github.com/asciidoctor/asciidoctor',
|
23
|
+
'funding_uri' => 'https://opencollective.com/asciidoctor'
|
23
24
|
}
|
24
25
|
|
25
26
|
# NOTE the logic to build the list of files is designed to produce a usable package even when the git command is not available
|
@@ -38,7 +39,7 @@ Gem::Specification.new do |s|
|
|
38
39
|
s.add_development_dependency 'cucumber', '~> 3.1.0'
|
39
40
|
# erubi is needed for testing alternate eRuby impls
|
40
41
|
s.add_development_dependency 'erubi', '~> 1.10.0'
|
41
|
-
s.add_development_dependency 'haml', '~> 6.
|
42
|
+
s.add_development_dependency 'haml', '~> 6.3.0'
|
42
43
|
s.add_development_dependency 'minitest', '~> 5.22.0'
|
43
44
|
s.add_development_dependency 'nokogiri', '~> 1.13.0'
|
44
45
|
s.add_development_dependency 'rake', '~> 12.3.0'
|
@@ -106,7 +106,6 @@ h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title str
|
|
106
106
|
:not(pre):not([class^=L])>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background:#f7f7f8;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed}
|
107
107
|
pre{color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;line-height:1.45;text-rendering:optimizeSpeed}
|
108
108
|
pre code,pre pre{color:inherit;font-size:inherit;line-height:inherit}
|
109
|
-
pre>code{display:block}
|
110
109
|
pre.nowrap,pre.nowrap pre{white-space:pre;word-wrap:normal}
|
111
110
|
em em{font-style:normal}
|
112
111
|
strong strong{font-weight:400}
|
@@ -209,6 +208,7 @@ table.tableblock.fit-content>caption.title{white-space:nowrap;width:0}
|
|
209
208
|
.literalblock pre,.listingblock>.content>pre:not(.highlight),.listingblock>.content>pre[class=highlight],.listingblock>.content>pre[class^="highlight "]{background:#f7f7f8}
|
210
209
|
.literalblock.output pre{color:#f7f7f8;background:rgba(0,0,0,.9)}
|
211
210
|
.listingblock>.content{position:relative}
|
211
|
+
.listingblock pre>code{display:block}
|
212
212
|
.listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:inherit;opacity:.5}
|
213
213
|
.listingblock:hover code[data-lang]::before{display:block}
|
214
214
|
.listingblock.terminal pre .command::before{content:attr(data-prompt);padding-right:.5em;color:inherit;opacity:.5}
|
@@ -399,15 +399,7 @@ class AbstractNode
|
|
399
399
|
# Returns A data URI string built from Base64 encoded data read from the URI
|
400
400
|
# and the mime type specified in the Content Type header.
|
401
401
|
def generate_data_uri_from_uri image_uri, cache_uri = false
|
402
|
-
|
403
|
-
# caching requires the open-uri-cached gem to be installed
|
404
|
-
# processing will be automatically aborted if these libraries can't be opened
|
405
|
-
Helpers.require_library 'open-uri/cached', 'open-uri-cached'
|
406
|
-
elsif !RUBY_ENGINE_OPAL
|
407
|
-
# autoload open-uri
|
408
|
-
::OpenURI
|
409
|
-
end
|
410
|
-
|
402
|
+
Helpers.require_open_uri cache_uri
|
411
403
|
begin
|
412
404
|
mimetype, bindata = ::OpenURI.open_uri(image_uri, URI_READ_MODE) {|f| [f.content_type, f.read] }
|
413
405
|
# NOTE pack 'm0' is equivalent to Base64.strict_encode64
|
data/lib/asciidoctor/callouts.rb
CHANGED
@@ -59,7 +59,7 @@ class Callouts
|
|
59
59
|
#
|
60
60
|
# Returns A space-separated String of callout ids associated with the specified list item
|
61
61
|
def callout_ids li_ordinal
|
62
|
-
current_list.map {|
|
62
|
+
current_list.map {|item| item[:ordinal] == li_ordinal ? %(#{item[:id]} ) : '' }.join.chop
|
63
63
|
end
|
64
64
|
|
65
65
|
# Public: The current list for which callouts are being collected
|
@@ -94,7 +94,7 @@ module Asciidoctor
|
|
94
94
|
self[:attributes][name] = val
|
95
95
|
end
|
96
96
|
opts.on('-T', '--template-dir DIR', 'a directory containing custom converter templates that override the built-in converter (requires tilt gem)',
|
97
|
-
'may be specified
|
97
|
+
'may be specified more than once') do |template_dir|
|
98
98
|
if self[:template_dirs].nil?
|
99
99
|
self[:template_dirs] = [template_dir]
|
100
100
|
elsif ::Array === self[:template_dirs]
|
@@ -535,12 +535,15 @@ class Converter::DocBook5Converter < Converter::Base
|
|
535
535
|
end
|
536
536
|
|
537
537
|
def convert_inline_image node
|
538
|
-
%(<inlinemediaobject#{common_attributes nil, node.role}>
|
538
|
+
img = %(<inlinemediaobject#{common_attributes nil, node.role}>
|
539
539
|
<imageobject>
|
540
|
-
<imagedata fileref="#{node.type == 'icon' ? (node.icon_uri node.target) : (node.image_uri node.target)}"#{image_size_attributes node.attributes}/>
|
540
|
+
<imagedata fileref="#{node.type == 'icon' ? (node.icon_uri node.target) : (fileref = node.image_uri node.target)}"#{image_size_attributes node.attributes}/>
|
541
541
|
</imageobject>
|
542
542
|
<textobject><phrase>#{node.alt}</phrase></textobject>
|
543
543
|
</inlinemediaobject>)
|
544
|
+
fileref && (node.attr? 'link') && (link_href = node.attr 'link') ?
|
545
|
+
%(<link xl:href="#{link_href}">#{img}</link>) :
|
546
|
+
img
|
544
547
|
end
|
545
548
|
|
546
549
|
def convert_inline_indexterm node
|
@@ -390,8 +390,8 @@ module Converter
|
|
390
390
|
def convert node, transform = node.node_name, opts = nil
|
391
391
|
opts ? (send 'convert_' + transform, node, opts) : (send 'convert_' + transform, node)
|
392
392
|
rescue
|
393
|
-
raise unless ::NoMethodError === (ex = $!) && ex.receiver == self && ex.name.to_s == transform
|
394
|
-
logger.warn %(missing convert handler for #{
|
393
|
+
raise unless ::NoMethodError === (ex = $!) && ex.receiver == self && ex.name.to_s == 'convert_' + transform
|
394
|
+
logger.warn %(missing convert handler for #{transform} node in #{@backend} backend (#{self.class}))
|
395
395
|
nil
|
396
396
|
end
|
397
397
|
|
data/lib/asciidoctor/document.rb
CHANGED
@@ -1038,7 +1038,7 @@ class Document < AbstractBlock
|
|
1038
1038
|
docinfo = docinfo ? ['private'] : nil
|
1039
1039
|
end
|
1040
1040
|
else
|
1041
|
-
docinfo = docinfo.split(',').map {|
|
1041
|
+
docinfo = docinfo.split(',').map {|keyword| keyword.strip }
|
1042
1042
|
end
|
1043
1043
|
|
1044
1044
|
if docinfo
|
@@ -1256,7 +1256,7 @@ class Document < AbstractBlock
|
|
1256
1256
|
# localdatetime, docdate, docyear, doctime, and docdatetime. Honor the SOURCE_DATE_EPOCH environment variable, if set.
|
1257
1257
|
def fill_datetime_attributes attrs, input_mtime
|
1258
1258
|
# See https://reproducible-builds.org/specs/source-date-epoch/
|
1259
|
-
now =
|
1259
|
+
now = ::ENV['SOURCE_DATE_EPOCH'].nil_or_empty? ? ::Time.now : (source_date_epoch = (::Time.at Integer ::ENV['SOURCE_DATE_EPOCH']).utc)
|
1260
1260
|
if (localdate = attrs['localdate'])
|
1261
1261
|
attrs['localyear'] ||= (localdate.index '-') == 4 ? (localdate.slice 0, 4) : nil
|
1262
1262
|
else
|
@@ -309,7 +309,7 @@ module Extensions
|
|
309
309
|
alias parse_content_as content_model
|
310
310
|
|
311
311
|
def positional_attributes *value
|
312
|
-
option :positional_attrs, value.flatten
|
312
|
+
option :positional_attrs, (value.flatten.map {|name| name.to_s })
|
313
313
|
end
|
314
314
|
alias name_positional_attributes positional_attributes
|
315
315
|
# NOTE positional_attrs alias is deprecated
|
@@ -485,7 +485,7 @@ module Extensions
|
|
485
485
|
# to add content to the header.
|
486
486
|
class DocinfoProcessor < Processor
|
487
487
|
def initialize config = {}
|
488
|
-
super
|
488
|
+
super
|
489
489
|
@config[:location] ||= :head
|
490
490
|
end
|
491
491
|
|
@@ -1359,7 +1359,7 @@ module Extensions
|
|
1359
1359
|
|
1360
1360
|
def add_document_processor kind, args, &block
|
1361
1361
|
kind_name = kind.to_s.tr '_', ' '
|
1362
|
-
kind_class_symbol = kind_name.split.map {|
|
1362
|
+
kind_class_symbol = kind_name.split.map {|segment| segment.capitalize }.join.to_sym
|
1363
1363
|
kind_class = Extensions.const_get kind_class_symbol, false
|
1364
1364
|
kind_java_class = (defined? ::AsciidoctorJ) ? (::AsciidoctorJ::Extensions.const_get kind_class_symbol, false) : nil
|
1365
1365
|
kind_store = instance_variable_get(%(@#{kind}_extensions).to_sym) || instance_variable_set(%(@#{kind}_extensions).to_sym, [])
|
@@ -1403,7 +1403,7 @@ module Extensions
|
|
1403
1403
|
|
1404
1404
|
def add_syntax_processor kind, args, &block
|
1405
1405
|
kind_name = kind.to_s.tr '_', ' '
|
1406
|
-
kind_class_symbol = (kind_name.split.map {|
|
1406
|
+
kind_class_symbol = (kind_name.split.map {|segment| segment.capitalize } << 'Processor').join.to_sym
|
1407
1407
|
kind_class = Extensions.const_get kind_class_symbol, false
|
1408
1408
|
kind_java_class = (defined? ::AsciidoctorJ) ? (::AsciidoctorJ::Extensions.const_get kind_class_symbol, false) : nil
|
1409
1409
|
kind_store = instance_variable_get(%(@#{kind}_extensions).to_sym) || instance_variable_set(%(@#{kind}_extensions).to_sym, {})
|
data/lib/asciidoctor/helpers.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# backtick_javascript: true
|
1
2
|
# frozen_string_literal: true
|
2
3
|
module Asciidoctor
|
3
4
|
# Internal: Except where noted, a module that contains internal helper functions.
|
@@ -48,6 +49,25 @@ module Helpers
|
|
48
49
|
nil
|
49
50
|
end
|
50
51
|
|
52
|
+
# Internal: Require the OpenURI library.
|
53
|
+
#
|
54
|
+
# Attempts to load `open-uri-cached` if the cache argument is true otherwise autoload `open-uri`.
|
55
|
+
#
|
56
|
+
# cache - A Boolean flag indicating whether to activate content cache URI
|
57
|
+
#
|
58
|
+
# Returns nothing
|
59
|
+
def require_open_uri cache = false
|
60
|
+
if cache
|
61
|
+
# caching requires the open-uri-cached gem to be installed
|
62
|
+
# processing will be automatically aborted if these libraries can't be opened
|
63
|
+
require_library 'open-uri/cached', 'open-uri-cached' unless defined? ::OpenURI::Cache
|
64
|
+
else
|
65
|
+
# autoload open-uri
|
66
|
+
::OpenURI
|
67
|
+
end
|
68
|
+
nil
|
69
|
+
end
|
70
|
+
|
51
71
|
# Internal: Prepare the source data Array for parsing.
|
52
72
|
#
|
53
73
|
# Encodes the data to UTF-8, if necessary, and removes any trailing
|
data/lib/asciidoctor/logging.rb
CHANGED
@@ -1,15 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
proc do
|
4
|
+
old_verbose, $VERBOSE = $VERBOSE, nil
|
5
|
+
require 'logger' # suppress warning in Ruby 3.4 about loading logger from stdlib
|
6
|
+
$VERBOSE = old_verbose
|
7
|
+
end.call
|
3
8
|
|
4
9
|
module Asciidoctor
|
5
10
|
class Logger < ::Logger
|
6
11
|
attr_reader :max_severity
|
7
12
|
|
8
|
-
def initialize *args
|
13
|
+
def initialize *args, **opts
|
14
|
+
opts[:progname] = 'asciidoctor'
|
15
|
+
opts[:formatter] = BasicFormatter.new unless opts.key? :formatter
|
16
|
+
opts[:level] = WARN unless opts.key? :level
|
17
|
+
args = [$stderr] if args.empty?
|
9
18
|
super
|
10
|
-
|
11
|
-
|
12
|
-
|
19
|
+
if @progname.nil? && (method __method__).super_method.parameters.size == 3
|
20
|
+
@progname = opts[:progname]
|
21
|
+
@formatter = opts[:formatter]
|
22
|
+
@level = opts[:level]
|
23
|
+
end
|
13
24
|
end
|
14
25
|
|
15
26
|
def add severity, message = nil, progname = nil
|
data/lib/asciidoctor/parser.rb
CHANGED
@@ -1898,7 +1898,7 @@ class Parser
|
|
1898
1898
|
implicit_author_metadata[%(firstname_#{name_idx = idx + 1})],
|
1899
1899
|
implicit_author_metadata[%(middlename_#{name_idx})],
|
1900
1900
|
implicit_author_metadata[%(lastname_#{name_idx})]
|
1901
|
-
].compact.map {|
|
1901
|
+
].compact.map {|name| name.tr ' ', '_' }.join ' '
|
1902
1902
|
end if sparse
|
1903
1903
|
# process as names only
|
1904
1904
|
author_metadata = process_authors authors, true, false
|
data/lib/asciidoctor/reader.rb
CHANGED
@@ -467,7 +467,7 @@ class Reader
|
|
467
467
|
if lines_to_restore.respond_to? :reverse
|
468
468
|
@lines.push(*lines_to_restore.reverse)
|
469
469
|
else
|
470
|
-
lines_to_restore.reverse_each {|
|
470
|
+
lines_to_restore.reverse_each {|l| @lines.push l }
|
471
471
|
end
|
472
472
|
nil
|
473
473
|
end
|
@@ -619,7 +619,7 @@ class PreprocessorReader < Reader
|
|
619
619
|
|
620
620
|
# Public: Initialize the PreprocessorReader object
|
621
621
|
def initialize document, data = nil, cursor = nil, opts = {}
|
622
|
-
@document = document
|
622
|
+
@sourcemap = (@document = document).sourcemap
|
623
623
|
super data, cursor, opts
|
624
624
|
if (default_include_depth = (document.attributes['max-include-depth'] || 64).to_i) > 0
|
625
625
|
# track absolute max depth, current max depth for comparing to include stack size, and relative max depth for reporting
|
@@ -657,6 +657,11 @@ class PreprocessorReader < Reader
|
|
657
657
|
if (line = super)
|
658
658
|
line
|
659
659
|
elsif @include_stack.empty?
|
660
|
+
end_cursor = nil
|
661
|
+
@conditional_stack.delete_if do |conditional|
|
662
|
+
logger.error message_with_context %(detected unterminated preprocessor conditional directive: #{conditional[:name]}::#{conditional[:target] || ''}[#{conditional[:expr] || ''}]), source_location: conditional[:source_location] || (end_cursor ||= cursor_at_prev_line)
|
663
|
+
true
|
664
|
+
end
|
660
665
|
nil
|
661
666
|
else
|
662
667
|
pop_include
|
@@ -890,7 +895,7 @@ class PreprocessorReader < Reader
|
|
890
895
|
# preprocessing recursively until the next line of available content is
|
891
896
|
# found.
|
892
897
|
#
|
893
|
-
#
|
898
|
+
# name - The name of the conditional inclusion directive (ifdef, ifndef, ifeval, endif)
|
894
899
|
# target - The target, which is the name of one or more attributes that are
|
895
900
|
# used in the condition (blank in the case of the ifeval directive)
|
896
901
|
# delimiter - The conditional delimiter for multiple attributes ('+' means all
|
@@ -901,27 +906,32 @@ class PreprocessorReader < Reader
|
|
901
906
|
# ifndef directives, and for the conditional expression for the ifeval directive.
|
902
907
|
#
|
903
908
|
# Returns a Boolean indicating whether the cursor should be advanced
|
904
|
-
def preprocess_conditional_directive
|
909
|
+
def preprocess_conditional_directive name, target, delimiter, text
|
905
910
|
# attributes are case insensitive
|
906
911
|
target = target.downcase unless (no_target = target.empty?)
|
907
912
|
|
908
|
-
if
|
913
|
+
if name == 'endif'
|
909
914
|
if text
|
910
915
|
logger.error message_with_context %(malformed preprocessor directive - text not permitted: endif::#{target}[#{text}]), source_location: cursor
|
911
916
|
elsif @conditional_stack.empty?
|
912
917
|
logger.error message_with_context %(unmatched preprocessor directive: endif::#{target}[]), source_location: cursor
|
913
|
-
elsif no_target || target ==
|
918
|
+
elsif no_target || target == @conditional_stack[-1][:target]
|
914
919
|
@conditional_stack.pop
|
915
920
|
@skipping = @conditional_stack.empty? ? false : @conditional_stack[-1][:skipping]
|
916
921
|
else
|
917
|
-
logger.error message_with_context %(mismatched preprocessor directive: endif::#{target}[], expected endif::#{
|
922
|
+
logger.error message_with_context %(mismatched preprocessor directive: endif::#{target}[], expected endif::#{@conditional_stack[-1][:target] || ''}[]), source_location: cursor
|
918
923
|
end
|
919
924
|
return true
|
920
925
|
elsif @skipping
|
926
|
+
if name === 'ifeval'
|
927
|
+
return true unless no_target && text && (EvalExpressionRx.match? text.strip)
|
928
|
+
elsif no_target
|
929
|
+
return true
|
930
|
+
end
|
921
931
|
skip = false
|
922
932
|
else
|
923
933
|
# QUESTION any way to wrap ifdef & ifndef logic up together?
|
924
|
-
case
|
934
|
+
case name
|
925
935
|
when 'ifdef'
|
926
936
|
if no_target
|
927
937
|
logger.error message_with_context %(malformed preprocessor directive - missing target: ifdef::[#{text}]), source_location: cursor
|
@@ -930,10 +940,10 @@ class PreprocessorReader < Reader
|
|
930
940
|
case delimiter
|
931
941
|
when ','
|
932
942
|
# skip if no attribute is defined
|
933
|
-
skip = target.split(',', -1).none? {|
|
943
|
+
skip = target.split(',', -1).none? {|attr_name| @document.attributes.key? attr_name }
|
934
944
|
when '+'
|
935
945
|
# skip if any attribute is undefined
|
936
|
-
skip = target.split('+', -1).any? {|
|
946
|
+
skip = target.split('+', -1).any? {|attr_name| !@document.attributes.key? attr_name }
|
937
947
|
else
|
938
948
|
# if the attribute is undefined, then skip
|
939
949
|
skip = !@document.attributes.key?(target)
|
@@ -946,10 +956,10 @@ class PreprocessorReader < Reader
|
|
946
956
|
case delimiter
|
947
957
|
when ','
|
948
958
|
# skip if any attribute is defined
|
949
|
-
skip = target.split(',', -1).any? {|
|
959
|
+
skip = target.split(',', -1).any? {|attr_name| @document.attributes.key? attr_name }
|
950
960
|
when '+'
|
951
961
|
# skip if all attributes are defined
|
952
|
-
skip = target.split('+', -1).all? {|
|
962
|
+
skip = target.split('+', -1).all? {|attr_name| @document.attributes.key? attr_name }
|
953
963
|
else
|
954
964
|
# if the attribute is defined, then skip
|
955
965
|
skip = @document.attributes.key?(target)
|
@@ -976,11 +986,11 @@ class PreprocessorReader < Reader
|
|
976
986
|
end
|
977
987
|
|
978
988
|
# conditional inclusion block
|
979
|
-
if
|
989
|
+
if name == 'ifeval'
|
980
990
|
@skipping = true if skip
|
981
|
-
@conditional_stack << {
|
991
|
+
@conditional_stack << { name: name, expr: text, skip: skip, skipping: @skipping, source_location: @sourcemap ? cursor : nil }
|
982
992
|
# single line conditional inclusion
|
983
|
-
|
993
|
+
elsif text
|
984
994
|
unless @skipping || skip
|
985
995
|
replace_next_line text.rstrip
|
986
996
|
# HACK push dummy line to stand in for the opening conditional directive that's subsequently dropped
|
@@ -989,6 +999,10 @@ class PreprocessorReader < Reader
|
|
989
999
|
# QUESTION should we just call preprocess_include_directive here?
|
990
1000
|
@look_ahead -= 1 if text.start_with? 'include::'
|
991
1001
|
end
|
1002
|
+
# conditional inclusion block
|
1003
|
+
else
|
1004
|
+
@skipping = true if skip
|
1005
|
+
@conditional_stack << { name: name, target: target, skip: skip, skipping: @skipping, source_location: @sourcemap ? cursor : nil }
|
992
1006
|
end
|
993
1007
|
|
994
1008
|
true
|
@@ -1043,9 +1057,9 @@ class PreprocessorReader < Reader
|
|
1043
1057
|
# if running in SafeMode::SECURE or greater, don't process this directive
|
1044
1058
|
# however, be friendly and at least make it a link to the source document
|
1045
1059
|
elsif doc.safe >= SafeMode::SECURE
|
1060
|
+
# FIXME we don't want to use a passthrough or link macro if we're in a verbatim context
|
1046
1061
|
expanded_target = %(pass:c[#{expanded_target}]) if expanded_target.include? ' '
|
1047
|
-
#
|
1048
|
-
replace_next_line %(link:#{expanded_target}[role=include])
|
1062
|
+
replace_next_line %(link:#{expanded_target}[#{(doc.attr? 'compat-mode') ? '' : 'role=include'}])
|
1049
1063
|
elsif @maxdepth
|
1050
1064
|
if @include_stack.size >= @maxdepth[:curr]
|
1051
1065
|
logger.error message_with_context %(maximum include depth of #{@maxdepth[:rel]} exceeded), source_location: cursor
|
@@ -1244,17 +1258,11 @@ class PreprocessorReader < Reader
|
|
1244
1258
|
doc = @document
|
1245
1259
|
if (Helpers.uriish? target) || (::String === @dir ? nil : (target = %(#{@dir}/#{target})))
|
1246
1260
|
unless doc.attr? 'allow-uri-read'
|
1261
|
+
# FIXME we don't want to use a passthrough or link macro if we're in a verbatim context
|
1247
1262
|
target = %(pass:c[#{target}]) if target.include? ' '
|
1248
|
-
return replace_next_line %(link:#{target}[role=include])
|
1249
|
-
end
|
1250
|
-
if doc.attr? 'cache-uri'
|
1251
|
-
# caching requires the open-uri-cached gem to be installed
|
1252
|
-
# processing will be automatically aborted if these libraries can't be opened
|
1253
|
-
Helpers.require_library 'open-uri/cached', 'open-uri-cached' unless defined? ::OpenURI::Cache
|
1254
|
-
elsif !RUBY_ENGINE_OPAL
|
1255
|
-
# autoload open-uri
|
1256
|
-
::OpenURI
|
1263
|
+
return replace_next_line %(link:#{target}[#{(doc.attr? 'compat-mode') ? '' : 'role=include'}])
|
1257
1264
|
end
|
1265
|
+
Helpers.require_open_uri doc.attr? 'cache-uri'
|
1258
1266
|
[(::URI.parse target), :uri, target]
|
1259
1267
|
else
|
1260
1268
|
# include file is resolved relative to dir of current include, or base_dir if within original docfile
|
@@ -384,7 +384,7 @@ module Substitutors
|
|
384
384
|
if (items = $2)
|
385
385
|
items = items.gsub ESC_R_SB, R_SB if items.include? R_SB
|
386
386
|
if (delim = items.include?('>') ? '>' : (items.include?(',') ? ',' : nil))
|
387
|
-
submenus = items.split(delim).map {|
|
387
|
+
submenus = items.split(delim).map {|item| item.strip }
|
388
388
|
menuitem = submenus.pop
|
389
389
|
else
|
390
390
|
submenus, menuitem = [], items.rstrip
|
@@ -402,7 +402,7 @@ module Substitutors
|
|
402
402
|
# honor the escape
|
403
403
|
next $&.slice 1, $&.length if $&.start_with? RS
|
404
404
|
|
405
|
-
menu, *submenus = $1.split('>').map {|
|
405
|
+
menu, *submenus = $1.split('>').map {|item| item.strip }
|
406
406
|
menuitem = submenus.pop
|
407
407
|
Inline.new(self, :menu, nil, attributes: { 'menu' => menu, 'submenus' => submenus, 'menuitem' => menuitem }).convert
|
408
408
|
end
|
@@ -454,7 +454,7 @@ module Substitutors
|
|
454
454
|
end
|
455
455
|
attrs['terms'] = terms
|
456
456
|
if (see_also = attrs['see-also'])
|
457
|
-
attrs['see-also'] = (see_also.include? ',') ? (see_also.split ',').map {|
|
457
|
+
attrs['see-also'] = (see_also.include? ',') ? (see_also.split ',').map {|item| item.lstrip } : [see_also]
|
458
458
|
end
|
459
459
|
else
|
460
460
|
attrs = { 'terms' => attrlist }
|
@@ -471,7 +471,7 @@ module Substitutors
|
|
471
471
|
if (term = normalize_text $2, true, true).include? '='
|
472
472
|
term = (attrs = (AttributeList.new term, self).parse)[1] || (attrs = nil) || term
|
473
473
|
if attrs && (see_also = attrs['see-also'])
|
474
|
-
attrs['see-also'] = (see_also.include? ',') ? (see_also.split ',').map {|
|
474
|
+
attrs['see-also'] = (see_also.include? ',') ? (see_also.split ',').map {|item| item.lstrip } : [see_also]
|
475
475
|
end
|
476
476
|
end
|
477
477
|
(Inline.new self, :indexterm, term, attributes: attrs, type: :visible).convert
|
@@ -1005,7 +1005,7 @@ module Substitutors
|
|
1005
1005
|
end
|
1006
1006
|
# If the start attribute is defined, then the lines to highlight specified by the provided spec should be relative to the start value.
|
1007
1007
|
unless (shift = start ? start - 1 : 0) == 0
|
1008
|
-
lines = lines.map {|
|
1008
|
+
lines = lines.map {|n| n - shift }
|
1009
1009
|
end
|
1010
1010
|
lines.sort
|
1011
1011
|
end
|
@@ -1541,7 +1541,7 @@ module Substitutors
|
|
1541
1541
|
end
|
1542
1542
|
values << accum.strip
|
1543
1543
|
else
|
1544
|
-
str.split(',').map {|
|
1544
|
+
str.split(',').map {|item| item.strip }
|
1545
1545
|
end
|
1546
1546
|
end
|
1547
1547
|
end
|
@@ -16,14 +16,15 @@ class SyntaxHighlighter::CodeRayAdapter < SyntaxHighlighter::Base
|
|
16
16
|
def highlight node, source, lang, opts
|
17
17
|
@requires_stylesheet = true if (css_mode = opts[:css_mode]) == :class
|
18
18
|
lang = lang ? (::CodeRay::Scanners[lang = lang.to_sym] && lang rescue :text) : :text
|
19
|
-
|
19
|
+
highlighter_opts = {
|
20
20
|
css: css_mode,
|
21
21
|
line_numbers: (line_numbers = opts[:number_lines]),
|
22
22
|
line_number_start: opts[:start_line_number],
|
23
23
|
line_number_anchors: false,
|
24
24
|
highlight_lines: opts[:highlight_lines],
|
25
25
|
bold_every: false,
|
26
|
-
|
26
|
+
}
|
27
|
+
highlighted = ::CodeRay::Duo[lang, :html, highlighter_opts].highlight source
|
27
28
|
if line_numbers == :table && opts[:callouts]
|
28
29
|
[highlighted, (idx = highlighted.index CodeCellStartTagCs) ? idx + CodeCellStartTagCs.length : nil]
|
29
30
|
else
|
data/lib/asciidoctor/version.rb
CHANGED
data/man/asciidoctor.1
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
'\" t
|
2
2
|
.\" Title: asciidoctor
|
3
3
|
.\" Author: Dan Allen, Sarah White
|
4
|
-
.\" Generator: Asciidoctor 2.0.
|
4
|
+
.\" Generator: Asciidoctor 2.0.23
|
5
5
|
.\" Date: 2018-03-20
|
6
6
|
.\" Manual: Asciidoctor Manual
|
7
|
-
.\" Source: Asciidoctor 2.0.
|
7
|
+
.\" Source: Asciidoctor 2.0.24
|
8
8
|
.\" Language: English
|
9
9
|
.\"
|
10
|
-
.TH "ASCIIDOCTOR" "1" "2018-03-20" "Asciidoctor 2.0.
|
10
|
+
.TH "ASCIIDOCTOR" "1" "2018-03-20" "Asciidoctor 2.0.24" "Asciidoctor Manual"
|
11
11
|
.ie \n(.g .ds Aq \(aq
|
12
12
|
.el .ds Aq '
|
13
13
|
.ss \n[.ss] 0
|
data/man/asciidoctor.adoc
CHANGED
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.
|
4
|
+
version: 2.0.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Allen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
- Jason Porter
|
11
11
|
- Nick Hengeveld
|
12
12
|
- Jeremy McAnally
|
13
|
-
autorequire:
|
13
|
+
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
date: 2018-03-20 00:00:00.000000000 Z
|
@@ -63,14 +63,14 @@ dependencies:
|
|
63
63
|
requirements:
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: 6.
|
66
|
+
version: 6.3.0
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: 6.
|
73
|
+
version: 6.3.0
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
75
|
name: minitest
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
@@ -257,7 +257,8 @@ metadata:
|
|
257
257
|
changelog_uri: https://github.com/asciidoctor/asciidoctor/blob/HEAD/CHANGELOG.adoc
|
258
258
|
mailing_list_uri: https://chat.asciidoctor.org
|
259
259
|
source_code_uri: https://github.com/asciidoctor/asciidoctor
|
260
|
-
|
260
|
+
funding_uri: https://opencollective.com/asciidoctor
|
261
|
+
post_install_message:
|
261
262
|
rdoc_options: []
|
262
263
|
require_paths:
|
263
264
|
- lib
|
@@ -272,8 +273,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
272
273
|
- !ruby/object:Gem::Version
|
273
274
|
version: '0'
|
274
275
|
requirements: []
|
275
|
-
rubygems_version: 3.5.
|
276
|
-
signing_key:
|
276
|
+
rubygems_version: 3.5.22
|
277
|
+
signing_key:
|
277
278
|
specification_version: 4
|
278
279
|
summary: An implementation of the AsciiDoc text processor and publishing toolchain
|
279
280
|
test_files: []
|