asciidoctor 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of asciidoctor might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +85 -0
- data/README.adoc +79 -6
- data/Rakefile +22 -1
- data/benchmark/benchmark.rb +3 -1
- data/compat/asciidoc.conf +2 -2
- data/data/stylesheets/asciidoctor-default.css +3 -3
- data/features/step_definitions.rb +12 -1
- data/lib/asciidoctor.rb +74 -42
- data/lib/asciidoctor/abstract_block.rb +5 -1
- data/lib/asciidoctor/abstract_node.rb +40 -23
- data/lib/asciidoctor/attribute_list.rb +14 -5
- data/lib/asciidoctor/block.rb +45 -12
- data/lib/asciidoctor/callouts.rb +1 -0
- data/lib/asciidoctor/cli/invoker.rb +6 -2
- data/lib/asciidoctor/cli/options.rb +23 -9
- data/lib/asciidoctor/converter.rb +9 -19
- data/lib/asciidoctor/converter/base.rb +11 -14
- data/lib/asciidoctor/converter/composite.rb +8 -19
- data/lib/asciidoctor/converter/docbook45.rb +1 -0
- data/lib/asciidoctor/converter/docbook5.rb +24 -2
- data/lib/asciidoctor/converter/factory.rb +1 -0
- data/lib/asciidoctor/converter/html5.rb +61 -25
- data/lib/asciidoctor/converter/template.rb +19 -26
- data/lib/asciidoctor/document.rb +73 -45
- data/lib/asciidoctor/extensions.rb +121 -9
- data/lib/asciidoctor/helpers.rb +1 -0
- data/lib/asciidoctor/inline.rb +1 -0
- data/lib/asciidoctor/list.rb +1 -0
- data/lib/asciidoctor/opal_ext.rb +22 -0
- data/lib/asciidoctor/opal_ext/file.rb +26 -13
- data/lib/asciidoctor/parser.rb +15 -18
- data/lib/asciidoctor/path_resolver.rb +18 -0
- data/lib/asciidoctor/reader.rb +8 -9
- data/lib/asciidoctor/section.rb +5 -8
- data/lib/asciidoctor/stylesheets.rb +1 -0
- data/lib/asciidoctor/substitutors.rb +18 -18
- data/lib/asciidoctor/table.rb +2 -1
- data/lib/asciidoctor/timings.rb +1 -0
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +10 -11
- data/man/asciidoctor.adoc +80 -99
- data/test/attributes_test.rb +42 -0
- data/test/blocks_test.rb +19 -7
- data/test/document_test.rb +114 -0
- data/test/extensions_test.rb +100 -0
- data/test/fixtures/custom-docinfodir/basic-docinfo.html +1 -0
- data/test/fixtures/custom-docinfodir/docinfo.html +1 -0
- data/test/fixtures/hello-asciidoctor.pdf +0 -0
- data/test/invoker_test.rb +4 -3
- data/test/lists_test.rb +31 -5
- data/test/options_test.rb +1 -1
- data/test/paths_test.rb +21 -0
- data/test/preamble_test.rb +33 -0
- data/test/reader_test.rb +13 -0
- data/test/sections_test.rb +22 -0
- data/test/substitutions_test.rb +49 -0
- data/test/tables_test.rb +76 -0
- data/test/test_helper.rb +4 -2
- metadata +7 -5
- data/lib/asciidoctor/debug.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c5d135474454be23b11dfdcc8b7d24d55e4638f
|
4
|
+
data.tar.gz: 909678f3db8d1468040ee56257e16910093d2f8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c5883d45569bc9d4e5d55ba38abd919d6526f2762bccb28115d75ead73915b7688d75562f20ea65810fe0f2ff8f9d192cc4cbc96874acc857a86d8d704b725a
|
7
|
+
data.tar.gz: 3a8425493fe73e4125d43351e4a7f08df1c7ddbd927977efa36700b28f4665eb9f65dd0416c3d10240a464683a67a2f848e748a2186b6140f77836e1e16c5802
|
data/CHANGELOG.adoc
CHANGED
@@ -11,6 +11,91 @@ endif::[]
|
|
11
11
|
This document provides a high-level view of the changes introduced in Asciidoctor by release.
|
12
12
|
For a detailed view of what has changed, refer to the https://github.com/asciidoctor/asciidoctor/commits/master[commit history] on GitHub.
|
13
13
|
|
14
|
+
== 1.5.2 (2014-11-27) - @mojavelinux
|
15
|
+
|
16
|
+
Enhancements::
|
17
|
+
|
18
|
+
* add docinfo extension (@mogztter) (#1162)
|
19
|
+
* allow docinfo to be in separate directory from content, specified by `docinfodir` attribute (@mogztter) (#511)
|
20
|
+
* enable TeX equation auto-numbering if `eqnums` attribute is set (@jxxcarlson) (#1110)
|
21
|
+
|
22
|
+
Improvements::
|
23
|
+
|
24
|
+
* recognize `--` as valid line comment for callout numbers; make line comment configurable (#1068)
|
25
|
+
* upgrade highlight.js to version 8.4 (#1216)
|
26
|
+
* upgrade Font Awesome to version 4.2.0 (@clojens) (#1201)
|
27
|
+
* define JAVASCRIPT_PLATFORM constant to simplify conditional logic in the JavaScript environment (#897)
|
28
|
+
* provide access to destination directory, outfile and outdir via Document object (#1203)
|
29
|
+
* print encoding information in version report produced by `asciidoctor -v` (#1210)
|
30
|
+
* add intrinsic attribute named `cpp` with value `C++` (#1208)
|
31
|
+
* preserve URI targets passed to `stylesheet` and related attributes (#1192)
|
32
|
+
* allow numeric characters in block attribute name (#1103)
|
33
|
+
* support custom YouTube playlists (#1105)
|
34
|
+
* make start number for unique id generation configurable (#1148)
|
35
|
+
* normalize and force UTF-8 encoding of docinfo content (#831)
|
36
|
+
* allow subs and default_subs to be specified in Block constructor (#749)
|
37
|
+
* enhance error message when reading binary input files (@mogztter) (#1158)
|
38
|
+
* add `append` method as alias to `<<` method on AbstractBlock (#1085)
|
39
|
+
* assign value of `preface-title` as title of preface node (#1090)
|
40
|
+
* fix spacing around checkbox in checklist (#1138)
|
41
|
+
* automatically load Slim's include plugin when using slim templates (@jirutka) (#1151)
|
42
|
+
* mixin Slim helpers into execution scope of slim templates (@jirutka) (#1143)
|
43
|
+
* improve DocBook output for manpage doctype (@bk2204) (#1134, #1142)
|
44
|
+
|
45
|
+
Compliance::
|
46
|
+
|
47
|
+
* substitute attribute entry value in attributes defined outside of header (#1130)
|
48
|
+
* allow empty cell to appear at end of table row (#1106)
|
49
|
+
* only produce one row for table in CSV or DSV format with a single cell (#1180)
|
50
|
+
|
51
|
+
Bug fixes::
|
52
|
+
|
53
|
+
* add explicit to_s call to generate delimiter settings for MathJax config (#1198)
|
54
|
+
* fix includes that reference absolute Windows paths (#1144)
|
55
|
+
* apply DSL to extension block in a way compatible with Opal
|
56
|
+
|
57
|
+
Distribution Packages::
|
58
|
+
|
59
|
+
* http://rubygems.org/gems/asciidoctor[RubyGem (asciidoctor)]
|
60
|
+
* https://apps.fedoraproject.org/packages/rubygem-asciidoctor[Fedora (rubygem-asciidoctor)]
|
61
|
+
* http://packages.debian.org/sid/asciidoctor[Debian (asciidoctor)]
|
62
|
+
* http://packages.ubuntu.com/saucy/asciidoctor[Ubuntu (asciidoctor)]
|
63
|
+
|
64
|
+
https://github.com/asciidoctor/asciidoctor/issues?q=milestone%3Av1.5.2[issues resolved] |
|
65
|
+
https://github.com/asciidoctor/asciidoctor/releases/tag/v1.5.2[git tag] |
|
66
|
+
https://github.com/asciidoctor/asciidoctor/compare/v1.5.0...v1.5.2[full diff]
|
67
|
+
|
68
|
+
== 1.5.1 (2014-09-29) - @mojavelinux
|
69
|
+
|
70
|
+
Bug fixes::
|
71
|
+
|
72
|
+
* recognize tag directives inside comments within XML files for including tagged regions
|
73
|
+
* restore passthroughs inside footnotes when more than one footnote appears on the same line
|
74
|
+
* -S flag in cli recognizes safe mode name as lowercase string
|
75
|
+
* do not match # in character reference when looking for marked text
|
76
|
+
* add namespace to lang attribute in DocBook 5 backend
|
77
|
+
* restore missing space before conum on last line of listing when highlighting with Pygments
|
78
|
+
* place conums on correct lines when line numbers are enabled when highlighting with Pygments
|
79
|
+
* don't expand mailto links in print styles
|
80
|
+
|
81
|
+
Improvements::
|
82
|
+
|
83
|
+
* implement File.read in Node (JavaScript) environment
|
84
|
+
* assign sectnumlevels and toclevels values to maxdepth attribute on AsciiDoc processing instructions in DocBook output
|
85
|
+
* add test for usage of image block macro with data URI
|
86
|
+
* use badges from shields.io in README
|
87
|
+
|
88
|
+
Distribution Packages::
|
89
|
+
|
90
|
+
* http://rubygems.org/gems/asciidoctor[RubyGem (asciidoctor)]
|
91
|
+
* https://apps.fedoraproject.org/packages/rubygem-asciidoctor[Fedora (rubygem-asciidoctor)]
|
92
|
+
* http://packages.debian.org/sid/asciidoctor[Debian (asciidoctor)]
|
93
|
+
* http://packages.ubuntu.com/saucy/asciidoctor[Ubuntu (asciidoctor)]
|
94
|
+
|
95
|
+
https://github.com/asciidoctor/asciidoctor/issues?q=milestone%3Av1.5.1[issues resolved] |
|
96
|
+
https://github.com/asciidoctor/asciidoctor/releases/tag/v1.5.1[git tag] |
|
97
|
+
https://github.com/asciidoctor/asciidoctor/compare/v1.5.0...v1.5.1[full diff]
|
98
|
+
|
14
99
|
== 1.5.0 (2014-08-12) - @mojavelinux
|
15
100
|
|
16
101
|
Performance::
|
data/README.adoc
CHANGED
@@ -42,12 +42,11 @@ endif::[]
|
|
42
42
|
:uri-freesoftware: https://www.gnu.org/philosophy/free-sw.html
|
43
43
|
:uri-foundation: http://foundation.zurb.com
|
44
44
|
:uri-tilt: https://github.com/rtomayko/tilt
|
45
|
-
:uri-ruby: https://ruby-lang.org
|
46
45
|
// images:
|
47
|
-
:screenshot
|
46
|
+
:image-uri-screenshot: https://raw.githubusercontent.com/asciidoctor/asciidoctor/master/screenshot.png
|
48
47
|
|
49
48
|
{uri-project}[Asciidoctor] is a _fast_ text processor and publishing toolchain for converting {uri-what-is-asciidoc}[AsciiDoc] content to HTML5, DocBook 5 (or 4.5) and other formats.
|
50
|
-
Asciidoctor is written in
|
49
|
+
Asciidoctor is written in Ruby, packaged as a RubyGem and published to {uri-rubygem}[RubyGems.org].
|
51
50
|
The gem is also included in several Linux distributions, including Fedora, Debian and Ubuntu.
|
52
51
|
Asciidoctor is open source, {uri-repo}[hosted on GitHub] and released under the MIT license.
|
53
52
|
|
@@ -62,8 +61,19 @@ We use http://opalrb.org[Opal] to transcompile the Ruby source to JavaScript to
|
|
62
61
|
Asciidoctor.js is used to power the AsciiDoc preview extensions for Chrome, Atom, Brackets and other web-based tooling.
|
63
62
|
====
|
64
63
|
|
64
|
+
.Key documentation
|
65
|
+
[square]
|
66
|
+
* {uri-docs}/what-is-asciidoc[What is Asciidoc?]
|
67
|
+
* {uri-docs}/asciidoc-writers-guide[AsciiDoc Writer's Guide]
|
68
|
+
* {uri-docs}/asciidoc-syntax-quick-reference[AsciiDoc Syntax Reference]
|
69
|
+
* {uri-docs}/user-manual[Asciidoctor User Manual]
|
70
|
+
|
65
71
|
ifdef::env-github[]
|
66
|
-
|
72
|
+
.*Project Health*
|
73
|
+
image:http://img.shields.io/travis/asciidoctor/asciidoctor/master.svg[Build Status, link=https://travis-ci.org/asciidoctor/asciidoctor]
|
74
|
+
//image:http://img.shields.io/coveralls/asciidoctor/asciidoctor/master.svg[Coverage Status, link=https://coveralls.io/r/asciidoctor/asciidoctor]
|
75
|
+
image:https://codeclimate.com/github/asciidoctor/asciidoctor/badges/gpa.svg[Code Climate, link="https://codeclimate.com/github/asciidoctor/asciidoctor"]
|
76
|
+
image:http://inch-ci.org/github/asciidoctor/asciidoctor.svg?branch=master[Inline docs, link="http://inch-ci.org/github/asciidoctor/asciidoctor"]
|
67
77
|
endif::env-github[]
|
68
78
|
|
69
79
|
== The Big Picture
|
@@ -71,7 +81,7 @@ endif::env-github[]
|
|
71
81
|
Asciidoctor reads content written in plain text, as shown in the panel on the left in the image below, and converts it to HTML5, as shown rendered in the right panel.
|
72
82
|
Asciidoctor adds a default stylesheet to the HTML5 document, as shown, to provide a pleasant out-of-the-box experience.
|
73
83
|
|
74
|
-
image::{screenshot
|
84
|
+
image::{image-uri-screenshot}[Preview of AsciiDoc source and corresponding rendered HTML]
|
75
85
|
|
76
86
|
== AsciiDoc Processing
|
77
87
|
|
@@ -86,7 +96,7 @@ Asciidoctor also offers a modern, responsive theme based on {uri-foundation}[Fou
|
|
86
96
|
|
87
97
|
== Requirements
|
88
98
|
|
89
|
-
Asciidoctor works on Linux, OSX (Mac) and Windows and requires one of the following implementations of
|
99
|
+
Asciidoctor works on Linux, OSX (Mac) and Windows and requires one of the following implementations of Ruby:
|
90
100
|
|
91
101
|
* MRI (Ruby 1.8.7, 1.9.3, 2.0.0 & 2.1.2)
|
92
102
|
* JRuby 1.7 (Ruby 1.8 and 1.9 modes)
|
@@ -330,6 +340,69 @@ The project was initiated in 2012 by https://github.com/erebor[Ryan Waldron] and
|
|
330
340
|
|
331
341
|
== Changelog
|
332
342
|
|
343
|
+
== 1.5.2 (2014-11-27) - @mojavelinux
|
344
|
+
|
345
|
+
Enhancements::
|
346
|
+
|
347
|
+
* add docinfo extension (@mogztter) (#1162)
|
348
|
+
* allow docinfo to be in separate directory from content, specified by `docinfodir` attribute (@mogztter) (#511)
|
349
|
+
* enable TeX equation auto-numbering if `eqnums` attribute is set (@jxxcarlson) (#1110)
|
350
|
+
|
351
|
+
Improvements::
|
352
|
+
|
353
|
+
* recognize `--` as valid line comment for callout numbers; make line comment configurable (#1068)
|
354
|
+
* upgrade highlight.js to version 8.4 (#1216)
|
355
|
+
* upgrade Font Awesome to version 4.2.0 (@clojens) (#1201)
|
356
|
+
* define JAVASCRIPT_PLATFORM constant to simplify conditional logic in the JavaScript environment (#897)
|
357
|
+
* provide access to destination directory, outfile and outdir via Document object (#1203)
|
358
|
+
* print encoding information in version report produced by `asciidoctor -v` (#1210)
|
359
|
+
* add intrinsic attribute named `cpp` with value `C++` (#1208)
|
360
|
+
* preserve URI targets passed to `stylesheet` and related attributes (#1192)
|
361
|
+
* allow numeric characters in block attribute name (#1103)
|
362
|
+
* support custom YouTube playlists (#1105)
|
363
|
+
* make start number for unique id generation configurable (#1148)
|
364
|
+
* normalize and force UTF-8 encoding of docinfo content (#831)
|
365
|
+
* allow subs and default_subs to be specified in Block constructor (#749)
|
366
|
+
* enhance error message when reading binary input files (@mogztter) (#1158)
|
367
|
+
* add `append` method as alias to `<<` method on AbstractBlock (#1085)
|
368
|
+
* assign value of `preface-title` as title of preface node (#1090)
|
369
|
+
* fix spacing around checkbox in checklist (#1138)
|
370
|
+
* automatically load Slim's include plugin when using slim templates (@jirutka) (#1151)
|
371
|
+
* mixin Slim helpers into execution scope of slim templates (@jirutka) (#1143)
|
372
|
+
* improve DocBook output for manpage doctype (@bk2204) (#1134, #1142)
|
373
|
+
|
374
|
+
Compliance::
|
375
|
+
|
376
|
+
* substitute attribute entry value in attributes defined outside of header (#1130)
|
377
|
+
* allow empty cell to appear at end of table row (#1106)
|
378
|
+
* only produce one row for table in CSV or DSV format with a single cell (#1180)
|
379
|
+
|
380
|
+
Bug fixes::
|
381
|
+
|
382
|
+
* add explicit to_s call to generate delimiter settings for MathJax config (#1198)
|
383
|
+
* fix includes that reference absolute Windows paths (#1144)
|
384
|
+
* apply DSL to extension block in a way compatible with Opal
|
385
|
+
|
386
|
+
== 1.5.1 (2014-09-29) - @mojavelinux
|
387
|
+
|
388
|
+
Bug fixes::
|
389
|
+
|
390
|
+
* recognize tag directives inside comments within XML files for including tagged regions
|
391
|
+
* restore passthroughs inside footnotes when more than one footnote appears on the same line
|
392
|
+
* -S flag in cli recognizes safe mode name as lowercase string
|
393
|
+
* do not match # in character reference when looking for marked text
|
394
|
+
* add namespace to lang attribute in DocBook 5 backend
|
395
|
+
* restore missing space before conum on last line of listing when highlighting with Pygments
|
396
|
+
* place conums on correct lines when line numbers are enabled when highlighting with Pygments
|
397
|
+
* don't expand mailto links in print styles
|
398
|
+
|
399
|
+
Improvements::
|
400
|
+
|
401
|
+
* implement File.read in Node (JavaScript) environment
|
402
|
+
* assign sectnumlevels and toclevels values to maxdepth attribute on AsciiDoc processing instructions in DocBook output
|
403
|
+
* add test for usage of image block macro with data URI
|
404
|
+
* use badges from shields.io in README
|
405
|
+
|
333
406
|
=== 1.5.0 (2014-08-12) - @mojavelinux
|
334
407
|
|
335
408
|
Performance::
|
data/Rakefile
CHANGED
@@ -19,7 +19,7 @@ begin
|
|
19
19
|
require 'rake/testtask'
|
20
20
|
Rake::TestTask.new(:test) do |test|
|
21
21
|
prepare_test_env
|
22
|
-
puts
|
22
|
+
puts %(LANG: #{ENV['LANG']}) if ENV.key? 'TRAVIS_BUILD_ID'
|
23
23
|
test.libs << 'test'
|
24
24
|
test.pattern = 'test/**/*_test.rb'
|
25
25
|
test.verbose = true
|
@@ -52,6 +52,27 @@ begin
|
|
52
52
|
rescue LoadError
|
53
53
|
end
|
54
54
|
|
55
|
+
def ci_setup_tasks
|
56
|
+
tasks = []
|
57
|
+
begin
|
58
|
+
require 'ci/reporter/rake/minitest'
|
59
|
+
tasks << 'ci:setup:minitest'
|
60
|
+
# FIXME reporter for Cucumber tests not activating
|
61
|
+
#require 'ci/reporter/rake/cucumber'
|
62
|
+
#tasks << 'ci:setup:cucumber'
|
63
|
+
rescue LoadError
|
64
|
+
end if ENV['SHIPPABLE'] && RUBY_VERSION >= '1.9.3'
|
65
|
+
tasks
|
66
|
+
end
|
67
|
+
|
68
|
+
desc 'Activates coverage and JUnit-style XML reports for tests'
|
69
|
+
task :coverage => ci_setup_tasks do
|
70
|
+
# exclude coverage run for Ruby 1.8.7 or (disabled) if running on Travis CI
|
71
|
+
ENV['COVERAGE'] = 'true' if RUBY_VERSION >= '1.9.3' # && (ENV['SHIPPABLE'] || !ENV['TRAVIS_BUILD_ID'])
|
72
|
+
ENV['CI_REPORTS'] = 'shippable/testresults'
|
73
|
+
ENV['COVERAGE_REPORTS'] = 'shippable/codecoverage'
|
74
|
+
end
|
75
|
+
|
55
76
|
namespace :test do
|
56
77
|
desc 'Run unit and feature tests'
|
57
78
|
task :all => [:test,:features]
|
data/benchmark/benchmark.rb
CHANGED
@@ -21,10 +21,12 @@ To get the best results under MRI, tune Ruby using environment variables as foll
|
|
21
21
|
$ RUBY_GC_MALLOC_LIMIT=90000000 RUBY_FREE_MIN=650000 ruby benchmark.rb userguide-loop 10
|
22
22
|
|
23
23
|
.Ruby >= 2.1
|
24
|
-
$ RUBY_GC_MALLOC_LIMIT=128000000 RUBY_GC_OLDMALLOC_LIMIT=128000000 RUBY_GC_HEAP_INIT_SLOTS=800000 RUBY_GC_HEAP_FREE_SLOTS=800000 RUBY_GC_HEAP_GROWTH_MAX_SLOTS=250000 RUBY_GC_HEAP_GROWTH_FACTOR=
|
24
|
+
$ RUBY_GC_MALLOC_LIMIT=128000000 RUBY_GC_OLDMALLOC_LIMIT=128000000 RUBY_GC_HEAP_INIT_SLOTS=800000 RUBY_GC_HEAP_FREE_SLOTS=800000 RUBY_GC_HEAP_GROWTH_MAX_SLOTS=250000 RUBY_GC_HEAP_GROWTH_FACTOR=2 ruby benchmark.rb userguide-loop 10
|
25
25
|
|
26
26
|
Asciidoctor starts with ~ 12,500 objects, adds ~ 300,000 each run, so tune RUBY_GC_HEAP_* accordingly
|
27
27
|
|
28
|
+
See http://globaldev.co.uk/2014/05/ruby-2-1-in-detail/#gc-tuning-environment-variables
|
29
|
+
|
28
30
|
Execute Ruby using the `--disable=gems` flag to speed up the initial load time, as shown below:
|
29
31
|
|
30
32
|
$ ruby --disable=gems ...
|
data/compat/asciidoc.conf
CHANGED
@@ -10,15 +10,15 @@ newline=\n
|
|
10
10
|
[attributes]
|
11
11
|
# make html5 the default html backend
|
12
12
|
backend-alias-html=html5
|
13
|
-
apostrophe='
|
14
13
|
asterisk=*
|
15
14
|
backtick=`
|
16
15
|
brvbar=¦
|
17
16
|
caret=^
|
18
17
|
# plus introduced in AsciiDoc 8.6.9
|
19
18
|
plus=+
|
20
|
-
|
19
|
+
blank=
|
21
20
|
tilde=~
|
21
|
+
cpp=C++
|
22
22
|
user-home={eval:os.path.expanduser('~')}
|
23
23
|
vbar=|
|
24
24
|
# NOTE use -a no-inline-literal to set compat-mode to default when using AsciiDoc Python
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */
|
2
2
|
/* Remove the comments around the @import statement below when using this as a custom stylesheet */
|
3
|
-
/*@import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic
|
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";*/
|
4
4
|
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}
|
5
5
|
audio,canvas,video{display:inline-block}
|
6
6
|
audio:not([controls]){display:none;height:0}
|
@@ -264,8 +264,8 @@ dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}
|
|
264
264
|
ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}
|
265
265
|
ul.unstyled,ol.unnumbered,ul.checklist,ul.none{list-style-type:none}
|
266
266
|
ul.unstyled,ol.unnumbered,ul.checklist{margin-left:.625em}
|
267
|
-
ul.checklist li>p:first-child>.fa-
|
268
|
-
ul.checklist li>p:first-child>input[type="checkbox"]:first-child{position:relative;top:1px}
|
267
|
+
ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1em;font-size:.85em}
|
268
|
+
ul.checklist li>p:first-child>input[type="checkbox"]:first-child{width:1em;position:relative;top:1px}
|
269
269
|
ul.inline{margin:0 auto .625em auto;margin-left:-1.375em;margin-right:0;padding:0;list-style:none;overflow:hidden}
|
270
270
|
ul.inline>li{list-style:none;float:left;margin-left:1.375em;display:block}
|
271
271
|
ul.inline>li>*{display:block}
|
@@ -1,4 +1,15 @@
|
|
1
|
-
|
1
|
+
# encoding: UTF-8
|
2
|
+
ASCIIDOCTOR_PROJECT_DIR = File.dirname File.dirname(__FILE__)
|
3
|
+
Dir.chdir ASCIIDOCTOR_PROJECT_DIR
|
4
|
+
|
5
|
+
if RUBY_VERSION < '1.9'
|
6
|
+
require 'rubygems'
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'simplecov' if ENV['COVERAGE'] == 'true'
|
10
|
+
|
11
|
+
require File.join(ASCIIDOCTOR_PROJECT_DIR, 'lib', 'asciidoctor')
|
12
|
+
|
2
13
|
require 'rspec/expectations'
|
3
14
|
require 'tilt'
|
4
15
|
require 'slim'
|
data/lib/asciidoctor.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
RUBY_ENGINE = 'unknown' unless defined? RUBY_ENGINE
|
2
3
|
RUBY_ENGINE_OPAL = (RUBY_ENGINE == 'opal')
|
3
4
|
RUBY_ENGINE_JRUBY = (RUBY_ENGINE == 'jruby')
|
@@ -98,7 +99,7 @@ module Asciidoctor
|
|
98
99
|
|
99
100
|
# Flags to control compliance with the behavior of AsciiDoc
|
100
101
|
module Compliance
|
101
|
-
@keys =
|
102
|
+
@keys = ::Set.new
|
102
103
|
class << self
|
103
104
|
attr :keys
|
104
105
|
end
|
@@ -106,7 +107,7 @@ module Asciidoctor
|
|
106
107
|
# Defines a new compliance key and assigns an initial value.
|
107
108
|
def self.define key, value
|
108
109
|
if key == :keys || (self.respond_to? key)
|
109
|
-
raise ::ArgumentError, %(
|
110
|
+
raise ::ArgumentError, %(illegal key name: #{key})
|
110
111
|
end
|
111
112
|
instance_variable_set %(@#{key}), value
|
112
113
|
class << self; self; end.send :attr_accessor, key
|
@@ -156,8 +157,14 @@ module Asciidoctor
|
|
156
157
|
|
157
158
|
# Asciidoctor will allow the id, role and options to be set
|
158
159
|
# on blocks using a shorthand syntax (e.g., #idname.rolename%optionname)
|
160
|
+
# Compliance value: false
|
159
161
|
define :shorthand_property_syntax, true
|
160
162
|
|
163
|
+
# Asciidoctor will start counting at the following number
|
164
|
+
# when creating a unique id when there is a conflict
|
165
|
+
# Compliance value: 2
|
166
|
+
define :unique_id_start_index, 2
|
167
|
+
|
161
168
|
# Asciidoctor will recognize commonly-used Markdown syntax
|
162
169
|
# to the degree it does not interfere with existing
|
163
170
|
# AsciiDoc syntax and behavior.
|
@@ -651,6 +658,7 @@ module Asciidoctor
|
|
651
658
|
# * Foo
|
652
659
|
# - Foo
|
653
660
|
#
|
661
|
+
# NOTE we know trailing (.*) will match at least one character because we strip trailing spaces
|
654
662
|
UnorderedListRx = /^#{CG_BLANK}*(-|\*{1,5})#{CG_BLANK}+(.*)$/
|
655
663
|
|
656
664
|
# Matches an ordered list item (explicit numbering or up to 5 consecutive dots).
|
@@ -666,6 +674,7 @@ module Asciidoctor
|
|
666
674
|
# I. Foo (upperroman)
|
667
675
|
#
|
668
676
|
# NOTE leading space match is not always necessary, but is used for list reader
|
677
|
+
# NOTE we know trailing (.*) will match at least one character because we strip trailing spaces
|
669
678
|
OrderedListRx = /^#{CG_BLANK}*(\.{1,5}|\d+\.|[a-zA-Z]\.|[IVXivx]+\))#{CG_BLANK}+(.*)$/
|
670
679
|
|
671
680
|
# Matches the ordinals for each type of ordered list.
|
@@ -720,20 +729,24 @@ module Asciidoctor
|
|
720
729
|
#
|
721
730
|
# <1> Foo
|
722
731
|
#
|
732
|
+
# NOTE we know trailing (.*) will match at least one character because we strip trailing spaces
|
723
733
|
CalloutListRx = /^<?(\d+)>#{CG_BLANK}+(.*)/
|
724
734
|
|
725
735
|
# Matches a callout reference inside literal text.
|
726
736
|
#
|
727
737
|
# Examples
|
728
|
-
# <1> (optionally prefixed by //,
|
738
|
+
# <1> (optionally prefixed by //, #, -- or ;; line comment chars)
|
729
739
|
# <1> <2> (multiple callouts on one line)
|
730
740
|
# <!--1--> (for XML-based languages)
|
731
741
|
#
|
732
|
-
# NOTE
|
733
|
-
|
734
|
-
|
742
|
+
# NOTE extract regexps are applied line-by-line, so we can use $ as end-of-line char
|
743
|
+
CalloutExtractRx = /(?:(?:\/\/|#|--|;;) ?)?(\\)?<!?(--|)(\d+)\2>(?=(?: ?\\?<!?\2\d+\2>)*$)/
|
744
|
+
CalloutExtractRxt = "(\\\\)?<()(\\d+)>(?=(?: ?\\\\?<\\d+>)*$)"
|
745
|
+
# NOTE special characters have not been replaced when scanning
|
735
746
|
CalloutQuickScanRx = /\\?<!?(--|)(\d+)\1>(?=(?: ?\\?<!?\1\d+\1>)*#{CC_EOL})/
|
736
|
-
|
747
|
+
# NOTE special characters have already been replaced when converting to an SGML format
|
748
|
+
CalloutSourceRx = /(?:(?:\/\/|#|--|;;) ?)?(\\)?<!?(--|)(\d+)\2>(?=(?: ?\\?<!?\2\d+\2>)*#{CC_EOL})/
|
749
|
+
CalloutSourceRxt = "(\\\\)?<()(\\d+)>(?=(?: ?\\\\?<\\d+>)*#{CC_EOL})"
|
737
750
|
|
738
751
|
# A Hash of regexps for lists used for dynamic access.
|
739
752
|
ListRxMap = {
|
@@ -1073,9 +1086,12 @@ module Asciidoctor
|
|
1073
1086
|
# Examples
|
1074
1087
|
# http://domain
|
1075
1088
|
# https://domain
|
1089
|
+
# file:///path
|
1076
1090
|
# data:info
|
1077
1091
|
#
|
1078
|
-
|
1092
|
+
# not c:/sample.adoc or c:\sample.adoc
|
1093
|
+
#
|
1094
|
+
UriSniffRx = %r{^#{CG_ALPHA}[#{CC_ALNUM}.+-]+:/{0,2}}
|
1079
1095
|
|
1080
1096
|
# Detects the end of an implicit URI in the text
|
1081
1097
|
#
|
@@ -1125,12 +1141,11 @@ module Asciidoctor
|
|
1125
1141
|
'asterisk' => '*',
|
1126
1142
|
'tilde' => '~',
|
1127
1143
|
'plus' => '+',
|
1128
|
-
'apostrophe' => '\'',
|
1129
1144
|
'backslash' => '\\',
|
1130
1145
|
'backtick' => '`',
|
1146
|
+
'blank' => '',
|
1131
1147
|
'empty' => '',
|
1132
1148
|
'sp' => ' ',
|
1133
|
-
'space' => ' ',
|
1134
1149
|
'two-colons' => '::',
|
1135
1150
|
'two-semicolons' => ';;',
|
1136
1151
|
'nbsp' => ' ',
|
@@ -1144,6 +1159,7 @@ module Asciidoctor
|
|
1144
1159
|
'rdquo' => '”',
|
1145
1160
|
'wj' => '⁠',
|
1146
1161
|
'brvbar' => '¦',
|
1162
|
+
'cpp' => 'C++',
|
1147
1163
|
'amp' => '&',
|
1148
1164
|
'lt' => '<',
|
1149
1165
|
'gt' => '>'
|
@@ -1269,15 +1285,15 @@ module Asciidoctor
|
|
1269
1285
|
|
1270
1286
|
attributes = options[:attributes] = if !(attrs = options[:attributes])
|
1271
1287
|
{}
|
1272
|
-
elsif
|
1288
|
+
elsif ::Hash === attrs || (::RUBY_ENGINE_JRUBY && ::Java::JavaUtil::Map === attrs)
|
1273
1289
|
attrs.dup
|
1274
|
-
elsif
|
1290
|
+
elsif ::Array === attrs
|
1275
1291
|
attrs.inject({}) do |accum, entry|
|
1276
1292
|
k, v = entry.split '=', 2
|
1277
1293
|
accum[k] = v || ''
|
1278
1294
|
accum
|
1279
1295
|
end
|
1280
|
-
elsif
|
1296
|
+
elsif ::String === attrs
|
1281
1297
|
# convert non-escaped spaces into null character, so we split on the
|
1282
1298
|
# correct spaces chars, and restore escaped spaces
|
1283
1299
|
capture_1 = ::RUBY_ENGINE_OPAL ? '$1' : '\1'
|
@@ -1301,11 +1317,11 @@ module Asciidoctor
|
|
1301
1317
|
end
|
1302
1318
|
|
1303
1319
|
lines = nil
|
1304
|
-
if
|
1305
|
-
|
1320
|
+
if ::File === input
|
1321
|
+
# TODO cli checks if input path can be read and is file, but might want to add check to API
|
1322
|
+
input_path = ::File.expand_path input.path
|
1306
1323
|
input_mtime = input.mtime
|
1307
|
-
|
1308
|
-
input_path = input.path
|
1324
|
+
lines = input.readlines
|
1309
1325
|
# hold off on setting infile and indir until we get a better sense of their purpose
|
1310
1326
|
attributes['docfile'] = input_path
|
1311
1327
|
attributes['docdir'] = ::File.dirname input_path
|
@@ -1321,12 +1337,12 @@ module Asciidoctor
|
|
1321
1337
|
rescue
|
1322
1338
|
end
|
1323
1339
|
lines = input.readlines
|
1324
|
-
elsif
|
1340
|
+
elsif ::String === input
|
1325
1341
|
lines = input.lines.entries
|
1326
|
-
elsif
|
1342
|
+
elsif ::Array === input
|
1327
1343
|
lines = input.dup
|
1328
1344
|
else
|
1329
|
-
raise ::ArgumentError, %(
|
1345
|
+
raise ::ArgumentError, %(unsupported input type: #{input.class})
|
1330
1346
|
end
|
1331
1347
|
|
1332
1348
|
if timings
|
@@ -1334,9 +1350,16 @@ module Asciidoctor
|
|
1334
1350
|
timings.start :parse
|
1335
1351
|
end
|
1336
1352
|
|
1337
|
-
|
1353
|
+
if options[:parse] == false
|
1354
|
+
doc = Document.new lines, options
|
1355
|
+
else
|
1356
|
+
doc = (Document.new lines, options).parse
|
1357
|
+
end
|
1358
|
+
|
1338
1359
|
timings.record :parse if timings
|
1339
1360
|
doc
|
1361
|
+
rescue => e
|
1362
|
+
raise e.class, %(asciidoctor: FAILED: #{attributes.fetch 'docfile', '<stdin>'}: Failed to parse source, #{e.message})
|
1340
1363
|
end
|
1341
1364
|
|
1342
1365
|
# Public: Parse the contents of the AsciiDoc source file into an Asciidoctor::Document
|
@@ -1393,7 +1416,7 @@ module Asciidoctor
|
|
1393
1416
|
|
1394
1417
|
case to_file
|
1395
1418
|
when true, nil
|
1396
|
-
write_to_same_dir = !to_dir &&
|
1419
|
+
write_to_same_dir = !to_dir && ::File === input
|
1397
1420
|
stream_output = false
|
1398
1421
|
write_to_target = to_dir
|
1399
1422
|
to_file = nil
|
@@ -1402,27 +1425,43 @@ module Asciidoctor
|
|
1402
1425
|
stream_output = false
|
1403
1426
|
write_to_target = false
|
1404
1427
|
to_file = nil
|
1428
|
+
when '/dev/null'
|
1429
|
+
return self.load input, options
|
1405
1430
|
else
|
1406
1431
|
write_to_same_dir = false
|
1407
1432
|
stream_output = to_file.respond_to? :write
|
1408
1433
|
write_to_target = stream_output ? false : to_file
|
1409
1434
|
end
|
1410
1435
|
|
1411
|
-
|
1412
|
-
options[:header_footer] = true
|
1436
|
+
unless options.key? :header_footer
|
1437
|
+
options[:header_footer] = true if write_to_same_dir || write_to_target
|
1438
|
+
end
|
1439
|
+
|
1440
|
+
# NOTE at least make intended target directory available, if there is one
|
1441
|
+
if write_to_same_dir
|
1442
|
+
input_path = ::File.expand_path input.path
|
1443
|
+
options[:to_dir] = (outdir = ::File.dirname input_path)
|
1444
|
+
elsif write_to_target
|
1445
|
+
if to_dir
|
1446
|
+
if to_file
|
1447
|
+
options[:to_dir] = ::File.dirname ::File.expand_path(::File.join to_dir, to_file)
|
1448
|
+
else
|
1449
|
+
options[:to_dir] = ::File.expand_path to_dir
|
1450
|
+
end
|
1451
|
+
elsif to_file
|
1452
|
+
options[:to_dir] = ::File.dirname ::File.expand_path to_file
|
1453
|
+
end
|
1454
|
+
else
|
1455
|
+
options[:to_dir] = nil
|
1413
1456
|
end
|
1414
1457
|
|
1415
1458
|
doc = self.load input, options
|
1416
1459
|
|
1417
|
-
if
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
outfile = ::File.join ::File.dirname(infile), %(#{doc.attributes['docname']}#{doc.attributes['outfilesuffix']})
|
1422
|
-
if outfile == infile
|
1423
|
-
raise ::IOError, 'Input file and output file are the same!'
|
1460
|
+
if write_to_same_dir
|
1461
|
+
outfile = ::File.join outdir, %(#{doc.attributes['docname']}#{doc.attributes['outfilesuffix']})
|
1462
|
+
if outfile == input_path
|
1463
|
+
raise ::IOError, %(input file and output file cannot be the same: #{outfile})
|
1424
1464
|
end
|
1425
|
-
outdir = ::File.dirname outfile
|
1426
1465
|
elsif write_to_target
|
1427
1466
|
working_dir = options.has_key?(:base_dir) ? ::File.expand_path(options[:base_dir]) : ::File.expand_path(::Dir.pwd)
|
1428
1467
|
# QUESTION should the jail be the working_dir or doc.base_dir???
|
@@ -1456,15 +1495,12 @@ module Asciidoctor
|
|
1456
1495
|
end
|
1457
1496
|
|
1458
1497
|
timings.start :convert if timings
|
1459
|
-
|
1498
|
+
opts = outfile && !stream_output ? { 'outfile' => outfile, 'outdir' => outdir } : {}
|
1499
|
+
output = doc.convert opts
|
1460
1500
|
timings.record :convert if timings
|
1461
1501
|
|
1462
1502
|
if outfile
|
1463
1503
|
timings.start :write if timings
|
1464
|
-
unless stream_output
|
1465
|
-
doc.attributes['outfile'] = outfile
|
1466
|
-
doc.attributes['outdir'] = outdir
|
1467
|
-
end
|
1468
1504
|
doc.write output, outfile
|
1469
1505
|
timings.record :write if timings
|
1470
1506
|
|
@@ -1476,9 +1512,7 @@ module Asciidoctor
|
|
1476
1512
|
copy_coderay_stylesheet = (doc.attr? 'source-highlighter', 'coderay') && (doc.attr 'coderay-css', 'class') == 'class'
|
1477
1513
|
copy_pygments_stylesheet = (doc.attr? 'source-highlighter', 'pygments') && (doc.attr 'pygments-css', 'class') == 'class'
|
1478
1514
|
if copy_asciidoctor_stylesheet || copy_user_stylesheet || copy_coderay_stylesheet || copy_pygments_stylesheet
|
1479
|
-
|
1480
|
-
stylesoutdir = doc.normalize_system_path(doc.attr('stylesdir'), outdir,
|
1481
|
-
doc.safe >= SafeMode::SAFE ? outdir : nil)
|
1515
|
+
stylesoutdir = doc.normalize_system_path(doc.attr('stylesdir'), outdir, doc.safe >= SafeMode::SAFE ? outdir : nil)
|
1482
1516
|
Helpers.mkdir_p stylesoutdir if mkdirs
|
1483
1517
|
|
1484
1518
|
if copy_asciidoctor_stylesheet
|
@@ -1534,11 +1568,9 @@ module Asciidoctor
|
|
1534
1568
|
end
|
1535
1569
|
|
1536
1570
|
if RUBY_ENGINE == 'opal'
|
1537
|
-
require 'asciidoctor/debug'
|
1538
1571
|
require 'asciidoctor/version'
|
1539
1572
|
require 'asciidoctor/timings'
|
1540
1573
|
else
|
1541
|
-
autoload :Debug, 'asciidoctor/debug'
|
1542
1574
|
autoload :VERSION, 'asciidoctor/version'
|
1543
1575
|
autoload :Timings, 'asciidoctor/timings'
|
1544
1576
|
end
|