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.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +162 -17
  3. data/LICENSE +1 -1
  4. data/README-de.adoc +12 -13
  5. data/README-fr.adoc +11 -12
  6. data/README-jp.adoc +11 -12
  7. data/README-zh_CN.adoc +12 -13
  8. data/README.adoc +6 -7
  9. data/asciidoctor.gemspec +19 -24
  10. data/bin/asciidoctor +5 -4
  11. data/data/reference/syntax.adoc +283 -0
  12. data/data/stylesheets/asciidoctor-default.css +56 -52
  13. data/data/stylesheets/coderay-asciidoctor.css +7 -9
  14. data/lib/asciidoctor.rb +171 -232
  15. data/lib/asciidoctor/abstract_block.rb +96 -105
  16. data/lib/asciidoctor/abstract_node.rb +118 -139
  17. data/lib/asciidoctor/attribute_list.rb +10 -14
  18. data/lib/asciidoctor/block.rb +20 -19
  19. data/lib/asciidoctor/callouts.rb +4 -2
  20. data/lib/asciidoctor/cli.rb +3 -2
  21. data/lib/asciidoctor/cli/invoker.rb +14 -21
  22. data/lib/asciidoctor/cli/options.rb +64 -54
  23. data/lib/asciidoctor/converter.rb +357 -185
  24. data/lib/asciidoctor/converter/composite.rb +40 -48
  25. data/lib/asciidoctor/converter/docbook5.rb +604 -640
  26. data/lib/asciidoctor/converter/html5.rb +949 -963
  27. data/lib/asciidoctor/converter/manpage.rb +569 -548
  28. data/lib/asciidoctor/converter/template.rb +231 -272
  29. data/lib/asciidoctor/core_ext.rb +5 -18
  30. data/lib/asciidoctor/core_ext/float/truncate.rb +19 -0
  31. data/lib/asciidoctor/core_ext/match_data/names.rb +7 -0
  32. data/lib/asciidoctor/core_ext/nil_or_empty.rb +1 -0
  33. data/lib/asciidoctor/core_ext/regexp/is_match.rb +4 -2
  34. data/lib/asciidoctor/document.rb +399 -377
  35. data/lib/asciidoctor/extensions.rb +72 -140
  36. data/lib/asciidoctor/helpers.rb +122 -83
  37. data/lib/asciidoctor/inline.rb +5 -1
  38. data/lib/asciidoctor/list.rb +13 -11
  39. data/lib/asciidoctor/logging.rb +17 -16
  40. data/lib/asciidoctor/parser.rb +390 -423
  41. data/lib/asciidoctor/path_resolver.rb +10 -5
  42. data/lib/asciidoctor/reader.rb +286 -263
  43. data/lib/asciidoctor/rouge_ext.rb +39 -0
  44. data/lib/asciidoctor/section.rb +9 -8
  45. data/lib/asciidoctor/stylesheets.rb +19 -37
  46. data/lib/asciidoctor/substitutors.rb +364 -509
  47. data/lib/asciidoctor/syntax_highlighter.rb +238 -0
  48. data/lib/asciidoctor/syntax_highlighter/coderay.rb +87 -0
  49. data/lib/asciidoctor/syntax_highlighter/highlightjs.rb +26 -0
  50. data/lib/asciidoctor/syntax_highlighter/html_pipeline.rb +10 -0
  51. data/lib/asciidoctor/syntax_highlighter/prettify.rb +27 -0
  52. data/lib/asciidoctor/syntax_highlighter/pygments.rb +149 -0
  53. data/lib/asciidoctor/syntax_highlighter/rouge.rb +129 -0
  54. data/lib/asciidoctor/table.rb +73 -66
  55. data/lib/asciidoctor/timings.rb +4 -2
  56. data/lib/asciidoctor/version.rb +2 -1
  57. data/lib/asciidoctor/writer.rb +30 -0
  58. data/man/asciidoctor.1 +19 -15
  59. data/man/asciidoctor.adoc +14 -12
  60. metadata +69 -216
  61. data/CONTRIBUTING.adoc +0 -185
  62. data/Gemfile +0 -60
  63. data/Rakefile +0 -129
  64. data/bin/asciidoctor-safe +0 -15
  65. data/features/open_block.feature +0 -92
  66. data/features/pass_block.feature +0 -66
  67. data/features/step_definitions.rb +0 -49
  68. data/features/text_formatting.feature +0 -57
  69. data/features/xref.feature +0 -1039
  70. data/lib/asciidoctor/converter/base.rb +0 -59
  71. data/lib/asciidoctor/converter/docbook45.rb +0 -93
  72. data/lib/asciidoctor/converter/factory.rb +0 -226
  73. data/lib/asciidoctor/core_ext/1.8.7/base64/strict_encode64.rb +0 -6
  74. data/lib/asciidoctor/core_ext/1.8.7/concurrent/hash.rb +0 -5
  75. data/lib/asciidoctor/core_ext/1.8.7/hash/key.rb +0 -4
  76. data/lib/asciidoctor/core_ext/1.8.7/io/binread.rb +0 -6
  77. data/lib/asciidoctor/core_ext/1.8.7/io/write.rb +0 -5
  78. data/lib/asciidoctor/core_ext/1.8.7/string/chr.rb +0 -6
  79. data/lib/asciidoctor/core_ext/1.8.7/string/limit_bytesize.rb +0 -29
  80. data/lib/asciidoctor/core_ext/1.8.7/symbol/empty.rb +0 -6
  81. data/lib/asciidoctor/core_ext/1.8.7/symbol/length.rb +0 -6
  82. data/lib/asciidoctor/core_ext/string/limit_bytesize.rb +0 -10
  83. data/test/api_test.rb +0 -1240
  84. data/test/attribute_list_test.rb +0 -242
  85. data/test/attributes_test.rb +0 -1623
  86. data/test/blocks_test.rb +0 -3870
  87. data/test/converter_test.rb +0 -470
  88. data/test/document_test.rb +0 -1853
  89. data/test/extensions_test.rb +0 -1560
  90. data/test/fixtures/asciidoc_index.txt +0 -521
  91. data/test/fixtures/basic-docinfo-footer.html +0 -6
  92. data/test/fixtures/basic-docinfo-footer.xml +0 -8
  93. data/test/fixtures/basic-docinfo.html +0 -1
  94. data/test/fixtures/basic-docinfo.xml +0 -4
  95. data/test/fixtures/basic.asciidoc +0 -5
  96. data/test/fixtures/chapter-a.adoc +0 -3
  97. data/test/fixtures/child-include.adoc +0 -5
  98. data/test/fixtures/circle.svg +0 -9
  99. data/test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb +0 -6
  100. data/test/fixtures/custom-backends/haml/docbook45/block_paragraph.xml.haml +0 -6
  101. data/test/fixtures/custom-backends/haml/html5-tweaks/block_paragraph.html.haml +0 -1
  102. data/test/fixtures/custom-backends/haml/html5/block_paragraph.html.haml +0 -3
  103. data/test/fixtures/custom-backends/haml/html5/block_sidebar.html.haml +0 -5
  104. data/test/fixtures/custom-backends/slim/docbook45/block_paragraph.xml.slim +0 -6
  105. data/test/fixtures/custom-backends/slim/html5/block_paragraph.html.slim +0 -3
  106. data/test/fixtures/custom-backends/slim/html5/block_sidebar.html.slim +0 -5
  107. data/test/fixtures/custom-docinfodir/basic-docinfo.html +0 -1
  108. data/test/fixtures/custom-docinfodir/docinfo.html +0 -1
  109. data/test/fixtures/docinfo-footer.html +0 -1
  110. data/test/fixtures/docinfo-footer.xml +0 -9
  111. data/test/fixtures/docinfo.html +0 -1
  112. data/test/fixtures/docinfo.xml +0 -3
  113. data/test/fixtures/doctime-localtime.adoc +0 -2
  114. data/test/fixtures/dot.gif +0 -0
  115. data/test/fixtures/encoding.asciidoc +0 -13
  116. data/test/fixtures/file-with-missing-include.adoc +0 -1
  117. data/test/fixtures/grandchild-include.adoc +0 -3
  118. data/test/fixtures/hello-asciidoctor.pdf +0 -69
  119. data/test/fixtures/include-file.asciidoc +0 -24
  120. data/test/fixtures/include-file.jsx +0 -8
  121. data/test/fixtures/include-file.ml +0 -3
  122. data/test/fixtures/include-file.xml +0 -5
  123. data/test/fixtures/lists.adoc +0 -96
  124. data/test/fixtures/master.adoc +0 -5
  125. data/test/fixtures/mismatched-end-tag.adoc +0 -7
  126. data/test/fixtures/other-chapters.adoc +0 -11
  127. data/test/fixtures/outer-include.adoc +0 -5
  128. data/test/fixtures/parent-include-restricted.adoc +0 -5
  129. data/test/fixtures/parent-include.adoc +0 -5
  130. data/test/fixtures/sample.asciidoc +0 -30
  131. data/test/fixtures/section-a.adoc +0 -4
  132. data/test/fixtures/stylesheets/custom.css +0 -3
  133. data/test/fixtures/subdir/index.adoc +0 -3
  134. data/test/fixtures/subdir/inner-include.adoc +0 -3
  135. data/test/fixtures/subdir/middle-include.adoc +0 -5
  136. data/test/fixtures/subs-docinfo.html +0 -2
  137. data/test/fixtures/subs.adoc +0 -6
  138. data/test/fixtures/tagged-class-enclosed.rb +0 -25
  139. data/test/fixtures/tagged-class.rb +0 -23
  140. data/test/fixtures/tip.gif +0 -0
  141. data/test/fixtures/unclosed-tag.adoc +0 -3
  142. data/test/fixtures/unexpected-end-tag.adoc +0 -4
  143. data/test/invoker_test.rb +0 -745
  144. data/test/links_test.rb +0 -855
  145. data/test/lists_test.rb +0 -5151
  146. data/test/logger_test.rb +0 -211
  147. data/test/manpage_test.rb +0 -660
  148. data/test/options_test.rb +0 -262
  149. data/test/paragraphs_test.rb +0 -562
  150. data/test/parser_test.rb +0 -742
  151. data/test/paths_test.rb +0 -395
  152. data/test/preamble_test.rb +0 -173
  153. data/test/reader_test.rb +0 -2161
  154. data/test/sections_test.rb +0 -3575
  155. data/test/substitutions_test.rb +0 -2066
  156. data/test/tables_test.rb +0 -2036
  157. data/test/test_helper.rb +0 -447
  158. data/test/text_test.rb +0 -309
