asciidoctor 1.5.5 → 1.5.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of asciidoctor might be problematic. Click here for more details.

Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +216 -1
  3. data/CONTRIBUTING.adoc +2 -2
  4. data/Gemfile +20 -1
  5. data/LICENSE.adoc +1 -1
  6. data/README-fr.adoc +4 -3
  7. data/README-jp.adoc +11 -10
  8. data/README-zh_CN.adoc +4 -3
  9. data/README.adoc +17 -202
  10. data/Rakefile +41 -25
  11. data/asciidoctor.gemspec +9 -10
  12. data/data/locale/attributes.adoc +216 -34
  13. data/data/stylesheets/asciidoctor-default.css +23 -16
  14. data/features/step_definitions.rb +15 -19
  15. data/features/xref.feature +584 -20
  16. data/lib/asciidoctor.rb +292 -278
  17. data/lib/asciidoctor/abstract_block.rb +155 -94
  18. data/lib/asciidoctor/abstract_node.rb +108 -94
  19. data/lib/asciidoctor/attribute_list.rb +30 -22
  20. data/lib/asciidoctor/block.rb +7 -7
  21. data/lib/asciidoctor/cli/invoker.rb +47 -34
  22. data/lib/asciidoctor/cli/options.rb +22 -11
  23. data/lib/asciidoctor/converter.rb +3 -3
  24. data/lib/asciidoctor/converter/base.rb +2 -2
  25. data/lib/asciidoctor/converter/composite.rb +1 -1
  26. data/lib/asciidoctor/converter/docbook45.rb +2 -2
  27. data/lib/asciidoctor/converter/docbook5.rb +132 -87
  28. data/lib/asciidoctor/converter/factory.rb +0 -1
  29. data/lib/asciidoctor/converter/html5.rb +116 -98
  30. data/lib/asciidoctor/converter/manpage.rb +51 -52
  31. data/lib/asciidoctor/converter/template.rb +47 -36
  32. data/lib/asciidoctor/core_ext.rb +8 -2
  33. data/lib/asciidoctor/core_ext/1.8.7/hash/key.rb +4 -0
  34. data/lib/asciidoctor/core_ext/1.8.7/io/binread.rb +6 -0
  35. data/lib/asciidoctor/core_ext/1.8.7/io/write.rb +5 -0
  36. data/lib/asciidoctor/core_ext/1.8.7/string/chr.rb +1 -1
  37. data/lib/asciidoctor/core_ext/1.8.7/string/{limit.rb → limit_bytesize.rb} +7 -6
  38. data/lib/asciidoctor/core_ext/1.8.7/symbol/empty.rb +6 -0
  39. data/lib/asciidoctor/core_ext/1.8.7/symbol/length.rb +1 -1
  40. data/lib/asciidoctor/core_ext/nil_or_empty.rb +5 -5
  41. data/lib/asciidoctor/core_ext/regexp/is_match.rb +3 -0
  42. data/lib/asciidoctor/core_ext/string/{limit.rb → limit_bytesize.rb} +2 -2
  43. data/lib/asciidoctor/document.rb +216 -213
  44. data/lib/asciidoctor/extensions.rb +318 -185
  45. data/lib/asciidoctor/helpers.rb +35 -35
  46. data/lib/asciidoctor/inline.rb +32 -1
  47. data/lib/asciidoctor/list.rb +22 -6
  48. data/lib/asciidoctor/parser.rb +1008 -1038
  49. data/lib/asciidoctor/path_resolver.rb +46 -50
  50. data/lib/asciidoctor/reader.rb +275 -251
  51. data/lib/asciidoctor/section.rb +86 -58
  52. data/lib/asciidoctor/stylesheets.rb +6 -6
  53. data/lib/asciidoctor/substitutors.rb +567 -649
  54. data/lib/asciidoctor/table.rb +163 -108
  55. data/lib/asciidoctor/version.rb +1 -1
  56. data/man/asciidoctor.1 +18 -16
  57. data/man/asciidoctor.adoc +15 -13
  58. data/test/attributes_test.rb +138 -22
  59. data/test/blocks_test.rb +377 -97
  60. data/test/converter_test.rb +13 -0
  61. data/test/document_test.rb +244 -34
  62. data/test/extensions_test.rb +409 -42
  63. data/test/fixtures/asciidoc_index.txt +521 -0
  64. data/test/fixtures/basic-docinfo-footer.html +6 -0
  65. data/test/fixtures/basic-docinfo-footer.xml +8 -0
  66. data/test/fixtures/basic-docinfo.html +1 -0
  67. data/test/fixtures/basic-docinfo.xml +4 -0
  68. data/test/fixtures/basic.asciidoc +5 -0
  69. data/test/fixtures/chapter-a.adoc +3 -0
  70. data/test/fixtures/child-include.adoc +5 -0
  71. data/test/fixtures/circle.svg +9 -0
  72. data/test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb +6 -0
  73. data/test/fixtures/custom-backends/haml/docbook45/block_paragraph.xml.haml +6 -0
  74. data/test/fixtures/custom-backends/haml/html5-tweaks/block_paragraph.html.haml +1 -0
  75. data/test/fixtures/custom-backends/haml/html5/block_paragraph.html.haml +3 -0
  76. data/test/fixtures/custom-backends/haml/html5/block_sidebar.html.haml +5 -0
  77. data/test/fixtures/custom-backends/slim/docbook45/block_paragraph.xml.slim +6 -0
  78. data/test/fixtures/custom-backends/slim/html5/block_paragraph.html.slim +3 -0
  79. data/test/fixtures/custom-backends/slim/html5/block_sidebar.html.slim +5 -0
  80. data/test/fixtures/custom-docinfodir/basic-docinfo.html +1 -0
  81. data/test/fixtures/custom-docinfodir/docinfo.html +1 -0
  82. data/test/fixtures/docinfo-footer.html +1 -0
  83. data/test/fixtures/docinfo-footer.xml +9 -0
  84. data/test/fixtures/docinfo.html +1 -0
  85. data/test/fixtures/docinfo.xml +3 -0
  86. data/test/fixtures/dot.gif +0 -0
  87. data/test/fixtures/encoding.asciidoc +13 -0
  88. data/test/fixtures/grandchild-include.adoc +3 -0
  89. data/test/fixtures/hello-asciidoctor.pdf +69 -0
  90. data/test/fixtures/include-file.asciidoc +24 -0
  91. data/test/fixtures/include-file.ml +3 -0
  92. data/test/fixtures/include-file.xml +5 -0
  93. data/test/fixtures/master.adoc +5 -0
  94. data/test/fixtures/mismatched-end-tag.adoc +7 -0
  95. data/test/fixtures/parent-include-restricted.adoc +5 -0
  96. data/test/fixtures/parent-include.adoc +5 -0
  97. data/test/fixtures/sample.asciidoc +26 -0
  98. data/test/fixtures/stylesheets/custom.css +3 -0
  99. data/test/fixtures/subs-docinfo.html +2 -0
  100. data/test/fixtures/subs.adoc +7 -0
  101. data/test/fixtures/tagged-class-enclosed.rb +26 -0
  102. data/test/fixtures/tagged-class.rb +23 -0
  103. data/test/fixtures/tip.gif +0 -0
  104. data/test/invoker_test.rb +82 -4
  105. data/test/links_test.rb +312 -37
  106. data/test/lists_test.rb +204 -25
  107. data/test/manpage_test.rb +191 -4
  108. data/test/options_test.rb +18 -1
  109. data/test/paragraphs_test.rb +32 -7
  110. data/test/parser_test.rb +150 -30
  111. data/test/paths_test.rb +47 -13
  112. data/test/preamble_test.rb +1 -1
  113. data/test/reader_test.rb +366 -126
  114. data/test/sections_test.rb +203 -56
  115. data/test/substitutions_test.rb +339 -131
  116. data/test/tables_test.rb +315 -15
  117. data/test/test_helper.rb +400 -0
  118. data/test/text_test.rb +5 -5
  119. metadata +110 -22
