asciidoctor 2.0.0.rc.1 → 2.0.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +12 -6
- data/README-de.adoc +3 -3
- data/README-fr.adoc +8 -8
- data/README-jp.adoc +11 -11
- data/README-zh_CN.adoc +11 -11
- data/README.adoc +2 -2
- data/lib/asciidoctor.rb +75 -98
- data/lib/asciidoctor/abstract_block.rb +1 -1
- data/lib/asciidoctor/block.rb +1 -1
- data/lib/asciidoctor/cli/options.rb +1 -1
- data/lib/asciidoctor/converter.rb +5 -5
- data/lib/asciidoctor/document.rb +8 -1
- data/lib/asciidoctor/logging.rb +3 -1
- data/lib/asciidoctor/reader.rb +2 -6
- data/lib/asciidoctor/substitutors.rb +91 -78
- data/lib/asciidoctor/syntax_highlighter/coderay.rb +2 -2
- data/lib/asciidoctor/table.rb +6 -10
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +4 -4
- data/man/asciidoctor.adoc +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f340fd25a88b03b8039dc09623ce2d043d30e78a09c84519e9e8ffb59f7f9217
|
4
|
+
data.tar.gz: e7b1550ffe98c8ccf086eb9ce2b41c2a7f32a9946d34ba5b2a647af0d7887248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ee1db87cdc03978ab1b20097ec44cc7151df771f6b9b434a2432bb6efc280079c4820164d039a5b04fc24351cb022d376d193628c5f673f5cc458d6e1c83a78
|
7
|
+
data.tar.gz: 696401edc7d556b9e1070ec1bd74cffcda8747b61a896d46b7c5cf521a35b6cf3925ed78809e8032babe293ca62cf281087e44a6ea21a03f5d1d24e32604bfcf
|
data/CHANGELOG.adoc
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
= Asciidoctor Changelog
|
2
|
-
:uri-asciidoctor:
|
2
|
+
:uri-asciidoctor: https://asciidoctor.org
|
3
3
|
:uri-asciidoc: {uri-asciidoctor}/docs/what-is-asciidoc
|
4
4
|
:uri-repo: https://github.com/asciidoctor/asciidoctor
|
5
5
|
:icons: font
|
@@ -13,7 +13,7 @@ endif::[]
|
|
13
13
|
This document provides a high-level view of the changes introduced in Asciidoctor by release.
|
14
14
|
For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub.
|
15
15
|
|
16
|
-
== 2.0.0.rc.
|
16
|
+
== 2.0.0.rc.2 (2019-03-12) - @mojavelinux
|
17
17
|
|
18
18
|
Enhancements / Compliance::
|
19
19
|
|
@@ -62,12 +62,14 @@ Enhancements / Compliance::
|
|
62
62
|
* modify Cell class to extend from AbstractBlock instead of AbstractNode (#2963)
|
63
63
|
* implement block? and inline? methods on Column, both which return false (#2963)
|
64
64
|
* drop verse table cell style (treat as normal table cell) (#3111)
|
65
|
+
* allow negated subs to be specified on inline pass macro (#2191)
|
65
66
|
* log warning if footnoteref macro is found and compat mode is not enabled (#3114)
|
66
67
|
* log debug message instead of warning if block style is unknown (#3092)
|
67
68
|
* allow backend to delegate to a registered backend using the syntax synthetic:delegate when using custom templates (e.g., slides:html) (#891)
|
68
69
|
* AbstractBlock#find_by looks inside AsciiDoc table cells if traverse_documents selector option is true (#3101)
|
69
70
|
* AbstractBlock#find_by finds table cells, which can be selected using the :table_cell context in the selector (#2524)
|
70
71
|
* allow ampersand to be used in e-mail address (#2553)
|
72
|
+
* propogate ID assigned to inline passthrough (#2912)
|
71
73
|
|
72
74
|
Improvements::
|
73
75
|
|
@@ -98,6 +100,9 @@ Improvements::
|
|
98
100
|
* add clearer exception message when source data is binary or has invalid encoding (#2884)
|
99
101
|
* rename context for table cell and table column to :table_cell and :table_column, respectively
|
100
102
|
* rename hardbreaks document attribute to hardbreaks-option; retain hardbreaks as a deprecated alias (#3123)
|
103
|
+
* truncate with precision (instead of rounding) when computing absolute width for columns in DocBook output (#3131)
|
104
|
+
* drop legacy LaTeX math delimiters (e.g, `$..$`) if present (#1339)
|
105
|
+
* upgrade MathJax to 2.7.5
|
101
106
|
|
102
107
|
Bug Fixes::
|
103
108
|
|
@@ -120,6 +125,7 @@ Bug Fixes::
|
|
120
125
|
* scope constant lookups (#2764)
|
121
126
|
* use byteslice instead of slice to remove BOM from string (#2764)
|
122
127
|
* don't fail if value of -a CLI option is empty string or equals sign (#2997)
|
128
|
+
* allow failure level to be set to DEBUG
|
123
129
|
* Reader#push_include should not fail if data is nil
|
124
130
|
* fix deprecated ERB trim mode that was causing warning (#3006)
|
125
131
|
* move time anchor after query string on vimeo video to avoid dropping options
|
@@ -127,7 +133,7 @@ Bug Fixes::
|
|
127
133
|
* enforce and report relative include depth properly (depth=0 rather than depth=1 disables nested includes)
|
128
134
|
* allow outfilesuffix to be soft set from API (#2640)
|
129
135
|
* don't split paragraphs in table cell at line that resolves to blank if adjacent to other non-blank lines (#2963)
|
130
|
-
*
|
136
|
+
* initialize the level to WARN when instantiating the NullLogger
|
131
137
|
|
132
138
|
Build / Infrastructure::
|
133
139
|
|
@@ -1454,7 +1460,7 @@ Distribution Packages::
|
|
1454
1460
|
* https://rubygems.org/gems/asciidoctor[RubyGem (asciidoctor)]
|
1455
1461
|
* https://apps.fedoraproject.org/packages/rubygem-asciidoctor[Fedora (rubygem-asciidoctor)]
|
1456
1462
|
|
1457
|
-
|
1463
|
+
https://asciidoctor.org/news/2013/05/31/asciidoctor-0-1-3-released[release notes] |
|
1458
1464
|
https://github.com/asciidoctor/asciidoctor/issues?milestone=4&state=closed[issues resolved] |
|
1459
1465
|
https://github.com/asciidoctor/asciidoctor/releases/tag/v0.1.3[git tag] |
|
1460
1466
|
https://github.com/asciidoctor/asciidoctor/compare/v0.1.2\...v0.1.3[full diff]
|
@@ -1467,7 +1473,7 @@ Performance::
|
|
1467
1473
|
|
1468
1474
|
Enhancements::
|
1469
1475
|
|
1470
|
-
* new website at
|
1476
|
+
* new website at https://asciidoctor.org
|
1471
1477
|
* added a default stylesheet (#76)
|
1472
1478
|
* added viewport meta tag for mobile browsers (#238)
|
1473
1479
|
* set attributes based on safe mode (#244)
|
@@ -1509,7 +1515,7 @@ Distribution Packages::
|
|
1509
1515
|
|
1510
1516
|
* https://rubygems.org/gems/asciidoctor[RubyGem (asciidoctor)]
|
1511
1517
|
|
1512
|
-
|
1518
|
+
https://asciidoctor.org/news/2013/04/25/asciidoctor-0-1-2-released[release notes] |
|
1513
1519
|
https://github.com/asciidoctor/asciidoctor/issues?milestone=3&state=closed[issues resolved] |
|
1514
1520
|
https://github.com/asciidoctor/asciidoctor/releases/tag/v0.1.2[git tag] |
|
1515
1521
|
https://github.com/asciidoctor/asciidoctor/compare/v0.1.1\...v0.1.2[full diff]
|
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]>; Ryan Waldron <https://github.com/erebor[@erebor]>
|
3
|
-
v2.0.0.rc.
|
3
|
+
v2.0.0.rc.2, 2019-03-12
|
4
4
|
// settings:
|
5
5
|
:idprefix:
|
6
6
|
:idseparator: -
|
@@ -17,13 +17,13 @@ ifdef::env-github[]
|
|
17
17
|
:warning-caption: :warning:
|
18
18
|
endif::[]
|
19
19
|
// Variables:
|
20
|
-
:release-version: 2.0.0.rc.
|
20
|
+
:release-version: 2.0.0.rc.2
|
21
21
|
// URIs:
|
22
22
|
:uri-org: https://github.com/asciidoctor
|
23
23
|
:uri-repo: {uri-org}/asciidoctor
|
24
24
|
:uri-asciidoctorj: {uri-org}/asciidoctorj
|
25
25
|
:uri-asciidoctorjs: {uri-org}/asciidoctor.js
|
26
|
-
:uri-project:
|
26
|
+
:uri-project: https://asciidoctor.org
|
27
27
|
ifdef::env-site[:uri-project: link:]
|
28
28
|
:uri-docs: {uri-project}/docs
|
29
29
|
:uri-news: {uri-project}/news
|
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]>; Ryan Waldron <https://github.com/erebor[@erebor]>
|
3
|
-
v2.0.0.rc.
|
3
|
+
v2.0.0.rc.2, 2019-03-12
|
4
4
|
// settings:
|
5
5
|
:idprefix:
|
6
6
|
:idseparator: -
|
@@ -17,13 +17,13 @@ ifdef::env-github[]
|
|
17
17
|
:warning-caption: :warning:
|
18
18
|
endif::[]
|
19
19
|
// Variables:
|
20
|
-
:release-version: 2.0.0.rc.
|
20
|
+
:release-version: 2.0.0.rc.2
|
21
21
|
// URIs:
|
22
22
|
:uri-org: https://github.com/asciidoctor
|
23
23
|
:uri-repo: {uri-org}/asciidoctor
|
24
24
|
:uri-asciidoctorj: {uri-org}/asciidoctorj
|
25
25
|
:uri-asciidoctorjs: {uri-org}/asciidoctor.js
|
26
|
-
:uri-project:
|
26
|
+
:uri-project: https://asciidoctor.org
|
27
27
|
ifdef::env-site[:uri-project: link:]
|
28
28
|
:uri-docs: {uri-project}/docs
|
29
29
|
:uri-news: {uri-project}/news
|
@@ -53,7 +53,7 @@ endif::[]
|
|
53
53
|
:uri-gitscm-repo: https://github.com/git/git-scm.com
|
54
54
|
:uri-prototype: {uri-gitscm-repo}/commits/master/lib/asciidoc.rb
|
55
55
|
:uri-freesoftware: https://www.gnu.org/philosophy/free-sw.html
|
56
|
-
:uri-foundation:
|
56
|
+
:uri-foundation: https://foundation.zurb.com
|
57
57
|
:uri-tilt: https://github.com/rtomayko/tilt
|
58
58
|
:uri-ruby: https://ruby-lang.org
|
59
59
|
// images:
|
@@ -296,7 +296,7 @@ Vous devriez voir les informations concernant la version d'Asciidoctor et celle
|
|
296
296
|
|
297
297
|
[.output,subs=attributes+]
|
298
298
|
....
|
299
|
-
Asciidoctor {release-version} [
|
299
|
+
Asciidoctor {release-version} [https://asciidoctor.org]
|
300
300
|
Runtime Environment (ruby 2.4.1p111 [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:- ex:UTF-8)
|
301
301
|
....
|
302
302
|
|
@@ -347,7 +347,7 @@ Vous pouvez aussi convertir une chaîne de texte en fragment HTML (pour une inse
|
|
347
347
|
|
348
348
|
[source]
|
349
349
|
----
|
350
|
-
content = '_Zen_ in the art of writing
|
350
|
+
content = '_Zen_ in the art of writing https://asciidoctor.org[AsciiDoc].'
|
351
351
|
Asciidoctor.convert content, safe: :safe
|
352
352
|
----
|
353
353
|
|
@@ -355,7 +355,7 @@ Si vous voulez le document HTML complet, activez l'option `header_footer` comme
|
|
355
355
|
|
356
356
|
[source]
|
357
357
|
----
|
358
|
-
content = '_Zen_ in the art of writing
|
358
|
+
content = '_Zen_ in the art of writing https://asciidoctor.org[AsciiDoc].'
|
359
359
|
html = Asciidoctor.convert content, header_footer: true, safe: :safe
|
360
360
|
----
|
361
361
|
|
@@ -363,7 +363,7 @@ Si vous avez besoin d'accéder au document analysé, vous pouvez séparer la con
|
|
363
363
|
|
364
364
|
[source]
|
365
365
|
----
|
366
|
-
content = '_Zen_ in the art of writing
|
366
|
+
content = '_Zen_ in the art of writing https://asciidoctor.org[AsciiDoc].'
|
367
367
|
document = Asciidoctor.load content, header_footer: true, safe: :safe
|
368
368
|
puts document.doctitle
|
369
369
|
html = document.convert
|
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]>; Ryan Waldron <https://github.com/erebor[@erebor]>
|
3
|
-
v2.0.0.rc.
|
3
|
+
v2.0.0.rc.2, 2019-03-12
|
4
4
|
// settings:
|
5
5
|
:page-layout: base
|
6
6
|
:idprefix:
|
@@ -18,13 +18,13 @@ ifdef::env-github[]
|
|
18
18
|
:warning-caption: :warning:
|
19
19
|
endif::[]
|
20
20
|
// Variables:
|
21
|
-
:release-version: 2.0.0.rc.
|
21
|
+
:release-version: 2.0.0.rc.2
|
22
22
|
// URIs:
|
23
23
|
:uri-org: https://github.com/asciidoctor
|
24
24
|
:uri-repo: {uri-org}/asciidoctor
|
25
25
|
:uri-asciidoctorj: {uri-org}/asciidoctorj
|
26
26
|
:uri-asciidoctorjs: {uri-org}/asciidoctor.js
|
27
|
-
:uri-project:
|
27
|
+
:uri-project: https://asciidoctor.org
|
28
28
|
ifdef::env-site[:uri-project: link:]
|
29
29
|
:uri-docs: {uri-project}/docs
|
30
30
|
:uri-news: {uri-project}/news
|
@@ -54,7 +54,7 @@ endif::[]
|
|
54
54
|
:uri-gitscm-repo: https://github.com/git/git-scm.com
|
55
55
|
:uri-prototype: {uri-gitscm-repo}/commits/master/lib/asciidoc.rb
|
56
56
|
:uri-freesoftware: https://www.gnu.org/philosophy/free-sw.html
|
57
|
-
:uri-foundation:
|
57
|
+
:uri-foundation: https://foundation.zurb.com
|
58
58
|
:uri-tilt: https://github.com/rtomayko/tilt
|
59
59
|
:uri-ruby: https://ruby-lang.org
|
60
60
|
// images:
|
@@ -87,7 +87,7 @@ Javaや他のJVM言語からAsciidoctor APIを直接呼び出すには, {uri-as
|
|
87
87
|
AsciidoctorJに基づいた, AsciidoctorプロセッサをApache Maven, GradleやJavadocに統合するプラグインがあります.
|
88
88
|
|
89
89
|
AsciidoctorはJavaScriptでも実行可能です.
|
90
|
-
{uri-asciidoctorjs}[Asciidoctor.js], WebブラウザやNode.jsのようなJavaScript環境で動くAsciidoctorの完全機能版, を生成するために, RubyのソースをJavaScriptにトランスパイルするのに
|
90
|
+
{uri-asciidoctorjs}[Asciidoctor.js], WebブラウザやNode.jsのようなJavaScript環境で動くAsciidoctorの完全機能版, を生成するために, RubyのソースをJavaScriptにトランスパイルするのに https://opalrb.com[Opal]を使います.
|
91
91
|
Asciidoctor.jsはChrome, Atom, Brackets や他のウェブベースのツールの拡張機能としてAsciiDocのプレビューのために使われます.
|
92
92
|
****
|
93
93
|
|
@@ -220,7 +220,7 @@ TIP: お使いのシステムは自動的にdebパッケージをアップデー
|
|
220
220
|
ディストリビューションのリリース毎に, どのバージョンがパッケージされているかはパッケージリポジトリを調べてください.
|
221
221
|
|
222
222
|
* https://packages.debian.org/search?keywords=asciidoctor&searchon=names&exact=1&suite=all§ion=all[asciidoctor package by Debian release]
|
223
|
-
*
|
223
|
+
* https://packages.ubuntu.com/search?keywords=asciidoctor&searchon=names&exact=1&suite=all§ion=all[asciidoctor package by Ubuntu release]
|
224
224
|
* https://community.linuxmint.com/software/view/asciidoctor[asciidoctor package by Mint release]
|
225
225
|
|
226
226
|
[CAUTION]
|
@@ -229,7 +229,7 @@ TIP: お使いのシステムは自動的にdebパッケージをアップデー
|
|
229
229
|
そのようなことをするのは, パッケージマネージャがファイル(/usr/local下にインストールされた)を追跡できなくなるためにシステムが不安定な状態にするためです.
|
230
230
|
単純に, システムgemはパッケージマネージャによってのみ管理されるべきです.
|
231
231
|
|
232
|
-
もし, パッケージマネージャによってインストールされたのより新しいバージョンのAsciidoctorを使いたければ,
|
232
|
+
もし, パッケージマネージャによってインストールされたのより新しいバージョンのAsciidoctorを使いたければ, https://rvm.io[RVM] や https://github.com/rbenv/rbenv[rbenv]を使ってRubyをホームディレクトリ(すなわち, ユーザースペース)にインストールするべきです.
|
233
233
|
それから, 安心して `gem` コマンドをAsciidoctorのアップデート, インストールのために使うことができます.
|
234
234
|
RVMやrbenvを使っているなら, gemはシステムからは孤立した場所にインストールされます.
|
235
235
|
====
|
@@ -264,7 +264,7 @@ AsciidoctorのバージョンとRuby環境についての情報がターミナ
|
|
264
264
|
|
265
265
|
[.output,subs=attributes+]
|
266
266
|
....
|
267
|
-
Asciidoctor {release-version} [
|
267
|
+
Asciidoctor {release-version} [https://asciidoctor.org]
|
268
268
|
Runtime Environment (ruby 2.4.1p111 [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:- ex:UTF-8)
|
269
269
|
....
|
270
270
|
|
@@ -315,7 +315,7 @@ AsciiDoc文字列を埋め込みHTML(HTMLページヘの挿入)へ変換する
|
|
315
315
|
|
316
316
|
[source]
|
317
317
|
----
|
318
|
-
content = '_Zen_ in the art of writing
|
318
|
+
content = '_Zen_ in the art of writing https://asciidoctor.org[AsciiDoc].'
|
319
319
|
Asciidoctor.convert content, safe: :safe
|
320
320
|
----
|
321
321
|
|
@@ -323,7 +323,7 @@ Asciidoctor.convert content, safe: :safe
|
|
323
323
|
|
324
324
|
[source]
|
325
325
|
----
|
326
|
-
content = '_Zen_ in the art of writing
|
326
|
+
content = '_Zen_ in the art of writing https://asciidoctor.org[AsciiDoc].'
|
327
327
|
html = Asciidoctor.convert content, header_footer: true, safe: :safe
|
328
328
|
----
|
329
329
|
|
@@ -331,7 +331,7 @@ html = Asciidoctor.convert content, header_footer: true, safe: :safe
|
|
331
331
|
|
332
332
|
[source]
|
333
333
|
----
|
334
|
-
content = '_Zen_ in the art of writing
|
334
|
+
content = '_Zen_ in the art of writing https://asciidoctor.org[AsciiDoc].'
|
335
335
|
document = Asciidoctor.load content, header_footer: true, safe: :safe
|
336
336
|
puts document.doctitle
|
337
337
|
html = document.convert
|
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]>; Ryan Waldron <https://github.com/erebor[@erebor]>
|
3
|
-
v2.0.0.rc.
|
3
|
+
v2.0.0.rc.2, 2019-03-12
|
4
4
|
// settings:
|
5
5
|
:page-layout: base
|
6
6
|
:idprefix:
|
@@ -18,13 +18,13 @@ ifdef::env-github[]
|
|
18
18
|
:warning-caption: :warning:
|
19
19
|
endif::[]
|
20
20
|
// Variables:
|
21
|
-
:release-version: 2.0.0.rc.
|
21
|
+
:release-version: 2.0.0.rc.2
|
22
22
|
// URIs:
|
23
23
|
:uri-org: https://github.com/asciidoctor
|
24
24
|
:uri-repo: {uri-org}/asciidoctor
|
25
25
|
:uri-asciidoctorj: {uri-org}/asciidoctorj
|
26
26
|
:uri-asciidoctorjs: {uri-org}/asciidoctor.js
|
27
|
-
:uri-project:
|
27
|
+
:uri-project: https://asciidoctor.org
|
28
28
|
ifdef::env-site[:uri-project: link:]
|
29
29
|
:uri-docs: {uri-project}/docs
|
30
30
|
:uri-news: {uri-project}/news
|
@@ -54,7 +54,7 @@ endif::[]
|
|
54
54
|
:uri-gitscm-repo: https://github.com/git/git-scm.com
|
55
55
|
:uri-prototype: {uri-gitscm-repo}/commits/master/lib/asciidoc.rb
|
56
56
|
:uri-freesoftware: https://www.gnu.org/philosophy/free-sw.html
|
57
|
-
:uri-foundation:
|
57
|
+
:uri-foundation: https://foundation.zurb.com
|
58
58
|
:uri-tilt: https://github.com/rtomayko/tilt
|
59
59
|
:uri-ruby: https://ruby-lang.org
|
60
60
|
// images:
|
@@ -85,7 +85,7 @@ Asciidoctor 是开源的,{uri-repo}[代码]托管在 GitHub,遵从 {uri-lice
|
|
85
85
|
基于 AsciidoctorJ 有好多插件可用,这些插件可以将 Asciidoctor 整合到 Apache Maven,Gradle 或 Javadoc 构建中。
|
86
86
|
|
87
87
|
Asciidoctor 也可以运行在 JavaScript 上。
|
88
|
-
我们可以使用
|
88
|
+
我们可以使用 https://opalrb.com[Opal] 将 Ruby 源码编译成 JavaScript 生成 {uri-asciidoctorjs}[Asciidoctor.js] 文件,这是一个全功能版的 Asciidoctor,可以运行在任意的 JavaScript 环境中,比如 Web 浏览器 或 Node.js。
|
89
89
|
Asciidoctor.js 被用于预览 AsciiDoc,支持 Chrome 扩展,Atom,Brackets 或其他基于 Web 的工具。
|
90
90
|
****
|
91
91
|
|
@@ -231,7 +231,7 @@ TIP: 如果你的 Debian 或 Ubuntu 系统配置的是自动升级包,在这
|
|
231
231
|
请查看发行版的包库,来确定每个发行版是打包的哪个版本。
|
232
232
|
|
233
233
|
* https://packages.debian.org/search?keywords=asciidoctor&searchon=names&exact=1&suite=all§ion=all[Debian 发行版中的 asciidoctor]
|
234
|
-
*
|
234
|
+
* https://packages.ubuntu.com/search?keywords=asciidoctor&searchon=names&exact=1&suite=all§ion=all[Ubuntu 发行版中的 asciidoctor]
|
235
235
|
* https://community.linuxmint.com/software/view/asciidoctor[Mint 发行版中的 asciidoctor]
|
236
236
|
|
237
237
|
[CAUTION]
|
@@ -240,7 +240,7 @@ TIP: 如果你的 Debian 或 Ubuntu 系统配置的是自动升级包,在这
|
|
240
240
|
这样做会使系统进入不一致的状态,包管理工具将不再跟踪相关文件(通常安装在 /usr/local 下。)
|
241
241
|
简单地说,系统的 gem 只能由包管理器进行管理。
|
242
242
|
|
243
|
-
如果你想使用一个比包管理器安装的更新版本的 Asciidoctor,你应该使用
|
243
|
+
如果你想使用一个比包管理器安装的更新版本的 Asciidoctor,你应该使用 https://rvm.io[RVM] 在你的用户家目录(比如:用户空间)下安装 Ruby。
|
244
244
|
然后,你就可以放心地使用 `gem` 命令来安装或者更新 Asciidoctor gem。
|
245
245
|
当使用 RVM 时,gem 将被安装到与系统隔离的位置。
|
246
246
|
====
|
@@ -276,7 +276,7 @@ TIP: 如果你的 Alpine Linux 系统配置的是自动升级包,在这种情
|
|
276
276
|
|
277
277
|
[.output,subs=attributes+]
|
278
278
|
....
|
279
|
-
Asciidoctor {release-version} [
|
279
|
+
Asciidoctor {release-version} [https://asciidoctor.org]
|
280
280
|
Runtime Environment (ruby 2.4.1p111 [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:- ex:UTF-8)
|
281
281
|
....
|
282
282
|
|
@@ -329,7 +329,7 @@ WARNING: 当你通过 API 使用 Asciidoctor 时,默认的安全模式是 `:se
|
|
329
329
|
|
330
330
|
[source]
|
331
331
|
----
|
332
|
-
content = '_Zen_ in the art of writing
|
332
|
+
content = '_Zen_ in the art of writing https://asciidoctor.org[AsciiDoc].'
|
333
333
|
Asciidoctor.convert content, safe: :safe
|
334
334
|
----
|
335
335
|
|
@@ -337,7 +337,7 @@ Asciidoctor.convert content, safe: :safe
|
|
337
337
|
|
338
338
|
[source]
|
339
339
|
----
|
340
|
-
content = '_Zen_ in the art of writing
|
340
|
+
content = '_Zen_ in the art of writing https://asciidoctor.org[AsciiDoc].'
|
341
341
|
html = Asciidoctor.convert content, header_footer: true, safe: :safe
|
342
342
|
----
|
343
343
|
|
@@ -345,7 +345,7 @@ html = Asciidoctor.convert content, header_footer: true, safe: :safe
|
|
345
345
|
|
346
346
|
[source]
|
347
347
|
----
|
348
|
-
content = '_Zen_ in the art of writing
|
348
|
+
content = '_Zen_ in the art of writing https://asciidoctor.org[AsciiDoc].'
|
349
349
|
document = Asciidoctor.load content, header_footer: true, safe: :safe
|
350
350
|
puts document.doctitle
|
351
351
|
html = document.convert
|
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]>; Ryan Waldron <https://github.com/erebor[@erebor]>
|
3
|
-
v2.0.0.rc.
|
3
|
+
v2.0.0.rc.2, 2019-03-12
|
4
4
|
// settings:
|
5
5
|
:idprefix:
|
6
6
|
:idseparator: -
|
@@ -17,7 +17,7 @@ ifdef::env-github[]
|
|
17
17
|
:warning-caption: :warning:
|
18
18
|
endif::[]
|
19
19
|
// Variables:
|
20
|
-
:release-version: 2.0.0.rc.
|
20
|
+
:release-version: 2.0.0.rc.2
|
21
21
|
// URIs:
|
22
22
|
:uri-org: https://github.com/asciidoctor
|
23
23
|
:uri-repo: {uri-org}/asciidoctor
|
data/lib/asciidoctor.rb
CHANGED
@@ -14,34 +14,37 @@ else
|
|
14
14
|
autoload :URI, 'uri'
|
15
15
|
end
|
16
16
|
|
17
|
-
# Public:
|
18
|
-
# using
|
17
|
+
# Public: The main application interface (API) for Asciidoctor. This API provides methods to parse AsciiDoc content and
|
18
|
+
# convert it to various output formats using built-in or third-party converters or Tilt-supported templates.
|
19
19
|
#
|
20
|
-
# AsciiDoc
|
21
|
-
#
|
20
|
+
# An AsciiDoc document can be as simple as a single line of content, though it more commonly starts with a document
|
21
|
+
# header that declares the document title and document attribute definitions. The document header is then followed by
|
22
|
+
# zero or more section titles, optionally nested, to organize the paragraphs, blocks, lists, etc. of the document.
|
22
23
|
#
|
23
|
-
#
|
24
|
+
# By default, the processor converts the AsciiDoc document to HTML 5 using a built-in converter. However, this behavior
|
25
|
+
# can be changed by specifying a different backend (e.g., +docbook+). A backend is a keyword for an output format (e.g.,
|
26
|
+
# DocBook). That keyword, in turn, is used to select a converter, which carries out the request to convert the document
|
27
|
+
# to that format.
|
24
28
|
#
|
25
|
-
#
|
29
|
+
# In addition to this API, Asciidoctor also provides a command-line interface (CLI) named +asciidoctor+ for converting
|
30
|
+
# AsciiDoc content. See the provided man(ual) page for usage and options.
|
26
31
|
#
|
27
|
-
#
|
32
|
+
# Examples
|
28
33
|
#
|
29
|
-
#
|
34
|
+
# # Convert an AsciiDoc file
|
35
|
+
# Asciidoctor.convert_file 'document.adoc', safe: :safe
|
30
36
|
#
|
31
|
-
#
|
37
|
+
# # Convert an AsciiDoc string
|
38
|
+
# puts Asciidoctor.convert "I'm using *Asciidoctor* version {asciidoctor-version}.", safe: :safe
|
32
39
|
#
|
33
|
-
#
|
34
|
-
# .
|
40
|
+
# # Convert an AsciiDoc file using Tilt-supported templates
|
41
|
+
# Asciidoctor.convert_file 'document.adoc', safe: :safe, template_dir: '/path/to/templates'
|
35
42
|
#
|
36
|
-
#
|
43
|
+
# # Parse an AsciiDoc file into a document object
|
44
|
+
# doc = Asciidoctor.load_file 'document.adoc', safe: :safe
|
37
45
|
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
# Asciidoctor.convert_file 'sample.adoc'
|
41
|
-
#
|
42
|
-
# Use custom (Tilt-supported) templates:
|
43
|
-
#
|
44
|
-
# Asciidoctor.convert_file 'sample.adoc', template_dir: 'path/to/templates'
|
46
|
+
# # Parse an AsciiDoc string into a document object
|
47
|
+
# doc = Asciidoctor.load "= Document Title\n\nfirst paragraph\n\nsecond paragraph", safe: :safe
|
45
48
|
#
|
46
49
|
module Asciidoctor
|
47
50
|
# alias the RUBY_ENGINE constant inside the Asciidoctor namespace and define a precomputed alias for runtime
|
@@ -499,9 +502,9 @@ module Asciidoctor
|
|
499
502
|
#
|
500
503
|
if RUBY_ENGINE == 'opal'
|
501
504
|
# NOTE In JavaScript, ^ and $ match the boundaries of the string when the m flag is not set
|
502
|
-
AttributeEntryPassMacroRx = /^pass:([a-z]+(?:,[a-z]+)*)?\[(#{CC_ALL}*)\]$/
|
505
|
+
AttributeEntryPassMacroRx = /^pass:([a-z]+(?:,[a-z-]+)*)?\[(#{CC_ALL}*)\]$/
|
503
506
|
else
|
504
|
-
AttributeEntryPassMacroRx = /\Apass:([a-z]+(?:,[a-z]+)*)?\[(.*)\]\Z/m
|
507
|
+
AttributeEntryPassMacroRx = /\Apass:([a-z]+(?:,[a-z-]+)*)?\[(.*)\]\Z/m
|
505
508
|
end
|
506
509
|
|
507
510
|
# Matches an inline attribute reference.
|
@@ -886,7 +889,7 @@ module Asciidoctor
|
|
886
889
|
# link:https://github.com[]
|
887
890
|
#
|
888
891
|
# FIXME revisit! the main issue is we need different rules for implicit vs explicit
|
889
|
-
InlineLinkRx = %r((^|link:|#{CG_BLANK}|<|[>\(\)\[\];])(\\?(?:https?|file|ftp|irc)://[^\s\[\]<]*[^\s.,\[\]<])(?:\[(|#{CC_ALL}*?[^\\])\])?)m
|
892
|
+
InlineLinkRx = %r((^|link:|#{CG_BLANK}|<|[>\(\)\[\];])(\\?(?:https?|file|ftp|irc)://[^\s\[\]<]*([^\s.,\[\]<]))(?:\[(|#{CC_ALL}*?[^\\])\])?)m
|
890
893
|
|
891
894
|
# Match a link or e-mail inline macro.
|
892
895
|
#
|
@@ -910,7 +913,7 @@ module Asciidoctor
|
|
910
913
|
# asciimath:[x != 0]
|
911
914
|
# latexmath:[\sqrt{4} = 2]
|
912
915
|
#
|
913
|
-
InlineStemMacroRx = /\\?(stem|(?:latex|ascii)math):([a-z]+(?:,[a-z]+)*)?\[(#{CC_ALL}*?[^\\])\]/m
|
916
|
+
InlineStemMacroRx = /\\?(stem|(?:latex|ascii)math):([a-z]+(?:,[a-z-]+)*)?\[(#{CC_ALL}*?[^\\])\]/m
|
914
917
|
|
915
918
|
# Matches a menu inline macro.
|
916
919
|
#
|
@@ -961,7 +964,7 @@ module Asciidoctor
|
|
961
964
|
# pass:quotes[text]
|
962
965
|
#
|
963
966
|
# NOTE we have to support an empty pass:[] for compatibility with AsciiDoc Python
|
964
|
-
InlinePassMacroRx = /(?:(?:(\\?)\[([^\]]+)\])?(\\{0,2})(\+\+\+?|\$\$)(#{CC_ALL}*?)\4|(\\?)pass:([a-z]+(?:,[a-z]+)*)?\[(|#{CC_ALL}*?[^\\])\])/m
|
967
|
+
InlinePassMacroRx = /(?:(?:(\\?)\[([^\]]+)\])?(\\{0,2})(\+\+\+?|\$\$)(#{CC_ALL}*?)\4|(\\?)pass:([a-z]+(?:,[a-z-]+)*)?\[(|#{CC_ALL}*?[^\\])\])/m
|
965
968
|
|
966
969
|
# Matches an xref (i.e., cross-reference) inline macro, which may span multiple lines.
|
967
970
|
#
|
@@ -1085,16 +1088,6 @@ module Asciidoctor
|
|
1085
1088
|
#
|
1086
1089
|
UriSniffRx = %r(^#{CG_ALPHA}[#{CC_ALNUM}.+-]+:/{0,2})
|
1087
1090
|
|
1088
|
-
# Detects the end of an implicit URI in the text
|
1089
|
-
#
|
1090
|
-
# Examples
|
1091
|
-
#
|
1092
|
-
# (http://google.com)
|
1093
|
-
# >http://google.com<
|
1094
|
-
# (See http://google.com):
|
1095
|
-
#
|
1096
|
-
UriTerminatorRx = /[);:]$/
|
1097
|
-
|
1098
1091
|
# Detects XML tags
|
1099
1092
|
XmlSanitizeRx = /<[^>]+>/
|
1100
1093
|
#end
|
@@ -1132,70 +1125,54 @@ module Asciidoctor
|
|
1132
1125
|
'gt' => '>'
|
1133
1126
|
}
|
1134
1127
|
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
#
|
1171
|
-
[:
|
1172
|
-
|
1173
|
-
#
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
compat_quote_subs[4] = [:monospaced, :unconstrained, /\\?(?:\[([^\]]+)\])?\+\+(#{CC_ALL}+?)\+\+/m]
|
1184
|
-
# +monospaced+
|
1185
|
-
compat_quote_subs[5] = [:monospaced, :constrained, /(^|[^#{CC_WORD};:}])(?:\[([^\]]+)\])?\+(\S|\S#{CC_ALL}*?\S)\+(?!#{CG_WORD})/m]
|
1186
|
-
# #unquoted#
|
1187
|
-
#compat_quote_subs[8] = [:unquoted, *compat_quote_subs[8][1..-1]]
|
1188
|
-
# ##unquoted##
|
1189
|
-
#compat_quote_subs[9] = [:unquoted, *compat_quote_subs[9][1..-1]]
|
1190
|
-
# 'emphasis'
|
1191
|
-
compat_quote_subs.insert 3, [:emphasis, :constrained, /(^|[^#{CC_WORD};:}])(?:\[([^\]]+)\])?'(\S|\S#{CC_ALL}*?\S)'(?!#{CG_WORD})/m]
|
1192
|
-
|
1193
|
-
QUOTE_SUBS = {
|
1194
|
-
false => quote_subs,
|
1195
|
-
true => compat_quote_subs
|
1196
|
-
}
|
1197
|
-
quote_subs = nil
|
1198
|
-
compat_quote_subs = nil
|
1128
|
+
QUOTE_SUBS = {}.tap do |accum|
|
1129
|
+
# unconstrained quotes:: can appear anywhere
|
1130
|
+
# constrained quotes:: must be bordered by non-word characters
|
1131
|
+
# NOTE these substitutions are processed in the order they appear here and
|
1132
|
+
# the order in which they are replaced is important
|
1133
|
+
accum[false] = normal = [
|
1134
|
+
# **strong**
|
1135
|
+
[:strong, :unconstrained, /\\?(?:\[([^\]]+)\])?\*\*(#{CC_ALL}+?)\*\*/m],
|
1136
|
+
# *strong*
|
1137
|
+
[:strong, :constrained, /(^|[^#{CC_WORD};:}])(?:\[([^\]]+)\])?\*(\S|\S#{CC_ALL}*?\S)\*(?!#{CG_WORD})/m],
|
1138
|
+
# "`double-quoted`"
|
1139
|
+
[:double, :constrained, /(^|[^#{CC_WORD};:}])(?:\[([^\]]+)\])?"`(\S|\S#{CC_ALL}*?\S)`"(?!#{CG_WORD})/m],
|
1140
|
+
# '`single-quoted`'
|
1141
|
+
[:single, :constrained, /(^|[^#{CC_WORD};:`}])(?:\[([^\]]+)\])?'`(\S|\S#{CC_ALL}*?\S)`'(?!#{CG_WORD})/m],
|
1142
|
+
# ``monospaced``
|
1143
|
+
[:monospaced, :unconstrained, /\\?(?:\[([^\]]+)\])?``(#{CC_ALL}+?)``/m],
|
1144
|
+
# `monospaced`
|
1145
|
+
[:monospaced, :constrained, /(^|[^#{CC_WORD};:"'`}])(?:\[([^\]]+)\])?`(\S|\S#{CC_ALL}*?\S)`(?![#{CC_WORD}"'`])/m],
|
1146
|
+
# __emphasis__
|
1147
|
+
[:emphasis, :unconstrained, /\\?(?:\[([^\]]+)\])?__(#{CC_ALL}+?)__/m],
|
1148
|
+
# _emphasis_
|
1149
|
+
[:emphasis, :constrained, /(^|[^#{CC_WORD};:}])(?:\[([^\]]+)\])?_(\S|\S#{CC_ALL}*?\S)_(?!#{CG_WORD})/m],
|
1150
|
+
# ##mark## (referred to in AsciiDoc Python as unquoted)
|
1151
|
+
[:mark, :unconstrained, /\\?(?:\[([^\]]+)\])?##(#{CC_ALL}+?)##/m],
|
1152
|
+
# #mark# (referred to in AsciiDoc Python as unquoted)
|
1153
|
+
[:mark, :constrained, /(^|[^#{CC_WORD}&;:}])(?:\[([^\]]+)\])?#(\S|\S#{CC_ALL}*?\S)#(?!#{CG_WORD})/m],
|
1154
|
+
# ^superscript^
|
1155
|
+
[:superscript, :unconstrained, /\\?(?:\[([^\]]+)\])?\^(\S+?)\^/],
|
1156
|
+
# ~subscript~
|
1157
|
+
[:subscript, :unconstrained, /\\?(?:\[([^\]]+)\])?~(\S+?)~/]
|
1158
|
+
]
|
1159
|
+
|
1160
|
+
accum[true] = compat = normal.drop 0
|
1161
|
+
# ``quoted''
|
1162
|
+
compat[2] = [:double, :constrained, /(^|[^#{CC_WORD};:}])(?:\[([^\]]+)\])?``(\S|\S#{CC_ALL}*?\S)''(?!#{CG_WORD})/m]
|
1163
|
+
# `quoted'
|
1164
|
+
compat[3] = [:single, :constrained, /(^|[^#{CC_WORD};:}])(?:\[([^\]]+)\])?`(\S|\S#{CC_ALL}*?\S)'(?!#{CG_WORD})/m]
|
1165
|
+
# ++monospaced++
|
1166
|
+
compat[4] = [:monospaced, :unconstrained, /\\?(?:\[([^\]]+)\])?\+\+(#{CC_ALL}+?)\+\+/m]
|
1167
|
+
# +monospaced+
|
1168
|
+
compat[5] = [:monospaced, :constrained, /(^|[^#{CC_WORD};:}])(?:\[([^\]]+)\])?\+(\S|\S#{CC_ALL}*?\S)\+(?!#{CG_WORD})/m]
|
1169
|
+
# #unquoted#
|
1170
|
+
#compat[8] = [:unquoted, *compat[8][1..-1]]
|
1171
|
+
# ##unquoted##
|
1172
|
+
#compat[9] = [:unquoted, *compat[9][1..-1]]
|
1173
|
+
# 'emphasis'
|
1174
|
+
compat.insert 3, [:emphasis, :constrained, /(^|[^#{CC_WORD};:}])(?:\[([^\]]+)\])?'(\S|\S#{CC_ALL}*?\S)'(?!#{CG_WORD})/m]
|
1175
|
+
end
|
1199
1176
|
|
1200
1177
|
# NOTE order of replacements is significant
|
1201
1178
|
REPLACEMENTS = [
|
@@ -18,7 +18,7 @@ class AbstractBlock < AbstractNode
|
|
18
18
|
# Public: Set the Integer level of this {Section} or the level of the Section to which this {AbstractBlock} belongs.
|
19
19
|
attr_accessor :level
|
20
20
|
|
21
|
-
# Public: Get/Set the numeral of this block (if section, relative to parent, otherwise absolute).
|
21
|
+
# Public: Get/Set the String numeral of this block (if section, relative to parent, otherwise absolute).
|
22
22
|
# Only assigned to section if automatic section numbering is enabled.
|
23
23
|
# Only assigned to formal block (block with title) if corresponding caption attribute is present.
|
24
24
|
attr_accessor :numeral
|
data/lib/asciidoctor/block.rb
CHANGED
@@ -118,7 +118,7 @@ module Asciidoctor
|
|
118
118
|
'may be specified more than once') do |path|
|
119
119
|
(self[:requires] ||= []).concat(path.split ',')
|
120
120
|
end
|
121
|
-
opts.on('--failure-level LEVEL', %w(warning WARNING error ERROR), 'set minimum logging level that triggers
|
121
|
+
opts.on('--failure-level LEVEL', %w(warning WARNING error ERROR debug DEBUG), 'set minimum logging level that triggers non-zero exit code: [WARN, ERROR, DEBUG] (default: FATAL)') do |level|
|
122
122
|
level = 'WARN' if (level = level.upcase) == 'WARNING'
|
123
123
|
self[:failure_level] = ::Logger::Severity.const_get level, false
|
124
124
|
end
|
@@ -21,8 +21,8 @@ module Asciidoctor
|
|
21
21
|
# super
|
22
22
|
# outfilesuffix '.txt'
|
23
23
|
# end
|
24
|
-
# def convert node, transform =
|
25
|
-
# case
|
24
|
+
# def convert node, transform = node.node_name, opts = nil
|
25
|
+
# case transform
|
26
26
|
# when 'document', 'section'
|
27
27
|
# [node.title, node.content].join %(\n\n)
|
28
28
|
# when 'paragraph'
|
@@ -376,10 +376,10 @@ module Converter
|
|
376
376
|
# underscore and mark them as private. Implementations may override this method to provide different behavior.
|
377
377
|
#
|
378
378
|
# See {Converter#convert} for details about the arguments and return value.
|
379
|
-
def convert node, transform =
|
380
|
-
opts ? (send transform
|
379
|
+
def convert node, transform = node.node_name, opts = nil
|
380
|
+
opts ? (send transform, node, opts) : (send transform, node)
|
381
381
|
rescue
|
382
|
-
raise unless ::NoMethodError === (ex = $!) && ex.receiver == self && ex.name.to_s ==
|
382
|
+
raise unless ::NoMethodError === (ex = $!) && ex.receiver == self && ex.name.to_s == transform
|
383
383
|
logger.warn %(missing convert handler for #{ex.name} node in #{@backend} backend (#{self.class}))
|
384
384
|
nil
|
385
385
|
end
|
data/lib/asciidoctor/document.rb
CHANGED
@@ -13,7 +13,7 @@ module Asciidoctor
|
|
13
13
|
# :safe (or :unsafe) to enable all of Asciidoctor's features.
|
14
14
|
#
|
15
15
|
# Asciidoctor.load '= Hello, AsciiDoc!', safe: :safe
|
16
|
-
# # => Asciidoctor::Document { doctype: "article", doctitle: "Hello,
|
16
|
+
# # => Asciidoctor::Document { doctype: "article", doctitle: "Hello, AsciiDoc!", blocks: 0 }
|
17
17
|
#
|
18
18
|
# Instances of this class can be used to extract information from the document
|
19
19
|
# or alter its structure. As such, the Document object is most often used in
|
@@ -613,6 +613,13 @@ class Document < AbstractBlock
|
|
613
613
|
end
|
614
614
|
end
|
615
615
|
|
616
|
+
# Public: Scan all registered references and return the ID of the reference that matches the specified reference text.
|
617
|
+
#
|
618
|
+
# If multiple references in the document have the same reference text, the first match in document order is used.
|
619
|
+
#
|
620
|
+
# text - The String reference text to compare to the converted reference text of each registered reference.
|
621
|
+
#
|
622
|
+
# Returns the String ID of the first reference with matching reference text or nothing if no reference is found.
|
616
623
|
def resolve_id text
|
617
624
|
((@reftexts ||= @parsed ? {}.tap {|accum| @catalog[:refs].each {|id, ref| accum[ref.xreftext] = id } } : nil) ||
|
618
625
|
{}.tap {|accum| @catalog[:refs].find {|id, ref| ref.xreftext == text ? accum[text] = id : nil } })[text]
|
data/lib/asciidoctor/logging.rb
CHANGED
data/lib/asciidoctor/reader.rb
CHANGED
@@ -957,12 +957,8 @@ class PreprocessorReader < Reader
|
|
957
957
|
lhs = resolve_expr_val $1
|
958
958
|
rhs = resolve_expr_val $3
|
959
959
|
|
960
|
-
# regex enforces a restricted set of math-related operations
|
961
|
-
|
962
|
-
skip = lhs.send :==, rhs
|
963
|
-
else
|
964
|
-
skip = !(lhs.send $2.to_sym, rhs)
|
965
|
-
end
|
960
|
+
# regex enforces a restricted set of math-related operations (==, !=, <=, >=, <, >)
|
961
|
+
skip = (lhs.send $2, rhs) ? false : true
|
966
962
|
end
|
967
963
|
end
|
968
964
|
|
@@ -232,7 +232,7 @@ module Substitutors
|
|
232
232
|
if compat_mode
|
233
233
|
old_behavior = true
|
234
234
|
else
|
235
|
-
if (old_behavior =
|
235
|
+
if (old_behavior = attributes && (attributes.end_with? 'x-'))
|
236
236
|
attributes = attributes.slice 0, attributes.length - 2
|
237
237
|
end
|
238
238
|
end
|
@@ -282,6 +282,8 @@ module Substitutors
|
|
282
282
|
type = STEM_TYPE_ALIASES[@document.attributes['stem']].to_sym
|
283
283
|
end
|
284
284
|
content = unescape_brackets $3
|
285
|
+
# NOTE for backwards compatibility with AsciiDoc Python, drop enclosing $ signs around latexmath
|
286
|
+
content = content.slice 1, content.length - 2 if type == :latexmath && (content.start_with? '$') && (content.end_with? '$')
|
285
287
|
subs = $2 ? (resolve_pass_subs $2) : ((@document.basebackend? 'html') ? BASIC_SUBS : nil)
|
286
288
|
passthrus[passthru_key = passthrus.size] = { text: content, subs: subs, type: type }
|
287
289
|
%(#{PASS_START}#{passthru_key}#{PASS_END})
|
@@ -317,7 +319,10 @@ module Substitutors
|
|
317
319
|
if (pass = passthrus[$1.to_i])
|
318
320
|
subbed_text = apply_subs(pass[:text], pass[:subs])
|
319
321
|
if (type = pass[:type])
|
320
|
-
|
322
|
+
if (attributes = pass[:attributes])
|
323
|
+
id = attributes.delete 'id'
|
324
|
+
end
|
325
|
+
subbed_text = Inline.new(self, :quoted, subbed_text, type: type, id: id, attributes: attributes).convert
|
321
326
|
end
|
322
327
|
subbed_text.include?(PASS_START) ? restore_passthroughs(subbed_text) : subbed_text
|
323
328
|
else
|
@@ -672,52 +677,55 @@ module Substitutors
|
|
672
677
|
if found_colon && (text.include? '://')
|
673
678
|
# inline urls, target[text] (optionally prefixed with link: and optionally surrounded by <>)
|
674
679
|
text = text.gsub InlineLinkRx do
|
675
|
-
target = $2
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
# NOTE if text is non-nil, then we've matched a formal macro (i.e., trailing square brackets)
|
680
|
-
captured, prefix, text, suffix = $&, $1, (macro = $3) || '', ''
|
681
|
-
if prefix == 'link:'
|
682
|
-
if macro
|
683
|
-
prefix = ''
|
684
|
-
else
|
685
|
-
# invalid macro syntax (link: prefix w/o trailing square brackets)
|
686
|
-
# we probably shouldn't even get here...our regex is doing too much
|
687
|
-
next captured
|
688
|
-
end
|
680
|
+
if (target = $2).start_with? RS
|
681
|
+
# honor the escape
|
682
|
+
next %(#{$1}#{target.slice 1, target.length}#{$4})
|
689
683
|
end
|
690
|
-
|
691
|
-
|
684
|
+
|
685
|
+
prefix, suffix = $1, ''
|
686
|
+
# NOTE if $4 is set, then we're looking at a formal macro
|
687
|
+
if $4
|
688
|
+
prefix = '' if prefix == 'link:'
|
689
|
+
text = $4
|
690
|
+
else
|
691
|
+
# invalid macro syntax (link: prefix w/o trailing square brackets)
|
692
|
+
# FIXME we probably shouldn't even get here...our regex is doing too much
|
693
|
+
next $& if prefix == 'link:'
|
694
|
+
text = ''
|
695
|
+
case $3
|
692
696
|
when ')'
|
693
|
-
#
|
697
|
+
# move trailing ) out of URL
|
694
698
|
target = target.chop
|
695
699
|
suffix = ')'
|
700
|
+
# NOTE handle case when modified target is a URI scheme (e.g., http://)
|
701
|
+
next $& if target.end_with? '://'
|
696
702
|
when ';'
|
697
|
-
|
698
|
-
|
703
|
+
if (prefix.start_with? '<') && (target.end_with? '>')
|
704
|
+
# move surrounding <> out of URL
|
699
705
|
prefix = prefix.slice 4, prefix.length
|
700
706
|
target = target.slice 0, target.length - 4
|
701
|
-
|
702
|
-
|
703
|
-
elsif (target = target.chop).end_with?(')')
|
707
|
+
elsif (target = target.chop).end_with? ')'
|
708
|
+
# move trailing ); out of URL
|
704
709
|
target = target.chop
|
705
710
|
suffix = ');'
|
706
711
|
else
|
712
|
+
# move trailing ; out of URL
|
707
713
|
suffix = ';'
|
708
714
|
end
|
715
|
+
# NOTE handle case when modified target is a URI scheme (e.g., http://)
|
716
|
+
next $& if target.end_with? '://'
|
709
717
|
when ':'
|
710
|
-
|
711
|
-
|
712
|
-
if (target = target.chop).end_with?(')')
|
718
|
+
if (target = target.chop).end_with? ')'
|
719
|
+
# move trailing ): out of URL
|
713
720
|
target = target.chop
|
714
721
|
suffix = '):'
|
715
722
|
else
|
723
|
+
# move trailing : out of URL
|
716
724
|
suffix = ':'
|
717
725
|
end
|
726
|
+
# NOTE handle case when modified target is a URI scheme (e.g., http://)
|
727
|
+
next $& if target.end_with? '://'
|
718
728
|
end
|
719
|
-
# NOTE handle case when remaining target is a URI scheme (e.g., http://)
|
720
|
-
return captured if target.end_with? '://'
|
721
729
|
end
|
722
730
|
|
723
731
|
attrs, link_opts = nil, { type: :link }
|
@@ -759,7 +767,7 @@ module Substitutors
|
|
759
767
|
|
760
768
|
doc.register :links, (link_opts[:target] = target)
|
761
769
|
link_opts[:attributes] = attrs if attrs
|
762
|
-
%(#{prefix}#{Inline.new
|
770
|
+
%(#{prefix}#{(Inline.new self, :anchor, text, link_opts).convert}#{suffix})
|
763
771
|
end
|
764
772
|
end
|
765
773
|
|
@@ -1344,32 +1352,7 @@ module Substitutors
|
|
1344
1352
|
# NOTE the call to highlight? is a defensive check since, normally, we wouldn't arrive here unless it returns true
|
1345
1353
|
return sub_source source, process_callouts unless (syntax_hl = @document.syntax_highlighter) && syntax_hl.highlight?
|
1346
1354
|
|
1347
|
-
if process_callouts
|
1348
|
-
callout_marks = {}
|
1349
|
-
lineno = 0
|
1350
|
-
last_lineno = nil
|
1351
|
-
callout_rx = (attr? 'line-comment') ? CalloutExtractRxMap[attr 'line-comment'] : CalloutExtractRx
|
1352
|
-
# extract callout marks, indexed by line number
|
1353
|
-
source = (source.split LF, -1).map do |line|
|
1354
|
-
lineno += 1
|
1355
|
-
line.gsub callout_rx do
|
1356
|
-
# honor the escape
|
1357
|
-
if $2
|
1358
|
-
# use sub since it might be behind a line comment
|
1359
|
-
$&.sub RS, ''
|
1360
|
-
else
|
1361
|
-
(callout_marks[lineno] ||= []) << [$1, $4]
|
1362
|
-
last_lineno = lineno
|
1363
|
-
nil
|
1364
|
-
end
|
1365
|
-
end
|
1366
|
-
end.join LF
|
1367
|
-
if last_lineno
|
1368
|
-
source = %(#{source}#{LF}) if last_lineno == lineno
|
1369
|
-
else
|
1370
|
-
callout_marks = nil
|
1371
|
-
end
|
1372
|
-
end
|
1355
|
+
source, callout_marks = extract_callouts source if process_callouts
|
1373
1356
|
|
1374
1357
|
doc_attrs = @document.attributes
|
1375
1358
|
syntax_hl_name = syntax_hl.name
|
@@ -1390,31 +1373,61 @@ module Substitutors
|
|
1390
1373
|
highlighted = highlighted.gsub HighlightedPassSlotRx, %(#{PASS_START}\\1#{PASS_END}) unless @passthroughs.empty?
|
1391
1374
|
|
1392
1375
|
# NOTE highlight method may have depleted callouts
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
Inline.new(self, :callout, conum_it == '.' ? (autonum += 1).to_s : conum_it, id: @document.callouts.read_next_id, attributes: { 'guard' => guard_it }).convert
|
1411
|
-
end.join ' '})
|
1412
|
-
end
|
1376
|
+
callout_marks.nil_or_empty? ? highlighted : (restore_callouts highlighted, callout_marks, source_offset)
|
1377
|
+
end
|
1378
|
+
|
1379
|
+
# Internal: Extract the callout numbers from the source to prepare it for syntax highlighting.
|
1380
|
+
def extract_callouts source
|
1381
|
+
callout_marks = {}
|
1382
|
+
lineno = 0
|
1383
|
+
last_lineno = nil
|
1384
|
+
callout_rx = (attr? 'line-comment') ? CalloutExtractRxMap[attr 'line-comment'] : CalloutExtractRx
|
1385
|
+
# extract callout marks, indexed by line number
|
1386
|
+
source = (source.split LF, -1).map do |line|
|
1387
|
+
lineno += 1
|
1388
|
+
line.gsub callout_rx do
|
1389
|
+
# honor the escape
|
1390
|
+
if $2
|
1391
|
+
# use sub since it might be behind a line comment
|
1392
|
+
$&.sub RS, ''
|
1413
1393
|
else
|
1414
|
-
|
1394
|
+
(callout_marks[lineno] ||= []) << [$1, $4]
|
1395
|
+
last_lineno = lineno
|
1396
|
+
''
|
1415
1397
|
end
|
1416
|
-
end
|
1398
|
+
end
|
1399
|
+
end.join LF
|
1400
|
+
if last_lineno
|
1401
|
+
source = %(#{source}#{LF}) if last_lineno == lineno
|
1402
|
+
else
|
1403
|
+
callout_marks = nil
|
1417
1404
|
end
|
1405
|
+
[source, callout_marks]
|
1406
|
+
end
|
1407
|
+
|
1408
|
+
# Internal: Restore the callout numbers to the highlighted source.
|
1409
|
+
def restore_callouts source, callout_marks, source_offset = nil
|
1410
|
+
if source_offset
|
1411
|
+
preamble = source.slice 0, source_offset
|
1412
|
+
source = source.slice source_offset, source.length
|
1413
|
+
else
|
1414
|
+
preamble = ''
|
1415
|
+
end
|
1416
|
+
autonum = lineno = 0
|
1417
|
+
preamble + ((source.split LF, -1).map do |line|
|
1418
|
+
if (conums = callout_marks.delete lineno += 1)
|
1419
|
+
if conums.size == 1
|
1420
|
+
guard, conum = conums[0]
|
1421
|
+
%(#{line}#{Inline.new(self, :callout, conum == '.' ? (autonum += 1).to_s : conum, id: @document.callouts.read_next_id, attributes: { 'guard' => guard }).convert})
|
1422
|
+
else
|
1423
|
+
%(#{line}#{conums.map do |guard_it, conum_it|
|
1424
|
+
Inline.new(self, :callout, conum_it == '.' ? (autonum += 1).to_s : conum_it, id: @document.callouts.read_next_id, attributes: { 'guard' => guard_it }).convert
|
1425
|
+
end.join ' '})
|
1426
|
+
end
|
1427
|
+
else
|
1428
|
+
line
|
1429
|
+
end
|
1430
|
+
end.join LF)
|
1418
1431
|
end
|
1419
1432
|
|
1420
1433
|
# e.g., highlight="1-5, !2, 10" or highlight=1-5;!2,10
|
@@ -15,8 +15,8 @@ class SyntaxHighlighter::CodeRayAdapter < SyntaxHighlighter::Base
|
|
15
15
|
|
16
16
|
def highlight node, source, lang, opts
|
17
17
|
@requires_stylesheet = true if (css_mode = opts[:css_mode]) == :class
|
18
|
-
|
19
|
-
highlighted = ::CodeRay::Duo[lang
|
18
|
+
lang = lang ? (::CodeRay::Scanners[lang = lang.to_sym] && lang rescue :text) : :text
|
19
|
+
highlighted = ::CodeRay::Duo[lang, :html,
|
20
20
|
css: css_mode,
|
21
21
|
line_numbers: (line_numbers = opts[:number_lines]),
|
22
22
|
line_number_start: opts[:start_line_number],
|
data/lib/asciidoctor/table.rb
CHANGED
@@ -71,13 +71,11 @@ class Table < AbstractBlock
|
|
71
71
|
end
|
72
72
|
@attributes['tablepcwidth'] = pcwidth_intval
|
73
73
|
|
74
|
-
if @document.attributes
|
75
|
-
|
76
|
-
@attributes['tableabswidth'] ||=
|
77
|
-
((@attributes['tablepcwidth'].to_f / 100) * @document.attributes['pagewidth']).round
|
74
|
+
if @document.attributes['pagewidth']
|
75
|
+
@attributes['tableabswidth'] = (abswidth_val = (((pcwidth_intval / 100.0) * @document.attributes['pagewidth'].to_f).truncate DEFAULT_PRECISION)) == abswidth_val.to_i ? abswidth_val.to_i : abswidth_val
|
78
76
|
end
|
79
77
|
|
80
|
-
attributes['orientation'] = 'landscape' if attributes['rotate-option']
|
78
|
+
@attributes['orientation'] = 'landscape' if attributes['rotate-option']
|
81
79
|
end
|
82
80
|
|
83
81
|
# Internal: Returns whether the current row being processed is
|
@@ -206,12 +204,10 @@ class Table::Column < AbstractNode
|
|
206
204
|
col_pcwidth = (@attributes['width'].to_f * 100.0 / width_base).truncate precision
|
207
205
|
col_pcwidth = col_pcwidth.to_i if col_pcwidth.to_i == col_pcwidth
|
208
206
|
end
|
209
|
-
|
210
|
-
|
211
|
-
# FIXME calculate more accurately (only used in DocBook output)
|
212
|
-
@attributes['colabswidth'] = ((col_pcwidth / 100.0) * parent.attributes['tableabswidth']).round
|
207
|
+
if parent.attributes['tableabswidth']
|
208
|
+
@attributes['colabswidth'] = (col_abswidth = ((col_pcwidth / 100.0) * parent.attributes['tableabswidth']).truncate precision) == col_abswidth.to_i ? col_abswidth.to_i : col_abswidth
|
213
209
|
end
|
214
|
-
col_pcwidth
|
210
|
+
@attributes['colpcwidth'] = col_pcwidth
|
215
211
|
end
|
216
212
|
|
217
213
|
def block?
|
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, Ryan Waldron
|
4
|
-
.\" Generator: Asciidoctor 2.0.0.rc.
|
5
|
-
.\" Date: 2019-03-
|
4
|
+
.\" Generator: Asciidoctor 2.0.0.rc.2
|
5
|
+
.\" Date: 2019-03-12
|
6
6
|
.\" Manual: Asciidoctor Manual
|
7
|
-
.\" Source: Asciidoctor 2.0.0.rc.
|
7
|
+
.\" Source: Asciidoctor 2.0.0.rc.2
|
8
8
|
.\" Language: English
|
9
9
|
.\"
|
10
|
-
.TH "ASCIIDOCTOR" "1" "2019-03-
|
10
|
+
.TH "ASCIIDOCTOR" "1" "2019-03-12" "Asciidoctor 2.0.0.rc.2" "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.0.rc.
|
4
|
+
version: 2.0.0.rc.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Allen
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2019-03-
|
16
|
+
date: 2019-03-12 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: asciimath
|
@@ -319,7 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
319
319
|
- !ruby/object:Gem::Version
|
320
320
|
version: 1.3.1
|
321
321
|
requirements: []
|
322
|
-
rubygems_version: 3.0.
|
322
|
+
rubygems_version: 3.0.3
|
323
323
|
signing_key:
|
324
324
|
specification_version: 4
|
325
325
|
summary: An implementation of the AsciiDoc text processor and publishing toolchain
|