asciidoctor 1.5.8 → 2.0.0.rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +162 -17
- data/LICENSE +1 -1
- data/README-de.adoc +12 -13
- data/README-fr.adoc +11 -12
- data/README-jp.adoc +11 -12
- data/README-zh_CN.adoc +12 -13
- data/README.adoc +6 -7
- data/asciidoctor.gemspec +19 -24
- data/bin/asciidoctor +5 -4
- data/data/reference/syntax.adoc +283 -0
- data/data/stylesheets/asciidoctor-default.css +56 -52
- data/data/stylesheets/coderay-asciidoctor.css +7 -9
- data/lib/asciidoctor.rb +171 -232
- data/lib/asciidoctor/abstract_block.rb +96 -105
- data/lib/asciidoctor/abstract_node.rb +118 -139
- data/lib/asciidoctor/attribute_list.rb +10 -14
- data/lib/asciidoctor/block.rb +20 -19
- data/lib/asciidoctor/callouts.rb +4 -2
- data/lib/asciidoctor/cli.rb +3 -2
- data/lib/asciidoctor/cli/invoker.rb +14 -21
- data/lib/asciidoctor/cli/options.rb +64 -54
- data/lib/asciidoctor/converter.rb +357 -185
- data/lib/asciidoctor/converter/composite.rb +40 -48
- data/lib/asciidoctor/converter/docbook5.rb +604 -640
- data/lib/asciidoctor/converter/html5.rb +949 -963
- data/lib/asciidoctor/converter/manpage.rb +569 -548
- data/lib/asciidoctor/converter/template.rb +231 -272
- data/lib/asciidoctor/core_ext.rb +5 -18
- data/lib/asciidoctor/core_ext/float/truncate.rb +19 -0
- data/lib/asciidoctor/core_ext/match_data/names.rb +7 -0
- data/lib/asciidoctor/core_ext/nil_or_empty.rb +1 -0
- data/lib/asciidoctor/core_ext/regexp/is_match.rb +4 -2
- data/lib/asciidoctor/document.rb +399 -377
- data/lib/asciidoctor/extensions.rb +72 -140
- data/lib/asciidoctor/helpers.rb +122 -83
- data/lib/asciidoctor/inline.rb +5 -1
- data/lib/asciidoctor/list.rb +13 -11
- data/lib/asciidoctor/logging.rb +17 -16
- data/lib/asciidoctor/parser.rb +390 -423
- data/lib/asciidoctor/path_resolver.rb +10 -5
- data/lib/asciidoctor/reader.rb +286 -263
- data/lib/asciidoctor/rouge_ext.rb +39 -0
- data/lib/asciidoctor/section.rb +9 -8
- data/lib/asciidoctor/stylesheets.rb +19 -37
- data/lib/asciidoctor/substitutors.rb +364 -509
- data/lib/asciidoctor/syntax_highlighter.rb +238 -0
- data/lib/asciidoctor/syntax_highlighter/coderay.rb +87 -0
- data/lib/asciidoctor/syntax_highlighter/highlightjs.rb +26 -0
- data/lib/asciidoctor/syntax_highlighter/html_pipeline.rb +10 -0
- data/lib/asciidoctor/syntax_highlighter/prettify.rb +27 -0
- data/lib/asciidoctor/syntax_highlighter/pygments.rb +149 -0
- data/lib/asciidoctor/syntax_highlighter/rouge.rb +129 -0
- data/lib/asciidoctor/table.rb +73 -66
- data/lib/asciidoctor/timings.rb +4 -2
- data/lib/asciidoctor/version.rb +2 -1
- data/lib/asciidoctor/writer.rb +30 -0
- data/man/asciidoctor.1 +19 -15
- data/man/asciidoctor.adoc +14 -12
- metadata +69 -216
- data/CONTRIBUTING.adoc +0 -185
- data/Gemfile +0 -60
- data/Rakefile +0 -129
- data/bin/asciidoctor-safe +0 -15
- data/features/open_block.feature +0 -92
- data/features/pass_block.feature +0 -66
- data/features/step_definitions.rb +0 -49
- data/features/text_formatting.feature +0 -57
- data/features/xref.feature +0 -1039
- data/lib/asciidoctor/converter/base.rb +0 -59
- data/lib/asciidoctor/converter/docbook45.rb +0 -93
- data/lib/asciidoctor/converter/factory.rb +0 -226
- data/lib/asciidoctor/core_ext/1.8.7/base64/strict_encode64.rb +0 -6
- data/lib/asciidoctor/core_ext/1.8.7/concurrent/hash.rb +0 -5
- data/lib/asciidoctor/core_ext/1.8.7/hash/key.rb +0 -4
- data/lib/asciidoctor/core_ext/1.8.7/io/binread.rb +0 -6
- data/lib/asciidoctor/core_ext/1.8.7/io/write.rb +0 -5
- data/lib/asciidoctor/core_ext/1.8.7/string/chr.rb +0 -6
- data/lib/asciidoctor/core_ext/1.8.7/string/limit_bytesize.rb +0 -29
- data/lib/asciidoctor/core_ext/1.8.7/symbol/empty.rb +0 -6
- data/lib/asciidoctor/core_ext/1.8.7/symbol/length.rb +0 -6
- data/lib/asciidoctor/core_ext/string/limit_bytesize.rb +0 -10
- data/test/api_test.rb +0 -1240
- data/test/attribute_list_test.rb +0 -242
- data/test/attributes_test.rb +0 -1623
- data/test/blocks_test.rb +0 -3870
- data/test/converter_test.rb +0 -470
- data/test/document_test.rb +0 -1853
- data/test/extensions_test.rb +0 -1560
- data/test/fixtures/asciidoc_index.txt +0 -521
- data/test/fixtures/basic-docinfo-footer.html +0 -6
- data/test/fixtures/basic-docinfo-footer.xml +0 -8
- data/test/fixtures/basic-docinfo.html +0 -1
- data/test/fixtures/basic-docinfo.xml +0 -4
- data/test/fixtures/basic.asciidoc +0 -5
- data/test/fixtures/chapter-a.adoc +0 -3
- data/test/fixtures/child-include.adoc +0 -5
- data/test/fixtures/circle.svg +0 -9
- data/test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb +0 -6
- data/test/fixtures/custom-backends/haml/docbook45/block_paragraph.xml.haml +0 -6
- data/test/fixtures/custom-backends/haml/html5-tweaks/block_paragraph.html.haml +0 -1
- data/test/fixtures/custom-backends/haml/html5/block_paragraph.html.haml +0 -3
- data/test/fixtures/custom-backends/haml/html5/block_sidebar.html.haml +0 -5
- data/test/fixtures/custom-backends/slim/docbook45/block_paragraph.xml.slim +0 -6
- data/test/fixtures/custom-backends/slim/html5/block_paragraph.html.slim +0 -3
- data/test/fixtures/custom-backends/slim/html5/block_sidebar.html.slim +0 -5
- data/test/fixtures/custom-docinfodir/basic-docinfo.html +0 -1
- data/test/fixtures/custom-docinfodir/docinfo.html +0 -1
- data/test/fixtures/docinfo-footer.html +0 -1
- data/test/fixtures/docinfo-footer.xml +0 -9
- data/test/fixtures/docinfo.html +0 -1
- data/test/fixtures/docinfo.xml +0 -3
- data/test/fixtures/doctime-localtime.adoc +0 -2
- data/test/fixtures/dot.gif +0 -0
- data/test/fixtures/encoding.asciidoc +0 -13
- data/test/fixtures/file-with-missing-include.adoc +0 -1
- data/test/fixtures/grandchild-include.adoc +0 -3
- data/test/fixtures/hello-asciidoctor.pdf +0 -69
- data/test/fixtures/include-file.asciidoc +0 -24
- data/test/fixtures/include-file.jsx +0 -8
- data/test/fixtures/include-file.ml +0 -3
- data/test/fixtures/include-file.xml +0 -5
- data/test/fixtures/lists.adoc +0 -96
- data/test/fixtures/master.adoc +0 -5
- data/test/fixtures/mismatched-end-tag.adoc +0 -7
- data/test/fixtures/other-chapters.adoc +0 -11
- data/test/fixtures/outer-include.adoc +0 -5
- data/test/fixtures/parent-include-restricted.adoc +0 -5
- data/test/fixtures/parent-include.adoc +0 -5
- data/test/fixtures/sample.asciidoc +0 -30
- data/test/fixtures/section-a.adoc +0 -4
- data/test/fixtures/stylesheets/custom.css +0 -3
- data/test/fixtures/subdir/index.adoc +0 -3
- data/test/fixtures/subdir/inner-include.adoc +0 -3
- data/test/fixtures/subdir/middle-include.adoc +0 -5
- data/test/fixtures/subs-docinfo.html +0 -2
- data/test/fixtures/subs.adoc +0 -6
- data/test/fixtures/tagged-class-enclosed.rb +0 -25
- data/test/fixtures/tagged-class.rb +0 -23
- data/test/fixtures/tip.gif +0 -0
- data/test/fixtures/unclosed-tag.adoc +0 -3
- data/test/fixtures/unexpected-end-tag.adoc +0 -4
- data/test/invoker_test.rb +0 -745
- data/test/links_test.rb +0 -855
- data/test/lists_test.rb +0 -5151
- data/test/logger_test.rb +0 -211
- data/test/manpage_test.rb +0 -660
- data/test/options_test.rb +0 -262
- data/test/paragraphs_test.rb +0 -562
- data/test/parser_test.rb +0 -742
- data/test/paths_test.rb +0 -395
- data/test/preamble_test.rb +0 -173
- data/test/reader_test.rb +0 -2161
- data/test/sections_test.rb +0 -3575
- data/test/substitutions_test.rb +0 -2066
- data/test/tables_test.rb +0 -2036
- data/test/test_helper.rb +0 -447
- data/test/text_test.rb +0 -309
data/CONTRIBUTING.adoc
DELETED
@@ -1,185 +0,0 @@
|
|
1
|
-
= Contributing
|
2
|
-
// settings:
|
3
|
-
:idprefix:
|
4
|
-
:idseparator: -
|
5
|
-
:source-language: ruby
|
6
|
-
:language: {source-language}
|
7
|
-
ifdef::env-github,env-browser[:outfilesuffix: .adoc]
|
8
|
-
// URIs:
|
9
|
-
:uri-repo: https://github.com/asciidoctor/asciidoctor
|
10
|
-
:uri-help-base: https://help.github.com/articles
|
11
|
-
:uri-issues: {uri-repo}/issues
|
12
|
-
:uri-fork-help: {uri-help-base}/fork-a-repo
|
13
|
-
:uri-branch-help: {uri-fork-help}#create-branches
|
14
|
-
:uri-pr-help: {uri-help-base}/using-pull-requests
|
15
|
-
:uri-gist: https://gist.github.com
|
16
|
-
:uri-yard: https://yardoc.org
|
17
|
-
:uri-tomdoc: http://tomdoc.org
|
18
|
-
|
19
|
-
== License Agreement
|
20
|
-
|
21
|
-
By contributing changes to this repository, you agree to license your contributions under the MIT license.
|
22
|
-
This ensures your contributions have the same license as the project and that the community is free to use your contributions.
|
23
|
-
You also assert that you are the original author of the work that you are contributing unless otherwise stated.
|
24
|
-
|
25
|
-
== Submitting an Issue
|
26
|
-
|
27
|
-
We use the {uri-issues}[issue tracker on GitHub] associated with this project to track bugs and features.
|
28
|
-
Before submitting a bug report or feature request, check to make sure it hasn't already been submitted.
|
29
|
-
When submitting a bug report, please include a {uri-gist}[Gist] that includes any details that may help reproduce the bug, including your gem version, Ruby version, and operating system.
|
30
|
-
|
31
|
-
Most importantly, since Asciidoctor is a text processor, reproducing most bugs requires that we have some snippet of text on which Asciidoctor exhibits the bad behavior.
|
32
|
-
|
33
|
-
An ideal bug report would include a pull request with failing specs.
|
34
|
-
|
35
|
-
== Submitting a Pull Request
|
36
|
-
|
37
|
-
. {uri-fork-help}[Fork the repository].
|
38
|
-
. Run `NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle` to install development dependencies.
|
39
|
-
- If the `bundle` command is not available, run `gem install bundler` to install it.
|
40
|
-
. {uri-branch-help}[Create a topic branch] (preferably using the pattern `issue-XYZ`, where `XYZ` is the issue number).
|
41
|
-
. Add tests for your unimplemented feature or bug fix. (See <<writing-and-executing-tests>>)
|
42
|
-
. Run `bundle exec rake` to run the tests.
|
43
|
-
If your tests pass, return to step 4.
|
44
|
-
. Implement your feature or bug fix.
|
45
|
-
. Run `bundle exec rake` to run the tests.
|
46
|
-
If your tests fail, return to step 6.
|
47
|
-
. Add documentation for your feature or bug fix.
|
48
|
-
. If your changes are not 100% documented, go back to step 8.
|
49
|
-
. Add, commit, and push your changes.
|
50
|
-
. {uri-pr-help}[Submit a pull request].
|
51
|
-
|
52
|
-
For ideas about how to use pull requests, see the post http://blog.quickpeople.co.uk/2013/07/10/useful-github-patterns[Useful GitHub Patterns].
|
53
|
-
|
54
|
-
=== Background Knowledge
|
55
|
-
|
56
|
-
As Asciidoctor is built using Ruby some basic knowledge of Ruby, RubyGems and Minitest is beneficial. The following resources provide a good starting point for contributors who may not be completely comfortable with these tools:
|
57
|
-
|
58
|
-
* https://www.ruby-lang.org/en/documentation/quickstart/[Ruby in 20 minutes]
|
59
|
-
* https://www.ruby-lang.org/en/documentation/ruby-from-other-languages/[Ruby from other languages]
|
60
|
-
* http://guides.rubygems.org/rubygems-basics/[RubyGems basics]
|
61
|
-
* http://guides.rubygems.org/what-is-a-gem/[What is a Gem?]
|
62
|
-
* http://blog.teamtreehouse.com/short-introduction-minitest[How to use Minitest]
|
63
|
-
* http://www.rubyinside.com/a-minitestspec-tutorial-elegant-spec-style-testing-that-comes-with-ruby-5354.html[Minitest spec tutorial]
|
64
|
-
* https://github.com/seattlerb/minitest/blob/master/README.rdoc[Minitest Project Documentation]
|
65
|
-
|
66
|
-
While these resources don't cover everything needed they serve as a good starting off point for beginners.
|
67
|
-
|
68
|
-
=== Writing and Executing Tests
|
69
|
-
|
70
|
-
Tests live inside the test directory and are named <topic>_test.rb.
|
71
|
-
For instance, tests for the different types of blocks can be found in the file test/blocks_test.rb.
|
72
|
-
|
73
|
-
Within a test file, individual test cases are organized inside of contexts.
|
74
|
-
A context is type of logical container that groups related tests together.
|
75
|
-
|
76
|
-
Each test case follows the same structure:
|
77
|
-
|
78
|
-
[source]
|
79
|
-
----
|
80
|
-
test 'description of test' do
|
81
|
-
# test logic
|
82
|
-
end
|
83
|
-
----
|
84
|
-
|
85
|
-
At the moment, the tests are quite primitive.
|
86
|
-
Here's how a typical test operates:
|
87
|
-
|
88
|
-
. Defines sample AsciiDoc source
|
89
|
-
. Renders the document to HTML or DocBook
|
90
|
-
. Uses XPath and CSS expressions to verify expected output
|
91
|
-
|
92
|
-
Here's how we might test the open block syntax:
|
93
|
-
|
94
|
-
[source]
|
95
|
-
----
|
96
|
-
test 'should render content bounded by two consecutive hyphens as an open block' do
|
97
|
-
input = <<-EOS
|
98
|
-
--
|
99
|
-
This is an open block.
|
100
|
-
--
|
101
|
-
EOS
|
102
|
-
result = render_embedded_string input
|
103
|
-
assert_css '.openblock', result, 1
|
104
|
-
assert_css '.openblock p', result, 1
|
105
|
-
assert_xpath '/div[@class="openblock"]//p[text()="This is an open block."]', result, 1
|
106
|
-
end
|
107
|
-
----
|
108
|
-
|
109
|
-
As you can see, several helpers are used to facilitate the test scenario.
|
110
|
-
The `render_embedded_string` invokes Asciidoctor's render method with the header and footer option disabled.
|
111
|
-
This method is ideal for unit-level tests.
|
112
|
-
If you need to test the whole document, use `render_string` instead.
|
113
|
-
The `assert_css` and `assert_xpath` assertion methods take a CSS or XPath selector, respectively, the rendered result and the number of expected matches.
|
114
|
-
You can also use built-in assertions in Ruby's test library.
|
115
|
-
|
116
|
-
To run all the tests, simply execute `rake`:
|
117
|
-
|
118
|
-
$ rake
|
119
|
-
|
120
|
-
NOTE: The tests should only take a few seconds to run using Ruby 2.1.
|
121
|
-
|
122
|
-
If you want to run a single test file, you can use `ruby`:
|
123
|
-
|
124
|
-
$ ruby test/blocks_test.rb
|
125
|
-
|
126
|
-
To test a single test case, first add the string "wip" to the beginning of the description.
|
127
|
-
For example:
|
128
|
-
|
129
|
-
[source]
|
130
|
-
----
|
131
|
-
test 'wip should render ...' do
|
132
|
-
...
|
133
|
-
end
|
134
|
-
----
|
135
|
-
|
136
|
-
Then, run `ruby` again, but this time pass a selector argument so it finds matching tests:
|
137
|
-
|
138
|
-
$ ruby test/blocks_test.rb -n /wip/
|
139
|
-
|
140
|
-
You can also turn on verbose mode if you want to see more output:
|
141
|
-
|
142
|
-
$ ruby test/blocks_test.rb -n /wip/ -v
|
143
|
-
|
144
|
-
Once you are done with your test, make sure to remove `wip` from the description and run all the tests again using `rake`.
|
145
|
-
|
146
|
-
We plan on switching to a more elegant testing framework in the future, such as RSpec or Cucumber, in order to make the tests more clear and robust.
|
147
|
-
|
148
|
-
=== Running Asciidoctor in Development Mode
|
149
|
-
|
150
|
-
Asciidoctor is designed so that you can run the script directly out of the cloned repository.
|
151
|
-
Simply execute the `asciidoctor` command directly (referencing it either by relative or absolute path).
|
152
|
-
There's no need to install it using the `gem` command first.
|
153
|
-
|
154
|
-
For example, to convert the README file, switch to the root of the project and run:
|
155
|
-
|
156
|
-
$ ./bin/asciidoctor README.adoc
|
157
|
-
|
158
|
-
IMPORTANT: You'll need to make sure you reference the correct relative path to the `asciidoctor` command.
|
159
|
-
|
160
|
-
If you want to be able to execute the `asciidoctor` command from any directory without worrying about the relative (or absolute) path, you can setup the following Bash alias:
|
161
|
-
|
162
|
-
alias asciidoctor-dev="/path/to/asciidoctor/bin/asciidoctor"
|
163
|
-
|
164
|
-
Now you can execute the `asciidoctor` command from any folder as follows:
|
165
|
-
|
166
|
-
$ asciidoctor-dev README.adoc
|
167
|
-
|
168
|
-
== Building the API Documentation
|
169
|
-
|
170
|
-
The API documentation is written in the {uri-tomdoc}[TomDoc] dialect and built using {uri-yard}[Yard].
|
171
|
-
|
172
|
-
The options for Yard are configured in the [.path]_.yardopts_ file at the root of the project.
|
173
|
-
|
174
|
-
To build the API documentation locally, run the following command:
|
175
|
-
|
176
|
-
$ bundle exec yard
|
177
|
-
|
178
|
-
The documentation will be built into the [.path]_rdoc_ folder.
|
179
|
-
|
180
|
-
== Supporting Additional Ruby Versions
|
181
|
-
|
182
|
-
If you would like this library to support another Ruby version, you may volunteer to be a maintainer.
|
183
|
-
Being a maintainer entails making sure all tests run and pass on that implementation.
|
184
|
-
When something breaks on your implementation, you will be expected to provide patches in a timely fashion.
|
185
|
-
If critical issues for a particular implementation exist at the time of a major release, support for that Ruby version may be dropped.
|
data/Gemfile
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Look in asciidoctor.gemspec for runtime and development dependencies
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
group :development do
|
7
|
-
ruby_version = Gem::Version.new RUBY_VERSION
|
8
|
-
gem 'concurrent-ruby', '~> 1.0.0' unless ruby_version < (Gem::Version.new '1.9.3')
|
9
|
-
if ruby_version < (Gem::Version.new '2.2.0')
|
10
|
-
if ruby_version < (Gem::Version.new '2.1.0')
|
11
|
-
if ruby_version < (Gem::Version.new '2.0.0')
|
12
|
-
gem 'haml', '~> 4.0.0'
|
13
|
-
if ruby_version < (Gem::Version.new '1.9.3')
|
14
|
-
gem 'cucumber', '~> 1.3.0'
|
15
|
-
gem 'nokogiri', '~> 1.5.0'
|
16
|
-
gem 'slim', '~> 2.1.0'
|
17
|
-
gem 'thread_safe', '0.3.6'
|
18
|
-
gem 'tilt', '2.0.7'
|
19
|
-
else
|
20
|
-
gem 'nokogiri', '~> 1.6.0'
|
21
|
-
gem 'slim', '<= 3.0.7'
|
22
|
-
end
|
23
|
-
else
|
24
|
-
gem 'nokogiri', '~> 1.6.0'
|
25
|
-
end
|
26
|
-
else
|
27
|
-
gem 'nokogiri', '~> 1.7.0' if Gem::Platform.local =~ 'x86-mingw32' || Gem::Platform.local =~ 'x64-mingw32'
|
28
|
-
# pin nokogiri because XPath behavior changed on JRuby starting in 1.8.3 (see sparklemotion/nokogiri#1803)
|
29
|
-
gem 'nokogiri', '1.8.2' if RUBY_ENGINE == 'jruby'
|
30
|
-
gem 'racc', '~> 1.4.0' if RUBY_VERSION == '2.1.0' && RUBY_ENGINE == 'rbx'
|
31
|
-
end
|
32
|
-
else
|
33
|
-
# pin nokogiri because XPath behavior changed on JRuby starting in 1.8.3 (see sparklemotion/nokogiri#1803)
|
34
|
-
gem 'nokogiri', '1.8.2' if RUBY_ENGINE == 'jruby'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
group :doc do
|
39
|
-
gem 'yard'
|
40
|
-
gem 'yard-tomdoc'
|
41
|
-
end
|
42
|
-
|
43
|
-
# enable this group to use Guard for continuous testing
|
44
|
-
# after removing comments, run `bundle install` then `guard`
|
45
|
-
#group :guardtest do
|
46
|
-
# gem 'guard'
|
47
|
-
# gem 'guard-test'
|
48
|
-
# gem 'libnotify'
|
49
|
-
# gem 'listen', :github => 'guard/listen'
|
50
|
-
#end
|
51
|
-
|
52
|
-
group :ci do
|
53
|
-
gem 'simplecov', '~> 0.14.1'
|
54
|
-
if ENV['SHIPPABLE']
|
55
|
-
gem 'simplecov-csv', '~> 0.1.3'
|
56
|
-
gem 'ci_reporter', '~> 2.0.0'
|
57
|
-
gem 'ci_reporter_minitest', '~> 1.0.0'
|
58
|
-
#gem 'ci_reporter_cucumber', '~> 1.0.0'
|
59
|
-
end
|
60
|
-
end
|
data/Rakefile
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
def prepare_test_env
|
2
|
-
# rather than hardcoding gc settings in test task,
|
3
|
-
# could use https://gist.github.com/benders/788695
|
4
|
-
ENV['RUBY_GC_MALLOC_LIMIT'] = 128_000_000.to_s
|
5
|
-
ENV['RUBY_GC_OLDMALLOC_LIMIT'] = 128_000_000.to_s
|
6
|
-
if RUBY_VERSION >= '2.1'
|
7
|
-
ENV['RUBY_GC_HEAP_INIT_SLOTS'] = 800_000.to_s
|
8
|
-
ENV['RUBY_GC_HEAP_FREE_SLOTS'] = 800_000.to_s
|
9
|
-
ENV['RUBY_GC_HEAP_GROWTH_MAX_SLOTS'] = 250_000.to_s
|
10
|
-
ENV['RUBY_GC_HEAP_GROWTH_FACTOR'] = 1.25.to_s
|
11
|
-
else
|
12
|
-
ENV['RUBY_FREE_MIN'] = 800_000.to_s
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
begin
|
17
|
-
require 'rake/testtask'
|
18
|
-
Rake::TestTask.new(:test) do |t|
|
19
|
-
prepare_test_env
|
20
|
-
puts %(LANG: #{ENV['LANG']}) if ENV.key? 'TRAVIS_BUILD_ID'
|
21
|
-
t.libs << 'test'
|
22
|
-
t.pattern = 'test/**/*_test.rb'
|
23
|
-
t.verbose = true
|
24
|
-
t.warning = true
|
25
|
-
end
|
26
|
-
task :default => 'test:all'
|
27
|
-
rescue LoadError
|
28
|
-
end
|
29
|
-
|
30
|
-
begin
|
31
|
-
require 'cucumber/rake/task'
|
32
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
33
|
-
t.cucumber_opts = %w(-f progress)
|
34
|
-
end
|
35
|
-
rescue LoadError
|
36
|
-
end
|
37
|
-
|
38
|
-
def ci_setup_tasks
|
39
|
-
tasks = []
|
40
|
-
begin
|
41
|
-
require 'ci/reporter/rake/minitest'
|
42
|
-
tasks << 'ci:setup:minitest'
|
43
|
-
# FIXME reporter for Cucumber tests not activating
|
44
|
-
#require 'ci/reporter/rake/cucumber'
|
45
|
-
#tasks << 'ci:setup:cucumber'
|
46
|
-
rescue LoadError
|
47
|
-
end if ENV['SHIPPABLE'] && RUBY_VERSION >= '1.9.3'
|
48
|
-
tasks
|
49
|
-
end
|
50
|
-
|
51
|
-
desc 'Activates coverage and JUnit-style XML reports for tests'
|
52
|
-
task :coverage => ci_setup_tasks do
|
53
|
-
# exclude coverage run for Ruby 1.8.7 or (disabled) if running on Travis CI
|
54
|
-
ENV['COVERAGE'] = 'true' if RUBY_VERSION >= '1.9.3' # && (ENV['SHIPPABLE'] || !ENV['TRAVIS_BUILD_ID'])
|
55
|
-
ENV['CI_REPORTS'] = 'shippable/testresults'
|
56
|
-
ENV['COVERAGE_REPORTS'] = 'shippable/codecoverage'
|
57
|
-
end
|
58
|
-
|
59
|
-
namespace :test do
|
60
|
-
desc 'Run unit and feature tests'
|
61
|
-
task :all => [:test, :features]
|
62
|
-
end
|
63
|
-
|
64
|
-
begin
|
65
|
-
require 'bundler/gem_tasks'
|
66
|
-
rescue LoadError
|
67
|
-
end
|
68
|
-
|
69
|
-
desc 'Open an irb session preloaded with this library'
|
70
|
-
task :console do
|
71
|
-
sh 'bundle console', :verbose => false
|
72
|
-
end
|
73
|
-
|
74
|
-
namespace :build do
|
75
|
-
desc 'Trigger builds for all dependent projects on Travis CI'
|
76
|
-
task :dependents do
|
77
|
-
if ENV['TRAVIS'].to_s == 'true'
|
78
|
-
next unless ENV['TRAVIS_PULL_REQUEST'].to_s == 'false' &&
|
79
|
-
ENV['TRAVIS_TAG'].to_s.empty? &&
|
80
|
-
(ENV['TRAVIS_JOB_NUMBER'].to_s.end_with? '.1')
|
81
|
-
end
|
82
|
-
# NOTE The TRAVIS_TOKEN env var must be defined in Travis interface.
|
83
|
-
# Retrieve this token using the `travis token` command.
|
84
|
-
# The GitHub user corresponding to the Travis user must have write access to the repository.
|
85
|
-
# After granting permission, sign into Travis and resync the repositories.
|
86
|
-
next unless (token = ENV['TRAVIS_TOKEN'])
|
87
|
-
require 'json'
|
88
|
-
require 'net/http'
|
89
|
-
require 'open-uri'
|
90
|
-
require 'yaml'
|
91
|
-
%w(
|
92
|
-
asciidoctor/asciidoctor.js
|
93
|
-
asciidoctor/asciidoctorj
|
94
|
-
asciidoctor/asciidoctorj/asciidoctorj-1.6.0
|
95
|
-
asciidoctor/asciidoctor-diagram
|
96
|
-
asciidoctor/asciidoctor-reveal.js
|
97
|
-
).each do |project|
|
98
|
-
org, name, branch = project.split '/', 3
|
99
|
-
branch ||= 'master'
|
100
|
-
project = [org, name, branch] * '/'
|
101
|
-
header = {
|
102
|
-
'Content-Type' => 'application/json',
|
103
|
-
'Accept' => 'application/json',
|
104
|
-
'Travis-API-Version' => '3',
|
105
|
-
'Authorization' => %(token #{token})
|
106
|
-
}
|
107
|
-
if (commit_hash = ENV['TRAVIS_COMMIT'])
|
108
|
-
commit_memo = %( (#{commit_hash.slice 0, 8})\n\nhttps://github.com/#{ENV['TRAVIS_REPO_SLUG'] || 'asciidoctor/asciidoctor'}/commit/#{commit_hash})
|
109
|
-
end
|
110
|
-
config = YAML.load open(%(https://raw.githubusercontent.com/#{project}/.travis-upstream-only.yml)) {|fd| fd.read } rescue {}
|
111
|
-
payload = {
|
112
|
-
'request' => {
|
113
|
-
'branch' => branch,
|
114
|
-
'message' => %(Build triggered by Asciidoctor#{commit_memo}),
|
115
|
-
'config' => config
|
116
|
-
}
|
117
|
-
}.to_json
|
118
|
-
(http = Net::HTTP.new 'api.travis-ci.org', 443).use_ssl = true
|
119
|
-
request = Net::HTTP::Post.new %(/repo/#{org}%2F#{name}/requests), header
|
120
|
-
request.body = payload
|
121
|
-
response = http.request request
|
122
|
-
if response.code == '202'
|
123
|
-
puts %(Successfully triggered build on #{project} repository)
|
124
|
-
else
|
125
|
-
warn %(Unable to trigger build on #{project} repository: #{response.code} - #{response.message})
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
data/bin/asciidoctor-safe
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'rubygems' unless defined? Gem
|
4
|
-
|
5
|
-
if File.exist?(asciidoctor = (File.expand_path '../../lib/asciidoctor', __FILE__))
|
6
|
-
require asciidoctor
|
7
|
-
else
|
8
|
-
require 'asciidoctor'
|
9
|
-
end
|
10
|
-
require 'asciidoctor/cli'
|
11
|
-
|
12
|
-
invoker = Asciidoctor::Cli::Invoker.new(ARGV + ['-S', 'safe'])
|
13
|
-
GC.start
|
14
|
-
invoker.invoke!
|
15
|
-
exit invoker.code
|
data/features/open_block.feature
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
# language: en
|
2
|
-
Feature: Open Blocks
|
3
|
-
In order to group content in a generic container
|
4
|
-
As a writer
|
5
|
-
I want to be able to wrap content in an open block
|
6
|
-
|
7
|
-
|
8
|
-
Scenario: Render an open block that contains a paragraph to HTML
|
9
|
-
Given the AsciiDoc source
|
10
|
-
"""
|
11
|
-
--
|
12
|
-
A paragraph in an open block.
|
13
|
-
--
|
14
|
-
"""
|
15
|
-
When it is converted to html
|
16
|
-
Then the result should match the HTML source
|
17
|
-
"""
|
18
|
-
<div class="openblock">
|
19
|
-
<div class="content">
|
20
|
-
<div class="paragraph">
|
21
|
-
<p>A paragraph in an open block.</p>
|
22
|
-
</div>
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
"""
|
26
|
-
|
27
|
-
|
28
|
-
Scenario: Render an open block that contains a paragraph to DocBook
|
29
|
-
Given the AsciiDoc source
|
30
|
-
"""
|
31
|
-
--
|
32
|
-
A paragraph in an open block.
|
33
|
-
--
|
34
|
-
"""
|
35
|
-
When it is converted to docbook
|
36
|
-
Then the result should match the XML source
|
37
|
-
"""
|
38
|
-
<simpara>A paragraph in an open block.</simpara>
|
39
|
-
"""
|
40
|
-
|
41
|
-
|
42
|
-
Scenario: Render an open block that contains a paragraph to HTML (alt)
|
43
|
-
Given the AsciiDoc source
|
44
|
-
"""
|
45
|
-
--
|
46
|
-
A paragraph in an open block.
|
47
|
-
--
|
48
|
-
"""
|
49
|
-
When it is converted to html
|
50
|
-
Then the result should match the HTML structure
|
51
|
-
"""
|
52
|
-
.openblock
|
53
|
-
.content
|
54
|
-
.paragraph
|
55
|
-
p A paragraph in an open block.
|
56
|
-
"""
|
57
|
-
|
58
|
-
|
59
|
-
Scenario: Render an open block that contains a paragraph to DocBook (alt)
|
60
|
-
Given the AsciiDoc source
|
61
|
-
"""
|
62
|
-
--
|
63
|
-
A paragraph in an open block.
|
64
|
-
--
|
65
|
-
"""
|
66
|
-
When it is converted to docbook
|
67
|
-
Then the result should match the XML structure
|
68
|
-
"""
|
69
|
-
simpara A paragraph in an open block.
|
70
|
-
"""
|
71
|
-
|
72
|
-
|
73
|
-
Scenario: Render an open block that contains a list to HTML
|
74
|
-
Given the AsciiDoc source
|
75
|
-
"""
|
76
|
-
--
|
77
|
-
* one
|
78
|
-
* two
|
79
|
-
* three
|
80
|
-
--
|
81
|
-
"""
|
82
|
-
When it is converted to html
|
83
|
-
Then the result should match the HTML structure
|
84
|
-
"""
|
85
|
-
.openblock
|
86
|
-
.content
|
87
|
-
.ulist
|
88
|
-
ul
|
89
|
-
li: p one
|
90
|
-
li: p two
|
91
|
-
li: p three
|
92
|
-
"""
|