//
// A collection of AsciiDoc test cases.
//
Test Cases
==========
:author: Joe Bloggs
== Passthrough attributes ==
ifdef::basebackend-docbook[]
:passtest: pass:[*lorum ipsum*]
endif::basebackend-docbook[]
ifdef::basebackend-html[]
:passtest: pass:[*lorum ipsum*]
endif::basebackend-html[]
{passtest}
ifdef::basebackend-docbook[]
:passtest: pass:specialcharacters,quotes[*lorum ipsum*]
endif::basebackend-docbook[]
ifdef::basebackend-html[]
:passtest: pass:specialcharacters,quotes[*lorum ipsum*]
endif::basebackend-html[]
{passtest}
== Author attributes ==
\{eval:expression}, \{sys:command} and \{sys2:command}, \{counter:c1}
Hello *{author}* ({firstname} {lastname}, {authorinitials}).
== System attributes ==
{counter:c1} {counter:c2:99} {counter:c3:A}
{c1} = 1, {c2} = 99, {c3} = A
{counter:c1} {counter:c2:99} {counter:c3:A}
{c1} {c2} {c3}
{c1} = 2, {c2} = 100, {c3} = B
{set:y:Foobar}
y: {y}
{set:y!}
y: {y}
:x: 3
:y: {eval:{x}+4}
{x}, {y}
{set:y:{x}}
{x}, {y}
== Quoted text attributes ==
A=_X_, (_X_), _X_, [_X_] _X_
A=*_X_*, (`_X_`), _`X`_, [*_X_*] +_X_+ _X_
// These two illustrate that nesting doesn't always work.
[_*X*_] _+X+_
[[_intro]]
<<_intro>> <<_intro,intro>> xref:_intro[] _intro_
[green,yellow,2]##fun with text##.
More [red,black,4]*fun with text*.
Yet more [red,,1.5]**fun with text**.
Yet more [red,,1.5]+fun with text+.
Yet more [red,,1.5]'fun with text'.
Yet more [red,,1.5]_fun with text_.
Yet more [orange]'fun with text'.
// role attributes.
[role="foo"]#fun with text#.
["green",role="foo"]#fun with text#.
["green","yellow",2,role="foo"]#fun with text#.
["green","yellow",2,role="foo"]*fun with text*.
["green","yellow",2,role="foo"]+fun with text+.
["green","yellow",2,role="foo"]_fun with text_.
["green","yellow",2,role="foo"]'fun with text'.
["green","yellow",2,role="foo"]$$fun with text$$.
["green","yellow",2,role="foo"]+++fun with text+++.
== Break list nesting ==
1. List 1.
2. List 1.
// New list.
a. List 2.
b. List 2.
== Listing Blocks ==
[subs="quotes"]
------------------------------------------
$ ls *-al*
------------------------------------------
[listing]
..........................................
[subs="quotes"]
------------------------------------------
$ ls *-al*
------------------------------------------
..........................................
.Listing
------------------------------------------
$ ls -al
------------------------------------------
.Listing example
==========================================
------------------------------------------
$ ls -al
------------------------------------------
==========================================
.Python paragraph
[source,python]
if n < 0: print 'Hello World!'
.Titled Python listing
[source,python]
------------------------------------------
if n < 0: print 'Hello World!'
------------------------------------------
.Python listing example
==========================================
[source,python]
------------------------------------------
if n < 0: print 'Hello World!'
------------------------------------------
==========================================
[[X1,anchor reftext]]
== Links ==
An [[X2]] inline anchor.
An [[X3, anchor reftext]] inline anchor with reftext.
<>; captioned link to <>.
<> link to inline anchor; captioned link to <>.
Link to <> anchor.
An example link to a bibliography entry <>.
[horizontal]
[[[Test::Unit]]]:: http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html
== Titles ==
[float]
===== Level 4 =====
[float]
==== Level 3 ====
[float]
=== Level 2 ===
[float]
== Level 1 ==
[float]
Level 4
+++++++
[float]
Level 3
^^^^^^^
[float]
Level 2
~~~~~~~
[float]
Level 1
-------
.Block title
Lorum ipsum.
== Lists ==
Bulleted:
- item text
* item text
** item text
*** item text
**** item text
***** item text
Numbered:
1. arabic (decimal) numbering
a. loweralpha numbering
A. upperalpha numbering
i) lowerroman numbering
I) upperroman numbering
. arabic (decimal) numbering
.. loweralpha numbering
... lowerroman numbering
.... upperalpha numbering
..... upperroman numbering
Labeled:
label:: item text
label;; item text
label::: item text
label:::: item text
With item anchor:
one:: Item one.
[[item_two]]two:: Item two.
three:: Item three.
== Inline passthroughs ==
- Test pass:[`ABC`].
- Test `pass:[ABC]`.
- The `++i` and `++j` auto-increments.
- Paths `~/.vim` and `~/docs`.
- The `__init__` method.
- The `{id}` attribute.
== Images
=== Block images
[[tiger_image]]
.Tyger tyger
image::../../images/tiger.png[Tyger tyger]
:height: 250
:width: 350
.Tyger tyger two
image::../../images/tiger.png[caption="Figure 2: ", alt="Tiger", align="center"]
:height!:
:width!:
// Images and icons directories.
:imagesdir: ../../doc
image::music2.png[]
:icons:
:iconsdir: ../../images/icons
NOTE: Lorum ipsum.
:icons!:
ifdef::backend-xhtml11[]
:imagesdir: ../../images
:data-uri:
image:smallnew.png[NEW] 'testing' `123`.
endif::[]
:data-uri!:
=== Inline images
:imagesdir: ../../images
Inline image image:smallnew.png[]
Inline image image:smallnew.png[NEW!]
Inline image image:smallnew.png["NEW!",title="Small new"]
== Admonishments
NOTE: Lorum ipsum.
TIP: Lorum ipsum.
WARNING: Lorum ipsum.
CAUTION: Lorum ipsum.
IMPORTANT: Lorum ipsum.
// With icon images.
:icons:
:iconsdir: ../../images/icons
NOTE: Lorum ipsum.
TIP: Lorum ipsum.
WARNING: Lorum ipsum.
CAUTION: Lorum ipsum.
IMPORTANT: Lorum ipsum.
:icons!:
== Backslash escapes
.Apostrophe
Don't vs don\'t.
.Exceptions
There are a number of exceptions to the usual single backslash rule
-- mostly relating to URL macros that have two syntaxes or quoting
ambiguity. Here are some non-standard escape examples:
[cols="l,v",width="40%",options="header"]
|========================================
|AsciiDoc | Renders
2*|
\srackham@methods.co.nz
<\srackham@methods.co.nz>
\mailto:[\srackham@methods.co.nz]
2*|
\http://www.foo1.co.nz
\\http://www.foobar.com[]
\\http://www.foobar.com[Foobar Limited]
2*|
A C\++ Library for C++
\\``double-quotes''
\*\*F**ile Open\...
|========================================
== Paragraphs
.Normal paragraph
This is a *bold* a line
This is a 'strong' line
This is another _strong_ line
.Literal paragraph
[literal]
This is a *bold* a line
This is a 'strong' line
This is another _strong_ line
.Verse paragraph
[verse]
This is a *bold* a line
This is a 'strong' line
This is another _strong_ line
.Indented (literal) paragraph
This is a *bold* a line
This is a 'strong' line
This is another _strong_ line
.Indented with quotes substitution
[subs="quotes"]
This is a *bold* a line
This is a 'strong' line
This is another _strong_ line
.Literal paragraph with quotes substitution
["literal",subs="quotes"]
This is a *bold* a line
This is a 'strong' line
This is another _strong_ line
ifndef::backend-docbook[]
.Monospaced paragraph with line breaks
+This is a *bold* line+ +
+This is a 'strong' line+ +
+This is another _strong_ line+
.Another monospaced paragraph with line breaks
+This is a *bold* a line +
This is a 'strong' line +
This is another _strong_ line+
endif::backend-docbook[]
.Literal block with quotes substitution
[subs="quotes"]
.............................
This is a *bold* a line
This is a 'strong' line
This is another _strong_ line
.............................
URLs
----
Mail Addresses
~~~~~~~~~~~~~~
joe_bloggs@mail_server.com_
joe-bloggs@mail-server.com.
joe-bloggs@mail-server.com,joe-bloggs@mail-server.com,
mailto:joe-bloggs@mail-server.com[Mail]
mailto:joe_bloggs@mail_server.com[Mail]
mailto:joe.bloggs@mail.server.com[Mail]
joe.bloggs@mail.server.com +
lorum ipsum.
Comments
--------
/////////////////////////////////////////////////////////////////////
A comment
block.
/////////////////////////////////////////////////////////////////////
// This is a comment line.
Qui in magna commodo, est labitur dolorum an. Est ne magna primis.
// Inline comment line.
adolescens. Sit munere ponderum dignissim et. Minim luptatum et.
:showcomments:
// This comment line will be displayed in the output.
Qui in magna commodo, est labitur dolorum an. Est ne magna primis.
// Visible inline comment line.
adolescens. Sit munere ponderum dignissim et. Minim luptatum et.
/////////////////////////////////////////////////////////////////////
Comment blocks are never displayed in the output.
/////////////////////////////////////////////////////////////////////
:showcomments!:
[[comment_macro]]
.Block title
// Block macro comment does not consume titles or attributes.
Lorum ipsum.
[[comment_block]]
.Block title
/////////////////////////////////////////////////////////////////////
Delimited comment block does not consume titles or attributes.
/////////////////////////////////////////////////////////////////////
Lorum ipsum.
ifdef::basebackend-docbook[]
[glossary]
List of terms
-------------
Using positional attribute to specify section template.
[glossary]
A glossary term::
The corresponding (indented) definition.
A second glossary term::
The corresponding (indented) definition.
[template="glossary"]
List of terms
-------------
Using named 'template' attribute to specify section template.
[glossary]
A glossary term::
The corresponding (indented) definition.
A second glossary term::
The corresponding (indented) definition.
endif::basebackend-docbook[]
Index Terms
-----------
Multi-passthough substitution (see
http://groups.google.com/group/asciidoc/browse_frm/thread/1269dc2feb1a482c)
((`foo`))
(((foo,`bar`)))
(((foo,`bar`,`two`)))
Table with fractional column width units
----------------------------------------
NOTE: 'pagewidth' and 'pageunits' only apply to DocBook outputs.
:miscellaneous.pagewidth: 17.5
:miscellaneous.pageunits: cm
.Horizontal and vertical source data
[width="50%",cols="3,^2,^2,10",options="header"]
|=========================================================
|Date |Duration |Avg HR |Notes
|22-Aug-08 |10:24 | 157 |
Worked out MSHR (max sustainable heart rate) by going hard
for this interval.
|22-Aug-08 |23:03 | 152 |
Back-to-back with previous interval.
|24-Aug-08 |40:00 | 145 |
Moderately hard interspersed with 3x 3min intervals (2min
hard + 1min really hard taking the HR up to 160).
|=========================================================
Floating tables and images
--------------------------
.Simple table
[float="left",width="15%"]
|=======
|1 |2 |A
|3 |4 |B
|5 |6 |C
|=======
.Tiger
[float="right"]
image::images/tiger.png["Tiger image"]
unfloat::[]
Section level offsets
---------------------
At level 1
:leveloffset: -1
Section title
^^^^^^^^^^^^^
At level 2
:leveloffset: 0
Section title
~~~~~~~~~~~~~
At level 2
:leveloffset: 2
Section title
-------------
At level 3
:leveloffset!:
:numbered!:
Section level offsets
---------------------
At level 1
Single-quoted attributes
------------------------
[quote,'http://en.wikipedia.org/wiki/Samuel_Johnson[Samuel Johnson]']
_____________________________________________________________________
Sir, a woman's preaching is like a dog's walking on his hind legs. It
is not done well; but you are surprised to find it done at all.
_____________________________________________________________________
["quote","'http://en.wikipedia.org/wiki/Samuel_Johnson[Samuel Johnson]'"]
_____________________________________________________________________
Sir, a woman's preaching is like a dog's walking on his hind legs. It
is not done well; but you are surprised to find it done at all.
_____________________________________________________________________
Footnotes
---------
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens. Sit munere ponderum dignissim et. Minim luptatum et vel.
footnote:[footnote one.
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens. Sit munere ponderum dignissim et. Minim luptatum et vel.
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens. Sit munere ponderum dignissim et. Minim luptatum et vel.]
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens. Sit munere ponderum dignissim et. Minim luptatum et vel.
footnoteref:["F2","footnote two.
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens. Sit munere ponderum dignissim et. Minim luptatum et vel."]
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens. Sit munere ponderum dignissim et. Minim luptatum et vel
footnoteref:[F2].
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens. Sit munere ponderum dignissim et. Minim luptatum et vel.
footnote:[http://www.methods.co.nz/asciidoc/ Qui in magna commodo,
est labitur dolorum an. Est ne magna primis adolescens. Sit munere
ponderum dignissim et. Minim luptatum et vel
image:images/smallnew.png[]]
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens. Sit munere ponderum dignissim et. Minim luptatum et vel.
footnote:[http://www.methods.co.nz/asciidoc/]
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens. Sit munere ponderum dignissim et. Minim luptatum et
vel footnote:[http://www.methods.co.nz/asciidoc/[AsciiDoc website].].
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens. Sit munere ponderum dignissim et. Minim luptatum et
footnoteref:[F3,A footnote, "with an image"
image:images/smallnew.png[]].
Rulers and page breaks
----------------------
Lorum ipsum...
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Lorum ipsum...
<<<
Lorum ipsum...