@@ -79,13 +79,12 @@ strong,b{font-weight:bold;line-height:inherit}
79
79
  small{font-size:60%;line-height:inherit}
80
80
  code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)}
81
81
  ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}
82
- ul,ol,ul.no-bullet,ol.no-bullet{margin-left:1.5em}
82
+ ul,ol{margin-left:1.5em}
83
83
  ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em}
84
84
  ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit}
85
85
  ul.square{list-style-type:square}
86
86
  ul.circle{list-style-type:circle}
87
87
  ul.disc{list-style-type:disc}
88
- ul.no-bullet{list-style:none}
89
88
  ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}
90
89
  dl dt{margin-bottom:.3125em;font-weight:bold}
91
90
  dl dd{margin-bottom:1.25em}
@@ -121,7 +120,11 @@ strong strong{font-weight:400}
121
120
  kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background-color:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em white inset;box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em #fff inset;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap}
122
121
  .keyseq kbd:first-child{margin-left:0}
123
122
  .keyseq kbd:last-child{margin-right:0}
124
- .menuseq,.menu{color:rgba(0,0,0,.8)}
123
+ .menuseq,.menuref{color:#000}
124
+ .menuseq b:not(.caret),.menuref{font-weight:inherit}
125
+ .menuseq{word-spacing:-.02em}
126
+ .menuseq b.caret{font-size:1.25em;line-height:.8}
127
+ .menuseq i.caret{font-weight:bold;text-align:center;width:.45em}
125
128
  b.button:before,b.button:after{position:relative;top:-1px;font-weight:400}
126
129
  b.button:before{content:"[";padding:0 3px 0 2px}
127
130
  b.button:after{content:"]";padding:0 2px 0 3px}
@@ -188,7 +191,7 @@ table.tableblock>caption.title{white-space:nowrap;overflow:visible;max-width:0}
188
191
  table.tableblock #preamble>.sectionbody>.paragraph:first-of-type p{font-size:inherit}
189
192
  .admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}
