asciidoctor 2.0.18 → 2.0.19
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 +49 -6
- data/README.adoc +10 -8
- data/asciidoctor.gemspec +2 -2
- data/data/locale/attributes-sw.adoc +23 -0
- data/data/stylesheets/asciidoctor-default.css +3 -6
- data/lib/asciidoctor/abstract_block.rb +1 -0
- data/lib/asciidoctor/block.rb +1 -1
- data/lib/asciidoctor/converter/docbook5.rb +19 -17
- data/lib/asciidoctor/converter/html5.rb +1 -1
- data/lib/asciidoctor/converter/manpage.rb +3 -3
- data/lib/asciidoctor/converter/template.rb +2 -1
- data/lib/asciidoctor/extensions.rb +21 -0
- data/lib/asciidoctor/helpers.rb +8 -2
- data/lib/asciidoctor/parser.rb +40 -24
- data/lib/asciidoctor/path_resolver.rb +11 -2
- data/lib/asciidoctor/reader.rb +17 -11
- data/lib/asciidoctor/rx.rb +9 -15
- data/lib/asciidoctor/substitutors.rb +28 -42
- data/lib/asciidoctor/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8ec8c2a1b561249c43342cc6d9fa2b970bc097ee4814c2e3b8e602fe259912b7
|
|
4
|
+
data.tar.gz: 2a096894e6fa57eee3857b07ca793e41ec6943524197c6f4a410fb08ac920147
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8a22a6420efa77f814a864e23b9be00875bd4454e7d0cec8ca835ca5bf0a4976b27b4ca7baeacc6e7f5dc41647a4aa41b0383c8f26fc201d4e59634cdc8ca99a
|
|
7
|
+
data.tar.gz: 996d37bc44cf38e6cbf9d1e2c1088ebb3ace5e590a2f3ebb75ba09609107983fee462ad08f5e2f00b64138f0baeac59b7cc349b788e57808743f544f8614628a
|
data/CHANGELOG.adoc
CHANGED
|
@@ -1,21 +1,65 @@
|
|
|
1
1
|
= Asciidoctor Changelog
|
|
2
|
-
:
|
|
3
|
-
:
|
|
4
|
-
:
|
|
2
|
+
:url-asciidoctor: https://asciidoctor.org
|
|
3
|
+
:url-asciidoc: https://docs.asciidoctor.org/asciidoc/latest/
|
|
4
|
+
:url-repo: https://github.com/asciidoctor/asciidoctor
|
|
5
5
|
:icons: font
|
|
6
6
|
:star: icon:star[role=red]
|
|
7
7
|
ifndef::icons[]
|
|
8
8
|
:star: ★
|
|
9
9
|
endif::[]
|
|
10
10
|
|
|
11
|
-
{
|
|
11
|
+
{url-asciidoctor}[Asciidoctor] is a _fast_, open source text processor and publishing toolchain for converting {url-asciidoc}[AsciiDoc] content into HTML 5, DocBook 5, and other formats.
|
|
12
12
|
|
|
13
13
|
This document provides a high-level view of the changes introduced in Asciidoctor by release.
|
|
14
|
-
For an even more detailed look at what has changed, refer to the {
|
|
14
|
+
For an even more detailed look at what has changed, refer to the {url-repo}/commits/[commit history] on GitHub.
|
|
15
15
|
|
|
16
16
|
This project utilizes semantic versioning.
|
|
17
17
|
|
|
18
18
|
// tag::compact[]
|
|
19
|
+
== 2.0.19 (2023-05-17) - @mojavelinux
|
|
20
|
+
|
|
21
|
+
Improvements::
|
|
22
|
+
|
|
23
|
+
* Return empty string instead of nil if raw or verbatim block has no lines
|
|
24
|
+
* Don't uppercase monospace span in section title in manpage output (#4402)
|
|
25
|
+
* Simplify processing of implicit link (i.e., autolink) by separating implicit and explicit match
|
|
26
|
+
* Generate partintro block consistently (#4450)
|
|
27
|
+
* Add Kiswahili translation for built-in labels (PR #4454) *@bkmgit*
|
|
28
|
+
|
|
29
|
+
Compliance::
|
|
30
|
+
|
|
31
|
+
* Fix call order so use of an include file with invalid encoding continues to raise error when using Ruby >= 3.2.0
|
|
32
|
+
* Fix test assertion for fallback Rouge stylesheet to be compatible with Rouge 4.1 (#4406) (*@tmzullinger*)
|
|
33
|
+
* Support `notitle` option on section as alternative to `untitled` to hide title (#4437)
|
|
34
|
+
* Add support for Haml 6 to template converter (#4429)
|
|
35
|
+
|
|
36
|
+
Bug Fixes::
|
|
37
|
+
|
|
38
|
+
* Process constrained inline passthrough inside monospace span (#4458)
|
|
39
|
+
* Catalog inline ref defined using anchor macro even when resolved reftext is empty
|
|
40
|
+
* Use while loop rather than recursion to locate next line to process; prevents stack limit error (#4368)
|
|
41
|
+
* Avoid matching numeric character references when searching for # in xref target (#4393)
|
|
42
|
+
* Use correct selector to collapse margin on first and last child of sidebar
|
|
43
|
+
* Don't allow target of include directive to start with a space (to distinguish it from a dlist item) or to end with a space
|
|
44
|
+
* Manify alt text of block image in manpage output (#4401)
|
|
45
|
+
* Adjust font size of term in horizontal dlist to match font size of term in regular dlist
|
|
46
|
+
* Implicitly attach nested list that starts with block attribute lines to dlist entry (#4268)
|
|
47
|
+
* Don't swallow square brackets when processing escaped URL macro
|
|
48
|
+
* Treat `uri:classloader:` as an absolute path prefix when running on JRuby (#3929)
|
|
49
|
+
* Apply reftext substitutions to value of `mantitle` attribute in DocBook output (#4448)
|
|
50
|
+
* Enclose `<reftext>` tag in `<article>` tag in DocBook output for man page (#4452)
|
|
51
|
+
* Correctly handle compat role on monospace and constrained passthrough when box attrlist or formatted text is escaped
|
|
52
|
+
|
|
53
|
+
Build / Infrastructure::
|
|
54
|
+
|
|
55
|
+
* Update latest CRuby in CI workflow to 3.2
|
|
56
|
+
* Update latest JRuby in CI workflow to 9.4.2.0
|
|
57
|
+
|
|
58
|
+
=== Details
|
|
59
|
+
|
|
60
|
+
{url-repo}/releases/tag/v2.0.19[git tag] | {url-repo}/compare/v2.0.18\...v2.0.19[source diff]
|
|
61
|
+
// end::compact[]
|
|
62
|
+
|
|
19
63
|
== 2.0.18 (2022-10-15) - @mojavelinux
|
|
20
64
|
|
|
21
65
|
Improvements::
|
|
@@ -39,7 +83,6 @@ Bug Fixes::
|
|
|
39
83
|
=== Details
|
|
40
84
|
|
|
41
85
|
{url-repo}/releases/tag/v2.0.18[git tag] | {url-repo}/compare/v2.0.17\...v2.0.18[source diff]
|
|
42
|
-
// end::compact[]
|
|
43
86
|
|
|
44
87
|
== 2.0.17 (2022-01-05) - @mojavelinux
|
|
45
88
|
|
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.19, 2023-05-17
|
|
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.18
|
|
20
20
|
// URLs:
|
|
21
21
|
:url-org: https://github.com/asciidoctor
|
|
22
22
|
:url-repo: {url-org}/asciidoctor
|
|
@@ -130,20 +130,22 @@ If you're using AsciiDoc.py, see {url-docs}/asciidoctor/latest/migrate/asciidoc-
|
|
|
130
130
|
|
|
131
131
|
Asciidoctor works on Linux, macOS and Windows and requires one of the following implementations of {url-ruby}[Ruby]:
|
|
132
132
|
|
|
133
|
-
* CRuby (aka MRI) 2.3 - 3.
|
|
134
|
-
* JRuby 9.1 - 9.
|
|
133
|
+
* CRuby (aka MRI) 2.3 - 3.2
|
|
134
|
+
* JRuby 9.1 - 9.4
|
|
135
135
|
* TruffleRuby (GraalVM)
|
|
136
136
|
|
|
137
137
|
[CAUTION]
|
|
138
138
|
====
|
|
139
139
|
If you're using a non-English Windows environment, you may bump into an `Encoding::UndefinedConversionError` when invoking Asciidoctor.
|
|
140
|
-
To solve this issue, we recommend
|
|
140
|
+
To solve this issue, we recommend overriding the default external and internal character encodings to `utf-8`.
|
|
141
|
+
You can do so by setting the `RUBYOPT` environment variable as follows:
|
|
141
142
|
|
|
142
|
-
|
|
143
|
+
RUBYOPT="-E utf-8:utf-8"
|
|
144
|
+
|
|
145
|
+
Once you make this change, all your Unicode headaches should be behind you.
|
|
143
146
|
|
|
144
|
-
Once you make this change, all your Unicode headaches will be behind you.
|
|
145
147
|
If you're using an IDE like Eclipse, make sure you set the encoding to UTF-8 there as well.
|
|
146
|
-
Asciidoctor
|
|
148
|
+
Asciidoctor is optimized to work with UTF-8 as the default encoding.
|
|
147
149
|
====
|
|
148
150
|
|
|
149
151
|
== Installation
|
data/asciidoctor.gemspec
CHANGED
|
@@ -38,9 +38,9 @@ Gem::Specification.new do |s|
|
|
|
38
38
|
s.add_development_dependency 'cucumber', '~> 3.1.0'
|
|
39
39
|
# erubi is needed for testing alternate eRuby impls
|
|
40
40
|
s.add_development_dependency 'erubi', '~> 1.10.0'
|
|
41
|
-
s.add_development_dependency 'haml', '~>
|
|
41
|
+
s.add_development_dependency 'haml', '~> 6.1.0'
|
|
42
42
|
s.add_development_dependency 'minitest', '~> 5.14.0'
|
|
43
|
-
s.add_development_dependency 'nokogiri', '~> 1.
|
|
43
|
+
s.add_development_dependency 'nokogiri', '~> 1.13.0'
|
|
44
44
|
s.add_development_dependency 'rake', '~> 12.3.0'
|
|
45
45
|
s.add_development_dependency 'slim', '~> 4.1.0'
|
|
46
46
|
s.add_development_dependency 'tilt', '~> 2.0.0'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Kiswahili translation, Benson Muite
|
|
2
|
+
:appendix-caption: Kiambatisho
|
|
3
|
+
:appendix-refsig: {appendix-caption}
|
|
4
|
+
:caution-caption: Hatari
|
|
5
|
+
:chapter-signifier: Somo
|
|
6
|
+
:chapter-refsig: {chapter-signifier}
|
|
7
|
+
:example-caption: Mfano
|
|
8
|
+
:figure-caption: Picha
|
|
9
|
+
:important-caption: Muhimu
|
|
10
|
+
:last-update-label: Geuza la mwisho
|
|
11
|
+
ifdef::listing-caption[:listing-caption: Orodha]
|
|
12
|
+
ifdef::manname-title[:manname-title: Jina]
|
|
13
|
+
:note-caption: Muhtasari
|
|
14
|
+
:part-signifier: Sehemu
|
|
15
|
+
:part-refsig: {part-signifier}
|
|
16
|
+
ifdef::preface-title[:preface-title: Dibaji]
|
|
17
|
+
:section-refsig: Fungu
|
|
18
|
+
:table-caption: Ratiba
|
|
19
|
+
:tip-caption: Shauri
|
|
20
|
+
:toc-title: Fahirisi
|
|
21
|
+
:untitled-label: Bila kichwa
|
|
22
|
+
:version-label: Toleo
|
|
23
|
+
:warning-caption: Onyo
|
|
@@ -198,13 +198,10 @@ table.tableblock.fit-content>caption.title{white-space:nowrap;width:0}
|
|
|
198
198
|
.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #dddddf;color:rgba(0,0,0,.6);word-wrap:anywhere}
|
|
199
199
|
.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
|
|
200
200
|
.exampleblock>.content{border:1px solid #e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;border-radius:4px}
|
|
201
|
-
.exampleblock>.content>:first-child{margin-top:0}
|
|
202
|
-
.exampleblock>.content>:last-child{margin-bottom:0}
|
|
203
201
|
.sidebarblock{border:1px solid #dbdbd6;margin-bottom:1.25em;padding:1.25em;background:#f3f3f2;border-radius:4px}
|
|
204
|
-
.sidebarblock>:first-child{margin-top:0}
|
|
205
|
-
.sidebarblock>:last-child{margin-bottom:0}
|
|
206
202
|
.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center}
|
|
207
|
-
.exampleblock>.content>:
|
|
203
|
+
.exampleblock>.content>:first-child,.sidebarblock>.content>:first-child{margin-top:0}
|
|
204
|
+
.exampleblock>.content>:last-child,.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}
|
|
208
205
|
.literalblock pre,.listingblock>.content>pre{border-radius:4px;overflow-x:auto;padding:1em;font-size:.8125em}
|
|
209
206
|
@media screen and (min-width:768px){.literalblock pre,.listingblock>.content>pre{font-size:.90625em}}
|
|
210
207
|
@media screen and (min-width:1280px){.literalblock pre,.listingblock>.content>pre{font-size:1em}}
|
|
@@ -383,7 +380,7 @@ b.conum *{color:inherit!important}
|
|
|
383
380
|
dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility}
|
|
384
381
|
h1,h2,p,td.content,span.alt,summary{letter-spacing:-.01em}
|
|
385
382
|
p strong,td.content strong,div.footnote strong{letter-spacing:-.005em}
|
|
386
|
-
p,blockquote,dt,td.content,span.alt,summary{font-size:1.0625rem}
|
|
383
|
+
p,blockquote,dt,td.content,td.hdlist1,span.alt,summary{font-size:1.0625rem}
|
|
387
384
|
p{margin-bottom:1.25rem}
|
|
388
385
|
.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em}
|
|
389
386
|
.exampleblock>.content{background:#fffef7;border-color:#e0e0dc;box-shadow:0 1px 4px #e0e0dc}
|
|
@@ -24,6 +24,7 @@ class AbstractBlock < AbstractNode
|
|
|
24
24
|
attr_accessor :numeral
|
|
25
25
|
|
|
26
26
|
# Public: Gets/Sets the location in the AsciiDoc source where this block begins.
|
|
27
|
+
# Tracking source location is not enabled by default, and is controlled by the sourcemap option.
|
|
27
28
|
attr_accessor :source_location
|
|
28
29
|
|
|
29
30
|
# Public: Get/Set the String style (block type qualifier) for this block.
|
data/lib/asciidoctor/block.rb
CHANGED
|
@@ -116,7 +116,7 @@ class Block < AbstractBlock
|
|
|
116
116
|
# maybe apply_subs can know how to strip whitespace?
|
|
117
117
|
result = apply_subs @lines, @subs
|
|
118
118
|
if result.size < 2
|
|
119
|
-
result[0]
|
|
119
|
+
result[0] || ''
|
|
120
120
|
else
|
|
121
121
|
result.shift while (first = result[0]) && first.rstrip.empty?
|
|
122
122
|
result.pop while (last = result[-1]) && last.rstrip.empty?
|
|
@@ -39,11 +39,25 @@ class Converter::DocBook5Converter < Converter::Base
|
|
|
39
39
|
result << ((node.attr? 'sectnumlevels') ? %(<?asciidoc-numbered maxdepth="#{node.attr 'sectnumlevels'}"?>) : '<?asciidoc-numbered?>') if node.attr? 'sectnums'
|
|
40
40
|
lang_attribute = (node.attr? 'nolang') ? '' : %( xml:lang="#{node.attr 'lang', 'en'}")
|
|
41
41
|
if (root_tag_name = node.doctype) == 'manpage'
|
|
42
|
-
|
|
42
|
+
manpage = true
|
|
43
|
+
root_tag_name = 'article'
|
|
43
44
|
end
|
|
44
45
|
root_tag_idx = result.size
|
|
45
46
|
id = node.id
|
|
46
47
|
result << (document_info_tag node) unless node.noheader
|
|
48
|
+
if manpage
|
|
49
|
+
result << '<refentry>'
|
|
50
|
+
result << '<refmeta>'
|
|
51
|
+
result << %(<refentrytitle>#{node.apply_reftext_subs node.attr 'mantitle'}</refentrytitle>) if node.attr? 'mantitle'
|
|
52
|
+
result << %(<manvolnum>#{node.attr 'manvolnum'}</manvolnum>) if node.attr? 'manvolnum'
|
|
53
|
+
result << %(<refmiscinfo class="source">#{node.attr 'mansource', ' '}</refmiscinfo>)
|
|
54
|
+
result << %(<refmiscinfo class="manual">#{node.attr 'manmanual', ' '}</refmiscinfo>)
|
|
55
|
+
result << '</refmeta>'
|
|
56
|
+
result << '<refnamediv>'
|
|
57
|
+
result += (node.attr 'mannames').map {|n| %(<refname>#{n}</refname>) } if node.attr? 'mannames'
|
|
58
|
+
result << %(<refpurpose>#{node.attr 'manpurpose'}</refpurpose>) if node.attr? 'manpurpose'
|
|
59
|
+
result << '</refnamediv>'
|
|
60
|
+
end
|
|
47
61
|
unless (docinfo_content = node.docinfo :header).empty?
|
|
48
62
|
result << docinfo_content
|
|
49
63
|
end
|
|
@@ -51,6 +65,7 @@ class Converter::DocBook5Converter < Converter::Base
|
|
|
51
65
|
unless (docinfo_content = node.docinfo :footer).empty?
|
|
52
66
|
result << docinfo_content
|
|
53
67
|
end
|
|
68
|
+
result << '</refentry>' if manpage
|
|
54
69
|
id, node.id = node.id, nil unless id
|
|
55
70
|
# defer adding root tag in case document ID is auto-generated on demand
|
|
56
71
|
result.insert root_tag_idx, %(<#{root_tag_name} xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0"#{lang_attribute}#{common_attributes id}>)
|
|
@@ -66,7 +81,7 @@ class Converter::DocBook5Converter < Converter::Base
|
|
|
66
81
|
else
|
|
67
82
|
tag_name = node.sectname
|
|
68
83
|
end
|
|
69
|
-
title_el = node.special && (node.option? 'untitled') ? '' : %(<title>#{node.title}</title>\n)
|
|
84
|
+
title_el = node.special && ((node.option? 'notitle') || (node.option? 'untitled')) ? '' : %(<title>#{node.title}</title>\n)
|
|
70
85
|
%(<#{tag_name}#{common_attributes node.id, node.role, node.reftext}>
|
|
71
86
|
#{title_el}#{node.content}
|
|
72
87
|
</#{tag_name}>)
|
|
@@ -248,10 +263,10 @@ class Converter::DocBook5Converter < Converter::Base
|
|
|
248
263
|
def convert_stem node
|
|
249
264
|
if (idx = node.subs.index :specialcharacters)
|
|
250
265
|
node.subs.delete_at idx
|
|
251
|
-
equation = node.content
|
|
266
|
+
equation = node.content
|
|
252
267
|
idx > 0 ? (node.subs.insert idx, :specialcharacters) : (node.subs.unshift :specialcharacters)
|
|
253
268
|
else
|
|
254
|
-
equation = node.content
|
|
269
|
+
equation = node.content
|
|
255
270
|
end
|
|
256
271
|
if node.style == 'asciimath'
|
|
257
272
|
# NOTE fop requires jeuclid to process mathml markup
|
|
@@ -702,19 +717,6 @@ class Converter::DocBook5Converter < Converter::Base
|
|
|
702
717
|
end
|
|
703
718
|
result << '</info>'
|
|
704
719
|
|
|
705
|
-
if doc.doctype == 'manpage'
|
|
706
|
-
result << '<refmeta>'
|
|
707
|
-
result << %(<refentrytitle>#{doc.attr 'mantitle'}</refentrytitle>) if doc.attr? 'mantitle'
|
|
708
|
-
result << %(<manvolnum>#{doc.attr 'manvolnum'}</manvolnum>) if doc.attr? 'manvolnum'
|
|
709
|
-
result << %(<refmiscinfo class="source">#{doc.attr 'mansource', ' '}</refmiscinfo>)
|
|
710
|
-
result << %(<refmiscinfo class="manual">#{doc.attr 'manmanual', ' '}</refmiscinfo>)
|
|
711
|
-
result << '</refmeta>'
|
|
712
|
-
result << '<refnamediv>'
|
|
713
|
-
result += (doc.attr 'mannames').map {|n| %(<refname>#{n}</refname>) } if doc.attr? 'mannames'
|
|
714
|
-
result << %(<refpurpose>#{doc.attr 'manpurpose'}</refpurpose>) if doc.attr? 'manpurpose'
|
|
715
|
-
result << '</refnamediv>'
|
|
716
|
-
end
|
|
717
|
-
|
|
718
720
|
result.join LF
|
|
719
721
|
end
|
|
720
722
|
|
|
@@ -675,7 +675,7 @@ Your browser does not support the audio tag.
|
|
|
675
675
|
title_element = node.title? ? %(<div class="title">#{node.captioned_title}</div>\n) : ''
|
|
676
676
|
%(<div#{id_attribute} class="listingblock#{(role = node.role) ? " #{role}" : ''}">
|
|
677
677
|
#{title_element}<div class="content">
|
|
678
|
-
#{syntax_hl ? (syntax_hl.format node, lang, opts) : pre_open +
|
|
678
|
+
#{syntax_hl ? (syntax_hl.format node, lang, opts) : pre_open + node.content + pre_close}
|
|
679
679
|
</div>
|
|
680
680
|
</div>)
|
|
681
681
|
end
|
|
@@ -28,7 +28,7 @@ class Converter::ManPageConverter < Converter::Base
|
|
|
28
28
|
EllipsisCharRefRx = /…(?:​)?/
|
|
29
29
|
WrappedIndentRx = /#{CG_BLANK}*#{LF}#{CG_BLANK}*/
|
|
30
30
|
XMLMarkupRx = /&#?[a-z\d]+;|</
|
|
31
|
-
PCDATAFilterRx =
|
|
31
|
+
PCDATAFilterRx = %r((&#?[a-z\d]+;|<#{ESC}\\f\(CR.*?</#{ESC}\\fP>|<[^>]+>)|([^&<]+))
|
|
32
32
|
|
|
33
33
|
def initialize backend, opts = {}
|
|
34
34
|
@backend = backend
|
|
@@ -39,7 +39,7 @@ class Converter::ManPageConverter < Converter::Base
|
|
|
39
39
|
unless node.attr? 'mantitle'
|
|
40
40
|
raise 'asciidoctor: ERROR: doctype must be set to manpage when using manpage backend'
|
|
41
41
|
end
|
|
42
|
-
mantitle = node.attr 'mantitle'
|
|
42
|
+
mantitle = (node.attr 'mantitle').gsub InvalidSectionIdCharsRx, ''
|
|
43
43
|
manvolnum = node.attr 'manvolnum', '1'
|
|
44
44
|
manname = node.attr 'manname', mantitle
|
|
45
45
|
manmanual = node.attr 'manmanual'
|
|
@@ -236,7 +236,7 @@ r lw(\n(.lu*75u/100u).'
|
|
|
236
236
|
result << (node.title? ? %(.sp
|
|
237
237
|
.B #{manify node.captioned_title}
|
|
238
238
|
.br) : '.sp')
|
|
239
|
-
result << %([#{node.alt}])
|
|
239
|
+
result << %([#{manify node.alt}])
|
|
240
240
|
result.join LF
|
|
241
241
|
end
|
|
242
242
|
|
|
@@ -29,7 +29,7 @@ class Converter::TemplateConverter < Converter::Base
|
|
|
29
29
|
erb: { trim: 0 },
|
|
30
30
|
# TODO line 466 of haml/compiler.rb sorts the attributes; file an issue to make this configurable
|
|
31
31
|
# NOTE AsciiDoc syntax expects HTML/XML output to use double quotes around attribute values
|
|
32
|
-
haml: { format: :xhtml, attr_wrapper: '"', escape_attrs: false, ugly: true },
|
|
32
|
+
haml: { format: :xhtml, attr_wrapper: '"', escape_html: false, escape_attrs: false, ugly: true },
|
|
33
33
|
slim: { disable_escape: true, sort_attrs: false, pretty: false },
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -227,6 +227,7 @@ class Converter::TemplateConverter < Converter::Base
|
|
|
227
227
|
Helpers.require_library 'haml' unless defined? ::Haml::Engine
|
|
228
228
|
# NOTE Haml 5 dropped support for pretty printing
|
|
229
229
|
@engine_options[extsym].delete :ugly if defined? ::Haml::TempleEngine
|
|
230
|
+
@engine_options[extsym][:attr_quote] = @engine_options[extsym].delete :attr_wrapper unless defined? ::Haml::Options
|
|
230
231
|
@active_engines[extsym] = true
|
|
231
232
|
end
|
|
232
233
|
when :erb
|
|
@@ -1109,6 +1109,9 @@ module Extensions
|
|
|
1109
1109
|
# Public: Checks whether any {BlockProcessor} extensions are registered to
|
|
1110
1110
|
# handle the specified block name appearing on the specified context.
|
|
1111
1111
|
#
|
|
1112
|
+
# This method assumes you've called blocks? first to check whether any
|
|
1113
|
+
# block extensions are registered.
|
|
1114
|
+
#
|
|
1112
1115
|
# Returns the [Extension] proxy object for the BlockProcessor that matches
|
|
1113
1116
|
# the block name and context or false if no match is found.
|
|
1114
1117
|
def registered_for_block? name, context
|
|
@@ -1124,6 +1127,9 @@ module Extensions
|
|
|
1124
1127
|
#
|
|
1125
1128
|
# name - the String or Symbol (coersed to a Symbol) macro name
|
|
1126
1129
|
#
|
|
1130
|
+
# This method assumes you've called blocks? first to check whether any
|
|
1131
|
+
# block extensions are registered.
|
|
1132
|
+
#
|
|
1127
1133
|
# Returns the [Extension] object stored in the registry that proxies the
|
|
1128
1134
|
# corresponding BlockProcessor or nil if a match is not found.
|
|
1129
1135
|
def find_block_extension name
|
|
@@ -1200,6 +1206,9 @@ module Extensions
|
|
|
1200
1206
|
#
|
|
1201
1207
|
# name - the String or Symbol (coersed to a Symbol) macro name
|
|
1202
1208
|
#
|
|
1209
|
+
# This method assumes you've called block_macros? first to check whether any
|
|
1210
|
+
# block macro extensions are registered.
|
|
1211
|
+
#
|
|
1203
1212
|
# Returns the [Extension] proxy object for the BlockMacroProcessor that matches
|
|
1204
1213
|
# the macro name or false if no match is found.
|
|
1205
1214
|
#--
|
|
@@ -1213,6 +1222,9 @@ module Extensions
|
|
|
1213
1222
|
#
|
|
1214
1223
|
# name - the String or Symbol (coersed to a Symbol) macro name
|
|
1215
1224
|
#
|
|
1225
|
+
# This method assumes you've called block_macros? first to check whether any
|
|
1226
|
+
# block macro extensions are registered.
|
|
1227
|
+
#
|
|
1216
1228
|
# Returns the [Extension] object stored in the registry that proxies the
|
|
1217
1229
|
# corresponding BlockMacroProcessor or nil if a match is not found.
|
|
1218
1230
|
def find_block_macro_extension name
|
|
@@ -1289,6 +1301,9 @@ module Extensions
|
|
|
1289
1301
|
#
|
|
1290
1302
|
# name - the String or Symbol (coersed to a Symbol) macro name
|
|
1291
1303
|
#
|
|
1304
|
+
# This method assumes you've called inline_macros? first to check whether any
|
|
1305
|
+
# inline macro extensions are registered.
|
|
1306
|
+
#
|
|
1292
1307
|
# Returns the [Extension] proxy object for the InlineMacroProcessor that matches
|
|
1293
1308
|
# the macro name or false if no match is found.
|
|
1294
1309
|
def registered_for_inline_macro? name
|
|
@@ -1300,6 +1315,9 @@ module Extensions
|
|
|
1300
1315
|
#
|
|
1301
1316
|
# name - the String or Symbol (coersed to a Symbol) macro name
|
|
1302
1317
|
#
|
|
1318
|
+
# This method assumes you've called inline_macros? first to check whether any
|
|
1319
|
+
# inline macro extensions are registered.
|
|
1320
|
+
#
|
|
1303
1321
|
# Returns the [Extension] object stored in the registry that proxies the
|
|
1304
1322
|
# corresponding InlineMacroProcessor or nil if a match is not found.
|
|
1305
1323
|
def find_inline_macro_extension name
|
|
@@ -1309,6 +1327,9 @@ module Extensions
|
|
|
1309
1327
|
# Public: Retrieves the {Extension} proxy objects for all
|
|
1310
1328
|
# InlineMacroProcessor instances in this registry.
|
|
1311
1329
|
#
|
|
1330
|
+
# This method assumes you've called inline_macros? first to check whether any
|
|
1331
|
+
# inline macro extensions are registered.
|
|
1332
|
+
#
|
|
1312
1333
|
# Returns an [Array] of Extension proxy objects.
|
|
1313
1334
|
def inline_macros
|
|
1314
1335
|
@inline_macro_extensions.values
|
data/lib/asciidoctor/helpers.rb
CHANGED
|
@@ -120,8 +120,14 @@ module Helpers
|
|
|
120
120
|
# str - the String to check
|
|
121
121
|
#
|
|
122
122
|
# returns true if the String is a URI, false if it is not
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
if ::RUBY_ENGINE == 'jruby'
|
|
124
|
+
def uriish? str
|
|
125
|
+
(str.include? ':') && !(str.start_with? 'uri:classloader:') && (UriSniffRx.match? str)
|
|
126
|
+
end
|
|
127
|
+
else
|
|
128
|
+
def uriish? str
|
|
129
|
+
(str.include? ':') && (UriSniffRx.match? str)
|
|
130
|
+
end
|
|
125
131
|
end
|
|
126
132
|
|
|
127
133
|
# Internal: Encode a URI component String for safe inclusion in a URI.
|
data/lib/asciidoctor/parser.rb
CHANGED
|
@@ -398,18 +398,22 @@ class Parser
|
|
|
398
398
|
# REVIEW this may be doing too much
|
|
399
399
|
if part
|
|
400
400
|
if !section.blocks?
|
|
401
|
-
# if this
|
|
401
|
+
# if this not a [partintro] open block, enclose it in a [partintro] open block
|
|
402
402
|
if new_block.style != 'partintro'
|
|
403
|
-
#
|
|
404
|
-
if new_block.context == :
|
|
405
|
-
new_block.context = :open
|
|
403
|
+
# if this is already a normal open block, simply add the partintro style
|
|
404
|
+
if new_block.style == 'open' && new_block.context == :open
|
|
406
405
|
new_block.style = 'partintro'
|
|
407
|
-
# emulate [partintro] open block
|
|
408
406
|
else
|
|
409
407
|
new_block.parent = (intro = Block.new section, :open, content_model: :compound)
|
|
410
408
|
intro.style = 'partintro'
|
|
411
409
|
section.blocks << intro
|
|
412
410
|
end
|
|
411
|
+
# if this is a [partintro] paragraph, convert it to a [partintro] open block w/ single paragraph
|
|
412
|
+
elsif new_block.content_model == :simple
|
|
413
|
+
new_block.content_model = :compound
|
|
414
|
+
new_block << (Block.new new_block, :paragraph, source: new_block.lines, subs: new_block.subs)
|
|
415
|
+
new_block.lines.clear
|
|
416
|
+
new_block.subs.clear
|
|
413
417
|
end
|
|
414
418
|
elsif section.blocks.size == 1
|
|
415
419
|
first_block = section.blocks[0]
|
|
@@ -419,12 +423,11 @@ class Parser
|
|
|
419
423
|
# rebuild [partintro] paragraph as an open block
|
|
420
424
|
elsif first_block.content_model != :compound
|
|
421
425
|
new_block.parent = (intro = Block.new section, :open, content_model: :compound)
|
|
422
|
-
intro.style = 'partintro'
|
|
423
|
-
section.blocks.shift
|
|
424
|
-
if first_block.style == 'partintro'
|
|
426
|
+
if first_block.style == (intro.style = 'partintro')
|
|
425
427
|
first_block.context = :paragraph
|
|
426
428
|
first_block.style = nil
|
|
427
429
|
end
|
|
430
|
+
section.blocks.shift
|
|
428
431
|
intro << first_block
|
|
429
432
|
section.blocks << intro
|
|
430
433
|
end
|
|
@@ -1168,8 +1171,8 @@ class Parser
|
|
|
1168
1171
|
if reftext.include? ']'
|
|
1169
1172
|
reftext = reftext.gsub '\]', ']'
|
|
1170
1173
|
reftext = document.sub_attributes reftext if reftext.include? ATTR_REF_HEAD
|
|
1171
|
-
elsif
|
|
1172
|
-
|
|
1174
|
+
elsif reftext.include? ATTR_REF_HEAD
|
|
1175
|
+
reftext = nil if (reftext = document.sub_attributes reftext).empty?
|
|
1173
1176
|
end
|
|
1174
1177
|
end
|
|
1175
1178
|
end
|
|
@@ -1439,21 +1442,33 @@ class Parser
|
|
|
1439
1442
|
|
|
1440
1443
|
# a delimited block immediately breaks the list unless preceded
|
|
1441
1444
|
# by a list continuation (they are harsh like that ;0)
|
|
1442
|
-
if (match = is_delimited_block?
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1445
|
+
if (match = is_delimited_block? this_line, true)
|
|
1446
|
+
break unless continuation == :active
|
|
1447
|
+
buffer << this_line
|
|
1448
|
+
# grab all the lines in the block, leaving the delimiters in place
|
|
1449
|
+
# we're being more strict here about the terminator, but I think that's a good thing
|
|
1450
|
+
buffer.concat reader.read_lines_until terminator: match.terminator, read_last_line: true, context: nil
|
|
1451
|
+
continuation = :inactive
|
|
1452
|
+
# BlockAttributeLineRx only breaks dlist if ensuing line is not a list item
|
|
1453
|
+
elsif dlist && continuation != :active && (this_line.start_with? '[') && (BlockAttributeLineRx.match? this_line)
|
|
1454
|
+
block_attribute_lines = [this_line]
|
|
1455
|
+
while (next_line = reader.peek_line)
|
|
1456
|
+
if is_delimited_block? next_line
|
|
1457
|
+
interrupt = true
|
|
1458
|
+
elsif next_line.empty? || ((next_line.start_with? '[') && (BlockAttributeLineRx.match? next_line))
|
|
1459
|
+
block_attribute_lines << reader.read_line
|
|
1460
|
+
next
|
|
1461
|
+
elsif (AnyListRx.match? next_line) && !(is_sibling_list_item? next_line, list_type, sibling_trait)
|
|
1462
|
+
buffer.concat block_attribute_lines
|
|
1463
|
+
else # rubocop:disable Lint/DuplicateBranch
|
|
1464
|
+
interrupt = true
|
|
1465
|
+
end
|
|
1466
|
+
break
|
|
1467
|
+
end
|
|
1468
|
+
if interrupt
|
|
1469
|
+
reader.unshift_lines block_attribute_lines
|
|
1450
1470
|
break
|
|
1451
1471
|
end
|
|
1452
|
-
# technically BlockAttributeLineRx only breaks if ensuing line is not a list item
|
|
1453
|
-
# which really means BlockAttributeLineRx only breaks if it's acting as a block delimiter
|
|
1454
|
-
# FIXME to be AsciiDoc compliant, we shouldn't break if style in attribute line is "literal" (i.e., [literal])
|
|
1455
|
-
elsif dlist && continuation != :active && (BlockAttributeLineRx.match? this_line)
|
|
1456
|
-
break
|
|
1457
1472
|
elsif continuation == :active && !this_line.empty?
|
|
1458
1473
|
# literal paragraphs have special considerations (and this is one of
|
|
1459
1474
|
# two entry points into one)
|
|
@@ -1470,7 +1485,8 @@ class Parser
|
|
|
1470
1485
|
end
|
|
1471
1486
|
continuation = :inactive
|
|
1472
1487
|
# let block metadata play out until we find the block
|
|
1473
|
-
elsif (
|
|
1488
|
+
elsif ((ch0 = this_line.chr) == '.' && (BlockTitleRx.match? this_line)) ||
|
|
1489
|
+
(ch0 == '[' && (BlockAttributeLineRx.match? this_line)) || (ch0 == ':' && (AttributeEntryRx.match? this_line))
|
|
1474
1490
|
buffer << this_line
|
|
1475
1491
|
else
|
|
1476
1492
|
if (nested_list_type = (within_nested_list ? [:dlist] : NESTABLE_LIST_CONTEXTS).find {|ctx| ListRxMap[ctx].match? this_line })
|
|
@@ -109,6 +109,7 @@ class PathResolver
|
|
|
109
109
|
SLASH = '/'
|
|
110
110
|
BACKSLASH = '\\'
|
|
111
111
|
DOUBLE_SLASH = '//'
|
|
112
|
+
URI_CLASSLOADER = 'uri:classloader:'
|
|
112
113
|
WindowsRootRx = %r(^(?:[a-zA-Z]:)?[\\/])
|
|
113
114
|
|
|
114
115
|
attr_accessor :file_separator
|
|
@@ -148,8 +149,9 @@ class PathResolver
|
|
|
148
149
|
# Public: Check if the specified path is an absolute root path (or, in the
|
|
149
150
|
# browser environment, an absolute URI as well)
|
|
150
151
|
#
|
|
151
|
-
# This operation considers both
|
|
152
|
-
#
|
|
152
|
+
# This operation considers both POSIX and Windows paths. If the JavaScript IO module
|
|
153
|
+
# is xmlhttprequest, this operation also considers absolute URIs. If running on JRuby,
|
|
154
|
+
# this operation also considers classloader URIs (starts with uri:classloader:).
|
|
153
155
|
#
|
|
154
156
|
# Unix absolute paths and UNC paths start with slash. Windows roots can
|
|
155
157
|
# start with a drive letter. When the IO module is xmlhttprequest (Opal
|
|
@@ -164,6 +166,10 @@ class PathResolver
|
|
|
164
166
|
def root? path
|
|
165
167
|
(absolute_path? path) || (path.start_with? 'file://', 'http://', 'https://')
|
|
166
168
|
end
|
|
169
|
+
elsif ::RUBY_ENGINE == 'jruby'
|
|
170
|
+
def root? path
|
|
171
|
+
(absolute_path? path) || (path.start_with? URI_CLASSLOADER)
|
|
172
|
+
end
|
|
167
173
|
else
|
|
168
174
|
alias root? absolute_path?
|
|
169
175
|
end
|
|
@@ -299,6 +305,9 @@ class PathResolver
|
|
|
299
305
|
# ex. /sample/path
|
|
300
306
|
elsif posix_path.start_with? SLASH
|
|
301
307
|
root = SLASH
|
|
308
|
+
# ex. uri:classloader:sample/path (or uri:classloader:/sample/path)
|
|
309
|
+
elsif posix_path.start_with? URI_CLASSLOADER
|
|
310
|
+
root = posix_path.slice 0, URI_CLASSLOADER.length
|
|
302
311
|
# ex. C:/sample/path (or file:///sample/path in browser environment)
|
|
303
312
|
else
|
|
304
313
|
root = posix_path.slice 0, (posix_path.index SLASH) + 1
|
data/lib/asciidoctor/reader.rb
CHANGED
|
@@ -125,16 +125,21 @@ class Reader
|
|
|
125
125
|
# Returns the next line of the source data as a String if there are lines remaining.
|
|
126
126
|
# Returns nothing if there is no more data.
|
|
127
127
|
def peek_line direct = false
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
128
|
+
while true
|
|
129
|
+
next_line = @lines[-1]
|
|
130
|
+
if direct || @look_ahead > 0
|
|
131
|
+
return @unescape_next_line ? (next_line.slice 1, next_line.length) : next_line
|
|
132
|
+
elsif next_line
|
|
133
|
+
# FIXME the problem with this approach is that we aren't
|
|
134
|
+
# retaining the modified line (hence the @unescape_next_line tweak)
|
|
135
|
+
# perhaps we need a stack of proxied lines
|
|
136
|
+
if (line = process_line next_line)
|
|
137
|
+
return line
|
|
138
|
+
end
|
|
139
|
+
else
|
|
140
|
+
@look_ahead = 0
|
|
141
|
+
return
|
|
142
|
+
end
|
|
138
143
|
end
|
|
139
144
|
end
|
|
140
145
|
|
|
@@ -1197,15 +1202,16 @@ class PreprocessorReader < Reader
|
|
|
1197
1202
|
push_include inc_lines, inc_path, relpath, inc_offset, parsed_attrs
|
|
1198
1203
|
end
|
|
1199
1204
|
else
|
|
1205
|
+
inc_content = nil
|
|
1200
1206
|
begin
|
|
1201
1207
|
# NOTE read content before shift so cursor is only advanced if IO operation succeeds
|
|
1202
1208
|
inc_content = reader.call(inc_path, read_mode) {|f| f.read }
|
|
1203
1209
|
shift
|
|
1204
|
-
push_include inc_content, inc_path, relpath, 1, parsed_attrs
|
|
1205
1210
|
rescue
|
|
1206
1211
|
logger.error message_with_context %(include #{target_type} not readable: #{inc_path}), source_location: cursor
|
|
1207
1212
|
return replace_next_line %(Unresolved directive in #{@path} - include::#{expanded_target}[#{attrlist}])
|
|
1208
1213
|
end
|
|
1214
|
+
push_include inc_content, inc_path, relpath, 1, parsed_attrs
|
|
1209
1215
|
end
|
|
1210
1216
|
true
|
|
1211
1217
|
end
|
data/lib/asciidoctor/rx.rb
CHANGED
|
@@ -89,7 +89,7 @@ module Asciidoctor
|
|
|
89
89
|
# include::chapter1.ad[]
|
|
90
90
|
# include::example.txt[lines=1;2;5..10]
|
|
91
91
|
#
|
|
92
|
-
IncludeDirectiveRx = /^(\\)?include::([^\[][^\[]*)\[(#{CC_ANY}+)?\]$/
|
|
92
|
+
IncludeDirectiveRx = /^(\\)?include::([^\s\[](?:[^\[]*[^\s\[])?)\[(#{CC_ANY}+)?\]$/
|
|
93
93
|
|
|
94
94
|
# Matches a trailing tag directive in an include file.
|
|
95
95
|
#
|
|
@@ -516,9 +516,9 @@ module Asciidoctor
|
|
|
516
516
|
# <https://github.com>
|
|
517
517
|
# link:https://github.com[]
|
|
518
518
|
# "https://github.com[]"
|
|
519
|
+
# (https://github.com) <= parenthesis not included in autolink
|
|
519
520
|
#
|
|
520
|
-
|
|
521
|
-
InlineLinkRx = %r((^|link:|#{CG_BLANK}|<|[>\(\)\[\];"'])(\\?(?:https?|file|ftp|irc)://[^\s\[\]<]*([^\s.,\[\]<]))(?:\[(|#{CC_ALL}*?[^\\])\])?)m
|
|
521
|
+
InlineLinkRx = %r((^|link:|#{CG_BLANK}|<|[>\(\)\[\];"'])(\\?(?:https?|file|ftp|irc)://)(?:([^\s\[\]]+)\[(|#{CC_ALL}*?[^\\])\]|([^\s\[\]<]*([^\s,.?!\[\]<\)]))))m
|
|
522
522
|
|
|
523
523
|
# Match a link or e-mail inline macro.
|
|
524
524
|
#
|
|
@@ -568,23 +568,17 @@ module Asciidoctor
|
|
|
568
568
|
# Examples
|
|
569
569
|
#
|
|
570
570
|
# +text+
|
|
571
|
-
#
|
|
571
|
+
# [x-]+text+
|
|
572
|
+
# [x-]`text`
|
|
573
|
+
# `text` (compat only)
|
|
574
|
+
# [role]`text` (compat only)
|
|
572
575
|
#
|
|
573
576
|
# NOTE we always capture the attributes so we know when to use compatible (i.e., legacy) behavior
|
|
574
577
|
InlinePassRx = {
|
|
575
|
-
false => ['+', '
|
|
576
|
-
true
|
|
578
|
+
false => ['+', '-]', /((?:^|[^#{CC_WORD};:\\])(?=(\[)|\+)|\\(?=\[)|(?=\\\+))(?:\2(x-|[^\]]+ x-)\]|(?:\[([^\]]+)\])?(?=(\\)?\+))(\5?(\+|`)(\S|\S#{CC_ALL}*?\S)\7)(?!#{CG_WORD})/m],
|
|
579
|
+
true => ['`', nil, /(^|[^`#{CC_WORD}])(?:(\Z)()|\[([^\]]+)\](?=(\\))?)?(\5?(`)([^`\s]|[^`\s]#{CC_ALL}*?\S)\7)(?![`#{CC_WORD}])/m],
|
|
577
580
|
}
|
|
578
581
|
|
|
579
|
-
# Matches an inline plus passthrough spanning multiple lines, but only when it occurs directly
|
|
580
|
-
# inside constrained monospaced formatting in non-compat mode.
|
|
581
|
-
#
|
|
582
|
-
# Examples
|
|
583
|
-
#
|
|
584
|
-
# +text+
|
|
585
|
-
#
|
|
586
|
-
SinglePlusInlinePassRx = /^(\\)?\+(\S|\S#{CC_ALL}*?\S)\+$/m
|
|
587
|
-
|
|
588
582
|
# Matches several variants of the passthrough inline macro, which may span multiple lines.
|
|
589
583
|
#
|
|
590
584
|
# Examples
|
|
@@ -526,9 +526,9 @@ module Substitutors
|
|
|
526
526
|
if found_colon && (text.include? '://')
|
|
527
527
|
# inline urls, target[text] (optionally prefixed with link: and optionally surrounded by <>)
|
|
528
528
|
text = text.gsub InlineLinkRx do
|
|
529
|
-
if (target = $2).start_with? RS
|
|
529
|
+
if (target = $2 + ($3 || $5)).start_with? RS
|
|
530
530
|
# honor the escape
|
|
531
|
-
next
|
|
531
|
+
next ($&.slice 0, (rs_idx = $1.length)) + ($&.slice rs_idx + 1, $&.length)
|
|
532
532
|
end
|
|
533
533
|
|
|
534
534
|
prefix, suffix = $1, ''
|
|
@@ -543,15 +543,7 @@ module Substitutors
|
|
|
543
543
|
when 'link:', ?", ?'
|
|
544
544
|
next $&
|
|
545
545
|
end
|
|
546
|
-
case $
|
|
547
|
-
when ')', '?', '!'
|
|
548
|
-
target = target.chop
|
|
549
|
-
if (suffix = $3) == ')' && (target.end_with? '.', '?', '!')
|
|
550
|
-
suffix = target[-1] + suffix
|
|
551
|
-
target = target.chop
|
|
552
|
-
end
|
|
553
|
-
# NOTE handle case when modified target is a URI scheme (e.g., http://)
|
|
554
|
-
next $& if target.end_with? '://'
|
|
546
|
+
case $6
|
|
555
547
|
when ';'
|
|
556
548
|
if (prefix.start_with? '<') && (target.end_with? '>')
|
|
557
549
|
# move surrounding <> out of URL
|
|
@@ -755,7 +747,7 @@ module Substitutors
|
|
|
755
747
|
|
|
756
748
|
if doc.compat_mode
|
|
757
749
|
fragment = refid
|
|
758
|
-
elsif (hash_idx = refid.index '#')
|
|
750
|
+
elsif (hash_idx = refid.index '#') && refid[hash_idx - 1] != '&'
|
|
759
751
|
if hash_idx > 0
|
|
760
752
|
if (fragment_len = refid.length - 1 - hash_idx) > 0
|
|
761
753
|
path, fragment = (refid.slice 0, hash_idx), (refid.slice hash_idx + 1, fragment_len)
|
|
@@ -1027,11 +1019,17 @@ module Substitutors
|
|
|
1027
1019
|
next %(#{$1}[#{attrlist}]#{RS * (escape_count - 1)}#{boundary}#{$5}#{boundary})
|
|
1028
1020
|
elsif $1 == RS
|
|
1029
1021
|
preceding = %([#{attrlist}])
|
|
1030
|
-
|
|
1031
|
-
if
|
|
1022
|
+
elsif boundary == '++'
|
|
1023
|
+
if attrlist == 'x-'
|
|
1024
|
+
old_behavior = true
|
|
1025
|
+
attributes = {}
|
|
1026
|
+
elsif attrlist.end_with? ' x-'
|
|
1032
1027
|
old_behavior = true
|
|
1033
|
-
|
|
1028
|
+
attributes = parse_quoted_text_attributes attrlist.slice 0, attrlist.length - 3
|
|
1029
|
+
else
|
|
1030
|
+
attributes = parse_quoted_text_attributes attrlist
|
|
1034
1031
|
end
|
|
1032
|
+
else
|
|
1035
1033
|
attributes = parse_quoted_text_attributes attrlist
|
|
1036
1034
|
end
|
|
1037
1035
|
elsif (escape_count = $3.length) > 0
|
|
@@ -1066,41 +1064,43 @@ module Substitutors
|
|
|
1066
1064
|
pass_inline_char1, pass_inline_char2, pass_inline_rx = InlinePassRx[compat_mode]
|
|
1067
1065
|
text = text.gsub pass_inline_rx do
|
|
1068
1066
|
preceding = $1
|
|
1069
|
-
attrlist = $
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1067
|
+
attrlist = $4 || $3
|
|
1068
|
+
escaped = true if $5
|
|
1069
|
+
quoted_text = $6
|
|
1070
|
+
format_mark = $7
|
|
1071
|
+
content = $8
|
|
1073
1072
|
|
|
1074
1073
|
if compat_mode
|
|
1075
1074
|
old_behavior = true
|
|
1076
|
-
elsif
|
|
1077
|
-
|
|
1075
|
+
elsif attrlist && (attrlist == 'x-' || (attrlist.end_with? ' x-'))
|
|
1076
|
+
old_behavior = old_behavior_forced = true
|
|
1078
1077
|
end
|
|
1079
1078
|
|
|
1080
1079
|
if attrlist
|
|
1081
|
-
if
|
|
1082
|
-
next extract_inner_passthrough content, %(#{preceding}[#{attrlist}]#{escape_mark})
|
|
1083
|
-
elsif escape_mark
|
|
1080
|
+
if escaped
|
|
1084
1081
|
# honor the escape of the formatting mark
|
|
1085
1082
|
next %(#{preceding}[#{attrlist}]#{quoted_text.slice 1, quoted_text.length})
|
|
1086
1083
|
elsif preceding == RS
|
|
1087
1084
|
# honor the escape of the attributes
|
|
1085
|
+
next %(#{preceding}[#{attrlist}]#{quoted_text}) if old_behavior_forced && format_mark == '`'
|
|
1088
1086
|
preceding = %([#{attrlist}])
|
|
1087
|
+
elsif old_behavior_forced
|
|
1088
|
+
attributes = attrlist == 'x-' ? {} : (parse_quoted_text_attributes attrlist.slice 0, attrlist.length - 3)
|
|
1089
1089
|
else
|
|
1090
1090
|
attributes = parse_quoted_text_attributes attrlist
|
|
1091
1091
|
end
|
|
1092
|
-
elsif
|
|
1093
|
-
next extract_inner_passthrough content, %(#{preceding}#{escape_mark})
|
|
1094
|
-
elsif escape_mark
|
|
1092
|
+
elsif escaped
|
|
1095
1093
|
# honor the escape of the formatting mark
|
|
1096
1094
|
next %(#{preceding}#{quoted_text.slice 1, quoted_text.length})
|
|
1095
|
+
elsif compat_mode && preceding == RS
|
|
1096
|
+
next quoted_text
|
|
1097
1097
|
end
|
|
1098
1098
|
|
|
1099
1099
|
if compat_mode
|
|
1100
1100
|
passthrus[passthru_key = passthrus.size] = { text: content, subs: BASIC_SUBS, attributes: attributes, type: :monospaced }
|
|
1101
1101
|
elsif attributes
|
|
1102
1102
|
if old_behavior
|
|
1103
|
-
subs =
|
|
1103
|
+
subs = format_mark == '`' ? BASIC_SUBS : NORMAL_SUBS
|
|
1104
1104
|
passthrus[passthru_key = passthrus.size] = { text: content, subs: subs, attributes: attributes, type: :monospaced }
|
|
1105
1105
|
else
|
|
1106
1106
|
passthrus[passthru_key = passthrus.size] = { text: content, subs: BASIC_SUBS, attributes: attributes, type: :unquoted }
|
|
@@ -1399,20 +1399,6 @@ module Substitutors
|
|
|
1399
1399
|
end.join LF)
|
|
1400
1400
|
end
|
|
1401
1401
|
|
|
1402
|
-
# Internal: Extract nested single-plus passthrough; otherwise return unprocessed
|
|
1403
|
-
def extract_inner_passthrough text, pre
|
|
1404
|
-
if (text.end_with? '+') && (text.start_with? '+', '\+') && SinglePlusInlinePassRx =~ text
|
|
1405
|
-
if $1
|
|
1406
|
-
%(#{pre}`+#{$2}+`)
|
|
1407
|
-
else
|
|
1408
|
-
@passthroughs[passthru_key = @passthroughs.size] = { text: $2, subs: BASIC_SUBS }
|
|
1409
|
-
%(#{pre}`#{PASS_START}#{passthru_key}#{PASS_END}`)
|
|
1410
|
-
end
|
|
1411
|
-
else
|
|
1412
|
-
%(#{pre}`#{text}`)
|
|
1413
|
-
end
|
|
1414
|
-
end
|
|
1415
|
-
|
|
1416
1402
|
# Internal: Convert a quoted text region
|
|
1417
1403
|
#
|
|
1418
1404
|
# match - The MatchData for the quoted text region
|
data/lib/asciidoctor/version.rb
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.19
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dan Allen
|
|
@@ -63,14 +63,14 @@ dependencies:
|
|
|
63
63
|
requirements:
|
|
64
64
|
- - "~>"
|
|
65
65
|
- !ruby/object:Gem::Version
|
|
66
|
-
version:
|
|
66
|
+
version: 6.1.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:
|
|
73
|
+
version: 6.1.0
|
|
74
74
|
- !ruby/object:Gem::Dependency
|
|
75
75
|
name: minitest
|
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -91,14 +91,14 @@ dependencies:
|
|
|
91
91
|
requirements:
|
|
92
92
|
- - "~>"
|
|
93
93
|
- !ruby/object:Gem::Version
|
|
94
|
-
version: 1.
|
|
94
|
+
version: 1.13.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: 1.
|
|
101
|
+
version: 1.13.0
|
|
102
102
|
- !ruby/object:Gem::Dependency
|
|
103
103
|
name: rake
|
|
104
104
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -188,6 +188,7 @@ files:
|
|
|
188
188
|
- data/locale/attributes-sr.adoc
|
|
189
189
|
- data/locale/attributes-sr_Latn.adoc
|
|
190
190
|
- data/locale/attributes-sv.adoc
|
|
191
|
+
- data/locale/attributes-sw.adoc
|
|
191
192
|
- data/locale/attributes-th.adoc
|
|
192
193
|
- data/locale/attributes-tr.adoc
|
|
193
194
|
- data/locale/attributes-uk.adoc
|
|
@@ -271,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
271
272
|
- !ruby/object:Gem::Version
|
|
272
273
|
version: '0'
|
|
273
274
|
requirements: []
|
|
274
|
-
rubygems_version: 3.
|
|
275
|
+
rubygems_version: 3.4.10
|
|
275
276
|
signing_key:
|
|
276
277
|
specification_version: 4
|
|
277
278
|
summary: An implementation of the AsciiDoc text processor and publishing toolchain
|