@@ -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
- """
@@ -1,1039 +0,0 @@
1
- # language: en
2
- Feature: Cross References
3
- In order to create cross references between sections and blocks in the current or neighboring document
4
- As a writer
5
- I want to be able to use the cross reference macro to compose these references
6
-
7
- Scenario: Create a cross reference to a block that has explicit reftext
8
- Given the AsciiDoc source
9
- """
10
- :xrefstyle: full
11
-
12
- See <<param-type-t>> to learn how it works.
13
-
14
- .Parameterized Type <T>
15
- [[param-type-t,that "<T>" thing]]
16
- ****
17
- This sidebar describes what that <T> thing is all about.
18
- ****
19
- """
20
- When it is converted to html
21
- Then the result should contain the HTML structure
22
- """
23
- |See
24
- a<> href='#param-type-t' that "&lt;T&gt;" thing
25
- |to learn how it works.
26
- """
27
- When it is converted to docbook
28
- Then the result should match the XML structure
29
- """
30
- simpara
31
- |See
32
- xref<> linkend='param-type-t'/
33
- |to learn how it works.
34
- sidebar xml:id='param-type-t' xreflabel='that &quot;&lt;T&gt;&quot; thing'
35
- title Parameterized Type &lt;T&gt;
36
- simpara This sidebar describes what that &lt;T&gt; thing is all about.
37
- """
38
-
39
- Scenario: Create a cross reference to a block that has explicit reftext with formatting
40
- Given the AsciiDoc source
41
- """
42
- :xrefstyle: full
43
-
44
- There are cats, then there are the <<big-cats>>.
45
-
46
- [[big-cats,*big* cats]]
47
- == Big Cats
48
-
49
- So ferocious.
50
- """
51
- When it is converted to html
52
- Then the result should contain the HTML structure
53
- """
54
- |There are cats, then there are the
55
- a< href='#big-cats' <strong>big</strong> cats
56
- |.
57
- """
58
- When it is converted to docbook
59
- Then the result should match the XML structure
60
- """
61
- simpara
62
- |There are cats, then there are the
63
- xref< linkend='big-cats'/
64
- |.
65
- section xml:id='big-cats' xreflabel='big cats'
66
- title Big Cats
67
- simpara So ferocious.
68
- """
69
-
70
- Scenario: Create a full cross reference to a numbered section
71
- Given the AsciiDoc source
72
- """
73
- :sectnums:
74
- :xrefstyle: full
75
-
76
- See <<sect-features>> to find a complete list of features.
77
-
78
- == About
79
-
80
- [#sect-features]
81
- === Features
82
-
83
- All the features are listed in this section.
84
- """
85
- When it is converted to html
86
- Then the result should contain the HTML structure
87
- """
88
- |See
89
- a<> href='#sect-features' Section 1.1, &#8220;Features&#8221;
90
- |to find a complete list of features.
91
- """
92
-
93
- Scenario: Create a short cross reference to a numbered section
94
- Given the AsciiDoc source
95
- """
96
- :sectnums:
97
- :xrefstyle: short
98
-
99
- See <<sect-features>> to find a complete list of features.
100
-
101
- [#sect-features]
102
- == Features
103
-
104
- All the features are listed in this section.
105
- """
106
- When it is converted to html
107
- Then the result should contain the HTML structure
108
- """
109
- |See
110
- a<> href='#sect-features' Section 1
111
- |to find a complete list of features.
112
- """
113
-
114
- Scenario: Create a basic cross reference to an unnumbered section
115
- Given the AsciiDoc source
116
- """
117
- :xrefstyle: full
118
-
119
- See <<sect-features>> to find a complete list of features.
120
-
121
- [#sect-features]
122
- == Features
123
-
124
- All the features are listed in this section.
125
- """
126
- When it is converted to html
127
- Then the result should contain the HTML structure
128
- """
129
- |See
130
- a<> href='#sect-features' Features
131
- |to find a complete list of features.
132
- """
133
-
134
- Scenario: Create a basic cross reference to a numbered section when the section reference signifier is disabled
135
- Given the AsciiDoc source
136
- """
137
- :sectnums:
138
- :xrefstyle: full
139
- :!section-refsig:
140
-
141
- See <<sect-features>> to find a complete list of features.
142
-
143
- [#sect-features]
144
- == Features
145
-
146
- All the features are listed in this section.
147
- """
148
- When it is converted to html
149
- Then the result should contain the HTML structure
150
- """
151
- |See
152
- a<> href='#sect-features' 1, &#8220;Features&#8221;
153
- |to find a complete list of features.
154
- """
155
-
156
- Scenario: Create a full cross reference to a numbered chapter
157
- Given the AsciiDoc source
158
- """
159
- :doctype: book
160
- :sectnums:
161
- :xrefstyle: full
162
-
163
- See <<chap-features>> to find a complete list of features.
164
-
165
- [#chap-features]
166
- == Features
167
-
168
- All the features are listed in this chapter.
169
- """
170
- When it is converted to html
171
- Then the result should contain the HTML structure
172
- """
173
- |See
174
- a<> href='#chap-features' Chapter 1, <em>Features</em>
175
- |to find a complete list of features.
176
- """
177
-
178
- Scenario: Create a short cross reference to a numbered chapter
179
- Given the AsciiDoc source
180
- """
181
- :doctype: book
182
- :sectnums:
183
- :xrefstyle: short
184
-
185
- See <<chap-features>> to find a complete list of features.
186
-
187
- [#chap-features]
188
- == Features
189
-
190
- All the features are listed in this chapter.
191
- """
192
- When it is converted to html
193
- Then the result should contain the HTML structure
194
- """
195
- |See
196
- a<> href='#chap-features' Chapter 1
197
- |to find a complete list of features.
198
- """
199
-
200
- Scenario: Create a basic cross reference to a numbered chapter
201
- Given the AsciiDoc source
202
- """
203
- :doctype: book
204
- :sectnums:
205
- :xrefstyle: basic
206
-
207
- See <<chap-features>> to find a complete list of features.
208
-
209
- [#chap-features]
210
- == Features
211
-
212
- All the features are listed in this chapter.
213
- """
214
- When it is converted to html
215
- Then the result should contain the HTML structure
216
- """
217
- |See
218
- a<> href='#chap-features' <em>Features</em>
219
- |to find a complete list of features.
220
- """
221
-
222
- Scenario: Create a basic cross reference to an unnumbered chapter
223
- Given the AsciiDoc source
224
- """
225
- :doctype: book
226
- :xrefstyle: full
227
-
228
- See <<chap-features>> to find a complete list of features.
229
-
230
- [#chap-features]
231
- == Features
232
-
233
- All the features are listed in this chapter.
234
- """
235
- When it is converted to html
236
- Then the result should contain the HTML structure
237
- """
238
- |See
239
- a<> href='#chap-features' <em>Features</em>
240
- |to find a complete list of features.
241
- """
242
-
243
- Scenario: Create a cross reference to a chapter using a custom chapter reference signifier
244
- Given the AsciiDoc source
245
- """
246
- :doctype: book
247
- :sectnums:
248
- :xrefstyle: full
249
- :chapter-refsig: Ch
250
-
251
- See <<chap-features>> to find a complete list of features.
252
-
253
- [#chap-features]
254
- == Features
255
-
256
- All the features are listed in this chapter.
257
- """
258
- When it is converted to html
259
- Then the result should contain the HTML structure
260
- """
261
- |See
262
- a<> href='#chap-features' Ch 1, <em>Features</em>
263
- |to find a complete list of features.
264
- """
265
-
266
- Scenario: Create a full cross reference to a numbered part
267
- Given the AsciiDoc source
268
- """
269
- :doctype: book
270
- :sectnums:
271
- :partnums:
272
- :xrefstyle: full
273
-
274
- [preface]
275
- = Preface
276
-
277
- See <<p1>> for an introduction to the language.
278
-
279
- [#p1]
280
- = Language
281
-
282
- == Syntax
283
-
284
- This chapter covers the syntax.
285
- """
286
- When it is converted to html
287
- Then the result should contain the HTML structure
288
- """
289
- |See
290
- a<> href='#p1' Part I, &#8220;Language&#8221;
291
- |for an introduction to the language.
292
- """
293
-
294
- Scenario: Create a short cross reference to a numbered part
295
- Given the AsciiDoc source
296
- """
297
- :doctype: book
298
- :sectnums:
299
- :partnums:
300
- :xrefstyle: short
301
-
302
- [preface]
303
- = Preface
304
-
305
- See <<p1>> for an introduction to the language.
306
-
307
- [#p1]
308
- = Language
309
-
310
- == Syntax
311
-
312
- This chapter covers the syntax.
313
- """
314
- When it is converted to html
315
- Then the result should contain the HTML structure
316
- """
317
- |See
318
- a<> href='#p1' Part I
319
- |for an introduction to the language.
320
- """
321
-
322
- Scenario: Create a basic cross reference to a numbered part
323
- Given the AsciiDoc source
324
- """
325
- :doctype: book
326
- :sectnums:
327
- :partnums:
328
- :xrefstyle: basic
329
-
330
- [preface]
331
- = Preface
332
-
333
- See <<p1>> for an introduction to the language.
334
-
335
- [#p1]
336
- = Language
337
-
338
- == Syntax
339
-
340
- This chapter covers the syntax.
341
- """
342
- When it is converted to html
343
- Then the result should contain the HTML structure
344
- """
345
- |See
346
- a<> href='#p1' Language
347
- |for an introduction to the language.
348
- """
349
-
350
- Scenario: Create a basic cross reference to an unnumbered part
351
- Given the AsciiDoc source
352
- """
353
- :doctype: book
354
- :sectnums:
355
- :xrefstyle: full
356
-
357
- [preface]
358
- = Preface
359
-
360
- See <<p1>> for an introduction to the language.
361
-
362
- [#p1]
363
- = Language
364
-
365
- == Syntax
366
-
367
- This chapter covers the syntax.
368
- """
369
- When it is converted to html
370
- Then the result should contain the HTML structure
371
- """
372
- |See
373
- a<> href='#p1' Language
374
- |for an introduction to the language.
375
- """
376
-
377
- @wip
378
- Scenario: Create a cross reference to a part using a custom part reference signifier
379
- Given the AsciiDoc source
380
- """
381
- :doctype: book
382
- :sectnums:
383
- :partnums:
384
- :xrefstyle: full
385
- :part-refsig: P
386
-
387
- [preface]
388
- = Preface
389
-
390
- See <<p1>> for an introduction to the language.
391
-
392
- [#p1]
393
- = Language
394
-
395
- == Syntax
396
-
397
- This chapter covers the syntax.
398
- """
399
- When it is converted to html
400
- Then the result should contain the HTML structure
401
- """
402
- |See
403
- a<> href='#p1' P I, &#8220;Language&#8221;
404
- |for an introduction to the language.
405
- """
406
-
407
- Scenario: Create a full cross reference to a numbered appendix
408
- Given the AsciiDoc source
409
- """
410
- :sectnums:
411
- :xrefstyle: full
412
-
413
- See <<app-features>> to find a complete list of features.
414
-
415
- [appendix#app-features]
416
- == Features
417
-
418
- All the features are listed in this appendix.
419
- """
420
- When it is converted to html
421
- Then the result should contain the HTML structure
422
- """
423
- |See
424
- a<> href='#app-features' Appendix A, <em>Features</em>
425
- |to find a complete list of features.
426
- """
427
-
428
- Scenario: Create a short cross reference to a numbered appendix
429
- Given the AsciiDoc source
430
- """
431
- :sectnums:
432
- :xrefstyle: short
433
-
434
- See <<app-features>> to find a complete list of features.
435
-
436
- [appendix#app-features]
437
- == Features
438
-
439
- All the features are listed in this appendix.
440
- """
441
- When it is converted to html
442
- Then the result should contain the HTML structure
443
- """
444
- |See
445
- a<> href='#app-features' Appendix A
446
- |to find a complete list of features.
447
- """
448
-
449
- Scenario: Create a full cross reference to an appendix even when section numbering is disabled
450
- Given the AsciiDoc source
451
- """
452
- :xrefstyle: full
453
-
454
- See <<app-features>> to find a complete list of features.
455
-
456
- [appendix#app-features]
457
- == Features
458
-
459
- All the features are listed in this appendix.
460
- """
461
- When it is converted to html
462
- Then the result should contain the HTML structure
463
- """
464
- |See
465
- a<> href='#app-features' Appendix A, <em>Features</em>
466
- |to find a complete list of features.
467
- """
468
-
469
- Scenario: Create a full cross reference to a numbered formal block
470
- Given the AsciiDoc source
471
- """
472
- :xrefstyle: full
473
-
474
- See <<tbl-features>> to find a table of features.
475
-
476
- .Features
477
- [#tbl-features%autowidth]
478
- |===
479
- |Text formatting |Formats text for display.
480
- |===
481
- """
482
- When it is converted to html
483
- Then the result should contain the HTML structure
484
- """
485
- |See
486
- a<> href='#tbl-features' Table 1, &#8220;Features&#8221;
487
- |to find a table of features.
488
- """
489
-
490
- Scenario: Create a short cross reference to a numbered formal block
491
- Given the AsciiDoc source
492
- """
493
- :xrefstyle: short
494
-
495
- See <<tbl-features>> to find a table of features.
496
-
497
- .Features
498
- [#tbl-features%autowidth]
499
- |===
500
- |Text formatting |Formats text for display.
501
- |===
502
- """
503
- When it is converted to html
504
- Then the result should contain the HTML structure
505
- """
506
- |See
507
- a<> href='#tbl-features' Table 1
508
- |to find a table of features.
509
- """
510
-
511
- Scenario: Create a basic cross reference to a numbered formal block when the caption prefix is disabled
512
- Given the AsciiDoc source
513
- """
514
- :xrefstyle: full
515
- :!table-caption:
516
-
517
- See <<tbl-features>> to find a table of features.
518
-
519
- .Features
520
- [#tbl-features%autowidth]
521
- |===
522
- |Text formatting |Formats text for display.
523
- |===
524
- """
525
- When it is converted to html
526
- Then the result should contain the HTML structure
527
- """
528
- |See
529
- a<> href='#tbl-features' Features
530
- |to find a table of features.
531
- """
532
-
533
- Scenario: Create a cross reference to a numbered formal block with a custom caption prefix
534
- Given the AsciiDoc source
535
- """
536
- :xrefstyle: full
537
- :table-caption: Tbl
538
-
539
- See <<tbl-features>> to find a table of features.
540
-
541
- .Features
542
- [#tbl-features%autowidth]
543
- |===
544
- |Text formatting |Formats text for display.
545
- |===
546
- """
547
- When it is converted to html
548
- Then the result should contain the HTML structure
549
- """
550
- |See
551
- a<> href='#tbl-features' Tbl 1, &#8220;Features&#8221;
552
- |to find a table of features.
553
- """
554
-
555
- Scenario: Create a full cross reference to a formal image block
556
- Given the AsciiDoc source
557
- """
558
- :xrefstyle: full
559
-
560
- Behold, <<tiger>>!
561
-
562
- .The ferocious Ghostscript tiger
563
- [#tiger]
564
- image::tiger.svg[Ghostscript tiger]
565
- """
566
- When it is converted to html
567
- Then the result should match the HTML structure
568
- """
569
- .paragraph: p
570
- |Behold,
571
- a< href='#tiger' Figure 1, &#8220;The ferocious Ghostscript tiger&#8221;
572
- |!
573
- #tiger.imageblock
574
- .content: img src='tiger.svg' alt='Ghostscript tiger'
575
- .title Figure 1. The ferocious Ghostscript tiger
576
- """
577
-
578
- Scenario: Create a short cross reference to a formal image block
579
- Given the AsciiDoc source
580
- """
581
- :xrefstyle: short
582
-
583
- Behold, <<tiger>>!
584
-
585
- .The ferocious Ghostscript tiger
586
- [#tiger]
587
- image::tiger.svg[Ghostscript tiger]
588
- """
589
- When it is converted to html
590
- Then the result should match the HTML structure
591
- """
592
- .paragraph: p
593
- |Behold,
594
- a< href='#tiger' Figure 1
595
- |!
596
- #tiger.imageblock
597
- .content: img src='tiger.svg' alt='Ghostscript tiger'
598
- .title Figure 1. The ferocious Ghostscript tiger
599
- """
600
-
601
- Scenario: Create a full cross reference to a block with an explicit caption
602
- Given the AsciiDoc source
603
- """
604
- :xrefstyle: full
605
-
606
- See <<diagram-1>> and <<diagram-2>>.
607
-
608
- .Managing Orders
609
- [#diagram-1,caption="Diagram {counter:diag-number}. "]
610
- image::managing-orders.png[Managing Orders]
611
-
612
- .Managing Inventory
613
- [#diagram-2,caption="Diagram {counter:diag-number}. "]
614
- image::managing-inventory.png[Managing Inventory]
615
- """
616
- When it is converted to html
617
- Then the result should match the HTML structure
618
- """
619
- .paragraph: p
620
- |See
621
- a<> href='#diagram-1' Diagram 1, &#8220;Managing Orders&#8221;
622
- |and
623
- a< href='#diagram-2' Diagram 2, &#8220;Managing Inventory&#8221;
624
- |.
625
- #diagram-1.imageblock
626
- .content: img src='managing-orders.png' alt='Managing Orders'
627
- .title Diagram 1. Managing Orders
628
- #diagram-2.imageblock
629
- .content: img src='managing-inventory.png' alt='Managing Inventory'
630
- .title Diagram 2. Managing Inventory
631
- """
632
-
633
- Scenario: Create a short cross reference to a block with an explicit caption
634
- Given the AsciiDoc source
635
- """
636
- :xrefstyle: short
637
-
638
- See <<diagram-1>> and <<diagram-2>>.
639
-
640
- .Managing Orders
641
- [#diagram-1,caption="Diagram {counter:diag-number}. "]
642
- image::managing-orders.png[Managing Orders]
643
-
644
- .Managing Inventory
645
- [#diagram-2,caption="Diagram {counter:diag-number}. "]
646
- image::managing-inventory.png[Managing Inventory]
647
- """
648
- When it is converted to html
649
- Then the result should match the HTML structure
650
- """
651
- .paragraph: p
652
- |See
653
- a<> href='#diagram-1' Diagram 1
654
- |and
655
- a< href='#diagram-2' Diagram 2
656
- |.
657
- #diagram-1.imageblock
658
- .content: img src='managing-orders.png' alt='Managing Orders'
659
- .title Diagram 1. Managing Orders
660
- #diagram-2.imageblock
661
- .content: img src='managing-inventory.png' alt='Managing Inventory'
662
- .title Diagram 2. Managing Inventory
663
- """
664
-
665
- Scenario: Create a basic cross reference to an unnumbered formal block
666
- Given the AsciiDoc source
667
- """
668
- :xrefstyle: full
669
-
670
- See <<data>> to find the data used in this report.
671
-
672
- .Data
673
- [#data]
674
- ....
675
- a
676
- b
677
- c
678
- ....
679
- """
680
- When it is converted to html
681
- Then the result should contain the HTML structure
682
- """
683
- |See
684
- a<> href='#data' Data
685
- |to find the data used in this report.
686
- """
687
-
688
- Scenario: Use title as cross reference text to refer to a formal admonition block
689
- Given the AsciiDoc source
690
- """
691
- :xrefstyle: full
692
-
693
- Recall in <<essential-tip-1>>, we told you how to speed up this process.
694
-
695
- .Essential tip #1
696
- [#essential-tip-1]
697
- TIP: You can speed up this process by pressing the turbo button.
698
- """
699
- When it is converted to html
700
- Then the result should contain the HTML structure
701
- """
702
- |Recall in
703
- a< href='#essential-tip-1' Essential tip #1
704
- |, we told you how to speed up this process.
705
- """
706
-
707
- Scenario: Create a cross reference from an AsciiDoc cell to a section
708
- Given the AsciiDoc source
709
- """
710
- |===
711
- a|See <<_install>>
712
- |===
713
-
714
- == Install
715
-
716
- Instructions go here.
717
- """
718
- When it is converted to html
719
- Then the result should match the HTML structure
720
- """
721
- table.tableblock.frame-all.grid-all.stretch
722
- colgroup
723
- col style='width: 100%;'
724
- tbody
725
- tr
726
- td.tableblock.halign-left.valign-top
727
- div.content
728
- .paragraph: p
729
- |See
730
- a< href='#_install' Install
731
- .sect1
732
- h2#_install Install
733
- .sectionbody
734
- .paragraph: p Instructions go here.
735
- """
736
-
737
- Scenario: Create a cross reference using the title of the target section
738
- Given the AsciiDoc source
739
- """
740
- == Section One
741
-
742
- content
743
-
744
- == Section Two
745
-
746
- refer to <<Section One>>
747
- """
748
- When it is converted to html
749
- Then the result should match the HTML structure
750
- """
751
- .sect1
752
- h2#_section_one Section One
753
- .sectionbody: .paragraph: p content
754
- .sect1
755
- h2#_section_two Section Two
756
- .sectionbody: .paragraph: p
757
- |refer to
758
- a< href='#_section_one' Section One
759
- """
760
-
761
- Scenario: Create a cross reference using the reftext of the target section
762
- Given the AsciiDoc source
763
- """
764
- [reftext="the first section"]
765
- == Section One
766
-
767
- content
768
-
769
- == Section Two
770
-
771
- refer to <<the first section>>
772
- """
773
- When it is converted to html
774
- Then the result should match the HTML structure
775
- """
776
- .sect1
777
- h2#_section_one Section One
778
- .sectionbody: .paragraph: p content
779
- .sect1
780
- h2#_section_two Section Two
781
- .sectionbody: .paragraph: p
782
- |refer to
783
- a< href='#_section_one' the first section
784
- """
785
- When it is converted to docbook
786
- Then the result should match the XML structure
787
- """
788
- section xml:id='_section_one' xreflabel='the first section'
789
- title Section One
790
- simpara content
791
- section xml:id='_section_two'
792
- title Section Two
793
- simpara
794
- |refer to
795
- xref< linkend='_section_one'/
796
- """
797
-
798
- Scenario: Create a cross reference using the formatted title of the target section
799
- Given the AsciiDoc source
800
- """
801
- == Section *One*
802
-
803
- content
804
-
805
- == Section Two
806
-
807
- refer to <<Section *One*>>
808
- """
809
- When it is converted to html
810
- Then the result should match the HTML structure
811
- """
812
- .sect1
813
- h2#_section_one
814
- |Section <strong>One</strong>
815
- .sectionbody: .paragraph: p content
816
- .sect1
817
- h2#_section_two Section Two
818
- .sectionbody: .paragraph: p
819
- |refer to
820
- a< href='#_section_one' Section <strong>One</strong>
821
- """
822
-
823
- Scenario: Does not process a natural cross reference in compat mode
824
- Given the AsciiDoc source
825
- """
826
- :compat-mode:
827
-
828
- == Section One
829
-
830
- content
831
-
832
- == Section Two
833
-
834
- refer to <<Section One>>
835
- """
836
- When it is converted to html
837
- Then the result should match the HTML structure
838
- """
839
- .sect1
840
- h2#_section_one
841
- |Section One
842
- .sectionbody: .paragraph: p content
843
- .sect1
844
- h2#_section_two Section Two
845
- .sectionbody: .paragraph: p
846
- |refer to
847
- a< href='#Section One' [Section One]
848
- """
849
-
850
- Scenario: Parses text of xref macro as attributes if attribute signature found
851
- Given the AsciiDoc source
852
- """
853
- == Section One
854
-
855
- content
856
-
857
- == Section Two
858
-
859
- refer to xref:_section_one[role=next]
860
- """
861
- When it is converted to html
862
- Then the result should match the HTML structure
863
- """
864
- .sect1
865
- h2#_section_one
866
- |Section One
867
- .sectionbody: .paragraph: p content
868
- .sect1
869
- h2#_section_two Section Two
870
- .sectionbody: .paragraph: p
871
- |refer to
872
- a< href='#_section_one' class='next' Section One
873
- """
874
-
875
- Scenario: Does not parse text of xref macro as attribute if attribute signature not found
876
- Given the AsciiDoc source
877
- """
878
- == Section One
879
-
880
- content
881
-
882
- == Section Two
883
-
884
- refer to xref:_section_one[One, Section One]
885
- """
886
- When it is converted to html
887
- Then the result should match the HTML structure
888
- """
889
- .sect1
890
- h2#_section_one
891
- |Section One
892
- .sectionbody: .paragraph: p content
893
- .sect1
894
- h2#_section_two Section Two
895
- .sectionbody: .paragraph: p
896
- |refer to
897
- a< href='#_section_one' One, Section One
898
- """
899
-
900
- Scenario: Uses whole text of xref macro as link text if attribute signature found and text is enclosed in double quotes
901
- Given the AsciiDoc source
902
- """
903
- == Section One
904
-
905
- content
906
-
907
- == Section Two
908
-
909
- refer to xref:_section_one["Section One == Starting Point"]
910
- """
911
- When it is converted to html
912
- Then the result should match the HTML structure
913
- """
914
- .sect1
915
- h2#_section_one
916
- |Section One
917
- .sectionbody: .paragraph: p content
918
- .sect1
919
- h2#_section_two Section Two
920
- .sectionbody: .paragraph: p
921
- |refer to
922
- a< href='#_section_one'
923
- |Section One == Starting Point
924
- """
925
-
926
- Scenario: Does not parse text of xref macro as text if enclosed in double quotes but attribute signature not found
927
- Given the AsciiDoc source
928
- """
929
- == Section One
930
-
931
- content
932
-
933
- == Section Two
934
-
935
- refer to xref:_section_one["The Premier Section"]
936
- """
937
- When it is converted to html
938
- Then the result should match the HTML structure
939
- """
940
- .sect1
941
- h2#_section_one
942
- |Section One
943
- .sectionbody: .paragraph: p content
944
- .sect1
945
- h2#_section_two Section Two
946
- .sectionbody: .paragraph: p
947
- |refer to
948
- a< href='#_section_one' "The Premier Section"
949
- """
950
-
951
- Scenario: Can escape double quotes in text of xref macro using backslashes when text is parsed as attributes
952
- Given the AsciiDoc source
953
- """
954
- == Section One
955
-
956
- content
957
-
958
- == Section Two
959
-
960
- refer to xref:_section_one["\"The Premier Section\"",role=spotlight]
961
- """
962
- When it is converted to html
963
- Then the result should match the HTML structure
964
- """
965
- .sect1
966
- h2#_section_one
967
- |Section One
968
- .sectionbody: .paragraph: p content
969
- .sect1
970
- h2#_section_two Section Two
971
- .sectionbody: .paragraph: p
972
- |refer to
973
- a< href='#_section_one' class='spotlight' "The Premier Section"
974
- """
975
-
976
- Scenario: Override xrefstyle for a given part of the document
977
- Given the AsciiDoc source
978
- """
979
- :xrefstyle: full
980
- :doctype: book
981
- :sectnums:
982
-
983
- == Foo
984
-
985
- refer to <<#_bar>>
986
-
987
- == Bar
988
- :xrefstyle: short
989
-
990
- refer to xref:#_foo[xrefstyle=short]
991
- """
992
- When it is converted to html
993
- Then the result should match the HTML structure
994
- """
995
- .sect1
996
- h2#_foo 1. Foo
997
- .sectionbody: .paragraph: p
998
- |refer to
999
- a< href='#_bar' Chapter 2, <em>Bar</em>
1000
- .sect1
1001
- h2#_bar 2. Bar
1002
- .sectionbody: .paragraph: p
1003
- |refer to
1004
- a< href='#_foo' Chapter 1
1005
- """
1006
-
1007
- Scenario: Override xrefstyle for a specific reference by assigning the xrefstyle attribute on the xref macro
1008
- Given the AsciiDoc source
1009
- """
1010
- :xrefstyle: full
1011
- :doctype: book
1012
- :sectnums:
1013
-
1014
- == Foo
1015
-
1016
- content
1017
-
1018
- == Bar
1019
-
1020
- refer to <<#_foo>>
1021
-
1022
- refer to xref:#_foo[xrefstyle=short]
1023
- """
1024
- When it is converted to html
1025
- Then the result should match the HTML structure
1026
- """
1027
- .sect1
1028
- h2#_foo 1. Foo
1029
- .sectionbody: .paragraph: p content
1030
- .sect1
1031
- h2#_bar 2. Bar
1032
- .sectionbody
1033
- .paragraph: p
1034
- |refer to
1035
- a< href='#_foo' Chapter 1, <em>Foo</em>
1036
- .paragraph: p
1037
- |refer to
1038
- a< href='#_foo' Chapter 1
1039
- """