190
193
  .admonitionblock>table td.icon{text-align:center;width:80px}
191
- .admonitionblock>table td.icon img{max-width:none}
194
+ .admonitionblock>table td.icon img{max-width:initial}
192
195
  .admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase}
193
196
  .admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #ddddd8;color:rgba(0,0,0,.6)}
194
197
  .admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
@@ -244,13 +247,13 @@ table.pyhltable .linenodiv{background:none!important;padding-right:0!important}
244
247
  table.tableblock{max-width:100%;border-collapse:separate}
245
248
  table.tableblock td>.paragraph:last-child p>p:last-child,table.tableblock th>p:last-child,table.tableblock td>p:last-child{margin-bottom:0}
246
249
  table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}
247
- table.grid-all th.tableblock,table.grid-all td.tableblock{border-width:0 1px 1px 0}
248
- table.grid-all tfoot>tr>th.tableblock,table.grid-all tfoot>tr>td.tableblock{border-width:1px 1px 0 0}
249
- table.grid-cols th.tableblock,table.grid-cols td.tableblock{border-width:0 1px 0 0}
250
- table.grid-all *>tr>.tableblock:last-child,table.grid-cols *>tr>.tableblock:last-child{border-right-width:0}
251
- table.grid-rows th.tableblock,table.grid-rows td.tableblock{border-width:0 0 1px 0}
252
- table.grid-all tbody>tr:last-child>th.tableblock,table.grid-all tbody>tr:last-child>td.tableblock,table.grid-all thead:last-child>tr>th.tableblock,table.grid-rows tbody>tr:last-child>th.tableblock,table.grid-rows tbody>tr:last-child>td.tableblock,table.grid-rows thead:last-child>tr>th.tableblock{border-bottom-width:0}
253
- table.grid-rows tfoot>tr>th.tableblock,table.grid-rows tfoot>tr>td.tableblock{border-width:1px 0 0 0}
250
+ table.grid-all>thead>tr>.tableblock,table.grid-all>tbody>tr>.tableblock{border-width:0 1px 1px 0}
251
+ table.grid-all>tfoot>tr>.tableblock{border-width:1px 1px 0 0}
252
+ table.grid-cols>*>tr>.tableblock{border-width:0 1px 0 0}
253
+ table.grid-rows>thead>tr>.tableblock,table.grid-rows>tbody>tr>.tableblock{border-width:0 0 1px 0}
254
+ table.grid-rows>tfoot>tr>.tableblock{border-width:1px 0 0 0}
255
+ table.grid-all>*>tr>.tableblock:last-child,table.grid-cols>*>tr>.tableblock:last-child{border-right-width:0}
256
+ table.grid-all>tbody>tr:last-child>.tableblock,table.grid-all>thead:last-child>tr>.tableblock,table.grid-rows>tbody>tr:last-child>.tableblock,table.grid-rows>thead:last-child>tr>.tableblock{border-bottom-width:0}
254
257
  table.frame-all{border-width:1px}
