asciidoctor 1.5.8 → 2.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +11 -0
  3. data/CHANGELOG.adoc +628 -45
  4. data/LICENSE +2 -1
  5. data/README-de.adoc +28 -38
  6. data/README-fr.adoc +30 -43
  7. data/README-jp.adoc +255 -201
  8. data/README-zh_CN.adoc +40 -44
  9. data/README.adoc +170 -143
  10. data/asciidoctor.gemspec +22 -34
  11. data/bin/asciidoctor +5 -4
  12. data/data/locale/attributes-ar.adoc +4 -3
  13. data/data/locale/attributes-be.adoc +23 -0
  14. data/data/locale/attributes-bg.adoc +4 -3
  15. data/data/locale/attributes-ca.adoc +6 -5
  16. data/data/locale/attributes-cs.adoc +4 -3
  17. data/data/locale/attributes-da.adoc +6 -5
  18. data/data/locale/attributes-de.adoc +6 -5
  19. data/data/locale/attributes-en.adoc +4 -4
  20. data/data/locale/attributes-es.adoc +6 -5
  21. data/data/locale/attributes-fa.adoc +4 -3
  22. data/data/locale/attributes-fi.adoc +4 -3
  23. data/data/locale/attributes-fr.adoc +8 -7
  24. data/data/locale/attributes-hu.adoc +4 -3
  25. data/data/locale/attributes-id.adoc +4 -3
  26. data/data/locale/attributes-it.adoc +6 -5
  27. data/data/locale/attributes-ja.adoc +4 -3
  28. data/data/locale/{attributes-kr.adoc → attributes-ko.adoc} +4 -3
  29. data/data/locale/attributes-nb.adoc +4 -3
  30. data/data/locale/attributes-nl.adoc +6 -5
  31. data/data/locale/attributes-nn.adoc +4 -3
  32. data/data/locale/attributes-pl.adoc +8 -7
  33. data/data/locale/attributes-pt.adoc +6 -5
  34. data/data/locale/attributes-pt_BR.adoc +6 -5
  35. data/data/locale/attributes-ro.adoc +4 -3
  36. data/data/locale/attributes-ru.adoc +6 -5
  37. data/data/locale/attributes-sr.adoc +4 -4
  38. data/data/locale/attributes-sr_Latn.adoc +4 -4
  39. data/data/locale/attributes-sv.adoc +4 -4
  40. data/data/locale/attributes-th.adoc +23 -0
  41. data/data/locale/attributes-tr.adoc +4 -3
  42. data/data/locale/attributes-uk.adoc +6 -5
  43. data/data/locale/attributes-vi.adoc +23 -0
  44. data/data/locale/attributes-zh_CN.adoc +4 -3
  45. data/data/locale/attributes-zh_TW.adoc +4 -3
  46. data/data/reference/syntax.adoc +296 -0
  47. data/data/stylesheets/asciidoctor-default.css +120 -114
  48. data/data/stylesheets/coderay-asciidoctor.css +15 -17
  49. data/lib/asciidoctor/abstract_block.rb +146 -140
  50. data/lib/asciidoctor/abstract_node.rb +152 -170
  51. data/lib/asciidoctor/attribute_list.rb +77 -89
  52. data/lib/asciidoctor/block.rb +29 -28
  53. data/lib/asciidoctor/callouts.rb +4 -2
  54. data/lib/asciidoctor/cli/invoker.rb +20 -24
  55. data/lib/asciidoctor/cli/options.rb +107 -96
  56. data/lib/asciidoctor/cli.rb +3 -2
  57. data/lib/asciidoctor/convert.rb +199 -0
  58. data/lib/asciidoctor/converter/composite.rb +40 -48
  59. data/lib/asciidoctor/converter/docbook5.rb +627 -644
  60. data/lib/asciidoctor/converter/html5.rb +1053 -951
  61. data/lib/asciidoctor/converter/manpage.rb +581 -532
  62. data/lib/asciidoctor/converter/template.rb +232 -271
  63. data/lib/asciidoctor/converter.rb +370 -185
  64. data/lib/asciidoctor/core_ext/float/truncate.rb +20 -0
  65. data/lib/asciidoctor/core_ext/hash/merge.rb +8 -0
  66. data/lib/asciidoctor/core_ext/match_data/names.rb +7 -0
  67. data/lib/asciidoctor/core_ext/nil_or_empty.rb +1 -0
  68. data/lib/asciidoctor/core_ext/regexp/is_match.rb +4 -2
  69. data/lib/asciidoctor/core_ext.rb +8 -17
  70. data/lib/asciidoctor/document.rb +503 -461
  71. data/lib/asciidoctor/extensions.rb +127 -174
  72. data/lib/asciidoctor/helpers.rb +184 -107
  73. data/lib/asciidoctor/inline.rb +9 -12
  74. data/lib/asciidoctor/list.rb +11 -29
  75. data/lib/asciidoctor/load.rb +119 -0
  76. data/lib/asciidoctor/logging.rb +22 -17
  77. data/lib/asciidoctor/parser.rb +673 -719
  78. data/lib/asciidoctor/path_resolver.rb +48 -33
  79. data/lib/asciidoctor/reader.rb +383 -338
  80. data/lib/asciidoctor/rouge_ext.rb +39 -0
  81. data/lib/asciidoctor/rx.rb +723 -0
  82. data/lib/asciidoctor/section.rb +17 -16
  83. data/lib/asciidoctor/stylesheets.rb +19 -37
  84. data/lib/asciidoctor/substitutors.rb +926 -1022
  85. data/lib/asciidoctor/syntax_highlighter/coderay.rb +88 -0
  86. data/lib/asciidoctor/syntax_highlighter/highlightjs.rb +34 -0
  87. data/lib/asciidoctor/syntax_highlighter/html_pipeline.rb +10 -0
  88. data/lib/asciidoctor/syntax_highlighter/prettify.rb +30 -0
  89. data/lib/asciidoctor/syntax_highlighter/pygments.rb +157 -0
  90. data/lib/asciidoctor/syntax_highlighter/rouge.rb +143 -0
  91. data/lib/asciidoctor/syntax_highlighter.rb +253 -0
  92. data/lib/asciidoctor/table.rb +152 -114
  93. data/lib/asciidoctor/timings.rb +7 -5
  94. data/lib/asciidoctor/version.rb +2 -1
  95. data/lib/asciidoctor/writer.rb +30 -0
  96. data/lib/asciidoctor.rb +266 -1340
  97. data/man/asciidoctor.1 +49 -47
  98. data/man/asciidoctor.adoc +54 -45
  99. metadata +50 -245
  100. data/CONTRIBUTING.adoc +0 -185
  101. data/Gemfile +0 -60
  102. data/Rakefile +0 -129
  103. data/bin/asciidoctor-safe +0 -15
  104. data/features/open_block.feature +0 -92
  105. data/features/pass_block.feature +0 -66
  106. data/features/step_definitions.rb +0 -49
  107. data/features/text_formatting.feature +0 -57
  108. data/features/xref.feature +0 -1039
  109. data/lib/asciidoctor/converter/base.rb +0 -59
  110. data/lib/asciidoctor/converter/docbook45.rb +0 -93
  111. data/lib/asciidoctor/converter/factory.rb +0 -226
  112. data/lib/asciidoctor/core_ext/1.8.7/base64/strict_encode64.rb +0 -6
  113. data/lib/asciidoctor/core_ext/1.8.7/concurrent/hash.rb +0 -5
  114. data/lib/asciidoctor/core_ext/1.8.7/hash/key.rb +0 -4
  115. data/lib/asciidoctor/core_ext/1.8.7/io/binread.rb +0 -6
  116. data/lib/asciidoctor/core_ext/1.8.7/io/write.rb +0 -5
  117. data/lib/asciidoctor/core_ext/1.8.7/string/chr.rb +0 -6
  118. data/lib/asciidoctor/core_ext/1.8.7/string/limit_bytesize.rb +0 -29
  119. data/lib/asciidoctor/core_ext/1.8.7/symbol/empty.rb +0 -6
  120. data/lib/asciidoctor/core_ext/1.8.7/symbol/length.rb +0 -6
  121. data/lib/asciidoctor/core_ext/string/limit_bytesize.rb +0 -10
  122. data/test/api_test.rb +0 -1240
  123. data/test/attribute_list_test.rb +0 -242
  124. data/test/attributes_test.rb +0 -1623
  125. data/test/blocks_test.rb +0 -3870
  126. data/test/converter_test.rb +0 -470
  127. data/test/document_test.rb +0 -1853
  128. data/test/extensions_test.rb +0 -1560
  129. data/test/fixtures/asciidoc_index.txt +0 -521
  130. data/test/fixtures/basic-docinfo-footer.html +0 -6
  131. data/test/fixtures/basic-docinfo-footer.xml +0 -8
  132. data/test/fixtures/basic-docinfo.html +0 -1
  133. data/test/fixtures/basic-docinfo.xml +0 -4
  134. data/test/fixtures/basic.asciidoc +0 -5
  135. data/test/fixtures/chapter-a.adoc +0 -3
  136. data/test/fixtures/child-include.adoc +0 -5
  137. data/test/fixtures/circle.svg +0 -9
  138. data/test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb +0 -6
  139. data/test/fixtures/custom-backends/haml/docbook45/block_paragraph.xml.haml +0 -6
  140. data/test/fixtures/custom-backends/haml/html5/block_paragraph.html.haml +0 -3
  141. data/test/fixtures/custom-backends/haml/html5/block_sidebar.html.haml +0 -5
  142. data/test/fixtures/custom-backends/haml/html5-tweaks/block_paragraph.html.haml +0 -1
  143. data/test/fixtures/custom-backends/slim/docbook45/block_paragraph.xml.slim +0 -6
  144. data/test/fixtures/custom-backends/slim/html5/block_paragraph.html.slim +0 -3
  145. data/test/fixtures/custom-backends/slim/html5/block_sidebar.html.slim +0 -5
  146. data/test/fixtures/custom-docinfodir/basic-docinfo.html +0 -1
  147. data/test/fixtures/custom-docinfodir/docinfo.html +0 -1
  148. data/test/fixtures/docinfo-footer.html +0 -1
  149. data/test/fixtures/docinfo-footer.xml +0 -9
  150. data/test/fixtures/docinfo.html +0 -1
  151. data/test/fixtures/docinfo.xml +0 -3
  152. data/test/fixtures/doctime-localtime.adoc +0 -2
  153. data/test/fixtures/dot.gif +0 -0
  154. data/test/fixtures/encoding.asciidoc +0 -13
  155. data/test/fixtures/file-with-missing-include.adoc +0 -1
  156. data/test/fixtures/grandchild-include.adoc +0 -3
  157. data/test/fixtures/hello-asciidoctor.pdf +0 -69
  158. data/test/fixtures/include-file.asciidoc +0 -24
  159. data/test/fixtures/include-file.jsx +0 -8
  160. data/test/fixtures/include-file.ml +0 -3
  161. data/test/fixtures/include-file.xml +0 -5
  162. data/test/fixtures/lists.adoc +0 -96
  163. data/test/fixtures/master.adoc +0 -5
  164. data/test/fixtures/mismatched-end-tag.adoc +0 -7
  165. data/test/fixtures/other-chapters.adoc +0 -11
  166. data/test/fixtures/outer-include.adoc +0 -5
  167. data/test/fixtures/parent-include-restricted.adoc +0 -5
  168. data/test/fixtures/parent-include.adoc +0 -5
  169. data/test/fixtures/sample.asciidoc +0 -30
  170. data/test/fixtures/section-a.adoc +0 -4
  171. data/test/fixtures/stylesheets/custom.css +0 -3
  172. data/test/fixtures/subdir/index.adoc +0 -3
  173. data/test/fixtures/subdir/inner-include.adoc +0 -3
  174. data/test/fixtures/subdir/middle-include.adoc +0 -5
  175. data/test/fixtures/subs-docinfo.html +0 -2
  176. data/test/fixtures/subs.adoc +0 -6
  177. data/test/fixtures/tagged-class-enclosed.rb +0 -25
  178. data/test/fixtures/tagged-class.rb +0 -23
  179. data/test/fixtures/tip.gif +0 -0
  180. data/test/fixtures/unclosed-tag.adoc +0 -3
  181. data/test/fixtures/unexpected-end-tag.adoc +0 -4
  182. data/test/invoker_test.rb +0 -745
  183. data/test/links_test.rb +0 -855
  184. data/test/lists_test.rb +0 -5151
  185. data/test/logger_test.rb +0 -211
  186. data/test/manpage_test.rb +0 -660
  187. data/test/options_test.rb +0 -262
  188. data/test/paragraphs_test.rb +0 -562
  189. data/test/parser_test.rb +0 -742
  190. data/test/paths_test.rb +0 -395
  191. data/test/preamble_test.rb +0 -173
  192. data/test/reader_test.rb +0 -2161
  193. data/test/sections_test.rb +0 -3575
  194. data/test/substitutions_test.rb +0 -2066
  195. data/test/tables_test.rb +0 -2036
  196. data/test/test_helper.rb +0 -447
  197. data/test/text_test.rb +0 -309
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
@@ -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
- """
@@ -1,66 +0,0 @@
1
- # language: en
2
- Feature: Open Blocks
3
- In order to pass content through unprocessed
4
- As a writer
5
- I want to be able to mark passthrough content using a pass block
6
-
7
-
8
- Scenario: Render a pass block without performing substitutions by default to HTML
9
- Given the AsciiDoc source
10
- """
11
- :name: value
12
-
13
- ++++
14
- <p>{name}</p>
15
-
16
- image:tiger.png[]
17
- ++++
18
- """
19
- When it is converted to html
20
- Then the result should match the HTML source
21
- """
22
- <p>{name}</p>
23
-
24
- image:tiger.png[]
25
- """
26
-
27
-
28
- Scenario: Render a pass block without performing substitutions by default to DocBook
29
- Given the AsciiDoc source
30
- """
31
- :name: value
32
-
33
- ++++
34
- <simpara>{name}</simpara>
35
-
36
- image:tiger.png[]
37
- ++++
38
- """
39
- When it is converted to docbook
40
- Then the result should match the XML source
41
- """
42
- <simpara>{name}</simpara>
43
-
44
- image:tiger.png[]
45
- """
46
-
47
-
48
- Scenario: Render a pass block performing explicit substitutions to HTML
49
- Given the AsciiDoc source
50
- """
51
- :name: value
52
-
53
- [subs="attributes,macros"]
54
- ++++
55
- <p>{name}</p>
56
-
57
- image:tiger.png[]
58
- ++++
59
- """
60
- When it is converted to html
61
- Then the result should match the HTML source
62
- """
63
- <p>value</p>
64
-
65
- <span class="image"><img src="tiger.png" alt="tiger"></span>
66
- """
@@ -1,49 +0,0 @@
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
-
13
- require 'rspec/expectations'
14
- require 'tilt'
15
- require 'slim'
16
-
17
- Given /the AsciiDoc source/ do |source|
18
- @source = source
19
- end
20
-
21
- When /it is converted to html/ do
22
- @output = Asciidoctor.convert @source
23
- #IO.write '/tmp/test.adoc', @source
24
- #@output = %x{asciidoc -f compat/asciidoc.conf -o - -s /tmp/test.adoc | XMLLINT_INDENT='' xmllint --format - | tail -n +2}.rstrip
25
- ##@output = %x{asciidoc -f compat/asciidoc.conf -o - -s /tmp/test.adoc}
26
- end
27
-
28
- When /it is converted to docbook/ do
29
- @output = Asciidoctor.convert @source, :backend => :docbook
30
- end
31
-
32
- Then /the result should (match|contain) the (HTML|XML) source/ do |matcher, format, expected|
33
- match_expectation = matcher == 'match' ? (eq expected) : (include expected)
34
- (expect @output).to match_expectation
35
- end
36
-
37
- Then /the result should (match|contain) the (HTML|XML) structure/ do |matcher, format, expected|
38
- result = @output
39
- if format == 'HTML'
40
- options = { :format => :html, :disable_escape => true, :sort_attrs => false }
41
- else # format == 'XML'
42
- options = { :format => :xhtml, :disable_escape => true, :sort_attrs => false }
43
- result = result.gsub '"/>', '" />' if result.include? '"/>'
44
- end
45
- result = Slim::Template.new(options) { result.each_line.map {|l| (l.start_with? '<') ? l : %(|#{l}) }.join }.render
46
- expected = Slim::Template.new(options) { expected }.render
47
- match_expectation = matcher == 'match' ? (eq expected) : (include expected)
48
- (expect result).to match_expectation
49
- end
@@ -1,57 +0,0 @@
1
- # language: en
2
- Feature: Text Formatting
3
- In order to apply formatting to the text
4
- As a writer
5
- I want to be able to markup inline text with formatting characters
6
-
7
-
8
- Scenario: Convert text that contains superscript and subscript characters
9
- Given the AsciiDoc source
10
- """
11
- _v_~rocket~ is the value
12
- ^3^He is the isotope
13
- log~4~x^n^ is the expression
14
- M^me^ White is the address
15
- the 10^th^ point has coordinate (x~10~, y~10~)
16
- """
17
- When it is converted to html
18
- Then the result should match the HTML source
19
- """
20
- <div class="paragraph">
21
- <p><em>v</em><sub>rocket</sub> is the value
22
- <sup>3</sup>He is the isotope
23
- log<sub>4</sub>x<sup>n</sup> is the expression
24
- M<sup>me</sup> White is the address
25
- the 10<sup>th</sup> point has coordinate (x<sub>10</sub>, y<sub>10</sub>)</p>
26
- </div>
27
- """
28
-
29
-
30
- Scenario: Convert text that has ex-inline literal formatting
31
- Given the AsciiDoc source
32
- """
33
- Use [x-]`{asciidoctor-version}` to print the version of Asciidoctor.
34
- """
35
- When it is converted to html
36
- Then the result should match the HTML source
37
- """
38
- <div class="paragraph">
39
- <p>Use <code>{asciidoctor-version}</code> to print the version of Asciidoctor.</p>
40
- </div>
41
- """
42
-
43
-
44
- Scenario: Convert text that has ex-inline monospaced formatting
45
- Given the AsciiDoc source
46
- """
47
- :encoding: UTF-8
48
-
49
- The document is assumed to be encoded as [x-]+{encoding}+.
50
- """
51
- When it is converted to html
52
- Then the result should match the HTML source
53
- """
54
- <div class="paragraph">
55
- <p>The document is assumed to be encoded as <code>UTF-8</code>.</p>
56
- </div>
57
- """