asciidoctor 2.0.7 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 363386e5f0af985125302b3f74565b9d55758b7ed2c6861fbd26e1554ce68cf6
4
- data.tar.gz: 50204a323636922a05b26c460ed659bdef48bc7de2a2342ac1f1c40997897d80
3
+ metadata.gz: 1ef189b83754a55b816f7a460e35f774c88caaad9ff226ce55c1c52cbc412164
4
+ data.tar.gz: d1df841d432830e57c6e09fd01d3dd862e8d15f4e3f5c6c18dcb1ee5ce837ae2
5
5
  SHA512:
6
- metadata.gz: d8136e7b02f0cc18e4b2e3e2f906a460e895fa1f3524b5302861354f9cfba49554592ef53bbff71a92f9f08068a685462f4c5f631016065f427e8947a267548c
7
- data.tar.gz: 778f9c5f7817a54fc4eeb863da1ee5e829e162f998ca2da2f34fd44a146973ee230201069bf65dedcfda4fd00ee4d75b429094fa612b994bfdb4b475f94940c7
6
+ metadata.gz: 0166e0df2ecdfef13e74befcdcc30bc4eaf52a0df358438350a5891c8f4ffa1346bc2d5d2c8be76d40fa931e88017be6748dd34cbd9184583ad631cfc91aa205
7
+ data.tar.gz: 2eaf29c5ac50b229214da2bf11f933767fc9bf43d3ff6b86d859501e1b1c446945d2845825cb4f5010e891a1c5af47e552f170533d3f4c48eaa19d7f1e30ff30
@@ -13,6 +13,25 @@ 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
+ // tag::compact[]
17
+ == 2.0.8 (2019-04-22) - @mojavelinux
18
+
19
+ Bug Fixes::
20
+
21
+ * restore background color applied to literal blocks by default stylesheet (#3258)
22
+ * use portability constants (CC_ALL, CC_ANY) in regular expressions defined in built-in converters (DocBook5 and ManPage)
23
+ * use portability constant (CC_ANY) in regular expression for custom inline macros
24
+ * use smarter margin collapsing for AsciiDoc table cell content; prevent passthrough content from being cut off (#3256)
25
+ * don't limit footnote ref to ASCII charset; allow any word character in Unicode to be used (#3269)
26
+
27
+ Improvements::
28
+
29
+ * register_for methods accept arguments as symbols (#3274)
30
+ * use Concurrent::Map instead of Concurrent::Hash in template converter
31
+ * use module_function keyword to define methods in Helpers
32
+ * move regular expression definitions to separate source file (internal change)
33
+
34
+ // end::compact[]
16
35
  == 2.0.7 (2019-04-13) - @mojavelinux
17
36
 
18
37
  Bug Fixes::
@@ -23,7 +42,10 @@ Bug Fixes::
23
42
  Improvements::
24
43
 
25
44
  * improve documentation for the `-a` CLI option; explain that `@` modifier can be placed at end of name as alternative to end of value
26
- * move source for main API entry points (load, load_file, convert, convert_file) to separate files
45
+ * move source for main API entry points (load, load_file, convert, convert_file) to separate files (internal change)
46
+ * define main API entry points (load, load_file, convert, convert_file) as module functions
47
+
48
+ Also see https://github.com/asciidoctor/asciidoctor/milestone/33?closed=1[issues resolved in 2.0.x] (cumulative).
27
49
 
28
50
  == 2.0.6 (2019-04-04) - @mojavelinux
29
51
 
@@ -38,6 +60,8 @@ Improvements::
38
60
  * implement Helpers.extname as a more efficient and flexible File.extname method
39
61
  * check for AsciiDoc file extension using end_with? instead of resolving the extname and using a lookup
40
62
 
63
+ Also see https://github.com/asciidoctor/asciidoctor/milestone/33?closed=1[issues resolved in 2.0.x] (cumulative).
64
+
41
65
  == 2.0.5 (2019-04-01) - @mojavelinux
42
66
 
43
67
  Bug Fixes::
@@ -48,6 +72,8 @@ Bug Fixes::
48
72
  * mark encoding of stdio objects used in CLI as UTF-8 (#3225)
49
73
  * make Asciidoctor::SyntaxHighlighter::Config.register_for method public as documented
50
74
 
75
+ Also see https://github.com/asciidoctor/asciidoctor/milestone/33?closed=1[issues resolved in 2.0.x] (cumulative).
76
+
51
77
  == 2.0.4 (2019-03-31) - @mojavelinux
52
78
 
53
79
  Bug Fixes::
@@ -58,6 +84,8 @@ Bug Fixes::
58
84
  * move Asciidoctor::Converter::BackendTraits.derive_backend_traits method to Asciidoctor::Converter
59
85
  * mark render and render_file methods as deprecated in API docs
60
86
 
87
+ Also see https://github.com/asciidoctor/asciidoctor/milestone/33?closed=1[issues resolved in 2.0.x] (cumulative).
88
+
61
89
  == 2.0.3 (2019-03-28) - @mojavelinux
62
90
 
63
91
  Bug Fixes::
@@ -65,6 +93,8 @@ Bug Fixes::
65
93
  * fix crash when attrlist is used on literal monospace phrase (#3216)
66
94
  * update use of magic regexp variables to fix compatibility with Opal / Asciidoctor.js (#3214)
67
95
 
96
+ Also see https://github.com/asciidoctor/asciidoctor/milestone/33?closed=1[issues resolved in 2.0.x] (cumulative).
97
+
68
98
  == 2.0.2 (2019-03-26) - @mojavelinux
69
99
 
70
100
  Bug Fixes::
@@ -72,6 +102,8 @@ Bug Fixes::
72
102
  * apply verbatim substitutions to literal paragraphs attached to list item (#3205)
73
103
  * implement #lines and #source methods on Table::Cell based on cell text (#3207)
74
104
 
105
+ Also see https://github.com/asciidoctor/asciidoctor/milestone/33?closed=1[issues resolved in 2.0.x] (cumulative).
106
+
75
107
  == 2.0.1 (2019-03-25) - @mojavelinux
76
108
 
77
109
  Bug Fixes::
@@ -87,6 +119,8 @@ Build / Infrastructure::
87
119
 
88
120
  * bundle .yardopts in RubyGem (#3193)
89
121
 
122
+ Also see https://github.com/asciidoctor/asciidoctor/milestone/33?closed=1[issues resolved in 2.0.x] (cumulative).
123
+
90
124
  == 2.0.0 (2019-03-22) - @mojavelinux
91
125
 
92
126
  Enhancements / Compliance::
@@ -254,7 +288,8 @@ Build / Infrastructure::
254
288
  * exclude test suite, build script, and Gemfile from gem (#3044)
255
289
  * split build tasks out into individual files
256
290
 
257
- // tag::compact[]
291
+ Also see https://github.com/asciidoctor/asciidoctor/milestone/33?closed=1[issues resolved in 2.0.x] (cumulative).
292
+
258
293
  == 1.5.8 (2018-10-28) - @mojavelinux
259
294
 
260
295
  Enhancements::
@@ -343,7 +378,6 @@ Documentation::
343
378
  Build / Infrastructure::
344
379
 
345
380
  * replace thread_safe with concurrent-ruby (PR #2822) (*@junaruga*)
346
- // end::compact[]
347
381
 
348
382
  == 1.5.7.1 (2018-05-10) - @mojavelinux
349
383
 
data/LICENSE CHANGED
@@ -1,6 +1,7 @@
1
1
  MIT License
2
2
 
3
- Copyright (C) 2012-2019 Dan Allen, Ryan Waldron and the Asciidoctor Project
3
+ Copyright (C) 2012-2019 Dan Allen, Sarah White, Ryan Waldron, and the
4
+ individual contributors to Asciidoctor.
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
@@ -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.7, 2019-04-13
3
+ v2.0.8, 2019-04-22
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.7
20
+ :release-version: 2.0.8
21
21
  // URIs:
22
22
  :uri-org: https://github.com/asciidoctor
23
23
  :uri-repo: {uri-org}/asciidoctor
@@ -453,7 +453,7 @@ Asciidoctor Organization auf GitHub:: {uri-org}
453
453
 
454
454
  == Lizenz
455
455
 
456
- Copyright (C) 2012-2019 Dan Allen, Sarah White und die einzelnen Mitarbeiter von Asciidoctor.
456
+ Copyright (C) 2012-2019 Dan Allen, Sarah White, Ryan Waldron, und die einzelnen Mitarbeiter von Asciidoctor.
457
457
  Die Nutzung dieser Software wird unter den Bedingungen der MIT-Lizenz gewährt.
458
458
 
459
459
  Siehe die {uri-license}[LIZENZ] für den vollen Lizenztext.
@@ -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.7, 2019-04-13
3
+ v2.0.8, 2019-04-22
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.7
20
+ :release-version: 2.0.8
21
21
  // URIs:
22
22
  :uri-org: https://github.com/asciidoctor
23
23
  :uri-repo: {uri-org}/asciidoctor
@@ -422,7 +422,7 @@ L'organisation Asciidoctor sur GitHub:: {uri-org}
422
422
 
423
423
  == Licence
424
424
 
425
- Copyright (C) 2012-2019 Dan Allen, Sarah White et les contributeurs individuels d'Asciidoctor.
425
+ Copyright (C) 2012-2019 Dan Allen, Sarah White, Ryan Waldron, et les contributeurs individuels d'Asciidoctor.
426
426
  Une utilisation libre de ce logiciel est autorisée sous les termes de la licence MIT.
427
427
 
428
428
  Consultez le fichier {uri-license}[LICENSE] pour plus de détails.
@@ -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.7, 2019-04-13
3
+ v2.0.8, 2019-04-22
4
4
  // settings:
5
5
  :page-layout: base
6
6
  :idprefix:
@@ -18,7 +18,7 @@ ifdef::env-github[]
18
18
  :warning-caption: :warning:
19
19
  endif::[]
20
20
  // Variables:
21
- :release-version: 2.0.7
21
+ :release-version: 2.0.8
22
22
  // URIs:
23
23
  :uri-org: https://github.com/asciidoctor
24
24
  :uri-repo: {uri-org}/asciidoctor
@@ -395,7 +395,7 @@ Asciidoctor organization on GitHub:: {uri-org}
395
395
 
396
396
  == Copyright and Licensing
397
397
 
398
- Copyright (C) 2012-2019 Dan Allen, Ryan Waldron and the Asciidoctor Project.
398
+ Copyright (C) 2012-2019 Dan Allen, Sarah White, Ryan Waldron, and the individual contributors to Asciidoctor.
399
399
  本ソフトウェアはMITライセンスのもとで自由に使用できます.
400
400
 
401
401
  詳細は {uri-license}[LICENSE] ファイルを参照してください.
@@ -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.7, 2019-04-13
3
+ v2.0.8, 2019-04-22
4
4
  // settings:
5
5
  :page-layout: base
6
6
  :idprefix:
@@ -18,7 +18,7 @@ ifdef::env-github[]
18
18
  :warning-caption: :warning:
19
19
  endif::[]
20
20
  // Variables:
21
- :release-version: 2.0.7
21
+ :release-version: 2.0.8
22
22
  // URIs:
23
23
  :uri-org: https://github.com/asciidoctor
24
24
  :uri-repo: {uri-org}/asciidoctor
@@ -412,7 +412,7 @@ Asciidoctor 组织在 GitHub 托管代码、议案跟踪和相关子项目。
412
412
  [#copyright-and-licensing]
413
413
  == 版权和协议
414
414
 
415
- Copyright (C) 2012-2019 Dan Allen, Ryan Waldron and the Asciidoctor Project.
415
+ Copyright (C) 2012-2019 Dan Allen, Sarah White, Ryan Waldron, and the individual contributors to Asciidoctor.
416
416
  这个软件的免费使用是在MIT许可条款授予的。
417
417
 
418
418
  请看 {uri-license}[版权声明] 文件来获取更多详细信息。
@@ -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.7, 2019-04-13
3
+ v2.0.8, 2019-04-22
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.7
20
+ :release-version: 2.0.8
21
21
  // URIs:
22
22
  :uri-org: https://github.com/asciidoctor
23
23
  :uri-repo: {uri-org}/asciidoctor
@@ -27,6 +27,7 @@ endif::[]
27
27
  :uri-maven-plugin: {uri-org}/asciidoctor-maven-plugin
28
28
  :uri-asciidoclet: {uri-org}/asciidoclet
29
29
  :uri-project: https://asciidoctor.org
30
+ :uri-gem: https://rubygems.org/gems/asciidoctor
30
31
  ifdef::env-site[:uri-project: link:]
31
32
  :uri-docs: {uri-project}/docs
32
33
  :uri-news: {uri-project}/news
@@ -91,12 +92,13 @@ endif::[]
91
92
 
92
93
  ifdef::status[]
93
94
  //.*Project health*
95
+ image:https://img.shields.io/gem/v/asciidoctor.svg[Latest Release, link={uri-gem}]
96
+ image:https://img.shields.io/badge/rubydoc.info-{release-version}-blue.svg[library (API) docs,link=https://www.rubydoc.info/gems/asciidoctor/{release-version}]
94
97
  image:https://img.shields.io/travis/asciidoctor/asciidoctor/master.svg[Build Status (Travis CI),link=https://travis-ci.org/asciidoctor/asciidoctor]
95
98
  image:https://ci.appveyor.com/api/projects/status/ifplu67oxvgn6ceq/branch/master?svg=true&amp;passingText=green%20bar&amp;failingText=%23fail&amp;pendingText=building%2E%2E%2E[Build Status (AppVeyor),link=https://ci.appveyor.com/project/asciidoctor/asciidoctor]
96
99
  //image:https://img.shields.io/coveralls/asciidoctor/asciidoctor/master.svg[Coverage Status,link=https://coveralls.io/r/asciidoctor/asciidoctor]
97
100
  //image:https://codeclimate.com/github/asciidoctor/asciidoctor/badges/gpa.svg[Code Climate,link=https://codeclimate.com/github/asciidoctor/asciidoctor]
98
101
  image:https://inch-ci.org/github/asciidoctor/asciidoctor.svg?branch=master[Inline docs,link=https://inch-ci.org/github/asciidoctor/asciidoctor]
99
- image:https://img.shields.io/badge/rubydoc.info-{release-version}-blue.svg[library (API) docs,link=https://www.rubydoc.info/gems/asciidoctor/{release-version}]
100
102
  endif::[]
101
103
 
102
104
  == Sponsors
@@ -458,7 +460,7 @@ Asciidoctor organization on GitHub:: {uri-org}
458
460
 
459
461
  == License
460
462
 
461
- Copyright (C) 2012-2019 Dan Allen, Sarah White and the individual contributors to Asciidoctor.
463
+ Copyright (C) 2012-2019 Dan Allen, Sarah White, Ryan Waldron, and the individual contributors to Asciidoctor.
462
464
  Use of this software is granted under the terms of the MIT License.
463
465
 
464
466
  See the {uri-license}[LICENSE] for the full license text.
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
46
46
  s.add_development_dependency 'minitest', '~> 5.11.0'
47
47
  s.add_development_dependency 'nokogiri', '~> 1.10.0'
48
48
  s.add_development_dependency 'rake', '~> 12.3.0'
49
- # Asciidoctor supports Rouge >= 3
49
+ # Asciidoctor supports Rouge >= 2
50
50
  s.add_development_dependency 'rouge', '~> 3.3.0'
51
51
  s.add_development_dependency 'rspec-expectations', '~> 3.8.0'
52
52
  s.add_development_dependency 'slim', '~> 4.0.0'
@@ -1,10 +1,9 @@
1
1
  /* Asciidoctor default stylesheet | MIT License | https://asciidoctor.org */
2
- /* Uncomment @import statement when using as custom stylesheet */
2
+ /* Uncomment @import statement to use as custom stylesheet */
3
3
  /*@import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700";*/
4
4
  article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}
5
- audio,canvas,video{display:inline-block}
5
+ audio,video{display:inline-block}
6
6
  audio:not([controls]){display:none;height:0}
7
- script{display:none!important}
8
7
  html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
9
8
  a{background:none}
10
9
  a:focus{outline:thin dotted}
@@ -209,8 +208,8 @@ table.tableblock #preamble>.sectionbody>[class="paragraph"]:first-of-type p{font
209
208
  .literalblock pre,.listingblock>.content>pre{-webkit-border-radius:4px;border-radius:4px;word-wrap:break-word;overflow-x:auto;padding:1em;font-size:.8125em}
210
209
  @media screen and (min-width:768px){.literalblock pre,.listingblock>.content>pre{font-size:.90625em}}
211
210
  @media screen and (min-width:1280px){.literalblock pre,.listingblock>.content>pre{font-size:1em}}
211
+ .literalblock pre,.listingblock>.content>pre:not(.highlight),.listingblock>.content>pre[class="highlight"],.listingblock>.content>pre[class^="highlight "]{background:#f7f7f8}
212
212
  .literalblock.output pre{color:#f7f7f8;background:rgba(0,0,0,.9)}
213
- .listingblock>.content>pre:not(.highlight),.listingblock>.content>pre[class="highlight"],.listingblock>.content>pre[class^="highlight "]{background:#f7f7f8}
214
213
  .listingblock>.content{position:relative}
215
214
  .listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:inherit;opacity:.5}
216
215
  .listingblock:hover code[data-lang]::before{display:block}
@@ -253,7 +252,8 @@ pre.pygments .lineno::before{content:"";margin-right:-.125em}
253
252
  .quoteblock.excerpt .attribution,.quoteblock .quoteblock .attribution{color:inherit;text-align:left;margin-right:0}
254
253
  table.tableblock{max-width:100%;border-collapse:separate}
255
254
  p.tableblock:last-child{margin-bottom:0}
256
- td.tableblock>.content{margin-bottom:-1.25em}
255
+ td.tableblock>.content>:last-child{margin-bottom:-1.25em}
256
+ td.tableblock>.content>:last-child.sidebarblock{margin-bottom:0}
257
257
  table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}
258
258
  table.grid-all>thead>tr>.tableblock,table.grid-all>tbody>tr>.tableblock{border-width:0 1px 1px 0}
259
259
  table.grid-all>tfoot>tr>.tableblock{border-width:1px 1px 0 0}
@@ -230,7 +230,7 @@ module Asciidoctor
230
230
 
231
231
  # Pointers to the preferred version for a given backend.
232
232
  BACKEND_ALIASES = {
233
- 'html' => 'html5',
233
+ 'html' => 'html5',
234
234
  'docbook' => 'docbook5'
235
235
  }
236
236
 
@@ -270,14 +270,14 @@ module Asciidoctor
270
270
 
271
271
  ADMONITION_STYLES = ['NOTE', 'TIP', 'IMPORTANT', 'WARNING', 'CAUTION'].to_set
272
272
 
273
- ADMONITION_STYLE_HEADS = ['N', 'T', 'I', 'W', 'C'].to_set
273
+ ADMONITION_STYLE_HEADS = ::Set.new.tap {|accum| ADMONITION_STYLES.each {|s| accum << s.chr } }
274
274
 
275
275
  PARAGRAPH_STYLES = ['comment', 'example', 'literal', 'listing', 'normal', 'open', 'pass', 'quote', 'sidebar', 'source', 'verse', 'abstract', 'partintro'].to_set
276
276
 
277
277
  VERBATIM_STYLES = ['literal', 'listing', 'source', 'verse'].to_set
278
278
 
279
279
  DELIMITED_BLOCKS = {
280
- '--' => [:open, ['comment', 'example', 'literal', 'listing', 'pass', 'quote', 'sidebar', 'source', 'verse', 'admonition', 'abstract', 'partintro'].to_set],
280
+ '--' => [:open, ['comment', 'example', 'literal', 'listing', 'pass', 'quote', 'sidebar', 'source', 'verse', 'admonition', 'abstract', 'partintro'].to_set],
281
281
  '----' => [:listing, ['literal', 'source'].to_set],
282
282
  '....' => [:literal, ['listing', 'source'].to_set],
283
283
  '====' => [:example, ['admonition'].to_set],
@@ -289,7 +289,7 @@ module Asciidoctor
289
289
  ':===' => [:table, ::Set.new],
290
290
  '!===' => [:table, ::Set.new],
291
291
  '////' => [:comment, ::Set.new],
292
- '```' => [:fenced_code, ::Set.new]
292
+ '```' => [:fenced_code, ::Set.new]
293
293
  }
294
294
 
295
295
  DELIMITED_BLOCK_HEADS = {}.tap {|accum| DELIMITED_BLOCKS.each_key {|k| accum[k.slice 0, 2] = true } }
@@ -300,13 +300,13 @@ module Asciidoctor
300
300
 
301
301
  LAYOUT_BREAK_CHARS = {
302
302
  '\'' => :thematic_break,
303
- '<' => :page_break
303
+ '<' => :page_break
304
304
  }
305
305
 
306
306
  MARKDOWN_THEMATIC_BREAK_CHARS = {
307
- '-' => :thematic_break,
308
- '*' => :thematic_break,
309
- '_' => :thematic_break
307
+ '-' => :thematic_break,
308
+ '*' => :thematic_break,
309
+ '_' => :thematic_break
310
310
  }
311
311
 
312
312
  HYBRID_LAYOUT_BREAK_CHARS = LAYOUT_BREAK_CHARS.merge MARKDOWN_THEMATIC_BREAK_CHARS
@@ -319,8 +319,8 @@ module Asciidoctor
319
319
  ORDERED_LIST_STYLES = [:arabic, :loweralpha, :lowerroman, :upperalpha, :upperroman] #, :lowergreek]
320
320
 
321
321
  ORDERED_LIST_KEYWORDS = {
322
- #'arabic' => '1',
323
- #'decimal' => '1',
322
+ #'arabic' => '1',
323
+ #'decimal' => '1',
324
324
  'loweralpha' => 'a',
325
325
  'lowerroman' => 'i',
326
326
  #'lowergreek' => 'a',
@@ -361,785 +361,56 @@ module Asciidoctor
361
361
 
362
362
  MATHJAX_VERSION = '2.7.5'
363
363
 
364
- # attributes which be changed within the content of the document (but not
365
- # header) because it has semantic meaning; ex. sectnums
364
+ # attributes which be changed throughout the flow of the document (e.g., sectnums)
366
365
  FLEXIBLE_ATTRIBUTES = ['sectnums']
367
366
 
368
- # A collection of regular expressions used by the parser.
369
- #
370
- # NOTE The following pattern, which appears frequently, captures the
371
- # contents between square brackets, ignoring escaped closing brackets
372
- # (closing brackets prefixed with a backslash '\' character)
373
- #
374
- # Pattern: \[(|#{CC_ALL}*?[^\\])\]
375
- # Matches: [enclosed text] and [enclosed [text\]], not [enclosed text \\] or [\\] (as these require a trailing space)
376
- #
377
- # NOTE \w only matches ASCII word characters, whereas [[:word:]] or \p{Word} matches any character in the Unicode word category.
378
- #(pseudo)module Rx
379
-
380
- ## Regular expression character classes (to ensure regexp compatibility between Ruby and JavaScript)
381
- ## CC stands for "character class", CG stands for "character class group"
382
-
383
- unless RUBY_ENGINE == 'opal'
384
- # CC_ALL is any character, including newlines (must be accompanied by multiline regexp flag)
385
- CC_ALL = '.'
386
- # CC_ANY is any character except newlines
387
- CC_ANY = '.'
388
- CC_EOL = '$'
389
- CC_ALPHA = CG_ALPHA = '\p{Alpha}'
390
- CC_ALNUM = CG_ALNUM = '\p{Alnum}'
391
- CG_BLANK = '\p{Blank}'
392
- CC_WORD = CG_WORD = '\p{Word}'
393
- end
394
-
395
- ## Document header
396
-
397
- # Matches the author info line immediately following the document title.
398
- #
399
- # Examples
400
- #
401
- # Doc Writer <doc@example.com>
402
- # Mary_Sue Brontë
403
- #
404
- AuthorInfoLineRx = /^(#{CG_WORD}[#{CC_WORD}\-'.]*)(?: +(#{CG_WORD}[#{CC_WORD}\-'.]*))?(?: +(#{CG_WORD}[#{CC_WORD}\-'.]*))?(?: +<([^>]+)>)?$/
405
-
406
- # Matches the delimiter that separates multiple authors.
407
- #
408
- # Examples
409
- #
410
- # Doc Writer; Junior Writer
411
- #
412
- AuthorDelimiterRx = /;(?: |$)/
413
-
414
- # Matches the revision info line, which appears immediately following
415
- # the author info line beneath the document title.
416
- #
417
- # Examples
418
- #
419
- # v1.0
420
- # 2013-01-01
421
- # v1.0, 2013-01-01: Ring in the new year release
422
- # 1.0, Jan 01, 2013
423
- #
424
- RevisionInfoLineRx = /^(?:[^\d{]*(#{CC_ANY}*?),)? *(?!:)(#{CC_ANY}*?)(?: *(?!^),?: *(#{CC_ANY}*))?$/
425
-
426
- # Matches the title and volnum in the manpage doctype.
427
- #
428
- # Examples
429
- #
430
- # = asciidoctor(1)
431
- # = asciidoctor ( 1 )
432
- #
433
- ManpageTitleVolnumRx = /^(#{CC_ANY}+?) *\( *(#{CC_ANY}+?) *\)$/
434
-
435
- # Matches the name and purpose in the manpage doctype.
436
- #
437
- # Examples
438
- #
439
- # asciidoctor - converts AsciiDoc source files to HTML, DocBook and other formats
440
- #
441
- ManpageNamePurposeRx = /^(#{CC_ANY}+?) +- +(#{CC_ANY}+)$/
442
-
443
- ## Preprocessor directives
444
-
445
- # Matches a conditional preprocessor directive (e.g., ifdef, ifndef, ifeval and endif).
446
- #
447
- # Examples
448
- #
449
- # ifdef::basebackend-html[]
450
- # ifndef::theme[]
451
- # ifeval::["{asciidoctor-version}" >= "0.1.0"]
452
- # ifdef::asciidoctor[Asciidoctor!]
453
- # endif::theme[]
454
- # endif::basebackend-html[]
455
- # endif::[]
456
- #
457
- ConditionalDirectiveRx = /^(\\)?(ifdef|ifndef|ifeval|endif)::(\S*?(?:([,+])\S*?)?)\[(#{CC_ANY}+)?\]$/
458
-
459
- # Matches a restricted (read as safe) eval expression.
460
- #
461
- # Examples
462
- #
463
- # "{asciidoctor-version}" >= "0.1.0"
464
- #
465
- EvalExpressionRx = /^(#{CC_ANY}+?) *([=!><]=|[><]) *(#{CC_ANY}+)$/
466
-
467
- # Matches an include preprocessor directive.
468
- #
469
- # Examples
470
- #
471
- # include::chapter1.ad[]
472
- # include::example.txt[lines=1;2;5..10]
473
- #
474
- IncludeDirectiveRx = /^(\\)?include::([^\[][^\[]*)\[(#{CC_ANY}+)?\]$/
475
-
476
- # Matches a trailing tag directive in an include file.
477
- #
478
- # Examples
479
- #
480
- # // tag::try-catch[]
481
- # try {
482
- # someMethod();
483
- # catch (Exception e) {
484
- # log(e);
485
- # }
486
- # // end::try-catch[]
487
- # NOTE m flag is required for Asciidoctor.js
488
- TagDirectiveRx = /\b(?:tag|(e)nd)::(\S+?)\[\](?=$|[ \r])/m
489
-
490
- ## Attribute entries and references
491
-
492
- # Matches a document attribute entry.
493
- #
494
- # Examples
495
- #
496
- # :foo: bar
497
- # :First Name: Dan
498
- # :sectnums!:
499
- # :!toc:
500
- # :long-entry: Attribute value lines ending in ' \' \
501
- # are joined together as a single value, \
502
- # collapsing the line breaks and indentation to \
503
- # a single space.
504
- #
505
- AttributeEntryRx = /^:(!?#{CG_WORD}[^:]*):(?:[ \t]+(#{CC_ANY}*))?$/
506
-
507
- # Matches invalid characters in an attribute name.
508
- InvalidAttributeNameCharsRx = /[^-#{CC_WORD}]/
509
-
510
- # Matches a pass inline macro that surrounds the value of an attribute
511
- # entry once it has been parsed.
512
- #
513
- # Examples
514
- #
515
- # pass:[text]
516
- # pass:a[{a} {b} {c}]
517
- #
518
- if RUBY_ENGINE == 'opal'
519
- # NOTE In JavaScript, ^ and $ match the boundaries of the string when the m flag is not set
520
- AttributeEntryPassMacroRx = /^pass:([a-z]+(?:,[a-z-]+)*)?\[(#{CC_ALL}*)\]$/
521
- else
522
- AttributeEntryPassMacroRx = /\Apass:([a-z]+(?:,[a-z-]+)*)?\[(.*)\]\Z/m
523
- end
524
-
525
- # Matches an inline attribute reference.
526
- #
527
- # Examples
528
- #
529
- # {foobar} or {app_name} or {product-version}
530
- # {counter:sequence-name:1}
531
- # {set:foo:bar}
532
- # {set:name!}
533
- #
534
- AttributeReferenceRx = /(\\)?\{(#{CG_WORD}[-#{CC_WORD}]*|(set|counter2?):#{CC_ANY}+?)(\\)?\}/
535
-
536
- ## Paragraphs and delimited blocks
537
-
538
- # Matches an anchor (i.e., id + optional reference text) on a line above a block.
539
- #
540
- # Examples
541
- #
542
- # [[idname]]
543
- # [[idname,Reference Text]]
544
- #
545
- BlockAnchorRx = /^\[\[(?:|([#{CC_ALPHA}_:][#{CC_WORD}:.-]*)(?:, *(#{CC_ANY}+))?)\]\]$/
546
-
547
- # Matches an attribute list above a block element.
548
- #
549
- # Examples
550
- #
551
- # # strictly positional
552
- # [quote, Adam Smith, Wealth of Nations]
553
- #
554
- # # name/value pairs
555
- # [NOTE, caption="Good to know"]
556
- #
557
- # # as attribute reference
558
- # [{lead}]
559
- #
560
- BlockAttributeListRx = /^\[(|[#{CC_WORD}.#%{,"']#{CC_ANY}*)\]$/
561
-
562
- # A combined pattern that matches either a block anchor or a block attribute list.
563
- #
564
- # TODO this one gets hit a lot, should be optimized as much as possible
565
- BlockAttributeLineRx = /^\[(?:|[#{CC_WORD}.#%{,"']#{CC_ANY}*|\[(?:|[#{CC_ALPHA}_:][#{CC_WORD}:.-]*(?:, *#{CC_ANY}+)?)\])\]$/
566
-
567
- # Matches a title above a block.
568
- #
569
- # Examples
570
- #
571
- # .Title goes here
572
- #
573
- BlockTitleRx = /^\.(\.?[^ \t.]#{CC_ANY}*)$/
574
-
575
- # Matches an admonition label at the start of a paragraph.
576
- #
577
- # Examples
578
- #
579
- # NOTE: Just a little note.
580
- # TIP: Don't forget!
581
- #
582
- AdmonitionParagraphRx = /^(#{ADMONITION_STYLES.to_a.join '|'}):[ \t]+/
583
-
584
- # Matches a literal paragraph, which is a line of text preceded by at least one space.
585
- #
586
- # Examples
587
- #
588
- # <SPACE>Foo
589
- # <TAB>Foo
590
- LiteralParagraphRx = /^([ \t]+#{CC_ANY}*)$/
591
-
592
- # Matches a comment block.
593
- #
594
- # Examples
595
- #
596
- # ////
597
- # This is a block comment.
598
- # It can span one or more lines.
599
- # ////
600
- #CommentBlockRx = %r(^/{4,}$)
601
-
602
- # Matches a comment line.
603
- #
604
- # Examples
605
- #
606
- # // note to author
607
- #
608
- #CommentLineRx = %r(^//(?=[^/]|$))
609
-
610
- ## Section titles
611
-
612
- # Matches an Atx (single-line) section title.
613
- #
614
- # Examples
615
- #
616
- # == Foo
617
- # // ^ a level 1 (h2) section title
618
- #
619
- # == Foo ==
620
- # // ^ also a level 1 (h2) section title
621
- #
622
- AtxSectionTitleRx = /^(=={0,5})[ \t]+(#{CC_ANY}+?)(?:[ \t]+\1)?$/
623
-
624
- # Matches an extended Atx section title that includes support for the Markdown variant.
625
- ExtAtxSectionTitleRx = /^(=={0,5}|#\#{0,5})[ \t]+(#{CC_ANY}+?)(?:[ \t]+\1)?$/
626
-
627
- # Matches the title only (first line) of an Setext (two-line) section title.
628
- # The title cannot begin with a dot and must have at least one alphanumeric character.
629
- SetextSectionTitleRx = /^((?!\.)#{CC_ANY}*?#{CG_ALNUM}#{CC_ANY}*)$/
630
-
631
- # Matches an anchor (i.e., id + optional reference text) inside a section title.
632
- #
633
- # Examples
634
- #
635
- # Section Title [[idname]]
636
- # Section Title [[idname,Reference Text]]
637
- #
638
- InlineSectionAnchorRx = / (\\)?\[\[([#{CC_ALPHA}_:][#{CC_WORD}:.-]*)(?:, *(#{CC_ANY}+))?\]\]$/
639
-
640
- # Matches invalid ID characters in a section title.
641
- #
642
- # NOTE uppercase chars not included since expression is only run on a lowercase string
643
- InvalidSectionIdCharsRx = /<[^>]+>|&(?:[a-z][a-z]+\d{0,2}|#\d\d\d{0,4}|#x[\da-f][\da-f][\da-f]{0,3});|[^ #{CC_WORD}\-.]+?/
644
-
645
- # Matches an explicit section level style like sect1
646
- #
647
- SectionLevelStyleRx = /^sect\d$/
648
-
649
- ## Lists
650
-
651
- # Detects the start of any list item.
652
- #
653
- # NOTE we only have to check as far as the blank character because we know it means non-whitespace follows.
654
- # IMPORTANT if this regexp does not agree with the regexp for each list type, the parser will hang.
655
- AnyListRx = %r(^(?:[ \t]*(?:-|\*\**|\.\.*|\u2022|\d+\.|[a-zA-Z]\.|[IVXivx]+\))[ \t]|(?!//[^/])[ \t]*[^ \t]#{CC_ANY}*?(?::::{0,2}|;;)(?:$|[ \t])|<?\d+>[ \t]))
656
-
657
- # Matches an unordered list item (one level for hyphens, up to 5 levels for asterisks).
658
- #
659
- # Examples
660
- #
661
- # * Foo
662
- # - Foo
663
- #
664
- # NOTE we know trailing (.*) will match at least one character because we strip trailing spaces
665
- UnorderedListRx = /^[ \t]*(-|\*\**|\u2022)[ \t]+(#{CC_ANY}*)$/
666
-
667
- # Matches an ordered list item (explicit numbering or up to 5 consecutive dots).
668
- #
669
- # Examples
670
- #
671
- # . Foo
672
- # .. Foo
673
- # 1. Foo (arabic, default)
674
- # a. Foo (loweralpha)
675
- # A. Foo (upperalpha)
676
- # i. Foo (lowerroman)
677
- # I. Foo (upperroman)
678
- #
679
- # NOTE leading space match is not always necessary, but is used for list reader
680
- # NOTE we know trailing (.*) will match at least one character because we strip trailing spaces
681
- OrderedListRx = /^[ \t]*(\.\.*|\d+\.|[a-zA-Z]\.|[IVXivx]+\))[ \t]+(#{CC_ANY}*)$/
682
-
683
- # Matches the ordinals for each type of ordered list.
684
- OrderedListMarkerRxMap = {
685
- arabic: /\d+\./,
686
- loweralpha: /[a-z]\./,
687
- lowerroman: /[ivx]+\)/,
688
- upperalpha: /[A-Z]\./,
689
- upperroman: /[IVX]+\)/,
690
- #lowergreek: /[a-z]\]/,
691
- }
692
-
693
- # Matches a description list entry.
694
- #
695
- # Examples
696
- #
697
- # foo::
698
- # bar:::
699
- # baz::::
700
- # blah;;
701
- #
702
- # # the term may be followed by a description on the same line...
703
- #
704
- # foo:: The metasyntactic variable that commonly accompanies 'bar' (see also, <<bar>>).
705
- #
706
- # # ...or on a separate line, which may optionally be indented
707
- #
708
- # foo::
709
- # The metasyntactic variable that commonly accompanies 'bar' (see also, <<bar>>).
710
- #
711
- # # attribute references may be used in both the term and the description
712
- #
713
- # {foo-term}:: {foo-desc}
714
- #
715
- # NOTE we know trailing (.*) will match at least one character because we strip trailing spaces
716
- # NOTE must skip line comment when looking for next list item inside list
717
- DescriptionListRx = %r(^(?!//[^/])[ \t]*([^ \t]#{CC_ANY}*?)(:::{0,2}|;;)(?:$|[ \t]+(#{CC_ANY}*)$))
718
-
719
- # Matches a sibling description list item (excluding the delimiter specified by the key).
720
- # NOTE must skip line comment when looking for sibling list item
721
- DescriptionListSiblingRx = {
722
- '::' => %r(^(?!//[^/])[ \t]*([^ \t]#{CC_ANY}*?[^:]|[^ \t:])(::)(?:$|[ \t]+(#{CC_ANY}*)$)),
723
- ':::' => %r(^(?!//[^/])[ \t]*([^ \t]#{CC_ANY}*?[^:]|[^ \t:])(:::)(?:$|[ \t]+(#{CC_ANY}*)$)),
724
- '::::' => %r(^(?!//[^/])[ \t]*([^ \t]#{CC_ANY}*?[^:]|[^ \t:])(::::)(?:$|[ \t]+(#{CC_ANY}*)$)),
725
- ';;' => %r(^(?!//[^/])[ \t]*([^ \t]#{CC_ANY}*?)(;;)(?:$|[ \t]+(#{CC_ANY}*)$))
726
- }
727
-
728
- # Matches a callout list item.
729
- #
730
- # Examples
731
- #
732
- # <1> Explanation
733
- #
734
- # or
735
- #
736
- # <.> Explanation with automatic number
737
- #
738
- # NOTE we know trailing (.*) will match at least one character because we strip trailing spaces
739
- CalloutListRx = /^<(\d+|\.)>[ \t]+(#{CC_ANY}*)$/
740
-
741
- # Matches a callout reference inside literal text.
742
- #
743
- # Examples
744
- # <1> (optionally prefixed by //, #, -- or ;; line comment chars)
745
- # <1> <2> (multiple callouts on one line)
746
- # <!--1--> (for XML-based languages)
747
- # <.> (auto-numbered)
748
- #
749
- # NOTE extract regexps are applied line-by-line, so we can use $ as end-of-line char
750
- CalloutExtractRx = %r(((?://|#|--|;;) ?)?(\\)?<!?(|--)(\d+|\.)\3>(?=(?: ?\\?<!?\3(?:\d+|\.)\3>)*$))
751
- CalloutExtractRxt = '(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*$)'
752
- CalloutExtractRxMap = ::Hash.new {|h, k| h[k] = /(#{k.empty? ? '' : "#{::Regexp.escape k} ?"})?#{CalloutExtractRxt}/ }
753
- # NOTE special characters have not been replaced when scanning
754
- CalloutScanRx = /\\?<!?(|--)(\d+|\.)\1>(?=(?: ?\\?<!?\1(?:\d+|\.)\1>)*#{CC_EOL})/
755
- # NOTE special characters have already been replaced when converting to an SGML format
756
- CalloutSourceRx = %r(((?://|#|--|;;) ?)?(\\)?&lt;!?(|--)(\d+|\.)\3&gt;(?=(?: ?\\?&lt;!?\3(?:\d+|\.)\3&gt;)*#{CC_EOL}))
757
- CalloutSourceRxt = "(\\\\)?&lt;()(\\d+|\\.)&gt;(?=(?: ?\\\\?&lt;(?:\\d+|\\.)&gt;)*#{CC_EOL})"
758
- CalloutSourceRxMap = ::Hash.new {|h, k| h[k] = /(#{k.empty? ? '' : "#{::Regexp.escape k} ?"})?#{CalloutSourceRxt}/ }
759
-
760
- # A Hash of regexps for lists used for dynamic access.
761
- ListRxMap = {
762
- ulist: UnorderedListRx,
763
- olist: OrderedListRx,
764
- dlist: DescriptionListRx,
765
- colist: CalloutListRx,
766
- }
767
-
768
- ## Tables
769
-
770
- # Parses the column spec (i.e., colspec) for a table.
771
- #
772
- # Examples
773
- #
774
- # 1*h,2*,^3e
775
- #
776
- ColumnSpecRx = /^(?:(\d+)\*)?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?(\d+%?|~)?([a-z])?$/
777
-
778
- # Parses the start and end of a cell spec (i.e., cellspec) for a table.
779
- #
780
- # Examples
781
- #
782
- # 2.3+<.>m
783
- #
784
- # FIXME use step-wise scan (or treetop) rather than this mega-regexp
785
- CellSpecStartRx = /^[ \t]*(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/
786
- CellSpecEndRx = /[ \t]+(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/
787
-
788
- # Block macros
789
-
790
- # Matches the custom block macro pattern.
791
- #
792
- # Examples
793
- #
794
- # gist::123456[]
795
- #
796
- #--
797
- # NOTE we've relaxed the match for target to accomodate the short format (e.g., name::[attrlist])
798
- CustomBlockMacroRx = /^(#{CG_WORD}[-#{CC_WORD}]*)::(|\S|\S#{CC_ANY}*?\S)\[(#{CC_ANY}+)?\]$/
799
-
800
- # Matches an image, video or audio block macro.
801
- #
802
- # Examples
803
- #
804
- # image::filename.png[Caption]
805
- # video::http://youtube.com/12345[Cats vs Dogs]
806
- #
807
- BlockMediaMacroRx = /^(image|video|audio)::(\S|\S#{CC_ANY}*?\S)\[(#{CC_ANY}+)?\]$/
808
-
809
- # Matches the TOC block macro.
810
- #
811
- # Examples
812
- #
813
- # toc::[]
814
- # toc::[levels=2]
815
- #
816
- BlockTocMacroRx = /^toc::\[(#{CC_ANY}+)?\]$/
817
-
818
- ## Inline macros
819
-
820
- # Matches an anchor (i.e., id + optional reference text) in the flow of text.
821
- #
822
- # Examples
823
- #
824
- # [[idname]]
825
- # [[idname,Reference Text]]
826
- # anchor:idname[]
827
- # anchor:idname[Reference Text]
828
- #
829
- InlineAnchorRx = /(\\)?(?:\[\[([#{CC_ALPHA}_:][#{CC_WORD}:.-]*)(?:, *(#{CC_ANY}+?))?\]\]|anchor:([#{CC_ALPHA}_:][#{CC_WORD}:.-]*)\[(?:\]|(#{CC_ANY}*?[^\\])\]))/
830
-
831
- # Scans for a non-escaped anchor (i.e., id + optional reference text) in the flow of text.
832
- InlineAnchorScanRx = /(?:^|[^\\\[])\[\[([#{CC_ALPHA}_:][#{CC_WORD}:.-]*)(?:, *(#{CC_ANY}+?))?\]\]|(?:^|[^\\])anchor:([#{CC_ALPHA}_:][#{CC_WORD}:.-]*)\[(?:\]|(#{CC_ANY}*?[^\\])\])/
833
-
834
- # Scans for a leading, non-escaped anchor (i.e., id + optional reference text).
835
- LeadingInlineAnchorRx = /^\[\[([#{CC_ALPHA}_:][#{CC_WORD}:.-]*)(?:, *(#{CC_ANY}+?))?\]\]/
836
-
837
- # Matches a bibliography anchor at the start of the list item text (in a bibliography list).
838
- #
839
- # Examples
840
- #
841
- # [[[Fowler_1997]]] Fowler M. ...
842
- #
843
- InlineBiblioAnchorRx = /^\[\[\[([#{CC_ALPHA}_:][#{CC_WORD}:.-]*)(?:, *(#{CC_ANY}+?))?\]\]\]/
844
-
845
- # Matches an inline e-mail address.
846
- #
847
- # doc.writer@example.com
848
- #
849
- InlineEmailRx = %r(([\\>:/])?#{CG_WORD}(?:&amp;|[#{CC_WORD}.%+-])*@#{CG_ALNUM}[#{CC_ALNUM}_.-]*\.[a-zA-Z]{2,5}\b)
850
-
851
- # Matches an inline footnote macro, which is allowed to span multiple lines.
852
- #
853
- # Examples
854
- # footnote:[text] (not referenceable)
855
- # footnote:id[text] (referenceable)
856
- # footnote:id[] (reference)
857
- # footnoteref:[id,text] (legacy)
858
- # footnoteref:[id] (legacy)
859
- #
860
- InlineFootnoteMacroRx = /\\?footnote(?:(ref):|:([\w-]+)?)\[(?:|(#{CC_ALL}*?[^\\]))\]/m
861
-
862
- # Matches an image or icon inline macro.
863
- #
864
- # Examples
865
- #
866
- # image:filename.png[Alt Text]
867
- # image:http://example.com/images/filename.png[Alt Text]
868
- # image:filename.png[More [Alt\] Text] (alt text becomes "More [Alt] Text")
869
- # icon:github[large]
870
- #
871
- # NOTE be as non-greedy as possible by not allowing newline or left square bracket in target
872
- InlineImageMacroRx = /\\?i(?:mage|con):([^:\s\[](?:[^\n\[]*[^\s\[])?)\[(|#{CC_ALL}*?[^\\])\]/m
873
-
874
- # Matches an indexterm inline macro, which may span multiple lines.
875
- #
876
- # Examples
877
- #
878
- # indexterm:[Tigers,Big cats]
879
- # (((Tigers,Big cats)))
880
- # indexterm2:[Tigers]
881
- # ((Tigers))
882
- #
883
- InlineIndextermMacroRx = /\\?(?:(indexterm2?):\[(#{CC_ALL}*?[^\\])\]|\(\((#{CC_ALL}+?)\)\)(?!\)))/m
884
-
885
- # Matches either the kbd or btn inline macro.
886
- #
887
- # Examples
888
- #
889
- # kbd:[F3]
890
- # kbd:[Ctrl+Shift+T]
891
- # kbd:[Ctrl+\]]
892
- # kbd:[Ctrl,T]
893
- # btn:[Save]
894
- #
895
- InlineKbdBtnMacroRx = /(\\)?(kbd|btn):\[(#{CC_ALL}*?[^\\])\]/m
896
-
897
- # Matches an implicit link and some of the link inline macro.
898
- #
899
- # Examples
900
- #
901
- # https://github.com
902
- # https://github.com[GitHub]
903
- # <https://github.com>
904
- # link:https://github.com[]
905
- #
906
- # FIXME revisit! the main issue is we need different rules for implicit vs explicit
907
- InlineLinkRx = %r((^|link:|#{CG_BLANK}|&lt;|[>\(\)\[\];])(\\?(?:https?|file|ftp|irc)://[^\s\[\]<]*([^\s.,\[\]<]))(?:\[(|#{CC_ALL}*?[^\\])\])?)m
908
-
909
- # Match a link or e-mail inline macro.
910
- #
911
- # Examples
912
- #
913
- # link:path[label]
914
- # mailto:doc.writer@example.com[]
915
- #
916
- # NOTE be as non-greedy as possible by not allowing space or left square bracket in target
917
- InlineLinkMacroRx = /\\?(?:link|(mailto)):(|[^:\s\[][^\s\[]*)\[(|#{CC_ALL}*?[^\\])\]/m
918
-
919
- # Matches the name of a macro.
920
- #
921
- MacroNameRx = /^#{CG_WORD}[-#{CC_WORD}]*$/
922
-
923
- # Matches a stem (and alternatives, asciimath and latexmath) inline macro, which may span multiple lines.
924
- #
925
- # Examples
926
- #
927
- # stem:[x != 0]
928
- # asciimath:[x != 0]
929
- # latexmath:[\sqrt{4} = 2]
930
- #
931
- InlineStemMacroRx = /\\?(stem|(?:latex|ascii)math):([a-z]+(?:,[a-z-]+)*)?\[(#{CC_ALL}*?[^\\])\]/m
932
-
933
- # Matches a menu inline macro.
934
- #
935
- # Examples
936
- #
937
- # menu:File[Save As...]
938
- # menu:View[Page Style > No Style]
939
- # menu:View[Page Style, No Style]
940
- #
941
- InlineMenuMacroRx = /\\?menu:(#{CG_WORD}|[#{CC_WORD}&][^\n\[]*[^\s\[])\[ *(#{CC_ALL}*?[^\\])?\]/m
942
-
943
- # Matches an implicit menu inline macro.
944
- #
945
- # Examples
946
- #
947
- # "File > New..."
948
- #
949
- InlineMenuRx = /\\?"([#{CC_WORD}&][^"]*?[ \n]+&gt;[ \n]+[^"]*)"/
950
-
951
- # Matches an inline passthrough, which may span multiple lines.
952
- #
953
- # Examples
954
- #
955
- # +text+
956
- # `text` (compat)
957
- #
958
- # NOTE we always capture the attributes so we know when to use compatible (i.e., legacy) behavior
959
- InlinePassRx = {
960
- false => ['+', '`', /(^|[^#{CC_WORD};:])(?:\[([^\]]+)\])?(\\?(\+|`)(\S|\S#{CC_ALL}*?\S)\4)(?!#{CG_WORD})/m],
961
- true => ['`', nil, /(^|[^`#{CC_WORD}])(?:\[([^\]]+)\])?(\\?(`)([^`\s]|[^`\s]#{CC_ALL}*?\S)\4)(?![`#{CC_WORD}])/m]
962
- }
963
-
964
- # Matches an inline plus passthrough spanning multiple lines, but only when it occurs directly
965
- # inside constrained monospaced formatting in non-compat mode.
966
- #
967
- # Examples
968
- #
969
- # +text+
970
- #
971
- SinglePlusInlinePassRx = /^(\\)?\+(\S|\S#{CC_ALL}*?\S)\+$/m
972
-
973
- # Matches several variants of the passthrough inline macro, which may span multiple lines.
974
- #
975
- # Examples
976
- #
977
- # +++text+++
978
- # $$text$$
979
- # pass:quotes[text]
980
- #
981
- # NOTE we have to support an empty pass:[] for compatibility with AsciiDoc Python
982
- InlinePassMacroRx = /(?:(?:(\\?)\[([^\]]+)\])?(\\{0,2})(\+\+\+?|\$\$)(#{CC_ALL}*?)\4|(\\?)pass:([a-z]+(?:,[a-z-]+)*)?\[(|#{CC_ALL}*?[^\\])\])/m
983
-
984
- # Matches an xref (i.e., cross-reference) inline macro, which may span multiple lines.
985
- #
986
- # Examples
987
- #
988
- # <<id,reftext>>
989
- # xref:id[reftext]
990
- #
991
- # NOTE special characters have already been escaped, hence the entity references
992
- # NOTE { is included in start characters to support target that begins with attribute reference in title content
993
- InlineXrefMacroRx = %r(\\?(?:&lt;&lt;([#{CC_WORD}#/.:{]#{CC_ALL}*?)&gt;&gt;|xref:([#{CC_WORD}#/.:{]#{CC_ALL}*?)\[(?:\]|(#{CC_ALL}*?[^\\])\])))m
994
-
995
- ## Layout
996
-
997
- # Matches a trailing + preceded by at least one space character,
998
- # which forces a hard line break (<br> tag in HTML output).
999
- #
1000
- # NOTE AsciiDoc Python allows + to be preceded by TAB; Asciidoctor does not
1001
- #
1002
- # Examples
1003
- #
1004
- # Humpty Dumpty sat on a wall, +
1005
- # Humpty Dumpty had a great fall.
1006
- #
1007
- if RUBY_ENGINE == 'opal'
1008
- # NOTE In JavaScript, ^ and $ only match the start and end of line if the multiline flag is present
1009
- HardLineBreakRx = /^(#{CC_ANY}*) \+$/m
1010
- else
1011
- # NOTE In Ruby, ^ and $ always match start and end of line
1012
- HardLineBreakRx = /^(.*) \+$/
1013
- end
1014
-
1015
- # Matches a Markdown horizontal rule.
1016
- #
1017
- # Examples
1018
- #
1019
- # --- or - - -
1020
- # *** or * * *
1021
- # ___ or _ _ _
1022
- #
1023
- MarkdownThematicBreakRx = /^ {0,3}([-*_])( *)\1\2\1$/
1024
-
1025
- # Matches an AsciiDoc or Markdown horizontal rule or AsciiDoc page break.
1026
- #
1027
- # Examples
1028
- #
1029
- # ''' (horizontal rule)
1030
- # <<< (page break)
1031
- # --- or - - - (horizontal rule, Markdown)
1032
- # *** or * * * (horizontal rule, Markdown)
1033
- # ___ or _ _ _ (horizontal rule, Markdown)
1034
- #
1035
- ExtLayoutBreakRx = /^(?:'{3,}|<{3,}|([-*_])( *)\1\2\1)$/
1036
-
1037
- ## General
1038
-
1039
- # Matches consecutive blank lines.
1040
- #
1041
- # Examples
1042
- #
1043
- # one
1044
- #
1045
- # two
1046
- #
1047
- BlankLineRx = /\n{2,}/
1048
-
1049
- # Matches a comma or semi-colon delimiter.
1050
- #
1051
- # Examples
1052
- #
1053
- # one,two
1054
- # three;four
1055
- #
1056
- #DataDelimiterRx = /[,;]/
1057
-
1058
- # Matches whitespace (space, tab, newline) escaped by a backslash.
1059
- #
1060
- # Examples
1061
- #
1062
- # three\ blind\ mice
1063
- #
1064
- EscapedSpaceRx = /\\([ \t\n])/
1065
-
1066
- # Detects if text is a possible candidate for the replacements substitution.
1067
- #
1068
- ReplaceableTextRx = /[&']|--|\.\.\.|\([CRT]M?\)/
1069
-
1070
- # Matches a whitespace delimiter, a sequence of spaces, tabs, and/or newlines.
1071
- # Matches the parsing rules of %w strings in Ruby.
1072
- #
1073
- # Examples
1074
- #
1075
- # one two three four
1076
- # five six
1077
- #
1078
- # TODO change to /(?<!\\)[ \t\n]+/ once lookbehind assertions are implemented in all modern browsers
1079
- SpaceDelimiterRx = /([^\\])[ \t\n]+/
1080
-
1081
- # Matches a + or - modifier in a subs list
1082
- #
1083
- SubModifierSniffRx = /[+-]/
1084
-
1085
- # Matches one or more consecutive digits at the end of a line.
1086
- #
1087
- # Examples
1088
- #
1089
- # docbook5
1090
- # html5
1091
- #
1092
- TrailingDigitsRx = /\d+$/
1093
-
1094
- # Detects strings that resemble URIs.
1095
- #
1096
- # Examples
1097
- # http://domain
1098
- # https://domain
1099
- # file:///path
1100
- # data:info
1101
- #
1102
- # not c:/sample.adoc or c:\sample.adoc
1103
- #
1104
- UriSniffRx = %r(^#{CG_ALPHA}[#{CC_ALNUM}.+-]+:/{0,2})
1105
-
1106
- # Detects XML tags
1107
- XmlSanitizeRx = /<[^>]+>/
1108
- #end
1109
-
1110
367
  INTRINSIC_ATTRIBUTES = {
1111
- 'startsb' => '[',
1112
- 'endsb' => ']',
1113
- 'vbar' => '|',
1114
- 'caret' => '^',
1115
- 'asterisk' => '*',
1116
- 'tilde' => '~',
1117
- 'plus' => '&#43;',
1118
- 'backslash' => '\\',
1119
- 'backtick' => '`',
1120
- 'blank' => '',
1121
- 'empty' => '',
1122
- 'sp' => ' ',
368
+ 'startsb' => '[',
369
+ 'endsb' => ']',
370
+ 'vbar' => '|',
371
+ 'caret' => '^',
372
+ 'asterisk' => '*',
373
+ 'tilde' => '~',
374
+ 'plus' => '&#43;',
375
+ 'backslash' => '\\',
376
+ 'backtick' => '`',
377
+ 'blank' => '',
378
+ 'empty' => '',
379
+ 'sp' => ' ',
1123
380
  'two-colons' => '::',
1124
381
  'two-semicolons' => ';;',
1125
- 'nbsp' => '&#160;',
1126
- 'deg' => '&#176;',
1127
- 'zwsp' => '&#8203;',
1128
- 'quot' => '&#34;',
1129
- 'apos' => '&#39;',
1130
- 'lsquo' => '&#8216;',
1131
- 'rsquo' => '&#8217;',
1132
- 'ldquo' => '&#8220;',
1133
- 'rdquo' => '&#8221;',
1134
- 'wj' => '&#8288;',
1135
- 'brvbar' => '&#166;',
1136
- 'pp' => '&#43;&#43;',
1137
- 'cpp' => 'C&#43;&#43;',
1138
- 'amp' => '&',
1139
- 'lt' => '<',
1140
- 'gt' => '>'
382
+ 'nbsp' => '&#160;',
383
+ 'deg' => '&#176;',
384
+ 'zwsp' => '&#8203;',
385
+ 'quot' => '&#34;',
386
+ 'apos' => '&#39;',
387
+ 'lsquo' => '&#8216;',
388
+ 'rsquo' => '&#8217;',
389
+ 'ldquo' => '&#8220;',
390
+ 'rdquo' => '&#8221;',
391
+ 'wj' => '&#8288;',
392
+ 'brvbar' => '&#166;',
393
+ 'pp' => '&#43;&#43;',
394
+ 'cpp' => 'C&#43;&#43;',
395
+ 'amp' => '&',
396
+ 'lt' => '<',
397
+ 'gt' => '>'
1141
398
  }
1142
399
 
400
+ # Regular expression character classes (to ensure regexp compatibility between Ruby and JavaScript)
401
+ # CC stands for "character class", CG stands for "character class group"
402
+ unless RUBY_ENGINE == 'opal'
403
+ # CC_ALL is any character, including newlines (must be accompanied by multiline regexp flag)
404
+ CC_ALL = '.'
405
+ # CC_ANY is any character except newlines
406
+ CC_ANY = '.'
407
+ CC_EOL = '$'
408
+ CC_ALPHA = CG_ALPHA = '\p{Alpha}'
409
+ CC_ALNUM = CG_ALNUM = '\p{Alnum}'
410
+ CG_BLANK = '\p{Blank}'
411
+ CC_WORD = CG_WORD = '\p{Word}'
412
+ end
413
+
1143
414
  QUOTE_SUBS = {}.tap do |accum|
1144
415
  # unconstrained quotes:: can appear anywhere
1145
416
  # constrained quotes:: must be bordered by non-word characters
@@ -1251,6 +522,7 @@ require_relative 'asciidoctor/core_ext'
1251
522
  # modules and helpers
1252
523
  require_relative 'asciidoctor/helpers'
1253
524
  require_relative 'asciidoctor/logging'
525
+ require_relative 'asciidoctor/rx'
1254
526
  require_relative 'asciidoctor/substitutors'
1255
527
  require_relative 'asciidoctor/version'
1256
528