255
258
  table.frame-sides{border-width:0 1px}
256
259
  table.frame-topbot{border-width:1px 0}
@@ -271,10 +274,12 @@ ul li ol{margin-left:1.5em}
271
274
  dl dd{margin-left:1.125em}
272
275
  dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}
273
276
  ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}
274
- ul.unstyled,ol.unnumbered,ul.checklist,ul.none{list-style-type:none}
275
- ul.unstyled,ol.unnumbered,ul.checklist{margin-left:.625em}
276
- ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1em;font-size:.85em}
277
- ul.checklist li>p:first-child>input[type="checkbox"]:first-child{width:1em;position:relative;top:1px}
277
+ ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none}
278
+ ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em}
279
+ ul.unstyled,ol.unstyled{margin-left:0}
280
+ ul.checklist{margin-left:.625em}
281
+ ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em}
282
+ ul.checklist li>p:first-child>input[type="checkbox"]:first-child{margin-right:.25em}
278
283
  ul.inline{margin:0 auto .625em auto;margin-left:-1.375em;margin-right:0;padding:0;list-style:none;overflow:hidden}
279
284
  ul.inline>li{list-style:none;float:left;margin-left:1.375em;display:block}
280
285
  ul.inline>li>*{display:block}
@@ -291,7 +296,8 @@ ol.lowergreek{list-style-type:lower-greek}
291
296
  td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em}
292
297
  td.hdlist1{font-weight:bold;padding-bottom:1.25em}
293
298
  .literalblock+.colist,.listingblock+.colist{margin-top:-.5em}
294
- .colist>table tr>td:first-of-type{padding:0 .75em;line-height:1}
299
+ .colist>table tr>td:first-of-type{padding:.4em .75em 0 .75em;line-height:1;vertical-align:top}
300
+ .colist>table tr>td:first-of-type img{max-width:initial}
295
301
  .colist>table tr>td:last-of-type{padding:.25em 0}
296
302
  .thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd}
297
303
  .imageblock.left,.imageblock[style*="float: left"]{margin:.25em .625em 1.25em 0}
