Blob Blame History Raw
//
// A collection of AsciiDoc test cases.
//

Test 'Cases'
============
:author: Joe Bloggs
// Web page meta data.
:title:       Test Cases
:keywords:    AsciiDoc, DocBook, EPUB, slideshow
:description: AsciiDoc is a text document format for writing short documents, +
              articles, books, slideshows and UNIX man pages.
:replacements.(\w)'(\w): \1’\2
:test-attribute: TEST_ATTRIBUTE


== Passthrough attributes ==
ifdef::basebackend-docbook[]
:passtest: pass:[<emphasis>*lorum ipsum*</emphasis>]
endif::basebackend-docbook[]
ifdef::basebackend-html[]
:passtest: pass:[<b>*lorum ipsum*</b>]
endif::basebackend-html[]
{passtest}

ifdef::basebackend-docbook[]
:passtest: pass:specialcharacters,quotes[<emphasis>*lorum ipsum*</emphasis>]
endif::basebackend-docbook[]
ifdef::basebackend-html[]
:passtest: pass:specialcharacters,quotes[<b>*lorum ipsum*</b>]
endif::basebackend-html[]
{passtest}


== Author attributes ==
\{eval:expression}, \{sys:command} and \{sys2:command}, \{counter:c1}

Hello *{author}* ({firstname} {lastname}, {authorinitials}).

{firstname,lastname,surname#}first name or last name or surname.

{firstname+lastname+surname#}first name and last name and surname.

{firstname+lastname#}first name and last name.


== 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_

// Quote attributes.
[foo]#fun with text#.
[foo bar]*fun with text*.
[foo]+fun with text+.
[foo]_fun with text_.
[foo]'fun with text'.
[foo]``fun with text''.
[foo]`fun with text'.

[foo]$$fun with text$$.

[foo]+++fun with text+++.

[red]#Obvious# and [big red yellow-background]*very obvious*.

[underline]#Underline text#, [overline]#overline text#
and [line-through]#line-through text#.

[firstletter]##T##esting 123 ...

(``+1\n+'') if (usually ``+-1\n+'')

(``++1\n++'') if (usually ``++-1\n++'')

(`{author}') and `{author}'


== Configuration attribute entries ==

:listdef-labeled.style: horizontal
term:: definition

:listdef-labeled.style: vertical
term:: definition

ifdef::backend-xhtml11[]
<<link1>>

:xref2-inlinemacro.: <a href="#{1}">{2?{2}}</a>

<<link1>>

:xref2-inlinemacro.: <a href="#{1}">{2=[{1}]}</a>
endif::[]


== role attribute ==

[role="test"]
Paragraph with a role attribute.

[role="test"]
- first
- second
- third


== 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.

<<X1>>; captioned link to <<X1,this test case>>.

<<X2>> link to inline anchor; captioned link to <<X2,inline anchor>>.

Link to <<X3>> anchor.

An example link to a bibliography entry <<Test::Unit>>.

[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.

List start number test:

// The ol start attribute is not valid XHTML 1.1 (but it works in all
// browsers).
ifndef::backend-xhtml11[]
[start=7]
. List item 7.
. List item 8.
endif::backend-xhtml11[]

== 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*|
\joe.bloggs@example.com
<\joe.bloggs@example.com>
\mailto:[\joe.bloggs@example.com]

2*|
\http://www.example.com
\\http://www.example.com[]
\\http://www.example.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::basebackend-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::basebackend-docbook[]

.Literal block with quotes substitution
[subs="quotes"]
.............................
This is a *bold* a line
This is a 'strong' line
This is another _strong_ line
.............................

[verse, William Blake, from Auguries of Innocence]
To see a world in a grain of sand,
And a heaven in a wild flower,
Hold infinity in the palm of your hand,
And eternity in an hour.

[quote, Bertrand Russell, The World of Mathematics (1956)]
A good notation has subtlety and suggestiveness which at times makes
it almost seem like a live teacher.


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
-----------
Test 1 ((test1)).

Test 2 (((test2))).

Test 3 (((test3,secondary))).

Test 4 (((test4,secondary,tertiary))).

Test 5 indexterm2:[test5].

Test 6 indexterm:[test6].

Test 7 indexterm:[test7,secondary].

Test 8 indexterm:[test8,secondary,tertiary].

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).

|=========================================================

== Table with parent configuration file and header attribute entry

[cols="asciidoc"]
|====
|
- Attribute entry from header: {test-attribute}
- Replacement from `testcases.conf` configuration file: test-replacement
|====

== Table column specifiers with merged cells
See
http://groups.google.com/group/asciidoc/browse_thread/thread/c9238380a1f2507a

[cols="<1m,>1,^1s, ^1e"]
|============================================
 .2+|        .2+|1- A     2+|2- B
                            |i- a      |ii- b
    |Values 1   |v1         |v2        |v3
    |Values 2   |v4         |v5        |v6
|============================================

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://asciidoc.org/ 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://asciidoc.org/]
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens. Sit munere ponderum dignissim et. Minim luptatum et
vel footnote:[http://asciidoc.org/[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&#44; &#34;with an image&#34;
image:images/smallnew.png[]].
footnote:[With [square brackets\]] Qui in magna commodo, est labitur
dolorum an. Est ne magna primis.


Rulers and page breaks
----------------------

Lorum ipsum...

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Lorum ipsum...

<<<

Lorum ipsum...


这是一个测试
------------
Double-with character titles.
<<_这是一个测试,link to auto-generated section ID>>.


ifdef::backend-html5[]
HTML 5 audio and video block macros
-----------------------------------
audio::images/example.ogg[]

.Audio tag test
audio::images/example.ogg[]

video::images/gizmo.ogv[width=200,options="nocontrols,autoplay"]

.Example video
video::images/gizmo.ogv[]

video::http://www.808.dk/pics/video/gizmo.ogv[]

++++
<video poster="images/gizmo.jpg" id="video" style="cursor: pointer;" >
  <source src="images/gizmo.webm" type="video/webm" />
  <source src="images/gizmo.ogv" type="video/ogg" />
  Video not playing? <a href="images/gizmo.mp4">Download file</a> instead.
</video>

<script type="text/javascript">
  var video = document.getElementById('video');
  video.addEventListener('click',function(){
    video.play();
  },false);
</script>
++++

endif::backend-html5[]


== Block macros

:rs458: 2

ifeval::[{rs458}==2]
RS458 is 2.
endif::[]
ifeval::[not ({rs458}==2)]
This will not be processed.
endif::[]

// Test eval block macro.
eval::[Section.setlevel(1)]

// Test template concatenation.
{template:test-template}

// Test ascii-ids attribute.
:ascii-ids:
== àn îd without accénts
Lorum ipsum...

:ascii-ids!:
== àn îd with accénts
Lorum ipsum...


== Inline macros
http://groups.google.com/group/asciidoc/[A URL with [square
brackets\]].