@@ -354,6 +360,7 @@ div.unbreakable{page-break-inside:avoid}
354
360
  .yellow{color:#bfbf00}
355
361
  .yellow-background{background-color:#fafa00}
356
362
  span.icon>.fa{cursor:default}
363
+ a span.icon>.fa{cursor:inherit}
357
364
  .admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
358
365
  .admonitionblock td.icon .icon-note:before{content:"\f05a";color:#19407c}
359
366
  .admonitionblock td.icon .icon-tip:before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}
@@ -20,7 +20,7 @@ end
20
20
 
21
21
  When /it is converted to html/ do
22
22
  @output = Asciidoctor.convert @source
23
- #File.open('/tmp/test.adoc', 'w') {|f| f.write @source }
23
+ #IO.write '/tmp/test.adoc', @source
24
24
  #@output = %x{asciidoc -f compat/asciidoc.conf -o - -s /tmp/test.adoc | XMLLINT_INDENT='' xmllint --format - | tail -n +2}.rstrip
25
25
  ##@output = %x{asciidoc -f compat/asciidoc.conf -o - -s /tmp/test.adoc}
26
26
  end
@@ -29,25 +29,21 @@ When /it is converted to docbook/ do
29
29
  @output = Asciidoctor.convert @source, :backend => :docbook
30
30
  end
31
31
 
32
- Then /the result should match the (HTML|XML) source/ do |format, expect|
33
- @output.should == expect
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
34
35
  end
35
36
 
36
- Then /the result should match the (HTML|XML) structure/ do |format, expect|
37
- case format
38
- when 'HTML'
39
- options = {:format => :html5}
40
- when 'XML'
41
- options = {:format => :xhtml}
42
- else
43
- options = {}
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
44
  end
45
- slim_friendly_output = @output.lines.entries.map {|line|
46
- if line.start_with? '<'
47
- line
48
- else
49
- %(|#{line})
50
- end
51
- }.join
52
- Slim::Template.new(options) { slim_friendly_output }.render.should == Slim::Template.new(options) { expect }.render
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
53
49
  end
@@ -1,9 +1,567 @@
1
1
  # language: en
2
2
  Feature: Cross References
3
- In order to create links to other sections
3
+ In order to create cross references between sections and blocks in the current or neighboring document
4
4
  As a writer
5
- I want to be able to use a cross reference macro
5
+ I want to be able to use the cross reference macro to compose these references
6
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 appendix
267
+ Given the AsciiDoc source
268
+ """
269
+ :sectnums:
270
+ :xrefstyle: full
271
+
272
+ See <<app-features>> to find a complete list of features.
273
+
274
+ [appendix#app-features]
275
+ == Features
276
+
277
+ All the features are listed in this appendix.
278
+ """
279
+ When it is converted to html
280
+ Then the result should contain the HTML structure
281
+ """
282
+ |See
283
+ a<> href='#app-features' Appendix A, <em>Features</em>
284
+ |to find a complete list of features.
285
+ """
286
+
287
+ Scenario: Create a short cross reference to a numbered appendix
288
+ Given the AsciiDoc source
289
+ """
290
+ :sectnums:
291
+ :xrefstyle: short
292
+
293
+ See <<app-features>> to find a complete list of features.
294
+
295
+ [appendix#app-features]
296
+ == Features
297
+
298
+ All the features are listed in this appendix.
299
+ """
300
+ When it is converted to html
301
+ Then the result should contain the HTML structure
302
+ """
303
+ |See
304
+ a<> href='#app-features' Appendix A
305
+ |to find a complete list of features.
306
+ """
307
+
308
+ Scenario: Create a full cross reference to an appendix even when section numbering is disabled
309
+ Given the AsciiDoc source
310
+ """
311
+ :xrefstyle: full
312
+
313
+ See <<app-features>> to find a complete list of features.
314
+
315
+ [appendix#app-features]
316
+ == Features
317
+
318
+ All the features are listed in this appendix.
319
+ """
320
+ When it is converted to html
321
+ Then the result should contain the HTML structure
322
+ """
323
+ |See
324
+ a<> href='#app-features' Appendix A, <em>Features</em>
325
+ |to find a complete list of features.
326
+ """
327
+
328
+ Scenario: Create a full cross reference to a numbered formal block
329
+ Given the AsciiDoc source
330
+ """
331
+ :xrefstyle: full
332
+
333
+ See <<tbl-features>> to find a table of features.
334
+
335
+ .Features
336
+ [#tbl-features%autowidth]
337
+ |===
338
+ |Text formatting |Formats text for display.
339
+ |===
340
+ """
341
+ When it is converted to html
342
+ Then the result should contain the HTML structure
343
+ """
344
+ |See
345
+ a<> href='#tbl-features' Table 1, &#8220;Features&#8221;
346
+ |to find a table of features.
347
+ """
348
+
349
+ Scenario: Create a short cross reference to a numbered formal block
350
+ Given the AsciiDoc source
351
+ """
352
+ :xrefstyle: short
353
+
354
+ See <<tbl-features>> to find a table of features.
355
+
356
+ .Features
357
+ [#tbl-features%autowidth]
358
+ |===
359
+ |Text formatting |Formats text for display.
360
+ |===
361
+ """
362
+ When it is converted to html
363
+ Then the result should contain the HTML structure
364
+ """
365
+ |See
366
+ a<> href='#tbl-features' Table 1
367
+ |to find a table of features.
368
+ """
369
+
370
+ Scenario: Create a basic cross reference to a numbered formal block when the caption prefix is disabled
371
+ Given the AsciiDoc source
372
+ """
373
+ :xrefstyle: full
374
+ :!table-caption:
375
+
376
+ See <<tbl-features>> to find a table of features.
377
+
378
+ .Features
379
+ [#tbl-features%autowidth]
380
+ |===
381
+ |Text formatting |Formats text for display.
382
+ |===
383
+ """
384
+ When it is converted to html
385
+ Then the result should contain the HTML structure
386
+ """
387
+ |See
388
+ a<> href='#tbl-features' Features
389
+ |to find a table of features.
390
+ """
391
+
392
+ Scenario: Create a cross reference to a numbered formal block with a custom caption prefix
393
+ Given the AsciiDoc source
394
+ """
395
+ :xrefstyle: full
396
+ :table-caption: Tbl
397
+
398
+ See <<tbl-features>> to find a table of features.
399
+
400
+ .Features
401
+ [#tbl-features%autowidth]
402
+ |===
403
+ |Text formatting |Formats text for display.
404
+ |===
405
+ """
406
+ When it is converted to html
407
+ Then the result should contain the HTML structure
408
+ """
409
+ |See
410
+ a<> href='#tbl-features' Tbl 1, &#8220;Features&#8221;
411
+ |to find a table of features.
412
+ """
413
+
414
+ Scenario: Create a full cross reference to a formal image block
415
+ Given the AsciiDoc source
416
+ """
417
+ :xrefstyle: full
418
+
419
+ Behold, <<tiger>>!
420
+
421
+ .The ferocious Ghostscript tiger
422
+ [#tiger]
423
+ image::tiger.svg[Ghostscript tiger]
424
+ """
425
+ When it is converted to html
426
+ Then the result should match the HTML structure
427
+ """
428
+ .paragraph: p
429
+ |Behold,
430
+ a< href='#tiger' Figure 1, &#8220;The ferocious Ghostscript tiger&#8221;
431
+ |!
432
+ #tiger.imageblock
433
+ .content: img src='tiger.svg' alt='Ghostscript tiger'
434
+ .title Figure 1. The ferocious Ghostscript tiger
435
+ """
436
+
437
+ Scenario: Create a short cross reference to a formal image block
438
+ Given the AsciiDoc source
439
+ """
440
+ :xrefstyle: short
441
+
442
+ Behold, <<tiger>>!
443
+
444
+ .The ferocious Ghostscript tiger
445
+ [#tiger]
446
+ image::tiger.svg[Ghostscript tiger]
447
+ """
448
+ When it is converted to html
449
+ Then the result should match the HTML structure
450
+ """
451
+ .paragraph: p
452
+ |Behold,
453
+ a< href='#tiger' Figure 1
454
+ |!
455
+ #tiger.imageblock
456
+ .content: img src='tiger.svg' alt='Ghostscript tiger'
457
+ .title Figure 1. The ferocious Ghostscript tiger
458
+ """
459
+
460
+ Scenario: Create a full cross reference to a block with an explicit caption
461
+ Given the AsciiDoc source
462
+ """
463
+ :xrefstyle: full
464
+
465
+ See <<diagram-1>> and <<diagram-2>>.
466
+
467
+ .Managing Orders
468
+ [#diagram-1,caption="Diagram {counter:diag-number}. "]
469
+ image::managing-orders.png[Managing Orders]
470
+
471
+ .Managing Inventory
472
+ [#diagram-2,caption="Diagram {counter:diag-number}. "]
473
+ image::managing-inventory.png[Managing Inventory]
474
+ """
475
+ When it is converted to html
476
+ Then the result should match the HTML structure
477
+ """
478
+ .paragraph: p
479
+ |See
480
+ a<> href='#diagram-1' Diagram 1, &#8220;Managing Orders&#8221;
481
+ |and
482
+ a< href='#diagram-2' Diagram 2, &#8220;Managing Inventory&#8221;
483
+ |.
484
+ #diagram-1.imageblock
485
+ .content: img src='managing-orders.png' alt='Managing Orders'
486
+ .title Diagram 1. Managing Orders
487
+ #diagram-2.imageblock
488
+ .content: img src='managing-inventory.png' alt='Managing Inventory'
489
+ .title Diagram 2. Managing Inventory
490
+ """
491
+
492
+ Scenario: Create a short cross reference to a block with an explicit caption
493
+ Given the AsciiDoc source
494
+ """
495
+ :xrefstyle: short
496
+
497
+ See <<diagram-1>> and <<diagram-2>>.
498
+
499
+ .Managing Orders
500
+ [#diagram-1,caption="Diagram {counter:diag-number}. "]
501
+ image::managing-orders.png[Managing Orders]
502
+
503
+ .Managing Inventory
504
+ [#diagram-2,caption="Diagram {counter:diag-number}. "]
505
+ image::managing-inventory.png[Managing Inventory]
506
+ """
507
+ When it is converted to html
508
+ Then the result should match the HTML structure
509
+ """
510
+ .paragraph: p
511
+ |See
512
+ a<> href='#diagram-1' Diagram 1
513
+ |and
514
+ a< href='#diagram-2' Diagram 2
515
+ |.
516
+ #diagram-1.imageblock
517
+ .content: img src='managing-orders.png' alt='Managing Orders'
518
+ .title Diagram 1. Managing Orders
519
+ #diagram-2.imageblock
520
+ .content: img src='managing-inventory.png' alt='Managing Inventory'
521
+ .title Diagram 2. Managing Inventory
522
+ """
523
+
524
+ Scenario: Create a basic cross reference to an unnumbered formal block
525
+ Given the AsciiDoc source
526
+ """
527
+ :xrefstyle: full
528
+
529
+ See <<data>> to find the data used in this report.
530
+
531
+ .Data
532
+ [#data]
533
+ ....
534
+ a
535
+ b
536
+ c
537
+ ....
538
+ """
539
+ When it is converted to html
540
+ Then the result should contain the HTML structure
541
+ """
542
+ |See
543
+ a<> href='#data' Data
544
+ |to find the data used in this report.
545
+ """
546
+
547
+ Scenario: Use title as cross reference text to refer to a formal admonition block
548
+ Given the AsciiDoc source
549
+ """
550
+ :xrefstyle: full
551
+
552
+ Recall in <<essential-tip-1>>, we told you how to speed up this process.
553
+
554
+ .Essential tip #1
555
+ [#essential-tip-1]
556
+ TIP: You can speed up this process by pressing the turbo button.
557
+ """
558
+ When it is converted to html
559
+ Then the result should contain the HTML structure
560
+ """
561
+ |Recall in
562
+ a< href='#essential-tip-1' Essential tip #1
563
+ |, we told you how to speed up this process.
564
+ """
7
565
 
8
566
  Scenario: Create a cross reference from an AsciiDoc cell to a section
9
567
  Given the AsciiDoc source
@@ -11,9 +569,9 @@ Feature: Cross References
11
569
  |===
12
570
  a|See <<_install>>
13
571
  |===
14
-
572
+
15
573
  == Install
16
-
574
+
17
575
  Instructions go here.
18
576
  """
19
577
  When it is converted to html
@@ -27,15 +585,14 @@ Feature: Cross References
27
585
  td.tableblock.halign-left.valign-top
28
586
  div
29
587
  .paragraph: p
30
- 'See
31
- a href='#_install' Install
588
+ |See
589
+ a< href='#_install' Install
32
590
  .sect1
33
591
  h2#_install Install
34
592
  .sectionbody
35
593
  .paragraph: p Instructions go here.
36
594
  """
37
595
 
38
-
39
596
  Scenario: Create a cross reference using the target section title
40
597
  Given the AsciiDoc source
41
598
  """
@@ -56,12 +613,11 @@ Feature: Cross References
56
613
  .sect1
57
614
  h2#_section_two Section Two
58
615
  .sectionbody: .paragraph: p
59
- 'refer to
60
- a href='#_section_one' Section One
616
+ |refer to
617
+ a< href='#_section_one' Section One
61
618
  """
62
619
 
63
-
64
- Scenario: Create a cross reference using the target reftext
620
+ Scenario: Create a natural cross reference using the reftext of the target section
65
621
  Given the AsciiDoc source
66
622
  """
67
623
  [reftext="the first section"]
@@ -82,10 +638,21 @@ Feature: Cross References
82
638
  .sect1
83
639
  h2#_section_two Section Two
84
640
  .sectionbody: .paragraph: p
85
- 'refer to
86
- a href='#_section_one' the first section
641
+ |refer to
642
+ a< href='#_section_one' the first section
643
+ """
644
+ When it is converted to docbook
645
+ Then the result should match the XML structure
646
+ """
647
+ section xml:id='_section_one' xreflabel='the first section'
648
+ title Section One
649
+ simpara content
650
+ section xml:id='_section_two'
651
+ title Section Two
652
+ simpara
653
+ |refer to
654
+ xref< linkend='_section_one'/
87
655
  """
88
-
89
656
 
90
657
  Scenario: Create a cross reference using the formatted target title
91
658
  Given the AsciiDoc source
@@ -103,14 +670,11 @@ Feature: Cross References
103
670
  """
104
671
  .sect1
105
672
  h2#_section_strong_one_strong
106
- 'Section
107
- strong One
673
+ |Section <strong>One</strong>
108
674
  .sectionbody: .paragraph: p content
109
675
  .sect1
110
676
  h2#_section_two Section Two
111
677
  .sectionbody: .paragraph: p
112
- 'refer to
113
- a href='#_section_strong_one_strong'
114
- 'Section
115
- strong One
678
+ |refer to
679
+ a< href='#_section_strong_one_strong' Section <strong>One</strong>
116
680
  """