summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-10-17 14:22:29 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-10-17 14:22:29 +0000
commitdf7b68225101966051f8b592a27127bf789eb81e (patch)
treea063e97ed58d0bdb2cbb5a95c3e8c1bcce54aa00 /tests
parente7dbfef4d8aa528d9245424e9c372e900a774c90 (diff)
initial import
git-svn-id: https://pandoc.googlecode.com/svn/trunk@2 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'tests')
-rw-r--r--tests/MarkdownTest_1.0.3/MarkdownTest.pl176
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html17
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text21
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Auto links.html18
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Auto links.text13
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Backslash escapes.html118
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Backslash escapes.text120
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html15
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text11
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Code Blocks.html18
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Code Blocks.text14
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Code Spans.html6
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Code Spans.text6
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html8
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text8
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Horizontal rules.html71
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Horizontal rules.text67
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html15
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text15
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html72
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text69
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.html13
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.text13
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Links, inline style.html11
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Links, inline style.text12
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Links, reference style.html52
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Links, reference style.text71
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.html9
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.text20
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html3
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text7
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html314
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text306
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html942
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text888
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.html9
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.text5
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html148
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text131
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Strong and em together.html7
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Strong and em together.text7
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Tabs.html25
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Tabs.text21
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Tidyness.html8
-rw-r--r--tests/MarkdownTest_1.0.3/Tests/Tidyness.text5
-rw-r--r--tests/bodybg.gifbin0 -> 10119 bytes
-rw-r--r--tests/generate.sh10
-rw-r--r--tests/html-reader.html399
-rw-r--r--tests/html-reader.native328
-rw-r--r--tests/insert1
-rw-r--r--tests/lalune.jpgbin0 -> 16270 bytes
-rw-r--r--tests/movie.jpgbin0 -> 1046 bytes
-rw-r--r--tests/rst-reader.native175
-rw-r--r--tests/rst-reader.rst341
-rw-r--r--tests/runtests.pl97
-rw-r--r--tests/s5.basic.html761
-rw-r--r--tests/s5.fancy.html1673
-rw-r--r--tests/s5.fragment.html18
-rw-r--r--tests/s5.inserts.html41
-rw-r--r--tests/s5.native15
-rw-r--r--tests/testsuite.native329
-rw-r--r--tests/testsuite.txt612
-rw-r--r--tests/writer.html456
-rw-r--r--tests/writer.latex581
-rw-r--r--tests/writer.markdown628
-rw-r--r--tests/writer.native329
-rw-r--r--tests/writer.rst743
-rw-r--r--tests/writer.rtf378
-rw-r--r--tests/writer.smart.html456
69 files changed, 12276 insertions, 0 deletions
diff --git a/tests/MarkdownTest_1.0.3/MarkdownTest.pl b/tests/MarkdownTest_1.0.3/MarkdownTest.pl
new file mode 100644
index 000000000..55553d09c
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/MarkdownTest.pl
@@ -0,0 +1,176 @@
+#!/usr/bin/perl
+
+#
+# MarkdownTester -- Run tests for Markdown implementations
+#
+# Copyright (c) 2004-2005 John Gruber
+# <http://daringfireball.net/projects/markdown/>
+#
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Benchmark;
+
+our $VERSION = '1.0.2';
+# Sat 24 Dec 2005
+
+my $time_start = new Benchmark;
+my $test_dir = "Tests";
+my $script = "./Markdown.pl";
+my $use_tidy = 0;
+my ($flag_version);
+
+GetOptions (
+ "script=s" => \$script,
+ "testdir=s" => \$test_dir,
+ "tidy" => \$use_tidy,
+ "version" => \$flag_version,
+ );
+
+if($flag_version) {
+ my $progname = $0;
+ $progname =~ s{.*/}{};
+ die "$progname version $VERSION\n";
+}
+
+unless (-d $test_dir) { die "'$test_dir' is not a directory.\n"; }
+unless (-f $script) { die "$script does not exist.\n"; }
+unless (-x $script) { die "$script is not executable.\n"; }
+
+my $tests_passed = 0;
+my $tests_failed = 0;
+
+TEST:
+foreach my $testfile (glob "$test_dir/*.text") {
+ my $testname = $testfile;
+ $testname =~ s{.*/(.+)\.text$}{$1}i;
+ print "$testname ... ";
+
+ # Look for a corresponding .html file for each .text file:
+ my $resultfile = $testfile;
+ $resultfile =~ s{\.text$}{\.html}i;
+ unless (-f $resultfile) {
+ print "'$resultfile' does not exist.\n\n";
+ next TEST;
+ }
+
+ # open(TEST, $testfile) || die("Can't open testfile: $!");
+ open(RESULT, $resultfile) || die("Can't open resultfile: $!");
+ undef $/;
+ # my $t_input = <TEST>;
+ my $t_result = <RESULT>;
+
+ my $t_output = `'$script' '$testfile'`;
+
+ # Normalize the output and expected result strings:
+ $t_result =~ s/\s+\z//; # trim trailing whitespace
+ $t_output =~ s/\s+\z//; # trim trailing whitespace
+ if ($use_tidy) {
+ # Escape the strings, pass them through to CLI tidy tool for tag-level equivalency
+ $t_result =~ s{'}{'\\''}g; # escape ' chars for shell
+ $t_output =~ s{'}{'\\''}g;
+ $t_result = `echo '$t_result' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
+ $t_output = `echo '$t_output' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
+ }
+
+ if ($t_output eq $t_result) {
+ print "OK\n";
+ $tests_passed++;
+ }
+ else {
+ print "FAILED\n\n";
+# This part added by JM to print diffs
+ open(OUT, '>tmp1') or die $!;
+ print OUT $t_output or die $!;
+ open(RES, '>tmp2') or die $!;
+ print RES $t_result or die $!;
+ print `diff tmp1 tmp2`;
+ close RES;
+ close OUT;
+ print "\n";
+ `rm tmp?`;
+# End of added part
+ $tests_failed++;
+ }
+}
+
+print "\n\n";
+print "$tests_passed passed; $tests_failed failed.\n";
+
+my $time_end = new Benchmark;
+my $time_diff = timediff($time_end, $time_start);
+print "Benchmark: ", timestr($time_diff), "\n";
+
+
+__END__
+
+=pod
+
+=head1 NAME
+
+B<MarkdownTest>
+
+
+=head1 SYNOPSIS
+
+B<MarkdownTest.pl> [ B<--options> ] [ I<file> ... ]
+
+
+=head1 DESCRIPTION
+
+
+=head1 OPTIONS
+
+Use "--" to end switch parsing. For example, to open a file named "-z", use:
+
+ MarkdownTest.pl -- -z
+
+=over 4
+
+=item B<--script>
+
+Specify the path to the Markdown script to test. Defaults to
+"./Markdown.pl". Example:
+
+ ./MarkdownTest.pl --script ./PHP-Markdown/php-markdown
+
+=item B<--testdir>
+
+Specify the path to a directory containing test data. Defaults to "Tests".
+
+=item B<--tidy>
+
+Flag to turn on using the command line 'tidy' tool to normalize HTML
+output before comparing script output to the expected test result.
+Assumes that the 'tidy' command is available in your PATH. Defaults to
+off.
+
+=back
+
+
+
+=head1 BUGS
+
+
+
+=head1 VERSION HISTORY
+
+1.0 Mon 13 Dec 2004-2005
+
+1.0.1 Mon 19 Sep 2005
+
+ + Better handling of case when foo.text exists, but foo.html doesn't.
+ It now prints a message and moves on, rather than dying.
+
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (c) 2004-2005 John Gruber
+<http://daringfireball.net/>
+All rights reserved.
+
+This is free software; you may redistribute it and/or modify it under
+the same terms as Perl itself.
+
+=cut
diff --git a/tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html b/tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html
new file mode 100644
index 000000000..9606860b6
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html
@@ -0,0 +1,17 @@
+<p>AT&amp;T has an ampersand in their name.</p>
+
+<p>AT&amp;T is another way to write it.</p>
+
+<p>This &amp; that.</p>
+
+<p>4 &lt; 5.</p>
+
+<p>6 > 5.</p>
+
+<p>Here's a <a href="http://example.com/?foo=1&amp;bar=2">link</a> with an ampersand in the URL.</p>
+
+<p>Here's a link with an amersand in the link text: <a href="http://att.com/" title="AT&amp;T">AT&amp;T</a>.</p>
+
+<p>Here's an inline <a href="/script?foo=1&amp;bar=2">link</a>.</p>
+
+<p>Here's an inline <a href="/script?foo=1&amp;bar=2">link</a>.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text b/tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text
new file mode 100644
index 000000000..0e9527f93
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text
@@ -0,0 +1,21 @@
+AT&T has an ampersand in their name.
+
+AT&amp;T is another way to write it.
+
+This & that.
+
+4 < 5.
+
+6 > 5.
+
+Here's a [link] [1] with an ampersand in the URL.
+
+Here's a link with an amersand in the link text: [AT&T] [2].
+
+Here's an inline [link](/script?foo=1&bar=2).
+
+Here's an inline [link](</script?foo=1&bar=2>).
+
+
+[1]: http://example.com/?foo=1&bar=2
+[2]: http://att.com/ "AT&T" \ No newline at end of file
diff --git a/tests/MarkdownTest_1.0.3/Tests/Auto links.html b/tests/MarkdownTest_1.0.3/Tests/Auto links.html
new file mode 100644
index 000000000..f8df9852c
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Auto links.html
@@ -0,0 +1,18 @@
+<p>Link: <a href="http://example.com/">http://example.com/</a>.</p>
+
+<p>With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</a></p>
+
+<ul>
+<li>In a list?</li>
+<li><a href="http://example.com/">http://example.com/</a></li>
+<li>It should.</li>
+</ul>
+
+<blockquote>
+ <p>Blockquoted: <a href="http://example.com/">http://example.com/</a></p>
+</blockquote>
+
+<p>Auto-links should not occur here: <code>&lt;http://example.com/&gt;</code></p>
+
+<pre><code>or here: &lt;http://example.com/&gt;
+</code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Auto links.text b/tests/MarkdownTest_1.0.3/Tests/Auto links.text
new file mode 100644
index 000000000..abbc48869
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Auto links.text
@@ -0,0 +1,13 @@
+Link: <http://example.com/>.
+
+With an ampersand: <http://example.com/?foo=1&bar=2>
+
+* In a list?
+* <http://example.com/>
+* It should.
+
+> Blockquoted: <http://example.com/>
+
+Auto-links should not occur here: `<http://example.com/>`
+
+ or here: <http://example.com/> \ No newline at end of file
diff --git a/tests/MarkdownTest_1.0.3/Tests/Backslash escapes.html b/tests/MarkdownTest_1.0.3/Tests/Backslash escapes.html
new file mode 100644
index 000000000..29870dac5
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Backslash escapes.html
@@ -0,0 +1,118 @@
+<p>These should all get escaped:</p>
+
+<p>Backslash: \</p>
+
+<p>Backtick: `</p>
+
+<p>Asterisk: *</p>
+
+<p>Underscore: _</p>
+
+<p>Left brace: {</p>
+
+<p>Right brace: }</p>
+
+<p>Left bracket: [</p>
+
+<p>Right bracket: ]</p>
+
+<p>Left paren: (</p>
+
+<p>Right paren: )</p>
+
+<p>Greater-than: ></p>
+
+<p>Hash: #</p>
+
+<p>Period: .</p>
+
+<p>Bang: !</p>
+
+<p>Plus: +</p>
+
+<p>Minus: -</p>
+
+<p>These should not, because they occur within a code block:</p>
+
+<pre><code>Backslash: \\
+
+Backtick: \`
+
+Asterisk: \*
+
+Underscore: \_
+
+Left brace: \{
+
+Right brace: \}
+
+Left bracket: \[
+
+Right bracket: \]
+
+Left paren: \(
+
+Right paren: \)
+
+Greater-than: \&gt;
+
+Hash: \#
+
+Period: \.
+
+Bang: \!
+
+Plus: \+
+
+Minus: \-
+</code></pre>
+
+<p>Nor should these, which occur in code spans:</p>
+
+<p>Backslash: <code>\\</code></p>
+
+<p>Backtick: <code>\`</code></p>
+
+<p>Asterisk: <code>\*</code></p>
+
+<p>Underscore: <code>\_</code></p>
+
+<p>Left brace: <code>\{</code></p>
+
+<p>Right brace: <code>\}</code></p>
+
+<p>Left bracket: <code>\[</code></p>
+
+<p>Right bracket: <code>\]</code></p>
+
+<p>Left paren: <code>\(</code></p>
+
+<p>Right paren: <code>\)</code></p>
+
+<p>Greater-than: <code>\&gt;</code></p>
+
+<p>Hash: <code>\#</code></p>
+
+<p>Period: <code>\.</code></p>
+
+<p>Bang: <code>\!</code></p>
+
+<p>Plus: <code>\+</code></p>
+
+<p>Minus: <code>\-</code></p>
+
+
+<p>These should get escaped, even though they're matching pairs for
+other Markdown constructs:</p>
+
+<p>*asterisks*</p>
+
+<p>_underscores_</p>
+
+<p>`backticks`</p>
+
+<p>This is a code span with a literal backslash-backtick sequence: <code>\`</code></p>
+
+<p>This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.</p>
+
+<p>This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Backslash escapes.text b/tests/MarkdownTest_1.0.3/Tests/Backslash escapes.text
new file mode 100644
index 000000000..5b014cb33
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Backslash escapes.text
@@ -0,0 +1,120 @@
+These should all get escaped:
+
+Backslash: \\
+
+Backtick: \`
+
+Asterisk: \*
+
+Underscore: \_
+
+Left brace: \{
+
+Right brace: \}
+
+Left bracket: \[
+
+Right bracket: \]
+
+Left paren: \(
+
+Right paren: \)
+
+Greater-than: \>
+
+Hash: \#
+
+Period: \.
+
+Bang: \!
+
+Plus: \+
+
+Minus: \-
+
+
+
+These should not, because they occur within a code block:
+
+ Backslash: \\
+
+ Backtick: \`
+
+ Asterisk: \*
+
+ Underscore: \_
+
+ Left brace: \{
+
+ Right brace: \}
+
+ Left bracket: \[
+
+ Right bracket: \]
+
+ Left paren: \(
+
+ Right paren: \)
+
+ Greater-than: \>
+
+ Hash: \#
+
+ Period: \.
+
+ Bang: \!
+
+ Plus: \+
+
+ Minus: \-
+
+
+Nor should these, which occur in code spans:
+
+Backslash: `\\`
+
+Backtick: `` \` ``
+
+Asterisk: `\*`
+
+Underscore: `\_`
+
+Left brace: `\{`
+
+Right brace: `\}`
+
+Left bracket: `\[`
+
+Right bracket: `\]`
+
+Left paren: `\(`
+
+Right paren: `\)`
+
+Greater-than: `\>`
+
+Hash: `\#`
+
+Period: `\.`
+
+Bang: `\!`
+
+Plus: `\+`
+
+Minus: `\-`
+
+
+These should get escaped, even though they're matching pairs for
+other Markdown constructs:
+
+\*asterisks\*
+
+\_underscores\_
+
+\`backticks\`
+
+This is a code span with a literal backslash-backtick sequence: `` \` ``
+
+This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.
+
+This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.
diff --git a/tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html b/tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html
new file mode 100644
index 000000000..990202a1b
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html
@@ -0,0 +1,15 @@
+<blockquote>
+ <p>Example:</p>
+
+<pre><code>sub status {
+ print "working";
+}
+</code></pre>
+
+ <p>Or:</p>
+
+<pre><code>sub status {
+ return "working";
+}
+</code></pre>
+</blockquote>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text b/tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text
new file mode 100644
index 000000000..c31d17104
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text
@@ -0,0 +1,11 @@
+> Example:
+>
+> sub status {
+> print "working";
+> }
+>
+> Or:
+>
+> sub status {
+> return "working";
+> }
diff --git a/tests/MarkdownTest_1.0.3/Tests/Code Blocks.html b/tests/MarkdownTest_1.0.3/Tests/Code Blocks.html
new file mode 100644
index 000000000..32703f5cb
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Code Blocks.html
@@ -0,0 +1,18 @@
+<pre><code>code block on the first line
+</code></pre>
+
+<p>Regular text.</p>
+
+<pre><code>code block indented by spaces
+</code></pre>
+
+<p>Regular text.</p>
+
+<pre><code>the lines in this block
+all contain trailing spaces
+</code></pre>
+
+<p>Regular Text.</p>
+
+<pre><code>code block on the last line
+</code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Code Blocks.text b/tests/MarkdownTest_1.0.3/Tests/Code Blocks.text
new file mode 100644
index 000000000..b54b09285
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Code Blocks.text
@@ -0,0 +1,14 @@
+ code block on the first line
+
+Regular text.
+
+ code block indented by spaces
+
+Regular text.
+
+ the lines in this block
+ all contain trailing spaces
+
+Regular Text.
+
+ code block on the last line \ No newline at end of file
diff --git a/tests/MarkdownTest_1.0.3/Tests/Code Spans.html b/tests/MarkdownTest_1.0.3/Tests/Code Spans.html
new file mode 100644
index 000000000..4b8afbb70
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Code Spans.html
@@ -0,0 +1,6 @@
+<p><code>&lt;test a="</code> content of attribute <code>"&gt;</code></p>
+
+<p>Fix for backticks within HTML tag: <span attr='`ticks`'>like this</span></p>
+
+<p>Here's how you put <code>`backticks`</code> in a code span.</p>
+
diff --git a/tests/MarkdownTest_1.0.3/Tests/Code Spans.text b/tests/MarkdownTest_1.0.3/Tests/Code Spans.text
new file mode 100644
index 000000000..750a1973d
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Code Spans.text
@@ -0,0 +1,6 @@
+`<test a="` content of attribute `">`
+
+Fix for backticks within HTML tag: <span attr='`ticks`'>like this</span>
+
+Here's how you put `` `backticks` `` in a code span.
+
diff --git a/tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html b/tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html
new file mode 100644
index 000000000..e21ac79a2
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html
@@ -0,0 +1,8 @@
+<p>In Markdown 1.0.0 and earlier. Version
+8. This line turns into a list item.
+Because a hard-wrapped line in the
+middle of a paragraph looked like a
+list item.</p>
+
+<p>Here's one with a bullet.
+* criminey.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text b/tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text
new file mode 100644
index 000000000..f8a5b27bf
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text
@@ -0,0 +1,8 @@
+In Markdown 1.0.0 and earlier. Version
+8. This line turns into a list item.
+Because a hard-wrapped line in the
+middle of a paragraph looked like a
+list item.
+
+Here's one with a bullet.
+* criminey.
diff --git a/tests/MarkdownTest_1.0.3/Tests/Horizontal rules.html b/tests/MarkdownTest_1.0.3/Tests/Horizontal rules.html
new file mode 100644
index 000000000..2dc2ab656
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Horizontal rules.html
@@ -0,0 +1,71 @@
+<p>Dashes:</p>
+
+<hr />
+
+<hr />
+
+<hr />
+
+<hr />
+
+<pre><code>---
+</code></pre>
+
+<hr />
+
+<hr />
+
+<hr />
+
+<hr />
+
+<pre><code>- - -
+</code></pre>
+
+<p>Asterisks:</p>
+
+<hr />
+
+<hr />
+
+<hr />
+
+<hr />
+
+<pre><code>***
+</code></pre>
+
+<hr />
+
+<hr />
+
+<hr />
+
+<hr />
+
+<pre><code>* * *
+</code></pre>
+
+<p>Underscores:</p>
+
+<hr />
+
+<hr />
+
+<hr />
+
+<hr />
+
+<pre><code>___
+</code></pre>
+
+<hr />
+
+<hr />
+
+<hr />
+
+<hr />
+
+<pre><code>_ _ _
+</code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Horizontal rules.text b/tests/MarkdownTest_1.0.3/Tests/Horizontal rules.text
new file mode 100644
index 000000000..1594bda27
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Horizontal rules.text
@@ -0,0 +1,67 @@
+Dashes:
+
+---
+
+ ---
+
+ ---
+
+ ---
+
+ ---
+
+- - -
+
+ - - -
+
+ - - -
+
+ - - -
+
+ - - -
+
+
+Asterisks:
+
+***
+
+ ***
+
+ ***
+
+ ***
+
+ ***
+
+* * *
+
+ * * *
+
+ * * *
+
+ * * *
+
+ * * *
+
+
+Underscores:
+
+___
+
+ ___
+
+ ___
+
+ ___
+
+ ___
+
+_ _ _
+
+ _ _ _
+
+ _ _ _
+
+ _ _ _
+
+ _ _ _
diff --git a/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html b/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html
new file mode 100644
index 000000000..3af9cafb1
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html
@@ -0,0 +1,15 @@
+<p>Simple block on one line:</p>
+
+<div>foo</div>
+
+<p>And nested without indentation:</p>
+
+<div>
+<div>
+<div>
+foo
+</div>
+<div style=">"/>
+</div>
+<div>bar</div>
+</div>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text b/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text
new file mode 100644
index 000000000..86b7206d2
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text
@@ -0,0 +1,15 @@
+Simple block on one line:
+
+<div>foo</div>
+
+And nested without indentation:
+
+<div>
+<div>
+<div>
+foo
+</div>
+<div style=">"/>
+</div>
+<div>bar</div>
+</div>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html b/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html
new file mode 100644
index 000000000..6bf78f8fc
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html
@@ -0,0 +1,72 @@
+<p>Here's a simple block:</p>
+
+<div>
+ foo
+</div>
+
+<p>This should be a code block, though:</p>
+
+<pre><code>&lt;div&gt;
+ foo
+&lt;/div&gt;
+</code></pre>
+
+<p>As should this:</p>
+
+<pre><code>&lt;div&gt;foo&lt;/div&gt;
+</code></pre>
+
+<p>Now, nested:</p>
+
+<div>
+ <div>
+ <div>
+ foo
+ </div>
+ </div>
+</div>
+
+<p>This should just be an HTML comment:</p>
+
+<!-- Comment -->
+
+<p>Multiline:</p>
+
+<!--
+Blah
+Blah
+-->
+
+<p>Code block:</p>
+
+<pre><code>&lt;!-- Comment --&gt;
+</code></pre>
+
+<p>Just plain comment, with trailing spaces on the line:</p>
+
+<!-- foo -->
+
+<p>Code:</p>
+
+<pre><code>&lt;hr /&gt;
+</code></pre>
+
+<p>Hr's:</p>
+
+<hr>
+
+<hr/>
+
+<hr />
+
+<hr>
+
+<hr/>
+
+<hr />
+
+<hr class="foo" id="bar" />
+
+<hr class="foo" id="bar"/>
+
+<hr class="foo" id="bar" >
diff --git a/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text b/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text
new file mode 100644
index 000000000..14aa2dc27
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text
@@ -0,0 +1,69 @@
+Here's a simple block:
+
+<div>
+ foo
+</div>
+
+This should be a code block, though:
+
+ <div>
+ foo
+ </div>
+
+As should this:
+
+ <div>foo</div>
+
+Now, nested:
+
+<div>
+ <div>
+ <div>
+ foo
+ </div>
+ </div>
+</div>
+
+This should just be an HTML comment:
+
+<!-- Comment -->
+
+Multiline:
+
+<!--
+Blah
+Blah
+-->
+
+Code block:
+
+ <!-- Comment -->
+
+Just plain comment, with trailing spaces on the line:
+
+<!-- foo -->
+
+Code:
+
+ <hr />
+
+Hr's:
+
+<hr>
+
+<hr/>
+
+<hr />
+
+<hr>
+
+<hr/>
+
+<hr />
+
+<hr class="foo" id="bar" />
+
+<hr class="foo" id="bar"/>
+
+<hr class="foo" id="bar" >
+
diff --git a/tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.html b/tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.html
new file mode 100644
index 000000000..3f167a161
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.html
@@ -0,0 +1,13 @@
+<p>Paragraph one.</p>
+
+<!-- This is a simple comment -->
+
+<!--
+ This is another comment.
+-->
+
+<p>Paragraph two.</p>
+
+<!-- one comment block -- -- with two comments -->
+
+<p>The end.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.text b/tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.text
new file mode 100644
index 000000000..41d830d03
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Inline HTML comments.text
@@ -0,0 +1,13 @@
+Paragraph one.
+
+<!-- This is a simple comment -->
+
+<!--
+ This is another comment.
+-->
+
+Paragraph two.
+
+<!-- one comment block -- -- with two comments -->
+
+The end.
diff --git a/tests/MarkdownTest_1.0.3/Tests/Links, inline style.html b/tests/MarkdownTest_1.0.3/Tests/Links, inline style.html
new file mode 100644
index 000000000..f36607ddd
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Links, inline style.html
@@ -0,0 +1,11 @@
+<p>Just a <a href="/url/">URL</a>.</p>
+
+<p><a href="/url/" title="title">URL and title</a>.</p>
+
+<p><a href="/url/" title="title preceded by two spaces">URL and title</a>.</p>
+
+<p><a href="/url/" title="title preceded by a tab">URL and title</a>.</p>
+
+<p><a href="/url/" title="title has spaces afterward">URL and title</a>.</p>
+
+<p><a href="">Empty</a>.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Links, inline style.text b/tests/MarkdownTest_1.0.3/Tests/Links, inline style.text
new file mode 100644
index 000000000..09017a90c
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Links, inline style.text
@@ -0,0 +1,12 @@
+Just a [URL](/url/).
+
+[URL and title](/url/ "title").
+
+[URL and title](/url/ "title preceded by two spaces").
+
+[URL and title](/url/ "title preceded by a tab").
+
+[URL and title](/url/ "title has spaces afterward" ).
+
+
+[Empty]().
diff --git a/tests/MarkdownTest_1.0.3/Tests/Links, reference style.html b/tests/MarkdownTest_1.0.3/Tests/Links, reference style.html
new file mode 100644
index 000000000..8e70c32f4
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Links, reference style.html
@@ -0,0 +1,52 @@
+<p>Foo <a href="/url/" title="Title">bar</a>.</p>
+
+<p>Foo <a href="/url/" title="Title">bar</a>.</p>
+
+<p>Foo <a href="/url/" title="Title">bar</a>.</p>
+
+<p>With <a href="/url/">embedded [brackets]</a>.</p>
+
+<p>Indented <a href="/url">once</a>.</p>
+
+<p>Indented <a href="/url">twice</a>.</p>
+
+<p>Indented <a href="/url">thrice</a>.</p>
+
+<p>Indented [four][] times.</p>
+
+<pre><code>[four]: /url
+</code></pre>
+
+<hr />
+
+<p><a href="foo">this</a> should work</p>
+
+<p>So should <a href="foo">this</a>.</p>
+
+<p>And <a href="foo">this</a>.</p>
+
+<p>And <a href="foo">this</a>.</p>
+
+<p>And <a href="foo">this</a>.</p>
+
+<p>But not [that] [].</p>
+
+<p>Nor [that][].</p>
+
+<p>Nor [that].</p>
+
+<p>[Something in brackets like <a href="foo">this</a> should work]</p>
+
+<p>[Same with <a href="foo">this</a>.]</p>
+
+<p>In this case, <a href="/somethingelse/">this</a> points to something else.</p>
+
+<p>Backslashing should suppress [this] and [this].</p>
+
+<hr />
+
+<p>Here's one where the <a href="/url/">link
+breaks</a> across lines.</p>
+
+<p>Here's another where the <a href="/url/">link
+breaks</a> across lines, but with a line-ending space.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Links, reference style.text b/tests/MarkdownTest_1.0.3/Tests/Links, reference style.text
new file mode 100644
index 000000000..341ec88e3
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Links, reference style.text
@@ -0,0 +1,71 @@
+Foo [bar] [1].
+
+Foo [bar][1].
+
+Foo [bar]
+[1].
+
+[1]: /url/ "Title"
+
+
+With [embedded [brackets]] [b].
+
+
+Indented [once][].
+
+Indented [twice][].
+
+Indented [thrice][].
+
+Indented [four][] times.
+
+ [once]: /url
+
+ [twice]: /url
+
+ [thrice]: /url
+
+ [four]: /url
+
+
+[b]: /url/
+
+* * *
+
+[this] [this] should work
+
+So should [this][this].
+
+And [this] [].
+
+And [this][].
+
+And [this].
+
+But not [that] [].
+
+Nor [that][].
+
+Nor [that].
+
+[Something in brackets like [this][] should work]
+
+[Same with [this].]
+
+In this case, [this](/somethingelse/) points to something else.
+
+Backslashing should suppress \[this] and [this\].
+
+[this]: foo
+
+
+* * *
+
+Here's one where the [link
+breaks] across lines.
+
+Here's another where the [link
+breaks] across lines, but with a line-ending space.
+
+
+[link breaks]: /url/
diff --git a/tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.html b/tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.html
new file mode 100644
index 000000000..bf81e939f
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.html
@@ -0,0 +1,9 @@
+<p>This is the <a href="/simple">simple case</a>.</p>
+
+<p>This one has a <a href="/foo">line
+break</a>.</p>
+
+<p>This one has a <a href="/foo">line
+break</a> with a line-ending space.</p>
+
+<p><a href="/that">this</a> and the <a href="/other">other</a></p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.text b/tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.text
new file mode 100644
index 000000000..8c44c98fe
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Links, shortcut references.text
@@ -0,0 +1,20 @@
+This is the [simple case].
+
+[simple case]: /simple
+
+
+
+This one has a [line
+break].
+
+This one has a [line
+break] with a line-ending space.
+
+[line break]: /foo
+
+
+[this] [that] and the [other]
+
+[this]: /this
+[that]: /that
+[other]: /other
diff --git a/tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html b/tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html
new file mode 100644
index 000000000..611c1ac61
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html
@@ -0,0 +1,3 @@
+<p>Foo <a href="/url/" title="Title with &quot;quotes&quot; inside">bar</a>.</p>
+
+<p>Foo <a href="/url/" title="Title with &quot;quotes&quot; inside">bar</a>.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text b/tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text
new file mode 100644
index 000000000..29d0e4235
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text
@@ -0,0 +1,7 @@
+Foo [bar][].
+
+Foo [bar](/url/ "Title with "quotes" inside").
+
+
+ [bar]: /url/ "Title with "quotes" inside"
+
diff --git a/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html b/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html
new file mode 100644
index 000000000..d5bdbb29a
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html
@@ -0,0 +1,314 @@
+<h1>Markdown: Basics</h1>
+
+<ul id="ProjectSubmenu">
+ <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
+ <li><a class="selected" title="Markdown Basics">Basics</a></li>
+ <li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>
+ <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
+ <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
+</ul>
+
+<h2>Getting the Gist of Markdown's Formatting Syntax</h2>
+
+<p>This page offers a brief overview of what it's like to use Markdown.
+The <a href="/projects/markdown/syntax" title="Markdown Syntax">syntax page</a> provides complete, detailed documentation for
+every feature, but Markdown should be very easy to pick up simply by
+looking at a few examples of it in action. The examples on this page
+are written in a before/after style, showing example syntax and the
+HTML output produced by Markdown.</p>
+
+<p>It's also helpful to simply try Markdown out; the <a href="/projects/markdown/dingus" title="Markdown Dingus">Dingus</a> is a
+web application that allows you type your own Markdown-formatted text
+and translate it to XHTML.</p>
+
+<p><strong>Note:</strong> This document is itself written using Markdown; you
+can <a href="/projects/markdown/basics.text">see the source for it by adding '.text' to the URL</a>.</p>
+
+<h2>Paragraphs, Headers, Blockquotes</h2>
+
+<p>A paragraph is simply one or more consecutive lines of text, separated
+by one or more blank lines. (A blank line is any line that looks like a
+blank line -- a line containing nothing spaces or tabs is considered
+blank.) Normal paragraphs should not be intended with spaces or tabs.</p>
+
+<p>Markdown offers two styles of headers: <em>Setext</em> and <em>atx</em>.
+Setext-style headers for <code>&lt;h1&gt;</code> and <code>&lt;h2&gt;</code> are created by
+"underlining" with equal signs (<code>=</code>) and hyphens (<code>-</code>), respectively.
+To create an atx-style header, you put 1-6 hash marks (<code>#</code>) at the
+beginning of the line -- the number of hashes equals the resulting
+HTML header level.</p>
+
+<p>Blockquotes are indicated using email-style '<code>&gt;</code>' angle brackets.</p>
+
+<p>Markdown:</p>
+
+<pre><code>A First Level Header
+====================
+
+A Second Level Header
+---------------------
+
+Now is the time for all good men to come to
+the aid of their country. This is just a
+regular paragraph.
+
+The quick brown fox jumped over the lazy
+dog's back.
+
+### Header 3
+
+&gt; This is a blockquote.
+&gt;
+&gt; This is the second paragraph in the blockquote.
+&gt;
+&gt; ## This is an H2 in a blockquote
+</code></pre>
+
+<p>Output:</p>
+
+<pre><code>&lt;h1&gt;A First Level Header&lt;/h1&gt;
+
+&lt;h2&gt;A Second Level Header&lt;/h2&gt;
+
+&lt;p&gt;Now is the time for all good men to come to
+the aid of their country. This is just a
+regular paragraph.&lt;/p&gt;
+
+&lt;p&gt;The quick brown fox jumped over the lazy
+dog's back.&lt;/p&gt;
+
+&lt;h3&gt;Header 3&lt;/h3&gt;
+
+&lt;blockquote&gt;
+ &lt;p&gt;This is a blockquote.&lt;/p&gt;
+
+ &lt;p&gt;This is the second paragraph in the blockquote.&lt;/p&gt;
+
+ &lt;h2&gt;This is an H2 in a blockquote&lt;/h2&gt;
+&lt;/blockquote&gt;
+</code></pre>
+
+<h3>Phrase Emphasis</h3>
+
+<p>Markdown uses asterisks and underscores to indicate spans of emphasis.</p>
+
+<p>Markdown:</p>
+
+<pre><code>Some of these words *are emphasized*.
+Some of these words _are emphasized also_.
+
+Use two asterisks for **strong emphasis**.
+Or, if you prefer, __use two underscores instead__.
+</code></pre>
+
+<p>Output:</p>
+
+<pre><code>&lt;p&gt;Some of these words &lt;em&gt;are emphasized&lt;/em&gt;.
+Some of these words &lt;em&gt;are emphasized also&lt;/em&gt;.&lt;/p&gt;
+
+&lt;p&gt;Use two asterisks for &lt;strong&gt;strong emphasis&lt;/strong&gt;.
+Or, if you prefer, &lt;strong&gt;use two underscores instead&lt;/strong&gt;.&lt;/p&gt;
+</code></pre>
+
+<h2>Lists</h2>
+
+<p>Unordered (bulleted) lists use asterisks, pluses, and hyphens (<code>*</code>,
+<code>+</code>, and <code>-</code>) as list markers. These three markers are
+interchangable; this:</p>
+
+<pre><code>* Candy.
+* Gum.
+* Booze.
+</code></pre>
+
+<p>this:</p>
+
+<pre><code>+ Candy.
++ Gum.
++ Booze.
+</code></pre>
+
+<p>and this:</p>
+
+<pre><code>- Candy.
+- Gum.
+- Booze.
+</code></pre>
+
+<p>all produce the same output:</p>
+
+<pre><code>&lt;ul&gt;
+&lt;li&gt;Candy.&lt;/li&gt;
+&lt;li&gt;Gum.&lt;/li&gt;
+&lt;li&gt;Booze.&lt;/li&gt;
+&lt;/ul&gt;
+</code></pre>
+
+<p>Ordered (numbered) lists use regular numbers, followed by periods, as
+list markers:</p>
+
+<pre><code>1. Red
+2. Green
+3. Blue
+</code></pre>
+
+<p>Output:</p>
+
+<pre><code>&lt;ol&gt;
+&lt;li&gt;Red&lt;/li&gt;
+&lt;li&gt;Green&lt;/li&gt;
+&lt;li&gt;Blue&lt;/li&gt;
+&lt;/ol&gt;
+</code></pre>
+
+<p>If you put blank lines between items, you'll get <code>&lt;p&gt;</code> tags for the
+list item text. You can create multi-paragraph list items by indenting
+the paragraphs by 4 spaces or 1 tab:</p>
+
+<pre><code>* A list item.
+
+ With multiple paragraphs.
+
+* Another item in the list.
+</code></pre>
+
+<p>Output:</p>
+
+<pre><code>&lt;ul&gt;
+&lt;li&gt;&lt;p&gt;A list item.&lt;/p&gt;
+&lt;p&gt;With multiple paragraphs.&lt;/p&gt;&lt;/li&gt;
+&lt;li&gt;&lt;p&gt;Another item in the list.&lt;/p&gt;&lt;/li&gt;
+&lt;/ul&gt;
+</code></pre>
+
+<h3>Links</h3>
+
+<p>Markdown supports two styles for creating links: <em>inline</em> and
+<em>reference</em>. With both styles, you use square brackets to delimit the
+text you want to turn into a link.</p>
+
+<p>Inline-style links use parentheses immediately after the link text.
+For example:</p>
+
+<pre><code>This is an [example link](http://example.com/).
+</code></pre>
+
+<p>Output:</p>
+
+<pre><code>&lt;p&gt;This is an &lt;a href="http://example.com/"&gt;
+example link&lt;/a&gt;.&lt;/p&gt;
+</code></pre>
+
+<p>Optionally, you may include a title attribute in the parentheses:</p>
+
+<pre><code>This is an [example link](http://example.com/ "With a Title").
+</code></pre>
+
+<p>Output:</p>
+
+<pre><code>&lt;p&gt;This is an &lt;a href="http://example.com/" title="With a Title"&gt;
+example link&lt;/a&gt;.&lt;/p&gt;
+</code></pre>
+
+<p>Reference-style links allow you to refer to your links by names, which
+you define elsewhere in your document:</p>
+
+<pre><code>I get 10 times more traffic from [Google][1] than from
+[Yahoo][2] or [MSN][3].
+
+[1]: http://google.com/ "Google"
+[2]: http://search.yahoo.com/ "Yahoo Search"
+[3]: http://search.msn.com/ "MSN Search"
+</code></pre>
+
+<p>Output:</p>
+
+<pre><code>&lt;p&gt;I get 10 times more traffic from &lt;a href="http://google.com/"
+title="Google"&gt;Google&lt;/a&gt; than from &lt;a href="http://search.yahoo.com/"
+title="Yahoo Search"&gt;Yahoo&lt;/a&gt; or &lt;a href="http://search.msn.com/"
+title="MSN Search"&gt;MSN&lt;/a&gt;.&lt;/p&gt;
+</code></pre>
+
+<p>The title attribute is optional. Link names may contain letters,
+numbers and spaces, but are <em>not</em> case sensitive:</p>
+
+<pre><code>I start my morning with a cup of coffee and
+[The New York Times][NY Times].
+
+[ny times]: http://www.nytimes.com/
+</code></pre>
+
+<p>Output:</p>
+
+<pre><code>&lt;p&gt;I start my morning with a cup of coffee and
+&lt;a href="http://www.nytimes.com/"&gt;The New York Times&lt;/a&gt;.&lt;/p&gt;
+</code></pre>
+
+<h3>Images</h3>
+
+<p>Image syntax is very much like link syntax.</p>
+
+<p>Inline (titles are optional):</p>
+
+<pre><code>![alt text](/path/to/img.jpg "Title")
+</code></pre>
+
+<p>Reference-style:</p>
+
+<pre><code>![alt text][id]
+
+[id]: /path/to/img.jpg "Title"
+</code></pre>
+
+<p>Both of the above examples produce the same output:</p>
+
+<pre><code>&lt;img src="/path/to/img.jpg" alt="alt text" title="Title" /&gt;
+</code></pre>
+
+<h3>Code</h3>
+
+<p>In a regular paragraph, you can create code span by wrapping text in
+backtick quotes. Any ampersands (<code>&amp;</code>) and angle brackets (<code>&lt;</code> or
+<code>&gt;</code>) will automatically be translated into HTML entities. This makes
+it easy to use Markdown to write about HTML example code:</p>
+
+<pre><code>I strongly recommend against using any `&lt;blink&gt;` tags.
+
+I wish SmartyPants used named entities like `&amp;mdash;`
+instead of decimal-encoded entites like `&amp;#8212;`.
+</code></pre>
+
+<p>Output:</p>
+
+<pre><code>&lt;p&gt;I strongly recommend against using any
+&lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
+
+&lt;p&gt;I wish SmartyPants used named entities like
+&lt;code&gt;&amp;amp;mdash;&lt;/code&gt; instead of decimal-encoded
+entites like &lt;code&gt;&amp;amp;#8212;&lt;/code&gt;.&lt;/p&gt;
+</code></pre>
+
+<p>To specify an entire block of pre-formatted code, indent every line of
+the block by 4 spaces or 1 tab. Just like with code spans, <code>&amp;</code>, <code>&lt;</code>,
+and <code>&gt;</code> characters will be escaped automatically.</p>
+
+<p>Markdown:</p>
+
+<pre><code>If you want your page to validate under XHTML 1.0 Strict,
+you've got to put paragraph tags in your blockquotes:
+
+ &lt;blockquote&gt;
+ &lt;p&gt;For example.&lt;/p&gt;
+ &lt;/blockquote&gt;
+</code></pre>
+
+<p>Output:</p>
+
+<pre><code>&lt;p&gt;If you want your page to validate under XHTML 1.0 Strict,
+you've got to put paragraph tags in your blockquotes:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;
+ &amp;lt;p&amp;gt;For example.&amp;lt;/p&amp;gt;
+&amp;lt;/blockquote&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+</code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text b/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text
new file mode 100644
index 000000000..486055ca7
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text
@@ -0,0 +1,306 @@
+Markdown: Basics
+================
+
+<ul id="ProjectSubmenu">
+ <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
+ <li><a class="selected" title="Markdown Basics">Basics</a></li>
+ <li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>
+ <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
+ <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
+</ul>
+
+
+Getting the Gist of Markdown's Formatting Syntax
+------------------------------------------------
+
+This page offers a brief overview of what it's like to use Markdown.
+The [syntax page] [s] provides complete, detailed documentation for
+every feature, but Markdown should be very easy to pick up simply by
+looking at a few examples of it in action. The examples on this page
+are written in a before/after style, showing example syntax and the
+HTML output produced by Markdown.
+
+It's also helpful to simply try Markdown out; the [Dingus] [d] is a
+web application that allows you type your own Markdown-formatted text
+and translate it to XHTML.
+
+**Note:** This document is itself written using Markdown; you
+can [see the source for it by adding '.text' to the URL] [src].
+
+ [s]: /projects/markdown/syntax "Markdown Syntax"
+ [d]: /projects/markdown/dingus "Markdown Dingus"
+ [src]: /projects/markdown/basics.text
+
+
+## Paragraphs, Headers, Blockquotes ##
+
+A paragraph is simply one or more consecutive lines of text, separated
+by one or more blank lines. (A blank line is any line that looks like a
+blank line -- a line containing nothing spaces or tabs is considered
+blank.) Normal paragraphs should not be intended with spaces or tabs.
+
+Markdown offers two styles of headers: *Setext* and *atx*.
+Setext-style headers for `<h1>` and `<h2>` are created by
+"underlining" with equal signs (`=`) and hyphens (`-`), respectively.
+To create an atx-style header, you put 1-6 hash marks (`#`) at the
+beginning of the line -- the number of hashes equals the resulting
+HTML header level.
+
+Blockquotes are indicated using email-style '`>`' angle brackets.
+
+Markdown:
+
+ A First Level Header
+ ====================
+
+ A Second Level Header
+ ---------------------
+
+ Now is the time for all good men to come to
+ the aid of their country. This is just a
+ regular paragraph.
+
+ The quick brown fox jumped over the lazy
+ dog's back.
+
+ ### Header 3
+
+ > This is a blockquote.
+ >
+ > This is the second paragraph in the blockquote.
+ >
+ > ## This is an H2 in a blockquote
+
+
+Output:
+
+ <h1>A First Level Header</h1>
+
+ <h2>A Second Level Header</h2>
+
+ <p>Now is the time for all good men to come to
+ the aid of their country. This is just a
+ regular paragraph.</p>
+
+ <p>The quick brown fox jumped over the lazy
+ dog's back.</p>
+
+ <h3>Header 3</h3>
+
+ <blockquote>
+ <p>This is a blockquote.</p>
+
+ <p>This is the second paragraph in the blockquote.</p>
+
+ <h2>This is an H2 in a blockquote</h2>
+ </blockquote>
+
+
+
+### Phrase Emphasis ###
+
+Markdown uses asterisks and underscores to indicate spans of emphasis.
+
+Markdown:
+
+ Some of these words *are emphasized*.
+ Some of these words _are emphasized also_.
+
+ Use two asterisks for **strong emphasis**.
+ Or, if you prefer, __use two underscores instead__.
+
+Output:
+
+ <p>Some of these words <em>are emphasized</em>.
+ Some of these words <em>are emphasized also</em>.</p>
+
+ <p>Use two asterisks for <strong>strong emphasis</strong>.
+ Or, if you prefer, <strong>use two underscores instead</strong>.</p>
+
+
+
+## Lists ##
+
+Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
+`+`, and `-`) as list markers. These three markers are
+interchangable; this:
+
+ * Candy.
+ * Gum.
+ * Booze.
+
+this:
+
+ + Candy.
+ + Gum.
+ + Booze.
+
+and this:
+
+ - Candy.
+ - Gum.
+ - Booze.
+
+all produce the same output:
+
+ <ul>
+ <li>Candy.</li>
+ <li>Gum.</li>
+ <li>Booze.</li>
+ </ul>
+
+Ordered (numbered) lists use regular numbers, followed by periods, as
+list markers:
+
+ 1. Red
+ 2. Green
+ 3. Blue
+
+Output:
+
+ <ol>
+ <li>Red</li>
+ <li>Green</li>
+ <li>Blue</li>
+ </ol>
+
+If you put blank lines between items, you'll get `<p>` tags for the
+list item text. You can create multi-paragraph list items by indenting
+the paragraphs by 4 spaces or 1 tab:
+
+ * A list item.
+
+ With multiple paragraphs.
+
+ * Another item in the list.
+
+Output:
+
+ <ul>
+ <li><p>A list item.</p>
+ <p>With multiple paragraphs.</p></li>
+ <li><p>Another item in the list.</p></li>
+ </ul>
+
+
+
+### Links ###
+
+Markdown supports two styles for creating links: *inline* and
+*reference*. With both styles, you use square brackets to delimit the
+text you want to turn into a link.
+
+Inline-style links use parentheses immediately after the link text.
+For example:
+
+ This is an [example link](http://example.com/).
+
+Output:
+
+ <p>This is an <a href="http://example.com/">
+ example link</a>.</p>
+
+Optionally, you may include a title attribute in the parentheses:
+
+ This is an [example link](http://example.com/ "With a Title").
+
+Output:
+
+ <p>This is an <a href="http://example.com/" title="With a Title">
+ example link</a>.</p>
+
+Reference-style links allow you to refer to your links by names, which
+you define elsewhere in your document:
+
+ I get 10 times more traffic from [Google][1] than from
+ [Yahoo][2] or [MSN][3].
+
+ [1]: http://google.com/ "Google"
+ [2]: http://search.yahoo.com/ "Yahoo Search"
+ [3]: http://search.msn.com/ "MSN Search"
+
+Output:
+
+ <p>I get 10 times more traffic from <a href="http://google.com/"
+ title="Google">Google</a> than from <a href="http://search.yahoo.com/"
+ title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
+ title="MSN Search">MSN</a>.</p>
+
+The title attribute is optional. Link names may contain letters,
+numbers and spaces, but are *not* case sensitive:
+
+ I start my morning with a cup of coffee and
+ [The New York Times][NY Times].
+
+ [ny times]: http://www.nytimes.com/
+
+Output:
+
+ <p>I start my morning with a cup of coffee and
+ <a href="http://www.nytimes.com/">The New York Times</a>.</p>
+
+
+### Images ###
+
+Image syntax is very much like link syntax.
+
+Inline (titles are optional):
+
+ ![alt text](/path/to/img.jpg "Title")
+
+Reference-style:
+
+ ![alt text][id]
+
+ [id]: /path/to/img.jpg "Title"
+
+Both of the above examples produce the same output:
+
+ <img src="/path/to/img.jpg" alt="alt text" title="Title" />
+
+
+
+### Code ###
+
+In a regular paragraph, you can create code span by wrapping text in
+backtick quotes. Any ampersands (`&`) and angle brackets (`<` or
+`>`) will automatically be translated into HTML entities. This makes
+it easy to use Markdown to write about HTML example code:
+
+ I strongly recommend against using any `<blink>` tags.
+
+ I wish SmartyPants used named entities like `&mdash;`
+ instead of decimal-encoded entites like `&#8212;`.
+
+Output:
+
+ <p>I strongly recommend against using any
+ <code>&lt;blink&gt;</code> tags.</p>
+
+ <p>I wish SmartyPants used named entities like
+ <code>&amp;mdash;</code> instead of decimal-encoded
+ entites like <code>&amp;#8212;</code>.</p>
+
+
+To specify an entire block of pre-formatted code, indent every line of
+the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`,
+and `>` characters will be escaped automatically.
+
+Markdown:
+
+ If you want your page to validate under XHTML 1.0 Strict,
+ you've got to put paragraph tags in your blockquotes:
+
+ <blockquote>
+ <p>For example.</p>
+ </blockquote>
+
+Output:
+
+ <p>If you want your page to validate under XHTML 1.0 Strict,
+ you've got to put paragraph tags in your blockquotes:</p>
+
+ <pre><code>&lt;blockquote&gt;
+ &lt;p&gt;For example.&lt;/p&gt;
+ &lt;/blockquote&gt;
+ </code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html b/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html
new file mode 100644
index 000000000..5c01306cc
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html
@@ -0,0 +1,942 @@
+<h1>Markdown: Syntax</h1>
+
+<ul id="ProjectSubmenu">
+ <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
+ <li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li>
+ <li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li>
+ <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
+ <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
+</ul>
+
+<ul>
+<li><a href="#overview">Overview</a>
+<ul>
+<li><a href="#philosophy">Philosophy</a></li>
+<li><a href="#html">Inline HTML</a></li>
+<li><a href="#autoescape">Automatic Escaping for Special Characters</a></li>
+</ul></li>
+<li><a href="#block">Block Elements</a>
+<ul>
+<li><a href="#p">Paragraphs and Line Breaks</a></li>
+<li><a href="#header">Headers</a></li>
+<li><a href="#blockquote">Blockquotes</a></li>
+<li><a href="#list">Lists</a></li>
+<li><a href="#precode">Code Blocks</a></li>
+<li><a href="#hr">Horizontal Rules</a></li>
+</ul></li>
+<li><a href="#span">Span Elements</a>
+<ul>
+<li><a href="#link">Links</a></li>
+<li><a href="#em">Emphasis</a></li>
+<li><a href="#code">Code</a></li>
+<li><a href="#img">Images</a></li>
+</ul></li>
+<li><a href="#misc">Miscellaneous</a>
+<ul>
+<li><a href="#backslash">Backslash Escapes</a></li>
+<li><a href="#autolink">Automatic Links</a></li>
+</ul></li>
+</ul>
+
+<p><strong>Note:</strong> This document is itself written using Markdown; you
+can <a href="/projects/markdown/syntax.text">see the source for it by adding '.text' to the URL</a>.</p>
+
+<hr />
+
+<h2 id="overview">Overview</h2>
+
+<h3 id="philosophy">Philosophy</h3>
+
+<p>Markdown is intended to be as easy-to-read and easy-to-write as is feasible.</p>
+
+<p>Readability, however, is emphasized above all else. A Markdown-formatted
+document should be publishable as-is, as plain text, without looking
+like it's been marked up with tags or formatting instructions. While
+Markdown's syntax has been influenced by several existing text-to-HTML
+filters -- including <a href="http://docutils.sourceforge.net/mirror/setext.html">Setext</a>, <a href="http://www.aaronsw.com/2002/atx/">atx</a>, <a href="http://textism.com/tools/textile/">Textile</a>, <a href="http://docutils.sourceforge.net/rst.html">reStructuredText</a>,
+<a href="http://www.triptico.com/software/grutatxt.html">Grutatext</a>, and <a href="http://ettext.taint.org/doc/">EtText</a> -- the single biggest source of
+inspiration for Markdown's syntax is the format of plain text email.</p>
+
+<p>To this end, Markdown's syntax is comprised entirely of punctuation
+characters, which punctuation characters have been carefully chosen so
+as to look like what they mean. E.g., asterisks around a word actually
+look like *emphasis*. Markdown lists look like, well, lists. Even
+blockquotes look like quoted passages of text, assuming you've ever
+used email.</p>
+
+<h3 id="html">Inline HTML</h3>
+
+<p>Markdown's syntax is intended for one purpose: to be used as a
+format for <em>writing</em> for the web.</p>
+
+<p>Markdown is not a replacement for HTML, or even close to it. Its
+syntax is very small, corresponding only to a very small subset of
+HTML tags. The idea is <em>not</em> to create a syntax that makes it easier
+to insert HTML tags. In my opinion, HTML tags are already easy to
+insert. The idea for Markdown is to make it easy to read, write, and
+edit prose. HTML is a <em>publishing</em> format; Markdown is a <em>writing</em>
+format. Thus, Markdown's formatting syntax only addresses issues that
+can be conveyed in plain text.</p>
+
+<p>For any markup that is not covered by Markdown's syntax, you simply
+use HTML itself. There's no need to preface it or delimit it to
+indicate that you're switching from Markdown to HTML; you just use
+the tags.</p>
+
+<p>The only restrictions are that block-level HTML elements -- e.g. <code>&lt;div&gt;</code>,
+<code>&lt;table&gt;</code>, <code>&lt;pre&gt;</code>, <code>&lt;p&gt;</code>, etc. -- must be separated from surrounding
+content by blank lines, and the start and end tags of the block should
+not be indented with tabs or spaces. Markdown is smart enough not
+to add extra (unwanted) <code>&lt;p&gt;</code> tags around HTML block-level tags.</p>
+
+<p>For example, to add an HTML table to a Markdown article:</p>
+
+<pre><code>This is a regular paragraph.
+
+&lt;table&gt;
+ &lt;tr&gt;
+ &lt;td&gt;Foo&lt;/td&gt;
+ &lt;/tr&gt;
+&lt;/table&gt;
+
+This is another regular paragraph.
+</code></pre>
+
+<p>Note that Markdown formatting syntax is not processed within block-level
+HTML tags. E.g., you can't use Markdown-style <code>*emphasis*</code> inside an
+HTML block.</p>
+
+<p>Span-level HTML tags -- e.g. <code>&lt;span&gt;</code>, <code>&lt;cite&gt;</code>, or <code>&lt;del&gt;</code> -- can be
+used anywhere in a Markdown paragraph, list item, or header. If you
+want, you can even use HTML tags instead of Markdown formatting; e.g. if
+you'd prefer to use HTML <code>&lt;a&gt;</code> or <code>&lt;img&gt;</code> tags instead of Markdown's
+link or image syntax, go right ahead.</p>
+
+<p>Unlike block-level HTML tags, Markdown syntax <em>is</em> processed within
+span-level tags.</p>
+
+<h3 id="autoescape">Automatic Escaping for Special Characters</h3>
+
+<p>In HTML, there are two characters that demand special treatment: <code>&lt;</code>
+and <code>&amp;</code>. Left angle brackets are used to start tags; ampersands are
+used to denote HTML entities. If you want to use them as literal
+characters, you must escape them as entities, e.g. <code>&amp;lt;</code>, and
+<code>&amp;amp;</code>.</p>
+
+<p>Ampersands in particular are bedeviling for web writers. If you want to
+write about 'AT&amp;T', you need to write '<code>AT&amp;amp;T</code>'. You even need to
+escape ampersands within URLs. Thus, if you want to link to:</p>
+
+<pre><code>http://images.google.com/images?num=30&amp;q=larry+bird
+</code></pre>
+
+<p>you need to encode the URL as:</p>
+
+<pre><code>http://images.google.com/images?num=30&amp;amp;q=larry+bird
+</code></pre>
+
+<p>in your anchor tag <code>href</code> attribute. Needless to say, this is easy to
+forget, and is probably the single most common source of HTML validation
+errors in otherwise well-marked-up web sites.</p>
+
+<p>Markdown allows you to use these characters naturally, taking care of
+all the necessary escaping for you. If you use an ampersand as part of
+an HTML entity, it remains unchanged; otherwise it will be translated
+into <code>&amp;amp;</code>.</p>
+
+<p>So, if you want to include a copyright symbol in your article, you can write:</p>
+
+<pre><code>&amp;copy;
+</code></pre>
+
+<p>and Markdown will leave it alone. But if you write:</p>
+
+<pre><code>AT&amp;T
+</code></pre>
+
+<p>Markdown will translate it to:</p>
+
+<pre><code>AT&amp;amp;T
+</code></pre>
+
+<p>Similarly, because Markdown supports <a href="#html">inline HTML</a>, if you use
+angle brackets as delimiters for HTML tags, Markdown will treat them as
+such. But if you write:</p>
+
+<pre><code>4 &lt; 5
+</code></pre>
+
+<p>Markdown will translate it to:</p>
+
+<pre><code>4 &amp;lt; 5
+</code></pre>
+
+<p>However, inside Markdown code spans and blocks, angle brackets and
+ampersands are <em>always</em> encoded automatically. This makes it easy to use
+Markdown to write about HTML code. (As opposed to raw HTML, which is a
+terrible format for writing about HTML syntax, because every single <code>&lt;</code>
+and <code>&amp;</code> in your example code needs to be escaped.)</p>
+
+<hr />
+
+<h2 id="block">Block Elements</h2>
+
+<h3 id="p">Paragraphs and Line Breaks</h3>
+
+<p>A paragraph is simply one or more consecutive lines of text, separated
+by one or more blank lines. (A blank line is any line that looks like a
+blank line -- a line containing nothing but spaces or tabs is considered
+blank.) Normal paragraphs should not be intended with spaces or tabs.</p>
+
+<p>The implication of the "one or more consecutive lines of text" rule is
+that Markdown supports "hard-wrapped" text paragraphs. This differs
+significantly from most other text-to-HTML formatters (including Movable
+Type's "Convert Line Breaks" option) which translate every line break
+character in a paragraph into a <code>&lt;br /&gt;</code> tag.</p>
+
+<p>When you <em>do</em> want to insert a <code>&lt;br /&gt;</code> break tag using Markdown, you
+end a line with two or more spaces, then type return.</p>
+
+<p>Yes, this takes a tad more effort to create a <code>&lt;br /&gt;</code>, but a simplistic
+"every line break is a <code>&lt;br /&gt;</code>" rule wouldn't work for Markdown.
+Markdown's email-style <a href="#blockquote">blockquoting</a> and multi-paragraph <a href="#list">list items</a>
+work best -- and look better -- when you format them with hard breaks.</p>
+
+<h3 id="header">Headers</h3>
+
+<p>Markdown supports two styles of headers, <a href="http://docutils.sourceforge.net/mirror/setext.html">Setext</a> and <a href="http://www.aaronsw.com/2002/atx/">atx</a>.</p>
+
+<p>Setext-style headers are "underlined" using equal signs (for first-level
+headers) and dashes (for second-level headers). For example:</p>
+
+<pre><code>This is an H1
+=============
+
+This is an H2
+-------------
+</code></pre>
+
+<p>Any number of underlining <code>=</code>'s or <code>-</code>'s will work.</p>
+
+<p>Atx-style headers use 1-6 hash characters at the start of the line,
+corresponding to header levels 1-6. For example:</p>
+
+<pre><code># This is an H1
+
+## This is an H2
+
+###### This is an H6
+</code></pre>
+
+<p>Optionally, you may "close" atx-style headers. This is purely
+cosmetic -- you can use this if you think it looks better. The
+closing hashes don't even need to match the number of hashes
+used to open the header. (The number of opening hashes
+determines the header level.) :</p>
+
+<pre><code># This is an H1 #
+
+## This is an H2 ##
+
+### This is an H3 ######
+</code></pre>
+
+<h3 id="blockquote">Blockquotes</h3>
+
+<p>Markdown uses email-style <code>&gt;</code> characters for blockquoting. If you're
+familiar with quoting passages of text in an email message, then you
+know how to create a blockquote in Markdown. It looks best if you hard
+wrap the text and put a <code>&gt;</code> before every line:</p>
+
+<pre><code>&gt; This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+&gt; consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+&gt; Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+&gt;
+&gt; Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+&gt; id sem consectetuer libero luctus adipiscing.
+</code></pre>
+
+<p>Markdown allows you to be lazy and only put the <code>&gt;</code> before the first
+line of a hard-wrapped paragraph:</p>
+
+<pre><code>&gt; This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+
+&gt; Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+id sem consectetuer libero luctus adipiscing.
+</code></pre>
+
+<p>Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
+adding additional levels of <code>&gt;</code>:</p>
+
+<pre><code>&gt; This is the first level of quoting.
+&gt;
+&gt; &gt; This is nested blockquote.
+&gt;
+&gt; Back to the first level.
+</code></pre>
+
+<p>Blockquotes can contain other Markdown elements, including headers, lists,
+and code blocks:</p>
+
+<pre><code>&gt; ## This is a header.
+&gt;
+&gt; 1. This is the first list item.
+&gt; 2. This is the second list item.
+&gt;
+&gt; Here's some example code:
+&gt;
+&gt; return shell_exec("echo $input | $markdown_script");
+</code></pre>
+
+<p>Any decent text editor should make email-style quoting easy. For
+example, with BBEdit, you can make a selection and choose Increase
+Quote Level from the Text menu.</p>
+
+<h3 id="list">Lists</h3>
+
+<p>Markdown supports ordered (numbered) and unordered (bulleted) lists.</p>
+
+<p>Unordered lists use asterisks, pluses, and hyphens -- interchangably
+-- as list markers:</p>
+
+<pre><code>* Red
+* Green
+* Blue
+</code></pre>
+
+<p>is equivalent to:</p>
+
+<pre><code>+ Red
++ Green
++ Blue
+</code></pre>
+
+<p>and:</p>
+
+<pre><code>- Red
+- Green
+- Blue
+</code></pre>
+
+<p>Ordered lists use numbers followed by periods:</p>
+
+<pre><code>1. Bird
+2. McHale
+3. Parish
+</code></pre>
+
+<p>It's important to note that the actual numbers you use to mark the
+list have no effect on the HTML output Markdown produces. The HTML
+Markdown produces from the above list is:</p>
+
+<pre><code>&lt;ol&gt;
+&lt;li&gt;Bird&lt;/li&gt;
+&lt;li&gt;McHale&lt;/li&gt;
+&lt;li&gt;Parish&lt;/li&gt;
+&lt;/ol&gt;
+</code></pre>
+
+<p>If you instead wrote the list in Markdown like this:</p>
+
+<pre><code>1. Bird
+1. McHale
+1. Parish
+</code></pre>
+
+<p>or even:</p>
+
+<pre><code>3. Bird
+1. McHale
+8. Parish
+</code></pre>
+
+<p>you'd get the exact same HTML output. The point is, if you want to,
+you can use ordinal numbers in your ordered Markdown lists, so that
+the numbers in your source match the numbers in your published HTML.
+But if you want to be lazy, you don't have to.</p>
+
+<p>If you do use lazy list numbering, however, you should still start the
+list with the number 1. At some point in the future, Markdown may support
+starting ordered lists at an arbitrary number.</p>
+
+<p>List markers typically start at the left margin, but may be indented by
+up to three spaces. List markers must be followed by one or more spaces
+or a tab.</p>
+
+<p>To make lists look nice, you can wrap items with hanging indents:</p>
+
+<pre><code>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+ Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+ viverra nec, fringilla in, laoreet vitae, risus.
+* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+ Suspendisse id sem consectetuer libero luctus adipiscing.
+</code></pre>
+
+<p>But if you want to be lazy, you don't have to:</p>
+
+<pre><code>* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+viverra nec, fringilla in, laoreet vitae, risus.
+* Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+Suspendisse id sem consectetuer libero luctus adipiscing.
+</code></pre>
+
+<p>If list items are separated by blank lines, Markdown will wrap the
+items in <code>&lt;p&gt;</code> tags in the HTML output. For example, this input:</p>
+
+<pre><code>* Bird
+* Magic
+</code></pre>
+
+<p>will turn into:</p>
+
+<pre><code>&lt;ul&gt;
+&lt;li&gt;Bird&lt;/li&gt;
+&lt;li&gt;Magic&lt;/li&gt;
+&lt;/ul&gt;
+</code></pre>
+
+<p>But this:</p>
+
+<pre><code>* Bird
+
+* Magic
+</code></pre>
+
+<p>will turn into:</p>
+
+<pre><code>&lt;ul&gt;
+&lt;li&gt;&lt;p&gt;Bird&lt;/p&gt;&lt;/li&gt;
+&lt;li&gt;&lt;p&gt;Magic&lt;/p&gt;&lt;/li&gt;
+&lt;/ul&gt;
+</code></pre>
+
+<p>List items may consist of multiple paragraphs. Each subsequent
+paragraph in a list item must be intended by either 4 spaces
+or one tab:</p>
+
+<pre><code>1. This is a list item with two paragraphs. Lorem ipsum dolor
+ sit amet, consectetuer adipiscing elit. Aliquam hendrerit
+ mi posuere lectus.
+
+ Vestibulum enim wisi, viverra nec, fringilla in, laoreet
+ vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
+ sit amet velit.
+
+2. Suspendisse id sem consectetuer libero luctus adipiscing.
+</code></pre>
+
+<p>It looks nice if you indent every line of the subsequent
+paragraphs, but here again, Markdown will allow you to be
+lazy:</p>
+
+<pre><code>* This is a list item with two paragraphs.
+
+ This is the second paragraph in the list item. You're
+only required to indent the first line. Lorem ipsum dolor
+sit amet, consectetuer adipiscing elit.
+
+* Another item in the same list.
+</code></pre>
+
+<p>To put a blockquote within a list item, the blockquote's <code>&gt;</code>
+delimiters need to be indented:</p>
+
+<pre><code>* A list item with a blockquote:
+
+ &gt; This is a blockquote
+ &gt; inside a list item.
+</code></pre>
+
+<p>To put a code block within a list item, the code block needs
+to be indented <em>twice</em> -- 8 spaces or two tabs:</p>
+
+<pre><code>* A list item with a code block:
+
+ &lt;code goes here&gt;
+</code></pre>
+
+<p>It's worth noting that it's possible to trigger an ordered list by
+accident, by writing something like this:</p>
+
+<pre><code>1986. What a great season.
+</code></pre>
+
+<p>In other words, a <em>number-period-space</em> sequence at the beginning of a
+line. To avoid this, you can backslash-escape the period:</p>
+
+<pre><code>1986\. What a great season.
+</code></pre>
+
+<h3 id="precode">Code Blocks</h3>
+
+<p>Pre-formatted code blocks are used for writing about programming or
+markup source code. Rather than forming normal paragraphs, the lines
+of a code block are interpreted literally. Markdown wraps a code block
+in both <code>&lt;pre&gt;</code> and <code>&lt;code&gt;</code> tags.</p>
+
+<p>To produce a code block in Markdown, simply indent every line of the
+block by at least 4 spaces or 1 tab. For example, given this input:</p>
+
+<pre><code>This is a normal paragraph:
+
+ This is a code block.
+</code></pre>
+
+<p>Markdown will generate:</p>
+
+<pre><code>&lt;p&gt;This is a normal paragraph:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;This is a code block.
+&lt;/code&gt;&lt;/pre&gt;
+</code></pre>
+
+<p>One level of indentation -- 4 spaces or 1 tab -- is removed from each
+line of the code block. For example, this:</p>
+
+<pre><code>Here is an example of AppleScript:
+
+ tell application "Foo"
+ beep
+ end tell
+</code></pre>
+
+<p>will turn into:</p>
+
+<pre><code>&lt;p&gt;Here is an example of AppleScript:&lt;/p&gt;
+
+&lt;pre&gt;&lt;code&gt;tell application "Foo"
+ beep
+end tell
+&lt;/code&gt;&lt;/pre&gt;
+</code></pre>
+
+<p>A code block continues until it reaches a line that is not indented
+(or the end of the article).</p>
+
+<p>Within a code block, ampersands (<code>&amp;</code>) and angle brackets (<code>&lt;</code> and <code>&gt;</code>)
+are automatically converted into HTML entities. This makes it very
+easy to include example HTML source code using Markdown -- just paste
+it and indent it, and Markdown will handle the hassle of encoding the
+ampersands and angle brackets. For example, this:</p>
+
+<pre><code> &lt;div class="footer"&gt;
+ &amp;copy; 2004 Foo Corporation
+ &lt;/div&gt;
+</code></pre>
+
+<p>will turn into:</p>
+
+<pre><code>&lt;pre&gt;&lt;code&gt;&amp;lt;div class="footer"&amp;gt;
+ &amp;amp;copy; 2004 Foo Corporation
+&amp;lt;/div&amp;gt;
+&lt;/code&gt;&lt;/pre&gt;
+</code></pre>
+
+<p>Regular Markdown syntax is not processed within code blocks. E.g.,
+asterisks are just literal asterisks within a code block. This means
+it's also easy to use Markdown to write about Markdown's own syntax.</p>
+
+<h3 id="hr">Horizontal Rules</h3>
+
+<p>You can produce a horizontal rule tag (<code>&lt;hr /&gt;</code>) by placing three or
+more hyphens, asterisks, or underscores on a line by themselves. If you
+wish, you may use spaces between the hyphens or asterisks. Each of the
+following lines will produce a horizontal rule:</p>
+
+<pre><code>* * *
+
+***
+
+*****
+
+- - -
+
+---------------------------------------
+
+_ _ _
+</code></pre>
+
+<hr />
+
+<h2 id="span">Span Elements</h2>
+
+<h3 id="link">Links</h3>
+
+<p>Markdown supports two style of links: <em>inline</em> and <em>reference</em>.</p>
+
+<p>In both styles, the link text is delimited by [square brackets].</p>
+
+<p>To create an inline link, use a set of regular parentheses immediately
+after the link text's closing square bracket. Inside the parentheses,
+put the URL where you want the link to point, along with an <em>optional</em>
+title for the link, surrounded in quotes. For example:</p>
+
+<pre><code>This is [an example](http://example.com/ "Title") inline link.
+
+[This link](http://example.net/) has no title attribute.
+</code></pre>
+
+<p>Will produce:</p>
+
+<pre><code>&lt;p&gt;This is &lt;a href="http://example.com/" title="Title"&gt;
+an example&lt;/a&gt; inline link.&lt;/p&gt;
+
+&lt;p&gt;&lt;a href="http://example.net/"&gt;This link&lt;/a&gt; has no
+title attribute.&lt;/p&gt;
+</code></pre>
+
+<p>If you're referring to a local resource on the same server, you can
+use relative paths:</p>
+
+<pre><code>See my [About](/about/) page for details.
+</code></pre>
+
+<p>Reference-style links use a second set of square brackets, inside
+which you place a label of your choosing to identify the link:</p>
+
+<pre><code>This is [an example][id] reference-style link.
+</code></pre>
+
+<p>You can optionally use a space to separate the sets of brackets:</p>
+
+<pre><code>This is [an example] [id] reference-style link.
+</code></pre>
+
+<p>Then, anywhere in the document, you define your link label like this,
+on a line by itself:</p>
+
+<pre><code>[id]: http://example.com/ "Optional Title Here"
+</code></pre>
+
+<p>That is:</p>
+
+<ul>
+<li>Square brackets containing the link identifier (optionally
+indented from the left margin using up to three spaces);</li>
+<li>followed by a colon;</li>
+<li>followed by one or more spaces (or tabs);</li>
+<li>followed by the URL for the link;</li>
+<li>optionally followed by a title attribute for the link, enclosed
+in double or single quotes.</li>
+</ul>
+
+<p>The link URL may, optionally, be surrounded by angle brackets:</p>
+
+<pre><code>[id]: &lt;http://example.com/&gt; "Optional Title Here"
+</code></pre>
+
+<p>You can put the title attribute on the next line and use extra spaces
+or tabs for padding, which tends to look better with longer URLs:</p>
+
+<pre><code>[id]: http://example.com/longish/path/to/resource/here
+ "Optional Title Here"
+</code></pre>
+
+<p>Link definitions are only used for creating links during Markdown
+processing, and are stripped from your document in the HTML output.</p>
+
+<p>Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are <em>not</em> case sensitive. E.g. these two links:</p>
+
+<pre><code>[link text][a]
+[link text][A]
+</code></pre>
+
+<p>are equivalent.</p>
+
+<p>The <em>implicit link name</em> shortcut allows you to omit the name of the
+link, in which case the link text itself is used as the name.
+Just use an empty set of square brackets -- e.g., to link the word
+"Google" to the google.com web site, you could simply write:</p>
+
+<pre><code>[Google][]
+</code></pre>
+
+<p>And then define the link:</p>
+
+<pre><code>[Google]: http://google.com/
+</code></pre>
+
+<p>Because link names may contain spaces, this shortcut even works for
+multiple words in the link text:</p>
+
+<pre><code>Visit [Daring Fireball][] for more information.
+</code></pre>
+
+<p>And then define the link:</p>
+
+<pre><code>[Daring Fireball]: http://daringfireball.net/
+</code></pre>
+
+<p>Link definitions can be placed anywhere in your Markdown document. I
+tend to put them immediately after each paragraph in which they're
+used, but if you want, you can put them all at the end of your
+document, sort of like footnotes.</p>
+
+<p>Here's an example of reference links in action:</p>
+
+<pre><code>I get 10 times more traffic from [Google] [1] than from
+[Yahoo] [2] or [MSN] [3].
+
+ [1]: http://google.com/ "Google"
+ [2]: http://search.yahoo.com/ "Yahoo Search"
+ [3]: http://search.msn.com/ "MSN Search"
+</code></pre>
+
+<p>Using the implicit link name shortcut, you could instead write:</p>
+
+<pre><code>I get 10 times more traffic from [Google][] than from
+[Yahoo][] or [MSN][].
+
+ [google]: http://google.com/ "Google"
+ [yahoo]: http://search.yahoo.com/ "Yahoo Search"
+ [msn]: http://search.msn.com/ "MSN Search"
+</code></pre>
+
+<p>Both of the above examples will produce the following HTML output:</p>
+
+<pre><code>&lt;p&gt;I get 10 times more traffic from &lt;a href="http://google.com/"
+title="Google"&gt;Google&lt;/a&gt; than from
+&lt;a href="http://search.yahoo.com/" title="Yahoo Search"&gt;Yahoo&lt;/a&gt;
+or &lt;a href="http://search.msn.com/" title="MSN Search"&gt;MSN&lt;/a&gt;.&lt;/p&gt;
+</code></pre>
+
+<p>For comparison, here is the same paragraph written using
+Markdown's inline link style:</p>
+
+<pre><code>I get 10 times more traffic from [Google](http://google.com/ "Google")
+than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
+[MSN](http://search.msn.com/ "MSN Search").
+</code></pre>
+
+<p>The point of reference-style links is not that they're easier to
+write. The point is that with reference-style links, your document
+source is vastly more readable. Compare the above examples: using
+reference-style links, the paragraph itself is only 81 characters
+long; with inline-style links, it's 176 characters; and as raw HTML,
+it's 234 characters. In the raw HTML, there's more markup than there
+is text.</p>
+
+<p>With Markdown's reference-style links, a source document much more
+closely resembles the final output, as rendered in a browser. By
+allowing you to move the markup-related metadata out of the paragraph,
+you can add links without interrupting the narrative flow of your
+prose.</p>
+
+<h3 id="em">Emphasis</h3>
+
+<p>Markdown treats asterisks (<code>*</code>) and underscores (<code>_</code>) as indicators of
+emphasis. Text wrapped with one <code>*</code> or <code>_</code> will be wrapped with an
+HTML <code>&lt;em&gt;</code> tag; double <code>*</code>'s or <code>_</code>'s will be wrapped with an HTML
+<code>&lt;strong&gt;</code> tag. E.g., this input:</p>
+
+<pre><code>*single asterisks*
+
+_single underscores_
+
+**double asterisks**
+
+__double underscores__
+</code></pre>
+
+<p>will produce:</p>
+
+<pre><code>&lt;em&gt;single asterisks&lt;/em&gt;
+
+&lt;em&gt;single underscores&lt;/em&gt;
+
+&lt;strong&gt;double asterisks&lt;/strong&gt;
+
+&lt;strong&gt;double underscores&lt;/strong&gt;
+</code></pre>
+
+<p>You can use whichever style you prefer; the lone restriction is that
+the same character must be used to open and close an emphasis span.</p>
+
+<p>Emphasis can be used in the middle of a word:</p>
+
+<pre><code>un*fucking*believable
+</code></pre>
+
+<p>But if you surround an <code>*</code> or <code>_</code> with spaces, it'll be treated as a
+literal asterisk or underscore.</p>
+
+<p>To produce a literal asterisk or underscore at a position where it
+would otherwise be used as an emphasis delimiter, you can backslash
+escape it:</p>
+
+<pre><code>\*this text is surrounded by literal asterisks\*
+</code></pre>
+
+<h3 id="code">Code</h3>
+
+<p>To indicate a span of code, wrap it with backtick quotes (<code>`</code>).
+Unlike a pre-formatted code block, a code span indicates code within a
+normal paragraph. For example:</p>
+
+<pre><code>Use the `printf()` function.
+</code></pre>
+
+<p>will produce:</p>
+
+<pre><code>&lt;p&gt;Use the &lt;code&gt;printf()&lt;/code&gt; function.&lt;/p&gt;
+</code></pre>
+
+<p>To include a literal backtick character within a code span, you can use
+multiple backticks as the opening and closing delimiters:</p>
+
+<pre><code>``There is a literal backtick (`) here.``
+</code></pre>
+
+<p>which will produce this:</p>
+
+<pre><code>&lt;p&gt;&lt;code&gt;There is a literal backtick (`) here.&lt;/code&gt;&lt;/p&gt;
+</code></pre>
+
+<p>The backtick delimiters surrounding a code span may include spaces --
+one after the opening, one before the closing. This allows you to place
+literal backtick characters at the beginning or end of a code span:</p>
+
+<pre><code>A single backtick in a code span: `` ` ``
+
+A backtick-delimited string in a code span: `` `foo` ``
+</code></pre>
+
+<p>will produce:</p>
+
+<pre><code>&lt;p&gt;A single backtick in a code span: &lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
+
+&lt;p&gt;A backtick-delimited string in a code span: &lt;code&gt;`foo`&lt;/code&gt;&lt;/p&gt;
+</code></pre>
+
+<p>With a code span, ampersands and angle brackets are encoded as HTML
+entities automatically, which makes it easy to include example HTML
+tags. Markdown will turn this:</p>
+
+<pre><code>Please don't use any `&lt;blink&gt;` tags.
+</code></pre>
+
+<p>into:</p>
+
+<pre><code>&lt;p&gt;Please don't use any &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
+</code></pre>
+
+<p>You can write this:</p>
+
+<pre><code>`&amp;#8212;` is the decimal-encoded equivalent of `&amp;mdash;`.
+</code></pre>
+
+<p>to produce:</p>
+
+<pre><code>&lt;p&gt;&lt;code&gt;&amp;amp;#8212;&lt;/code&gt; is the decimal-encoded
+equivalent of &lt;code&gt;&amp;amp;mdash;&lt;/code&gt;.&lt;/p&gt;
+</code></pre>
+
+<h3 id="img">Images</h3>
+
+<p>Admittedly, it's fairly difficult to devise a "natural" syntax for
+placing images into a plain text document format.</p>
+
+<p>Markdown uses an image syntax that is intended to resemble the syntax
+for links, allowing for two styles: <em>inline</em> and <em>reference</em>.</p>
+
+<p>Inline image syntax looks like this:</p>
+
+<pre><code>![Alt text](/path/to/img.jpg)
+
+![Alt text](/path/to/img.jpg "Optional title")
+</code></pre>
+
+<p>That is:</p>
+
+<ul>
+<li>An exclamation mark: <code>!</code>;</li>
+<li>followed by a set of square brackets, containing the <code>alt</code>
+attribute text for the image;</li>
+<li>followed by a set of parentheses, containing the URL or path to
+the image, and an optional <code>title</code> attribute enclosed in double
+or single quotes.</li>
+</ul>
+
+<p>Reference-style image syntax looks like this:</p>
+
+<pre><code>![Alt text][id]
+</code></pre>
+
+<p>Where "id" is the name of a defined image reference. Image references
+are defined using syntax identical to link references:</p>
+
+<pre><code>[id]: url/to/image "Optional title attribute"
+</code></pre>
+
+<p>As of this writing, Markdown has no syntax for specifying the
+dimensions of an image; if this is important to you, you can simply
+use regular HTML <code>&lt;img&gt;</code> tags.</p>
+
+<hr />
+
+<h2 id="misc">Miscellaneous</h2>
+
+<h3 id="autolink">Automatic Links</h3>
+
+<p>Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:</p>
+
+<pre><code>&lt;http://example.com/&gt;
+</code></pre>
+
+<p>Markdown will turn this into:</p>
+
+<pre><code>&lt;a href="http://example.com/"&gt;http://example.com/&lt;/a&gt;
+</code></pre>
+
+<p>Automatic links for email addresses work similarly, except that
+Markdown will also perform a bit of randomized decimal and hex
+entity-encoding to help obscure your address from address-harvesting
+spambots. For example, Markdown will turn this:</p>
+
+<pre><code>&lt;address@example.com&gt;
+</code></pre>
+
+<p>into something like this:</p>
+
+<pre><code>&lt;a href="&amp;#x6D;&amp;#x61;i&amp;#x6C;&amp;#x74;&amp;#x6F;:&amp;#x61;&amp;#x64;&amp;#x64;&amp;#x72;&amp;#x65;
+&amp;#115;&amp;#115;&amp;#64;&amp;#101;&amp;#120;&amp;#x61;&amp;#109;&amp;#x70;&amp;#x6C;e&amp;#x2E;&amp;#99;&amp;#111;
+&amp;#109;"&gt;&amp;#x61;&amp;#x64;&amp;#x64;&amp;#x72;&amp;#x65;&amp;#115;&amp;#115;&amp;#64;&amp;#101;&amp;#120;&amp;#x61;
+&amp;#109;&amp;#x70;&amp;#x6C;e&amp;#x2E;&amp;#99;&amp;#111;&amp;#109;&lt;/a&gt;
+</code></pre>
+
+<p>which will render in a browser as a clickable link to "address@example.com".</p>
+
+<p>(This sort of entity-encoding trick will indeed fool many, if not
+most, address-harvesting bots, but it definitely won't fool all of
+them. It's better than nothing, but an address published in this way
+will probably eventually start receiving spam.)</p>
+
+<h3 id="backslash">Backslash Escapes</h3>
+
+<p>Markdown allows you to use backslash escapes to generate literal
+characters which would otherwise have special meaning in Markdown's
+formatting syntax. For example, if you wanted to surround a word with
+literal asterisks (instead of an HTML <code>&lt;em&gt;</code> tag), you can backslashes
+before the asterisks, like this:</p>
+
+<pre><code>\*literal asterisks\*
+</code></pre>
+
+<p>Markdown provides backslash escapes for the following characters:</p>
+
+<pre><code>\ backslash
+` backtick
+* asterisk
+_ underscore
+{} curly braces
+[] square brackets
+() parentheses
+# hash mark
++ plus sign
+- minus sign (hyphen)
+. dot
+! exclamation mark
+</code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text b/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text
new file mode 100644
index 000000000..57360a16c
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text
@@ -0,0 +1,888 @@
+Markdown: Syntax
+================
+
+<ul id="ProjectSubmenu">
+ <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
+ <li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li>
+ <li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li>
+ <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
+ <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
+</ul>
+
+
+* [Overview](#overview)
+ * [Philosophy](#philosophy)
+ * [Inline HTML](#html)
+ * [Automatic Escaping for Special Characters](#autoescape)
+* [Block Elements](#block)
+ * [Paragraphs and Line Breaks](#p)
+ * [Headers](#header)
+ * [Blockquotes](#blockquote)
+ * [Lists](#list)
+ * [Code Blocks](#precode)
+ * [Horizontal Rules](#hr)
+* [Span Elements](#span)
+ * [Links](#link)
+ * [Emphasis](#em)
+ * [Code](#code)
+ * [Images](#img)
+* [Miscellaneous](#misc)
+ * [Backslash Escapes](#backslash)
+ * [Automatic Links](#autolink)
+
+
+**Note:** This document is itself written using Markdown; you
+can [see the source for it by adding '.text' to the URL][src].
+
+ [src]: /projects/markdown/syntax.text
+
+* * *
+
+<h2 id="overview">Overview</h2>
+
+<h3 id="philosophy">Philosophy</h3>
+
+Markdown is intended to be as easy-to-read and easy-to-write as is feasible.
+
+Readability, however, is emphasized above all else. A Markdown-formatted
+document should be publishable as-is, as plain text, without looking
+like it's been marked up with tags or formatting instructions. While
+Markdown's syntax has been influenced by several existing text-to-HTML
+filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4],
+[Grutatext] [5], and [EtText] [6] -- the single biggest source of
+inspiration for Markdown's syntax is the format of plain text email.
+
+ [1]: http://docutils.sourceforge.net/mirror/setext.html
+ [2]: http://www.aaronsw.com/2002/atx/
+ [3]: http://textism.com/tools/textile/
+ [4]: http://docutils.sourceforge.net/rst.html
+ [5]: http://www.triptico.com/software/grutatxt.html
+ [6]: http://ettext.taint.org/doc/
+
+To this end, Markdown's syntax is comprised entirely of punctuation
+characters, which punctuation characters have been carefully chosen so
+as to look like what they mean. E.g., asterisks around a word actually
+look like \*emphasis\*. Markdown lists look like, well, lists. Even
+blockquotes look like quoted passages of text, assuming you've ever
+used email.
+
+
+
+<h3 id="html">Inline HTML</h3>
+
+Markdown's syntax is intended for one purpose: to be used as a
+format for *writing* for the web.
+
+Markdown is not a replacement for HTML, or even close to it. Its
+syntax is very small, corresponding only to a very small subset of
+HTML tags. The idea is *not* to create a syntax that makes it easier
+to insert HTML tags. In my opinion, HTML tags are already easy to
+insert. The idea for Markdown is to make it easy to read, write, and
+edit prose. HTML is a *publishing* format; Markdown is a *writing*
+format. Thus, Markdown's formatting syntax only addresses issues that
+can be conveyed in plain text.
+
+For any markup that is not covered by Markdown's syntax, you simply
+use HTML itself. There's no need to preface it or delimit it to
+indicate that you're switching from Markdown to HTML; you just use
+the tags.
+
+The only restrictions are that block-level HTML elements -- e.g. `<div>`,
+`<table>`, `<pre>`, `<p>`, etc. -- must be separated from surrounding
+content by blank lines, and the start and end tags of the block should
+not be indented with tabs or spaces. Markdown is smart enough not
+to add extra (unwanted) `<p>` tags around HTML block-level tags.
+
+For example, to add an HTML table to a Markdown article:
+
+ This is a regular paragraph.
+
+ <table>
+ <tr>
+ <td>Foo</td>
+ </tr>
+ </table>
+
+ This is another regular paragraph.
+
+Note that Markdown formatting syntax is not processed within block-level
+HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an
+HTML block.
+
+Span-level HTML tags -- e.g. `<span>`, `<cite>`, or `<del>` -- can be
+used anywhere in a Markdown paragraph, list item, or header. If you
+want, you can even use HTML tags instead of Markdown formatting; e.g. if
+you'd prefer to use HTML `<a>` or `<img>` tags instead of Markdown's
+link or image syntax, go right ahead.
+
+Unlike block-level HTML tags, Markdown syntax *is* processed within
+span-level tags.
+
+
+<h3 id="autoescape">Automatic Escaping for Special Characters</h3>
+
+In HTML, there are two characters that demand special treatment: `<`
+and `&`. Left angle brackets are used to start tags; ampersands are
+used to denote HTML entities. If you want to use them as literal
+characters, you must escape them as entities, e.g. `&lt;`, and
+`&amp;`.
+
+Ampersands in particular are bedeviling for web writers. If you want to
+write about 'AT&T', you need to write '`AT&amp;T`'. You even need to
+escape ampersands within URLs. Thus, if you want to link to:
+
+ http://images.google.com/images?num=30&q=larry+bird
+
+you need to encode the URL as:
+
+ http://images.google.com/images?num=30&amp;q=larry+bird
+
+in your anchor tag `href` attribute. Needless to say, this is easy to
+forget, and is probably the single most common source of HTML validation
+errors in otherwise well-marked-up web sites.
+
+Markdown allows you to use these characters naturally, taking care of
+all the necessary escaping for you. If you use an ampersand as part of
+an HTML entity, it remains unchanged; otherwise it will be translated
+into `&amp;`.
+
+So, if you want to include a copyright symbol in your article, you can write:
+
+ &copy;
+
+and Markdown will leave it alone. But if you write:
+
+ AT&T
+
+Markdown will translate it to:
+
+ AT&amp;T
+
+Similarly, because Markdown supports [inline HTML](#html), if you use
+angle brackets as delimiters for HTML tags, Markdown will treat them as
+such. But if you write:
+
+ 4 < 5
+
+Markdown will translate it to:
+
+ 4 &lt; 5
+
+However, inside Markdown code spans and blocks, angle brackets and
+ampersands are *always* encoded automatically. This makes it easy to use
+Markdown to write about HTML code. (As opposed to raw HTML, which is a
+terrible format for writing about HTML syntax, because every single `<`
+and `&` in your example code needs to be escaped.)
+
+
+* * *
+
+
+<h2 id="block">Block Elements</h2>
+
+
+<h3 id="p">Paragraphs and Line Breaks</h3>
+
+A paragraph is simply one or more consecutive lines of text, separated
+by one or more blank lines. (A blank line is any line that looks like a
+blank line -- a line containing nothing but spaces or tabs is considered
+blank.) Normal paragraphs should not be intended with spaces or tabs.
+
+The implication of the "one or more consecutive lines of text" rule is
+that Markdown supports "hard-wrapped" text paragraphs. This differs
+significantly from most other text-to-HTML formatters (including Movable
+Type's "Convert Line Breaks" option) which translate every line break
+character in a paragraph into a `<br />` tag.
+
+When you *do* want to insert a `<br />` break tag using Markdown, you
+end a line with two or more spaces, then type return.
+
+Yes, this takes a tad more effort to create a `<br />`, but a simplistic
+"every line break is a `<br />`" rule wouldn't work for Markdown.
+Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l]
+work best -- and look better -- when you format them with hard breaks.
+
+ [bq]: #blockquote
+ [l]: #list
+
+
+
+<h3 id="header">Headers</h3>
+
+Markdown supports two styles of headers, [Setext] [1] and [atx] [2].
+
+Setext-style headers are "underlined" using equal signs (for first-level
+headers) and dashes (for second-level headers). For example:
+
+ This is an H1
+ =============
+
+ This is an H2
+ -------------
+
+Any number of underlining `=`'s or `-`'s will work.
+
+Atx-style headers use 1-6 hash characters at the start of the line,
+corresponding to header levels 1-6. For example:
+
+ # This is an H1
+
+ ## This is an H2
+
+ ###### This is an H6
+
+Optionally, you may "close" atx-style headers. This is purely
+cosmetic -- you can use this if you think it looks better. The
+closing hashes don't even need to match the number of hashes
+used to open the header. (The number of opening hashes
+determines the header level.) :
+
+ # This is an H1 #
+
+ ## This is an H2 ##
+
+ ### This is an H3 ######
+
+
+<h3 id="blockquote">Blockquotes</h3>
+
+Markdown uses email-style `>` characters for blockquoting. If you're
+familiar with quoting passages of text in an email message, then you
+know how to create a blockquote in Markdown. It looks best if you hard
+wrap the text and put a `>` before every line:
+
+ > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+ > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+ > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+ >
+ > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+ > id sem consectetuer libero luctus adipiscing.
+
+Markdown allows you to be lazy and only put the `>` before the first
+line of a hard-wrapped paragraph:
+
+ > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+ consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+ Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+
+ > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+ id sem consectetuer libero luctus adipiscing.
+
+Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
+adding additional levels of `>`:
+
+ > This is the first level of quoting.
+ >
+ > > This is nested blockquote.
+ >
+ > Back to the first level.
+
+Blockquotes can contain other Markdown elements, including headers, lists,
+and code blocks:
+
+ > ## This is a header.
+ >
+ > 1. This is the first list item.
+ > 2. This is the second list item.
+ >
+ > Here's some example code:
+ >
+ > return shell_exec("echo $input | $markdown_script");
+
+Any decent text editor should make email-style quoting easy. For
+example, with BBEdit, you can make a selection and choose Increase
+Quote Level from the Text menu.
+
+
+<h3 id="list">Lists</h3>
+
+Markdown supports ordered (numbered) and unordered (bulleted) lists.
+
+Unordered lists use asterisks, pluses, and hyphens -- interchangably
+-- as list markers:
+
+ * Red
+ * Green
+ * Blue
+
+is equivalent to:
+
+ + Red
+ + Green
+ + Blue
+
+and:
+
+ - Red
+ - Green
+ - Blue
+
+Ordered lists use numbers followed by periods:
+
+ 1. Bird
+ 2. McHale
+ 3. Parish
+
+It's important to note that the actual numbers you use to mark the
+list have no effect on the HTML output Markdown produces. The HTML
+Markdown produces from the above list is:
+
+ <ol>
+ <li>Bird</li>
+ <li>McHale</li>
+ <li>Parish</li>
+ </ol>
+
+If you instead wrote the list in Markdown like this:
+
+ 1. Bird
+ 1. McHale
+ 1. Parish
+
+or even:
+
+ 3. Bird
+ 1. McHale
+ 8. Parish
+
+you'd get the exact same HTML output. The point is, if you want to,
+you can use ordinal numbers in your ordered Markdown lists, so that
+the numbers in your source match the numbers in your published HTML.
+But if you want to be lazy, you don't have to.
+
+If you do use lazy list numbering, however, you should still start the
+list with the number 1. At some point in the future, Markdown may support
+starting ordered lists at an arbitrary number.
+
+List markers typically start at the left margin, but may be indented by
+up to three spaces. List markers must be followed by one or more spaces
+or a tab.
+
+To make lists look nice, you can wrap items with hanging indents:
+
+ * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+ Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+ viverra nec, fringilla in, laoreet vitae, risus.
+ * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+ Suspendisse id sem consectetuer libero luctus adipiscing.
+
+But if you want to be lazy, you don't have to:
+
+ * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+ Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+ viverra nec, fringilla in, laoreet vitae, risus.
+ * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+ Suspendisse id sem consectetuer libero luctus adipiscing.
+
+If list items are separated by blank lines, Markdown will wrap the
+items in `<p>` tags in the HTML output. For example, this input:
+
+ * Bird
+ * Magic
+
+will turn into:
+
+ <ul>
+ <li>Bird</li>
+ <li>Magic</li>
+ </ul>
+
+But this:
+
+ * Bird
+
+ * Magic
+
+will turn into:
+
+ <ul>
+ <li><p>Bird</p></li>
+ <li><p>Magic</p></li>
+ </ul>
+
+List items may consist of multiple paragraphs. Each subsequent
+paragraph in a list item must be intended by either 4 spaces
+or one tab:
+
+ 1. This is a list item with two paragraphs. Lorem ipsum dolor
+ sit amet, consectetuer adipiscing elit. Aliquam hendrerit
+ mi posuere lectus.
+
+ Vestibulum enim wisi, viverra nec, fringilla in, laoreet
+ vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
+ sit amet velit.
+
+ 2. Suspendisse id sem consectetuer libero luctus adipiscing.
+
+It looks nice if you indent every line of the subsequent
+paragraphs, but here again, Markdown will allow you to be
+lazy:
+
+ * This is a list item with two paragraphs.
+
+ This is the second paragraph in the list item. You're
+ only required to indent the first line. Lorem ipsum dolor
+ sit amet, consectetuer adipiscing elit.
+
+ * Another item in the same list.
+
+To put a blockquote within a list item, the blockquote's `>`
+delimiters need to be indented:
+
+ * A list item with a blockquote:
+
+ > This is a blockquote
+ > inside a list item.
+
+To put a code block within a list item, the code block needs
+to be indented *twice* -- 8 spaces or two tabs:
+
+ * A list item with a code block:
+
+ <code goes here>
+
+
+It's worth noting that it's possible to trigger an ordered list by
+accident, by writing something like this:
+
+ 1986. What a great season.
+
+In other words, a *number-period-space* sequence at the beginning of a
+line. To avoid this, you can backslash-escape the period:
+
+ 1986\. What a great season.
+
+
+
+<h3 id="precode">Code Blocks</h3>
+
+Pre-formatted code blocks are used for writing about programming or
+markup source code. Rather than forming normal paragraphs, the lines
+of a code block are interpreted literally. Markdown wraps a code block
+in both `<pre>` and `<code>` tags.
+
+To produce a code block in Markdown, simply indent every line of the
+block by at least 4 spaces or 1 tab. For example, given this input:
+
+ This is a normal paragraph:
+
+ This is a code block.
+
+Markdown will generate:
+
+ <p>This is a normal paragraph:</p>
+
+ <pre><code>This is a code block.
+ </code></pre>
+
+One level of indentation -- 4 spaces or 1 tab -- is removed from each
+line of the code block. For example, this:
+
+ Here is an example of AppleScript:
+
+ tell application "Foo"
+ beep
+ end tell
+
+will turn into:
+
+ <p>Here is an example of AppleScript:</p>
+
+ <pre><code>tell application "Foo"
+ beep
+ end tell
+ </code></pre>
+
+A code block continues until it reaches a line that is not indented
+(or the end of the article).
+
+Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
+are automatically converted into HTML entities. This makes it very
+easy to include example HTML source code using Markdown -- just paste
+it and indent it, and Markdown will handle the hassle of encoding the
+ampersands and angle brackets. For example, this:
+
+ <div class="footer">
+ &copy; 2004 Foo Corporation
+ </div>
+
+will turn into:
+
+ <pre><code>&lt;div class="footer"&gt;
+ &amp;copy; 2004 Foo Corporation
+ &lt;/div&gt;
+ </code></pre>
+
+Regular Markdown syntax is not processed within code blocks. E.g.,
+asterisks are just literal asterisks within a code block. This means
+it's also easy to use Markdown to write about Markdown's own syntax.
+
+
+
+<h3 id="hr">Horizontal Rules</h3>
+
+You can produce a horizontal rule tag (`<hr />`) by placing three or
+more hyphens, asterisks, or underscores on a line by themselves. If you
+wish, you may use spaces between the hyphens or asterisks. Each of the
+following lines will produce a horizontal rule:
+
+ * * *
+
+ ***
+
+ *****
+
+ - - -
+
+ ---------------------------------------
+
+ _ _ _
+
+
+* * *
+
+<h2 id="span">Span Elements</h2>
+
+<h3 id="link">Links</h3>
+
+Markdown supports two style of links: *inline* and *reference*.
+
+In both styles, the link text is delimited by [square brackets].
+
+To create an inline link, use a set of regular parentheses immediately
+after the link text's closing square bracket. Inside the parentheses,
+put the URL where you want the link to point, along with an *optional*
+title for the link, surrounded in quotes. For example:
+
+ This is [an example](http://example.com/ "Title") inline link.
+
+ [This link](http://example.net/) has no title attribute.
+
+Will produce:
+
+ <p>This is <a href="http://example.com/" title="Title">
+ an example</a> inline link.</p>
+
+ <p><a href="http://example.net/">This link</a> has no
+ title attribute.</p>
+
+If you're referring to a local resource on the same server, you can
+use relative paths:
+
+ See my [About](/about/) page for details.
+
+Reference-style links use a second set of square brackets, inside
+which you place a label of your choosing to identify the link:
+
+ This is [an example][id] reference-style link.
+
+You can optionally use a space to separate the sets of brackets:
+
+ This is [an example] [id] reference-style link.
+
+Then, anywhere in the document, you define your link label like this,
+on a line by itself:
+
+ [id]: http://example.com/ "Optional Title Here"
+
+That is:
+
+* Square brackets containing the link identifier (optionally
+ indented from the left margin using up to three spaces);
+* followed by a colon;
+* followed by one or more spaces (or tabs);
+* followed by the URL for the link;
+* optionally followed by a title attribute for the link, enclosed
+ in double or single quotes.
+
+The link URL may, optionally, be surrounded by angle brackets:
+
+ [id]: <http://example.com/> "Optional Title Here"
+
+You can put the title attribute on the next line and use extra spaces
+or tabs for padding, which tends to look better with longer URLs:
+
+ [id]: http://example.com/longish/path/to/resource/here
+ "Optional Title Here"
+
+Link definitions are only used for creating links during Markdown
+processing, and are stripped from your document in the HTML output.
+
+Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links:
+
+ [link text][a]
+ [link text][A]
+
+are equivalent.
+
+The *implicit link name* shortcut allows you to omit the name of the
+link, in which case the link text itself is used as the name.
+Just use an empty set of square brackets -- e.g., to link the word
+"Google" to the google.com web site, you could simply write:
+
+ [Google][]
+
+And then define the link:
+
+ [Google]: http://google.com/
+
+Because link names may contain spaces, this shortcut even works for
+multiple words in the link text:
+
+ Visit [Daring Fireball][] for more information.
+
+And then define the link:
+
+ [Daring Fireball]: http://daringfireball.net/
+
+Link definitions can be placed anywhere in your Markdown document. I
+tend to put them immediately after each paragraph in which they're
+used, but if you want, you can put them all at the end of your
+document, sort of like footnotes.
+
+Here's an example of reference links in action:
+
+ I get 10 times more traffic from [Google] [1] than from
+ [Yahoo] [2] or [MSN] [3].
+
+ [1]: http://google.com/ "Google"
+ [2]: http://search.yahoo.com/ "Yahoo Search"
+ [3]: http://search.msn.com/ "MSN Search"
+
+Using the implicit link name shortcut, you could instead write:
+
+ I get 10 times more traffic from [Google][] than from
+ [Yahoo][] or [MSN][].
+
+ [google]: http://google.com/ "Google"
+ [yahoo]: http://search.yahoo.com/ "Yahoo Search"
+ [msn]: http://search.msn.com/ "MSN Search"
+
+Both of the above examples will produce the following HTML output:
+
+ <p>I get 10 times more traffic from <a href="http://google.com/"
+ title="Google">Google</a> than from
+ <a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
+ or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
+
+For comparison, here is the same paragraph written using
+Markdown's inline link style:
+
+ I get 10 times more traffic from [Google](http://google.com/ "Google")
+ than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
+ [MSN](http://search.msn.com/ "MSN Search").
+
+The point of reference-style links is not that they're easier to
+write. The point is that with reference-style links, your document
+source is vastly more readable. Compare the above examples: using
+reference-style links, the paragraph itself is only 81 characters
+long; with inline-style links, it's 176 characters; and as raw HTML,
+it's 234 characters. In the raw HTML, there's more markup than there
+is text.
+
+With Markdown's reference-style links, a source document much more
+closely resembles the final output, as rendered in a browser. By
+allowing you to move the markup-related metadata out of the paragraph,
+you can add links without interrupting the narrative flow of your
+prose.
+
+
+<h3 id="em">Emphasis</h3>
+
+Markdown treats asterisks (`*`) and underscores (`_`) as indicators of
+emphasis. Text wrapped with one `*` or `_` will be wrapped with an
+HTML `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML
+`<strong>` tag. E.g., this input:
+
+ *single asterisks*
+
+ _single underscores_
+
+ **double asterisks**
+
+ __double underscores__
+
+will produce:
+
+ <em>single asterisks</em>
+
+ <em>single underscores</em>
+
+ <strong>double asterisks</strong>
+
+ <strong>double underscores</strong>
+
+You can use whichever style you prefer; the lone restriction is that
+the same character must be used to open and close an emphasis span.
+
+Emphasis can be used in the middle of a word:
+
+ un*fucking*believable
+
+But if you surround an `*` or `_` with spaces, it'll be treated as a
+literal asterisk or underscore.
+
+To produce a literal asterisk or underscore at a position where it
+would otherwise be used as an emphasis delimiter, you can backslash
+escape it:
+
+ \*this text is surrounded by literal asterisks\*
+
+
+
+<h3 id="code">Code</h3>
+
+To indicate a span of code, wrap it with backtick quotes (`` ` ``).
+Unlike a pre-formatted code block, a code span indicates code within a
+normal paragraph. For example:
+
+ Use the `printf()` function.
+
+will produce:
+
+ <p>Use the <code>printf()</code> function.</p>
+
+To include a literal backtick character within a code span, you can use
+multiple backticks as the opening and closing delimiters:
+
+ ``There is a literal backtick (`) here.``
+
+which will produce this:
+
+ <p><code>There is a literal backtick (`) here.</code></p>
+
+The backtick delimiters surrounding a code span may include spaces --
+one after the opening, one before the closing. This allows you to place
+literal backtick characters at the beginning or end of a code span:
+
+ A single backtick in a code span: `` ` ``
+
+ A backtick-delimited string in a code span: `` `foo` ``
+
+will produce:
+
+ <p>A single backtick in a code span: <code>`</code></p>
+
+ <p>A backtick-delimited string in a code span: <code>`foo`</code></p>
+
+With a code span, ampersands and angle brackets are encoded as HTML
+entities automatically, which makes it easy to include example HTML
+tags. Markdown will turn this:
+
+ Please don't use any `<blink>` tags.
+
+into:
+
+ <p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
+
+You can write this:
+
+ `&#8212;` is the decimal-encoded equivalent of `&mdash;`.
+
+to produce:
+
+ <p><code>&amp;#8212;</code> is the decimal-encoded
+ equivalent of <code>&amp;mdash;</code>.</p>
+
+
+
+<h3 id="img">Images</h3>
+
+Admittedly, it's fairly difficult to devise a "natural" syntax for
+placing images into a plain text document format.
+
+Markdown uses an image syntax that is intended to resemble the syntax
+for links, allowing for two styles: *inline* and *reference*.
+
+Inline image syntax looks like this:
+
+ ![Alt text](/path/to/img.jpg)
+
+ ![Alt text](/path/to/img.jpg "Optional title")
+
+That is:
+
+* An exclamation mark: `!`;
+* followed by a set of square brackets, containing the `alt`
+ attribute text for the image;
+* followed by a set of parentheses, containing the URL or path to
+ the image, and an optional `title` attribute enclosed in double
+ or single quotes.
+
+Reference-style image syntax looks like this:
+
+ ![Alt text][id]
+
+Where "id" is the name of a defined image reference. Image references
+are defined using syntax identical to link references:
+
+ [id]: url/to/image "Optional title attribute"
+
+As of this writing, Markdown has no syntax for specifying the
+dimensions of an image; if this is important to you, you can simply
+use regular HTML `<img>` tags.
+
+
+* * *
+
+
+<h2 id="misc">Miscellaneous</h2>
+
+<h3 id="autolink">Automatic Links</h3>
+
+Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:
+
+ <http://example.com/>
+
+Markdown will turn this into:
+
+ <a href="http://example.com/">http://example.com/</a>
+
+Automatic links for email addresses work similarly, except that
+Markdown will also perform a bit of randomized decimal and hex
+entity-encoding to help obscure your address from address-harvesting
+spambots. For example, Markdown will turn this:
+
+ <address@example.com>
+
+into something like this:
+
+ <a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
+ &#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
+ &#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
+ &#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
+
+which will render in a browser as a clickable link to "address@example.com".
+
+(This sort of entity-encoding trick will indeed fool many, if not
+most, address-harvesting bots, but it definitely won't fool all of
+them. It's better than nothing, but an address published in this way
+will probably eventually start receiving spam.)
+
+
+
+<h3 id="backslash">Backslash Escapes</h3>
+
+Markdown allows you to use backslash escapes to generate literal
+characters which would otherwise have special meaning in Markdown's
+formatting syntax. For example, if you wanted to surround a word with
+literal asterisks (instead of an HTML `<em>` tag), you can backslashes
+before the asterisks, like this:
+
+ \*literal asterisks\*
+
+Markdown provides backslash escapes for the following characters:
+
+ \ backslash
+ ` backtick
+ * asterisk
+ _ underscore
+ {} curly braces
+ [] square brackets
+ () parentheses
+ # hash mark
+ + plus sign
+ - minus sign (hyphen)
+ . dot
+ ! exclamation mark
+
diff --git a/tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.html b/tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.html
new file mode 100644
index 000000000..d8ec7f8e0
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.html
@@ -0,0 +1,9 @@
+<blockquote>
+ <p>foo</p>
+
+ <blockquote>
+ <p>bar</p>
+ </blockquote>
+
+ <p>foo</p>
+</blockquote>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.text b/tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.text
new file mode 100644
index 000000000..ed3c624ff
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Nested blockquotes.text
@@ -0,0 +1,5 @@
+> foo
+>
+> > bar
+>
+> foo
diff --git a/tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html b/tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html
new file mode 100644
index 000000000..ba71eab39
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html
@@ -0,0 +1,148 @@
+<h2>Unordered</h2>
+
+<p>Asterisks tight:</p>
+
+<ul>
+<li>asterisk 1</li>
+<li>asterisk 2</li>
+<li>asterisk 3</li>
+</ul>
+
+<p>Asterisks loose:</p>
+
+<ul>
+<li><p>asterisk 1</p></li>
+<li><p>asterisk 2</p></li>
+<li><p>asterisk 3</p></li>
+</ul>
+
+<hr />
+
+<p>Pluses tight:</p>
+
+<ul>
+<li>Plus 1</li>
+<li>Plus 2</li>
+<li>Plus 3</li>
+</ul>
+
+<p>Pluses loose:</p>
+
+<ul>
+<li><p>Plus 1</p></li>
+<li><p>Plus 2</p></li>
+<li><p>Plus 3</p></li>
+</ul>
+
+<hr />
+
+<p>Minuses tight:</p>
+
+<ul>
+<li>Minus 1</li>
+<li>Minus 2</li>
+<li>Minus 3</li>
+</ul>
+
+<p>Minuses loose:</p>
+
+<ul>
+<li><p>Minus 1</p></li>
+<li><p>Minus 2</p></li>
+<li><p>Minus 3</p></li>
+</ul>
+
+<h2>Ordered</h2>
+
+<p>Tight:</p>
+
+<ol>
+<li>First</li>
+<li>Second</li>
+<li>Third</li>
+</ol>
+
+<p>and:</p>
+
+<ol>
+<li>One</li>
+<li>Two</li>
+<li>Three</li>
+</ol>
+
+<p>Loose using tabs:</p>
+
+<ol>
+<li><p>First</p></li>
+<li><p>Second</p></li>
+<li><p>Third</p></li>
+</ol>
+
+<p>and using spaces:</p>
+
+<ol>
+<li><p>One</p></li>
+<li><p>Two</p></li>
+<li><p>Three</p></li>
+</ol>
+
+<p>Multiple paragraphs:</p>
+
+<ol>
+<li><p>Item 1, graf one.</p>
+
+<p>Item 2. graf two. The quick brown fox jumped over the lazy dog's
+back.</p></li>
+<li><p>Item 2.</p></li>
+<li><p>Item 3.</p></li>
+</ol>
+
+<h2>Nested</h2>
+
+<ul>
+<li>Tab
+<ul>
+<li>Tab
+<ul>
+<li>Tab</li>
+</ul></li>
+</ul></li>
+</ul>
+
+<p>Here's another:</p>
+
+<ol>
+<li>First</li>
+<li>Second:
+<ul>
+<li>Fee</li>
+<li>Fie</li>
+<li>Foe</li>
+</ul></li>
+<li>Third</li>
+</ol>
+
+<p>Same thing but with paragraphs:</p>
+
+<ol>
+<li><p>First</p></li>
+<li><p>Second:</p>
+
+<ul>
+<li>Fee</li>
+<li>Fie</li>
+<li>Foe</li>
+</ul></li>
+<li><p>Third</p></li>
+</ol>
+
+
+<p>This was an error in Markdown 1.0.1:</p>
+
+<ul>
+<li><p>this</p>
+
+<ul><li>sub</li></ul>
+
+<p>that</p></li>
+</ul>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text b/tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text
new file mode 100644
index 000000000..7f3b49777
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text
@@ -0,0 +1,131 @@
+## Unordered
+
+Asterisks tight:
+
+* asterisk 1
+* asterisk 2
+* asterisk 3
+
+
+Asterisks loose:
+
+* asterisk 1
+
+* asterisk 2
+
+* asterisk 3
+
+* * *
+
+Pluses tight:
+
++ Plus 1
++ Plus 2
++ Plus 3
+
+
+Pluses loose:
+
++ Plus 1
+
++ Plus 2
+
++ Plus 3
+
+* * *
+
+
+Minuses tight:
+
+- Minus 1
+- Minus 2
+- Minus 3
+
+
+Minuses loose:
+
+- Minus 1
+
+- Minus 2
+
+- Minus 3
+
+
+## Ordered
+
+Tight:
+
+1. First
+2. Second
+3. Third
+
+and:
+
+1. One
+2. Two
+3. Three
+
+
+Loose using tabs:
+
+1. First
+
+2. Second
+
+3. Third
+
+and using spaces:
+
+1. One
+
+2. Two
+
+3. Three
+
+Multiple paragraphs:
+
+1. Item 1, graf one.
+
+ Item 2. graf two. The quick brown fox jumped over the lazy dog's
+ back.
+
+2. Item 2.
+
+3. Item 3.
+
+
+
+## Nested
+
+* Tab
+ * Tab
+ * Tab
+
+Here's another:
+
+1. First
+2. Second:
+ * Fee
+ * Fie
+ * Foe
+3. Third
+
+Same thing but with paragraphs:
+
+1. First
+
+2. Second:
+ * Fee
+ * Fie
+ * Foe
+
+3. Third
+
+
+This was an error in Markdown 1.0.1:
+
+* this
+
+ * sub
+
+ that
diff --git a/tests/MarkdownTest_1.0.3/Tests/Strong and em together.html b/tests/MarkdownTest_1.0.3/Tests/Strong and em together.html
new file mode 100644
index 000000000..71ec78c70
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Strong and em together.html
@@ -0,0 +1,7 @@
+<p><strong><em>This is strong and em.</em></strong></p>
+
+<p>So is <strong><em>this</em></strong> word.</p>
+
+<p><strong><em>This is strong and em.</em></strong></p>
+
+<p>So is <strong><em>this</em></strong> word.</p>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Strong and em together.text b/tests/MarkdownTest_1.0.3/Tests/Strong and em together.text
new file mode 100644
index 000000000..95ee690db
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Strong and em together.text
@@ -0,0 +1,7 @@
+***This is strong and em.***
+
+So is ***this*** word.
+
+___This is strong and em.___
+
+So is ___this___ word.
diff --git a/tests/MarkdownTest_1.0.3/Tests/Tabs.html b/tests/MarkdownTest_1.0.3/Tests/Tabs.html
new file mode 100644
index 000000000..3301ba803
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Tabs.html
@@ -0,0 +1,25 @@
+<ul>
+<li><p>this is a list item
+indented with tabs</p></li>
+<li><p>this is a list item
+indented with spaces</p></li>
+</ul>
+
+<p>Code:</p>
+
+<pre><code>this code block is indented by one tab
+</code></pre>
+
+<p>And:</p>
+
+<pre><code> this code block is indented by two tabs
+</code></pre>
+
+<p>And:</p>
+
+<pre><code>+ this is an example list item
+ indented with tabs
+
++ this is an example list item
+ indented with spaces
+</code></pre>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Tabs.text b/tests/MarkdownTest_1.0.3/Tests/Tabs.text
new file mode 100644
index 000000000..589d1136e
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Tabs.text
@@ -0,0 +1,21 @@
++ this is a list item
+ indented with tabs
+
++ this is a list item
+ indented with spaces
+
+Code:
+
+ this code block is indented by one tab
+
+And:
+
+ this code block is indented by two tabs
+
+And:
+
+ + this is an example list item
+ indented with tabs
+
+ + this is an example list item
+ indented with spaces
diff --git a/tests/MarkdownTest_1.0.3/Tests/Tidyness.html b/tests/MarkdownTest_1.0.3/Tests/Tidyness.html
new file mode 100644
index 000000000..f2a8ce70f
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Tidyness.html
@@ -0,0 +1,8 @@
+<blockquote>
+<p>A list within a blockquote:</p>
+<ul>
+<li>asterisk 1</li>
+<li>asterisk 2</li>
+<li>asterisk 3</li>
+</ul>
+</blockquote>
diff --git a/tests/MarkdownTest_1.0.3/Tests/Tidyness.text b/tests/MarkdownTest_1.0.3/Tests/Tidyness.text
new file mode 100644
index 000000000..5f18b8da2
--- /dev/null
+++ b/tests/MarkdownTest_1.0.3/Tests/Tidyness.text
@@ -0,0 +1,5 @@
+> A list within a blockquote:
+>
+> * asterisk 1
+> * asterisk 2
+> * asterisk 3
diff --git a/tests/bodybg.gif b/tests/bodybg.gif
new file mode 100644
index 000000000..5f448a16f
--- /dev/null
+++ b/tests/bodybg.gif
Binary files differ
diff --git a/tests/generate.sh b/tests/generate.sh
new file mode 100644
index 000000000..75b3bb9ee
--- /dev/null
+++ b/tests/generate.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+../pandoc -r native -s -w native testsuite.native > writer.native
+../pandoc -r native -s -w markdown testsuite.native > writer.markdown
+../pandoc -r native -s -w rst testsuite.native > writer.rst
+../pandoc -r native -s -w html testsuite.native > writer.html
+../pandoc -r native -s -w html -S testsuite.native > writer.smart.html
+../pandoc -r native -s -w latex testsuite.native > writer.latex
+../pandoc -r native -s -w rtf testsuite.native > writer.rtf
+
diff --git a/tests/html-reader.html b/tests/html-reader.html
new file mode 100644
index 000000000..0df91b335
--- /dev/null
+++ b/tests/html-reader.html
@@ -0,0 +1,399 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta name="generator" content="pandoc" />
+<style type="text/css">
+div.pandocNote { border-left: 1px solid grey; padding-left: 1em; }
+span.pandocNoteRef { vertical-align: super; font-size: 80%; }
+span.pandocNoteMarker { }
+</style>
+<title>Pandoc Test Suite</title>
+</head>
+<body>
+<h1 class="title">Pandoc Test Suite</h1>
+<p>This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite.</p>
+<hr />
+<h1>Headers</h1>
+<h2>Level 2 with an <a href="/url">embedded link</a></h2>
+<h3>Level 3 with <em>emphasis</em></h3>
+<h4>Level 4</h4>
+<h5>Level 5</h5>
+<h1>Level 1</h1>
+<h2>Level 2 with <em>emphasis</em></h2>
+<h3>Level 3</h3>
+<p>with no blank line</p>
+<h2>Level 2</h2>
+<p>with no blank line</p>
+<hr />
+<h1>Paragraphs</h1>
+<p>Here's a regular paragraph.</p>
+<p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</p>
+<p>Here's one with a bullet. * criminey.</p>
+<p>There should be a hard line break<br />
+ here.</p>
+<hr />
+<h1>Block Quotes</h1>
+<p>E-mail style:</p>
+<blockquote>
+<p>This is a block quote. It is pretty short.</p>
+</blockquote>
+<blockquote>
+<p>Code in a block quote:</p>
+<pre><code>sub status {
+ print "working";
+}
+</code></pre>
+<p>A list:</p>
+<ol>
+<li>item one</li>
+<li>item two</li>
+</ol>
+<p>Nested block quotes:</p>
+<blockquote>
+<p>nested</p>
+</blockquote>
+<blockquote>
+<p>nested</p>
+</blockquote>
+</blockquote>
+<p>This should not be a block quote: 2 &gt; 1.</p>
+<p>Box-style:</p>
+<blockquote>
+<p>Example:</p>
+<pre><code>sub status {
+ print "working";
+}
+</code></pre>
+</blockquote>
+<blockquote>
+<ol>
+<li>do laundry</li>
+<li>take out the trash</li>
+</ol>
+</blockquote>
+<p>Here's a nested one:</p>
+<blockquote>
+<p>Joe said:</p>
+<blockquote>
+<p>Don't quote me.</p>
+</blockquote>
+</blockquote>
+<p>And a following paragraph.</p>
+<hr />
+<h1>Code Blocks</h1>
+<p>Code:</p>
+<pre><code>---- (should be four hyphens)
+
+sub status {
+ print "working";
+}
+
+this code block is indented by one tab
+</code></pre>
+<p>And:</p>
+<pre><code> this code block is indented by two tabs
+
+These should not be escaped: \$ \\ \> \[ \{
+</code></pre>
+<hr />
+<h1>Lists</h1>
+<h2>Unordered</h2>
+<p>Asterisks tight:</p>
+<ul>
+<li>asterisk 1</li>
+<li>asterisk 2</li>
+<li>asterisk 3</li>
+</ul>
+<p>Asterisks loose:</p>
+<ul>
+<li><p>asterisk 1</p>
+</li>
+<li><p>asterisk 2</p>
+</li>
+<li><p>asterisk 3</p>
+</li>
+</ul>
+<p>Pluses tight:</p>
+<ul>
+<li>Plus 1</li>
+<li>Plus 2</li>
+<li>Plus 3</li>
+</ul>
+<p>Pluses loose:</p>
+<ul>
+<li><p>Plus 1</p>
+</li>
+<li><p>Plus 2</p>
+</li>
+<li><p>Plus 3</p>
+</li>
+</ul>
+<p>Minuses tight:</p>
+<ul>
+<li>Minus 1</li>
+<li>Minus 2</li>
+<li>Minus 3</li>
+</ul>
+<p>Minuses loose:</p>
+<ul>
+<li><p>Minus 1</p>
+</li>
+<li><p>Minus 2</p>
+</li>
+<li><p>Minus 3</p>
+</li>
+</ul>
+<h2>Ordered</h2>
+<p>Tight:</p>
+<ol>
+<li>First</li>
+<li>Second</li>
+<li>Third</li>
+</ol>
+<p>and:</p>
+<ol>
+<li>One</li>
+<li>Two</li>
+<li>Three</li>
+</ol>
+<p>Loose using tabs:</p>
+<ol>
+<li><p>First</p>
+</li>
+<li><p>Second</p>
+</li>
+<li><p>Third</p>
+</li>
+</ol>
+<p>and using spaces:</p>
+<ol>
+<li><p>One</p>
+</li>
+<li><p>Two</p>
+</li>
+<li><p>Three</p>
+</li>
+</ol>
+<p>Multiple paragraphs:</p>
+<ol>
+<li><p>Item 1, graf one.</p>
+<p>Item 1. graf two. The quick brown fox jumped over the lazy dog's back.</p>
+</li>
+<li><p>Item 2.</p>
+</li>
+<li><p>Item 3.</p>
+</li>
+</ol>
+<h2>Nested</h2>
+<ul>
+<li>Tab<ul>
+<li>Tab<ul>
+<li>Tab</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+<p>Here's another:</p>
+<ol>
+<li>First</li>
+<li>Second:<ul>
+<li>Fee</li>
+<li>Fie</li>
+<li>Foe</li>
+</ul>
+</li>
+<li>Third</li>
+</ol>
+<p>Same thing but with paragraphs:</p>
+<ol>
+<li><p>First</p>
+</li>
+<li><p>Second:</p>
+<ul>
+<li>Fee</li>
+<li>Fie</li>
+<li>Foe</li>
+</ul>
+</li>
+<li><p>Third</p>
+</li>
+</ol>
+<h2>Tabs and spaces</h2>
+<ul>
+<li><p>this is a list item indented with tabs</p>
+</li>
+<li><p>this is a list item indented with spaces</p>
+<ul>
+<li><p>this is an example list item indented with tabs</p>
+</li>
+<li><p>this is an example list item indented with spaces</p>
+</li>
+</ul>
+</li>
+</ul>
+<hr />
+<h1>HTML Blocks</h1>
+<p>Simple block on one line:</p>
+foo<p>And nested without indentation:</p>
+foobar<p>Interpreted markdown in a table:</p>
+This is <em>emphasized</em>. And this is <strong>strong</strong><p>Here's a simple block:</p>
+foo<p>This should be a code block, though:</p>
+<pre><code>&lt;div>
+ foo
+&lt;/div>
+</code></pre>
+<p>As should this:</p>
+<pre><code>&lt;div>foo&lt;/div>
+</code></pre>
+<p>Now, nested:</p>
+foo<p>This should just be an HTML comment:</p>
+<p>Multiline:</p>
+<p>Code block:</p>
+<pre><code>&lt;!-- Comment -->
+</code></pre>
+<p>Just plain comment, with trailing spaces on the line:</p>
+<p>Code:</p>
+<pre><code>&lt;hr />
+</code></pre>
+<p>Hr's:</p>
+<hr />
+<hr />
+<hr />
+<hr />
+<hr />
+<hr />
+<hr />
+<hr />
+<hr />
+<hr />
+<h1>Inline Markup</h1>
+<p>This is <em>emphasized</em>, and so <em>is this</em>.</p>
+<p>This is <strong>strong</strong>, and so <strong>is this</strong>.</p>
+<p>An <em><a href="/url">emphasized link</a></em>.</p>
+<p><strong><em>This is strong and em.</em></strong></p>
+<p>So is <strong><em>this</em></strong> word.</p>
+<p><strong><em>This is strong and em.</em></strong></p>
+<p>So is <strong><em>this</em></strong> word.</p>
+<p>This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>, <code>&lt;html></code>.</p>
+<hr />
+<h1>Smart quotes, ellipses, dashes</h1>
+<p>"Hello," said the spider. "'Shelob' is my name."</p>
+<p>'A', 'B', and 'C' are letters.</p>
+<p>'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.'</p>
+<p>'He said, "I want to go."' Were you alive in the 70's?</p>
+<p>Here is some quoted '<code>code</code>' and a "<a href="http://example.com/?foo=1&amp;bar=2">quoted link</a>".</p>
+<p>Some dashes: one---two --- three--four -- five.</p>
+<p>Dashes between numbers: 5-7, 255-66, 1987-1999.</p>
+<p>Ellipses...and. . .and . . . .</p>
+<hr />
+<h1>LaTeX</h1>
+<ul>
+<li>\cite[22-23]{smith.1899}</li>
+<li>\doublespacing</li>
+<li>$2+2=4$</li>
+<li>$x \in y$</li>
+<li>$\alpha \wedge \omega$</li>
+<li>$223$</li>
+<li>$p$-Tree</li>
+<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
+<li>Here's one that has a line break in it: $\alpha + \omega \times x^2$.</li>
+</ul>
+<p>These shouldn't be math:</p>
+<ul>
+<li>To get the famous equation, write <code>$e = mc^2$</code>.</li>
+<li>$22,000 is a <em>lot</em> of money. So is $34,000. (It worked if "lot" is emphasized.)</li>
+<li>Escaped <code>$</code>: $73 <em>this should be emphasized</em> 23$.</li>
+</ul>
+<p>Here's a LaTeX table:</p>
+<p>\begin{tabular}{|l|l|}\hline Animal &amp; Number \\ \hline Dog &amp; 2 \\ Cat &amp; 1 \\ \hline \end{tabular}</p>
+<hr />
+<h1>Special Characters</h1>
+<p>Here is some unicode:</p>
+<ul>
+<li>I hat: Î</li>
+<li>o umlaut: ö</li>
+<li>section: §</li>
+<li>set membership: ∈</li>
+<li>copyright: ©</li>
+</ul>
+<p>AT&amp;T has an ampersand in their name.</p>
+<p>AT&amp;T is another way to write it.</p>
+<p>This &amp; that.</p>
+<p>4 &lt; 5.</p>
+<p>6 &gt; 5.</p>
+<p>Backslash: \</p>
+<p>Backtick: `</p>
+<p>Asterisk: *</p>
+<p>Underscore: _</p>
+<p>Left brace: {</p>
+<p>Right brace: }</p>
+<p>Left bracket: [</p>
+<p>Right bracket: ]</p>
+<p>Left paren: (</p>
+<p>Right paren: )</p>
+<p>Greater-than: &gt;</p>
+<p>Hash: #</p>
+<p>Period: .</p>
+<p>Bang: !</p>
+<p>Plus: +</p>
+<p>Minus: -</p>
+<hr />
+<h1>Links</h1>
+<h2>Explicit</h2>
+<p>Just a <a href="/url/">URL</a>.</p>
+<p><a href="/url/" title="title">URL and title</a>.</p>
+<p><a href="/url/" title="title preceded by two spaces">URL and title</a>.</p>
+<p><a href="/url/" title="title preceded by a tab">URL and title</a>.</p>
+<p><a href="/url/" title="title with &quot;quotes&quot; in it">URL and title</a></p>
+<p><a href="/url/" title="title with single quotes">URL and title</a></p>
+Email link (nobody [at] nowhere.net)<p><a href="">Empty</a>.</p>
+<h2>Reference</h2>
+<p>Foo <a href="/url/">bar</a>.</p>
+<p>Foo <a href="/url/">bar</a>.</p>
+<p>Foo <a href="/url/">bar</a>.</p>
+<p>With <a href="/url/">embedded [brackets]</a>.</p>
+<p><a href="/url/">b</a> by itself should be a link.</p>
+<p>Indented <a href="/url">once</a>.</p>
+<p>Indented <a href="/url">twice</a>.</p>
+<p>Indented <a href="/url">thrice</a>.</p>
+<p>This should [not] be a link.</p>
+<pre><code>[not]: /url
+</code></pre>
+<p>Foo <a href="/url/" title="Title with &quot;quotes&quot; inside">bar</a>.</p>
+<p>Foo <a href="/url/" title="Title with &quot;quote&quot; inside">biz</a>.</p>
+<h2>With ampersands</h2>
+<p>Here's a <a href="http://example.com/?foo=1&amp;bar=2">link with an ampersand in the URL</a>.</p>
+<p>Here's a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&amp;T</a>.</p>
+<p>Here's an <a href="/script?foo=1&amp;bar=2">inline link</a>.</p>
+<p>Here's an <a href="/script?foo=1&amp;bar=2">inline link in pointy braces</a>.</p>
+<h2>Autolinks</h2>
+<p>With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</a></p>
+<ul>
+<li>In a list?</li>
+<li><a href="http://example.com/">http://example.com/</a></li>
+<li>It should.</li>
+</ul>
+An e-mail address: nobody [at] nowhere.net<blockquote>
+<p>Blockquoted: <a href="http://example.com/">http://example.com/</a></p>
+</blockquote>
+<p>Auto-links should not occur here: <code>&lt;http://example.com/></code></p>
+<pre><code>or here: &lt;http://example.com/>
+</code></pre>
+<hr />
+<h1>Images</h1>
+<p>From "Voyage dans la Lune" by Georges Melies (1902):</p>
+<p><img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune"></p>
+<p>Here is a movie <img src="movie.jpg" alt="movie"> icon.</p>
+<hr />
+<h1>Footnotes</h1>
+<p>Here is a footnote reference<a href="#note_1">(1)</a>, and another<a href="#note_longnote">(longnote)</a>. This should <em>not</em> be a footnote reference, because it contains a space^(my note).</p>
+<p><a href="#ref_1">(1)</a> Here is the footnote. It can go anywhere in the document, not just at the end.</p>
+<p><a href="#ref_longnote">(longnote)</a> Here's the other note. This one contains multiple blocks.</p>
+<p>Caret characters are used to indicate that the blocks all belong to a single footnote (as with block quotes).</p>
+<pre><code> { &lt;code> }
+</code></pre>
+<p>If you want, you can use a caret at the beginning of every line, as with blockquotes, but all that you need is a caret at the beginning of the first line of the block and any preceding blank lines.</p>
+</body>
+</html>
+
diff --git a/tests/html-reader.native b/tests/html-reader.native
new file mode 100644
index 000000000..e018f6c7b
--- /dev/null
+++ b/tests/html-reader.native
@@ -0,0 +1,328 @@
+Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] [] "")
+[ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber's",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
+, HorizontalRule
+, Header 1 [Str "Headers"]
+, Header 2 [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embedded",Space,Str "link"] (Ref [Str "1"])]
+, Header 3 [Str "Level",Space,Str "3",Space,Str "with",Space,Emph [Str "emphasis"]]
+, Header 4 [Str "Level",Space,Str "4"]
+, Header 5 [Str "Level",Space,Str "5"]
+, Header 1 [Str "Level",Space,Str "1"]
+, Header 2 [Str "Level",Space,Str "2",Space,Str "with",Space,Emph [Str "emphasis"]]
+, Header 3 [Str "Level",Space,Str "3"]
+, Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
+, Header 2 [Str "Level",Space,Str "2"]
+, Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
+, HorizontalRule
+, Header 1 [Str "Paragraphs"]
+, Para [Str "Here's",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
+, Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",Space,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item.",Space,Str "Because",Space,Str "a",Space,Str "hard-wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item."]
+, Para [Str "Here's",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
+, Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Space,Str "here."]
+, HorizontalRule
+, Header 1 [Str "Block",Space,Str "Quotes"]
+, Para [Str "E-mail",Space,Str "style:"]
+, BlockQuote
+ [ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."] ]
+
+, BlockQuote
+ [ Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
+ , CodeBlock "sub status {\n print \"working\";\n}\n"
+ , Para [Str "A",Space,Str "list:"]
+ , OrderedList
+ [ [ Plain [Str "item",Space,Str "one"] ]
+ , [ Plain [Str "item",Space,Str "two"] ] ]
+ , Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
+ , BlockQuote
+ [ Para [Str "nested"] ]
+
+ , BlockQuote
+ [ Para [Str "nested"] ]
+ ]
+, Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "block",Space,Str "quote:",Space,Str "2",Space,Str ">",Space,Str "1."]
+, Para [Str "Box-style:"]
+, BlockQuote
+ [ Para [Str "Example:"]
+ , CodeBlock "sub status {\n print \"working\";\n}\n" ]
+, BlockQuote
+ [ OrderedList
+ [ [ Plain [Str "do",Space,Str "laundry"] ]
+ , [ Plain [Str "take",Space,Str "out",Space,Str "the",Space,Str "trash"] ] ] ]
+, Para [Str "Here's",Space,Str "a",Space,Str "nested",Space,Str "one:"]
+, BlockQuote
+ [ Para [Str "Joe",Space,Str "said:"]
+ , BlockQuote
+ [ Para [Str "Don't",Space,Str "quote",Space,Str "me."] ]
+ ]
+, Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
+, HorizontalRule
+, Header 1 [Str "Code",Space,Str "Blocks"]
+, Para [Str "Code:"]
+, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab\n"
+, Para [Str "And:"]
+, CodeBlock " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{\n"
+, HorizontalRule
+, Header 1 [Str "Lists"]
+, Header 2 [Str "Unordered"]
+, Para [Str "Asterisks",Space,Str "tight:"]
+, BulletList
+ [ [ Plain [Str "asterisk",Space,Str "1"] ]
+ , [ Plain [Str "asterisk",Space,Str "2"] ]
+ , [ Plain [Str "asterisk",Space,Str "3"] ] ]
+, Para [Str "Asterisks",Space,Str "loose:"]
+, BulletList
+ [ [ Para [Str "asterisk",Space,Str "1"] ]
+ , [ Para [Str "asterisk",Space,Str "2"] ]
+ , [ Para [Str "asterisk",Space,Str "3"] ] ]
+, Para [Str "Pluses",Space,Str "tight:"]
+, BulletList
+ [ [ Plain [Str "Plus",Space,Str "1"] ]
+ , [ Plain [Str "Plus",Space,Str "2"] ]
+ , [ Plain [Str "Plus",Space,Str "3"] ] ]
+, Para [Str "Pluses",Space,Str "loose:"]
+, BulletList
+ [ [ Para [Str "Plus",Space,Str "1"] ]
+ , [ Para [Str "Plus",Space,Str "2"] ]
+ , [ Para [Str "Plus",Space,Str "3"] ] ]
+, Para [Str "Minuses",Space,Str "tight:"]
+, BulletList
+ [ [ Plain [Str "Minus",Space,Str "1"] ]
+ , [ Plain [Str "Minus",Space,Str "2"] ]
+ , [ Plain [Str "Minus",Space,Str "3"] ] ]
+, Para [Str "Minuses",Space,Str "loose:"]
+, BulletList
+ [ [ Para [Str "Minus",Space,Str "1"] ]
+ , [ Para [Str "Minus",Space,Str "2"] ]
+ , [ Para [Str "Minus",Space,Str "3"] ] ]
+, Header 2 [Str "Ordered"]
+, Para [Str "Tight:"]
+, OrderedList
+ [ [ Plain [Str "First"] ]
+ , [ Plain [Str "Second"] ]
+ , [ Plain [Str "Third"] ] ]
+, Para [Str "and:"]
+, OrderedList
+ [ [ Plain [Str "One"] ]
+ , [ Plain [Str "Two"] ]
+ , [ Plain [Str "Three"] ] ]
+, Para [Str "Loose",Space,Str "using",Space,Str "tabs:"]
+, OrderedList
+ [ [ Para [Str "First"] ]
+ , [ Para [Str "Second"] ]
+ , [ Para [Str "Third"] ] ]
+, Para [Str "and",Space,Str "using",Space,Str "spaces:"]
+, OrderedList
+ [ [ Para [Str "One"] ]
+ , [ Para [Str "Two"] ]
+ , [ Para [Str "Three"] ] ]
+, Para [Str "Multiple",Space,Str "paragraphs:"]
+, OrderedList
+ [ [ Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
+ , Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog's",Space,Str "back."] ], [ Para [Str "Item",Space,Str "2."] ]
+ , [ Para [Str "Item",Space,Str "3."] ] ]
+, Header 2 [Str "Nested"]
+, BulletList
+ [ [ Plain [Str "Tab"]
+ , BulletList
+ [ [ Plain [Str "Tab"]
+ , BulletList
+ [ [ Plain [Str "Tab"] ]
+ ] ] ] ] ]
+, Para [Str "Here's",Space,Str "another:"]
+, OrderedList
+ [ [ Plain [Str "First"] ]
+ , [ Plain [Str "Second:"]
+ , BulletList
+ [ [ Plain [Str "Fee"] ]
+ , [ Plain [Str "Fie"] ]
+ , [ Plain [Str "Foe"] ] ] ], [ Plain [Str "Third"] ] ]
+, Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs:"]
+, OrderedList
+ [ [ Para [Str "First"] ]
+ , [ Para [Str "Second:"]
+ , BulletList
+ [ [ Plain [Str "Fee"] ]
+ , [ Plain [Str "Fie"] ]
+ , [ Plain [Str "Foe"] ] ] ], [ Para [Str "Third"] ] ]
+, Header 2 [Str "Tabs",Space,Str "and",Space,Str "spaces"]
+, BulletList
+ [ [ Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"] ]
+ , [ Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"]
+ , BulletList
+ [ [ Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"] ]
+ , [ Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"] ] ] ] ]
+, HorizontalRule
+, Header 1 [Str "HTML",Space,Str "Blocks"]
+, Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
+, Plain [Str "foo"]
+, Para [Str "And",Space,Str "nested",Space,Str "without",Space,Str "indentation:"]
+, Plain [Str "foobar"]
+, Para [Str "Interpreted",Space,Str "markdown",Space,Str "in",Space,Str "a",Space,Str "table:"]
+, Plain [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ".",Space,Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"]]
+, Para [Str "Here's",Space,Str "a",Space,Str "simple",Space,Str "block:"]
+, Plain [Str "foo"]
+, Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]
+, CodeBlock "<div>\n foo\n</div>\n"
+, Para [Str "As",Space,Str "should",Space,Str "this:"]
+, CodeBlock "<div>foo</div>\n"
+, Para [Str "Now,",Space,Str "nested:"]
+, Plain [Str "foo"]
+, Para [Str "This",Space,Str "should",Space,Str "just",Space,Str "be",Space,Str "an",Space,Str "HTML",Space,Str "comment:"]
+, Para [Str "Multiline:"]
+, Para [Str "Code",Space,Str "block:"]
+, CodeBlock "<!-- Comment -->\n"
+, Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"]
+, Para [Str "Code:"]
+, CodeBlock "<hr />\n"
+, Para [Str "Hr's:"]
+, HorizontalRule
+, HorizontalRule
+, HorizontalRule
+, HorizontalRule
+, HorizontalRule
+, HorizontalRule
+, HorizontalRule
+, HorizontalRule
+, HorizontalRule
+, HorizontalRule
+, Header 1 [Str "Inline",Space,Str "Markup"]
+, Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str "."]
+, Para [Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str "."]
+, Para [Str "An",Space,Emph [Link [Str "emphasized",Space,Str "link"] (Ref [Str "1"])],Str "."]
+, Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
+, Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
+, Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
+, Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
+, Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ">",Str ",",Space,Code "$",Str ",",Space,Code "\\",Str ",",Space,Code "\\$",Str ",",Space,Code "<html>",Str "."]
+, HorizontalRule
+, Header 1 [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
+, Para [Str "\"Hello,\"",Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Str "\"'Shelob'",Space,Str "is",Space,Str "my",Space,Str "name.\""]
+, Para [Str "'A',",Space,Str "'B',",Space,Str "and",Space,Str "'C'",Space,Str "are",Space,Str "letters."]
+, Para [Str "'Oak,'",Space,Str "'elm,'",Space,Str "and",Space,Str "'beech'",Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees.",Space,Str "So",Space,Str "is",Space,Str "'pine.'"]
+, Para [Str "'He",Space,Str "said,",Space,Str "\"I",Space,Str "want",Space,Str "to",Space,Str "go.\"'",Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70's?"]
+, Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Str "'",Code "code",Str "'",Space,Str "and",Space,Str "a",Space,Str "\"",Link [Str "quoted",Space,Str "link"] (Ref [Str "2"]),Str "\"."]
+, Para [Str "Some",Space,Str "dashes:",Space,Str "one---two",Space,Str "---",Space,Str "three--four",Space,Str "--",Space,Str "five."]
+, Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5-7,",Space,Str "255-66,",Space,Str "1987-1999."]
+, Para [Str "Ellipses...and.",Space,Str ".",Space,Str ".and",Space,Str ".",Space,Str ".",Space,Str ".",Space,Str "."]
+, HorizontalRule
+, Header 1 [Str "LaTeX"]
+, BulletList
+ [ [ Plain [Str "\\cite[22-23]{smith.1899}"] ]
+ , [ Plain [Str "\\doublespacing"] ]
+ , [ Plain [Str "$2+2=4$"] ]
+ , [ Plain [Str "$x",Space,Str "\\in",Space,Str "y$"] ]
+ , [ Plain [Str "$\\alpha",Space,Str "\\wedge",Space,Str "\\omega$"] ]
+ , [ Plain [Str "$223$"] ]
+ , [ Plain [Str "$p$-Tree"] ]
+ , [ Plain [Str "$\\frac{d}{dx}f(x)=\\lim_{h\\to",Space,Str "0}\\frac{f(x+h)-f(x)}{h}$"] ]
+ , [ Plain [Str "Here's",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Str "$\\alpha",Space,Str "+",Space,Str "\\omega",Space,Str "\\times",Space,Str "x^2$."] ] ]
+, Para [Str "These",Space,Str "shouldn't",Space,Str "be",Space,Str "math:"]
+, BulletList
+ [ [ Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ]
+ , [ Plain [Str "$22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money.",Space,Str "So",Space,Str "is",Space,Str "$34,000.",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Str "\"lot\"",Space,Str "is",Space,Str "emphasized.)"] ]
+ , [ Plain [Str "Escaped",Space,Code "$",Str ":",Space,Str "$73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23$."] ] ]
+, Para [Str "Here's",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
+, Para [Str "\\begin{tabular}{|l|l|}\\hline",Space,Str "Animal",Space,Str "&",Space,Str "Number",Space,Str "\\\\",Space,Str "\\hline",Space,Str "Dog",Space,Str "&",Space,Str "2",Space,Str "\\\\",Space,Str "Cat",Space,Str "&",Space,Str "1",Space,Str "\\\\",Space,Str "\\hline",Space,Str "\\end{tabular}"]
+, HorizontalRule
+, Header 1 [Str "Special",Space,Str "Characters"]
+, Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
+, BulletList
+ [ [ Plain [Str "I",Space,Str "hat:",Space,Str "\206"] ]
+ , [ Plain [Str "o",Space,Str "umlaut:",Space,Str "\246"] ]
+ , [ Plain [Str "section:",Space,Str "\167"] ]
+ , [ Plain [Str "set",Space,Str "membership:",Space,Str "\8712"] ]
+ , [ Plain [Str "copyright:",Space,Str "\169"] ] ]
+, Para [Str "AT",Str "&",Str "T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
+, Para [Str "AT",Str "&",Str "T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it."]
+, Para [Str "This",Space,Str "&",Space,Str "that."]
+, Para [Str "4",Space,Str "<",Space,Str "5."]
+, Para [Str "6",Space,Str ">",Space,Str "5."]
+, Para [Str "Backslash:",Space,Str "\\"]
+, Para [Str "Backtick:",Space,Str "`"]
+, Para [Str "Asterisk:",Space,Str "*"]
+, Para [Str "Underscore:",Space,Str "_"]
+, Para [Str "Left",Space,Str "brace:",Space,Str "{"]
+, Para [Str "Right",Space,Str "brace:",Space,Str "}"]
+, Para [Str "Left",Space,Str "bracket:",Space,Str "["]
+, Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
+, Para [Str "Left",Space,Str "paren:",Space,Str "("]
+, Para [Str "Right",Space,Str "paren:",Space,Str ")"]
+, Para [Str "Greater-than:",Space,Str ">"]
+, Para [Str "Hash:",Space,Str "#"]
+, Para [Str "Period:",Space,Str "."]
+, Para [Str "Bang:",Space,Str "!"]
+, Para [Str "Plus:",Space,Str "+"]
+, Para [Str "Minus:",Space,Str "-"]
+, HorizontalRule
+, Header 1 [Str "Links"]
+, Header 2 [Str "Explicit"]
+, Para [Str "Just",Space,Str "a",Space,Link [Str "URL"] (Ref [Str "3"]),Str "."]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Ref [Str "4"]),Str "."]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Ref [Str "5"]),Str "."]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Ref [Str "6"]),Str "."]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Ref [Str "7"])]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Ref [Str "8"])]
+, Plain [Str "Email",Space,Str "link",Space,Str "(nobody",Space,Str "[at]",Space,Str "nowhere.net)"]
+, Para [Link [Str "Empty"] (Ref [Str "9"]),Str "."]
+, Header 2 [Str "Reference"]
+, Para [Str "Foo",Space,Link [Str "bar"] (Ref [Str "3"]),Str "."]
+, Para [Str "Foo",Space,Link [Str "bar"] (Ref [Str "3"]),Str "."]
+, Para [Str "Foo",Space,Link [Str "bar"] (Ref [Str "3"]),Str "."]
+, Para [Str "With",Space,Link [Str "embedded",Space,Str "[brackets]"] (Ref [Str "3"]),Str "."]
+, Para [Link [Str "b"] (Ref [Str "3"]),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link."]
+, Para [Str "Indented",Space,Link [Str "once"] (Ref [Str "1"]),Str "."]
+, Para [Str "Indented",Space,Link [Str "twice"] (Ref [Str "1"]),Str "."]
+, Para [Str "Indented",Space,Link [Str "thrice"] (Ref [Str "1"]),Str "."]
+, Para [Str "This",Space,Str "should",Space,Str "[not]",Space,Str "be",Space,Str "a",Space,Str "link."]
+, CodeBlock "[not]: /url\n"
+, Para [Str "Foo",Space,Link [Str "bar"] (Ref [Str "10"]),Str "."]
+, Para [Str "Foo",Space,Link [Str "biz"] (Ref [Str "11"]),Str "."]
+, Header 2 [Str "With",Space,Str "ampersands"]
+, Para [Str "Here's",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] (Ref [Str "2"]),Str "."]
+, Para [Str "Here's",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link [Str "AT",Str "&",Str "T"] (Ref [Str "12"]),Str "."]
+, Para [Str "Here's",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] (Ref [Str "13"]),Str "."]
+, Para [Str "Here's",Space,Str "an",Space,Link [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] (Ref [Str "13"]),Str "."]
+, Header 2 [Str "Autolinks"]
+, Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link [Str "http://example.com/?foo=1",Str "&",Str "bar=2"] (Ref [Str "2"])]
+, BulletList
+ [ [ Plain [Str "In",Space,Str "a",Space,Str "list?"] ]
+ , [ Plain [Link [Str "http://example.com/"] (Ref [Str "14"])] ]
+ , [ Plain [Str "It",Space,Str "should."] ] ]
+, Plain [Str "An",Space,Str "e-mail",Space,Str "address:",Space,Str "nobody",Space,Str "[at]",Space,Str "nowhere.net"]
+, BlockQuote
+ [ Para [Str "Blockquoted:",Space,Link [Str "http://example.com/"] (Ref [Str "14"])] ]
+
+, Para [Str "Auto-links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code "<http://example.com/>"]
+, CodeBlock "or here: <http://example.com/>\n"
+, HorizontalRule
+, Header 1 [Str "Images"]
+, Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
+, Para [Image [Str "lalune"] (Ref [Str "15"])]
+, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] (Ref [Str "16"]),Space,Str "icon."]
+, HorizontalRule
+, Header 1 [Str "Footnotes"]
+, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",Link [Str "(1)"] (Ref [Str "17"]),Str ",",Space,Str "and",Space,Str "another",Link [Str "(longnote)"] (Ref [Str "18"]),Str ".",Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space^(my",Space,Str "note)."]
+, Para [Link [Str "(1)"] (Ref [Str "19"]),Space,Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "in",Space,Str "the",Space,Str "document,",Space,Str "not",Space,Str "just",Space,Str "at",Space,Str "the",Space,Str "end."]
+, Para [Link [Str "(longnote)"] (Ref [Str "20"]),Space,Str "Here's",Space,Str "the",Space,Str "other",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."]
+, Para [Str "Caret",Space,Str "characters",Space,Str "are",Space,Str "used",Space,Str "to",Space,Str "indicate",Space,Str "that",Space,Str "the",Space,Str "blocks",Space,Str "all",Space,Str "belong",Space,Str "to",Space,Str "a",Space,Str "single",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "block",Space,Str "quotes)."]
+, CodeBlock " { <code> }\n"
+, Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "use",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "every",Space,Str "line,",Space,Str "as",Space,Str "with",Space,Str "blockquotes,",Space,Str "but",Space,Str "all",Space,Str "that",Space,Str "you",Space,Str "need",Space,Str "is",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "the",Space,Str "block",Space,Str "and",Space,Str "any",Space,Str "preceding",Space,Str "blank",Space,Str "lines."]
+, Key [Str "1"] (Src "/url" "")
+, Key [Str "2"] (Src "http://example.com/?foo=1&bar=2" "")
+, Key [Str "3"] (Src "/url/" "")
+, Key [Str "4"] (Src "/url/" "title")
+, Key [Str "5"] (Src "/url/" "title preceded by two spaces")
+, Key [Str "6"] (Src "/url/" "title preceded by a tab")
+, Key [Str "7"] (Src "/url/" "title with \"quotes\" in it")
+, Key [Str "8"] (Src "/url/" "title with single quotes")
+, Key [Str "9"] (Src "" "")
+, Key [Str "10"] (Src "/url/" "Title with \"quotes\" inside")
+, Key [Str "11"] (Src "/url/" "Title with \"quote\" inside")
+, Key [Str "12"] (Src "http://att.com/" "AT&T")
+, Key [Str "13"] (Src "/script?foo=1&bar=2" "")
+, Key [Str "14"] (Src "http://example.com/" "")
+, Key [Str "15"] (Src "lalune.jpg" "Voyage dans la Lune")
+, Key [Str "16"] (Src "movie.jpg" "")
+, Key [Str "17"] (Src "#note_1" "")
+, Key [Str "18"] (Src "#note_longnote" "")
+, Key [Str "19"] (Src "#ref_1" "")
+, Key [Str "20"] (Src "#ref_longnote" "") ]
diff --git a/tests/insert b/tests/insert
new file mode 100644
index 000000000..f06069ede
--- /dev/null
+++ b/tests/insert
@@ -0,0 +1 @@
+STUFF INSERTED
diff --git a/tests/lalune.jpg b/tests/lalune.jpg
new file mode 100644
index 000000000..5a50fc088
--- /dev/null
+++ b/tests/lalune.jpg
Binary files differ
diff --git a/tests/movie.jpg b/tests/movie.jpg
new file mode 100644
index 000000000..7240efa3b
--- /dev/null
+++ b/tests/movie.jpg
Binary files differ
diff --git a/tests/rst-reader.native b/tests/rst-reader.native
new file mode 100644
index 000000000..fb63e5e60
--- /dev/null
+++ b/tests/rst-reader.native
@@ -0,0 +1,175 @@
+Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":",Space,Str "Subtitle"] ["John MacFarlane","Anonymous"] "July 17, 2006")
+[ BlockQuote
+ [ Para [Strong [Str "Revision"],Str ":",Space,Str "3"] ]
+
+, Header 1 [Str "Level",Space,Str "one",Space,Str "header"]
+, Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber's",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
+, Header 2 [Str "Level",Space,Str "two",Space,Str "header"]
+, Header 3 [Str "Level",Space,Str "three"]
+, Header 4 [Str "Level",Space,Str "four",Space,Str "with",Space,Emph [Str "emphasis"]]
+, Header 5 [Str "Level",Space,Str "five"]
+, Header 1 [Str "Paragraphs"]
+, Para [Str "Here's",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
+, Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",Space,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item.",Space,Str "Because",Space,Str "a",Space,Str "hard",Str "-",Str "wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item."]
+, Para [Str "Here's",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
+, Para [Str "Horizontal",Space,Str "rule",Str ":"]
+, HorizontalRule
+, Para [Str "Another",Str ":"]
+, HorizontalRule
+, Header 1 [Str "Block",Space,Str "Quotes"]
+, Para [Str "Here's",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"]
+, BlockQuote
+ [ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."] ]
+
+, Para [Str "Here's",Space,Str "another,",Space,Str "differently",Space,Str "indented",Str ":"]
+, BlockQuote
+ [ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It's",Space,Str "indented",Space,Str "with",Space,Str "a",Space,Str "tab."]
+ , Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"]
+ , CodeBlock "sub status {\n print \"working\";\n}\n"
+ , Para [Str "List",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"]
+ , OrderedList
+ [ [ Plain [Str "item",Space,Str "one"] ]
+ , [ Plain [Str "item",Space,Str "two"] ] ]
+ , Para [Str "Nested",Space,Str "block",Space,Str "quotes",Str ":"]
+ , BlockQuote
+ [ Para [Str "nested"]
+ , BlockQuote
+ [ Para [Str "nested"] ]
+ ] ]
+, Header 1 [Str "Code",Space,Str "Blocks"]
+, Para [Str "Code",Str ":"]
+, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n"
+, CodeBlock "this code block is indented by one tab\n"
+, Para [Str "And",Str ":"]
+, CodeBlock " this block is indented by two tabs\n\n These should not be escaped: \\$ \\\\ \\> \\[ \\{\n"
+, Header 1 [Str "Lists"]
+, Header 2 [Str "Unordered"]
+, Para [Str "Asterisks",Space,Str "tight",Str ":"]
+, BulletList
+ [ [ Plain [Str "asterisk",Space,Str "1"] ]
+ , [ Plain [Str "asterisk",Space,Str "2"] ]
+ , [ Plain [Str "asterisk",Space,Str "3"] ] ]
+, Para [Str "Asterisks",Space,Str "loose",Str ":"]
+, BulletList
+ [ [ Para [Str "asterisk",Space,Str "1"] ]
+ , [ Para [Str "asterisk",Space,Str "2"] ]
+ , [ Para [Str "asterisk",Space,Str "3"] ] ]
+, Para [Str "Pluses",Space,Str "tight",Str ":"]
+, BulletList
+ [ [ Plain [Str "Plus",Space,Str "1"] ]
+ , [ Plain [Str "Plus",Space,Str "2"] ]
+ , [ Plain [Str "Plus",Space,Str "3"] ] ]
+, Para [Str "Pluses",Space,Str "loose",Str ":"]
+, BulletList
+ [ [ Para [Str "Plus",Space,Str "1"] ]
+ , [ Para [Str "Plus",Space,Str "2"] ]
+ , [ Para [Str "Plus",Space,Str "3"] ] ]
+, Para [Str "Minuses",Space,Str "tight",Str ":"]
+, BulletList
+ [ [ Plain [Str "Minus",Space,Str "1"] ]
+ , [ Plain [Str "Minus",Space,Str "2"] ]
+ , [ Plain [Str "Minus",Space,Str "3"] ] ]
+, Para [Str "Minuses",Space,Str "loose",Str ":"]
+, BulletList
+ [ [ Para [Str "Minus",Space,Str "1"] ]
+ , [ Para [Str "Minus",Space,Str "2"] ]
+ , [ Para [Str "Minus",Space,Str "3"] ] ]
+, Header 2 [Str "Ordered"]
+, Para [Str "Tight",Str ":"]
+, OrderedList
+ [ [ Plain [Str "First"] ]
+ , [ Plain [Str "Second"] ]
+ , [ Plain [Str "Third"] ] ]
+, Para [Str "and",Str ":"]
+, OrderedList
+ [ [ Plain [Str "One"] ]
+ , [ Plain [Str "Two"] ]
+ , [ Plain [Str "Three"] ] ]
+, Para [Str "Loose",Space,Str "using",Space,Str "tabs",Str ":"]
+, OrderedList
+ [ [ Para [Str "First"] ]
+ , [ Para [Str "Second"] ]
+ , [ Para [Str "Third"] ] ]
+, Para [Str "and",Space,Str "using",Space,Str "spaces",Str ":"]
+, OrderedList
+ [ [ Para [Str "One"] ]
+ , [ Para [Str "Two"] ]
+ , [ Para [Str "Three"] ] ]
+, Para [Str "Multiple",Space,Str "paragraphs",Str ":"]
+, OrderedList
+ [ [ Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
+ , Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog's",Space,Str "back."] ], [ Para [Str "Item",Space,Str "2."] ]
+ , [ Para [Str "Item",Space,Str "3."] ] ]
+, Para [Str "Nested",Str ":"]
+, BulletList
+ [ [ Para [Str "Tab"]
+ , BulletList
+ [ [ Para [Str "Tab"]
+ , BulletList
+ [ [ Plain [Str "Tab"] ]
+ ] ] ] ] ]
+, Para [Str "Here's",Space,Str "another",Str ":"]
+, OrderedList
+ [ [ Para [Str "First"] ]
+ , [ Para [Str "Second",Str ":"]
+ , BlockQuote
+ [ BulletList
+ [ [ Plain [Str "Fee"] ]
+ , [ Plain [Str "Fie"] ]
+ , [ Plain [Str "Foe"] ] ] ] ], [ Para [Str "Third"] ] ]
+, Header 1 [Str "HTML",Space,Str "Blocks"]
+, Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line",Str ":"]
+, RawHtml "<div>foo</div>\n"
+, Para [Str "Now,",Space,Str "nested",Str ":"]
+, RawHtml "<div>\n <div>\n <div>\n foo\n </div>\n </div>\n</div>\n"
+, Header 1 [Str "LaTeX",Space,Str "Block"]
+, Para [TeX "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}\n"]
+, Header 1 [Str "Inline",Space,Str "Markup"]
+, Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ".",Space,Str "This",Space,Str "is",Space,Strong [Str "strong"],Str "."]
+, Para [Str "This",Space,Str "is",Space,Str "code",Str ":",Space,Code ">",Str ",",Space,Code "$",Str ",",Space,Code "\\",Str ",",Space,Code "\\$",Str ",",Space,Code "<html>",Str "."]
+, Header 1 [Str "Special",Space,Str "Characters"]
+, Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode",Str ":"]
+, BulletList
+ [ [ Plain [Str "I",Space,Str "hat",Str ":",Space,Str "\206"] ]
+ , [ Plain [Str "o",Space,Str "umlaut",Str ":",Space,Str "\246"] ]
+ , [ Plain [Str "section",Str ":",Space,Str "\167"] ]
+ , [ Plain [Str "set",Space,Str "membership",Str ":",Space,Str "\8712"] ]
+ , [ Plain [Str "copyright",Str ":",Space,Str "\169"] ] ]
+, Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
+, Para [Str "This",Space,Str "&",Space,Str "that."]
+, Para [Str "4",Space,Str "<",Space,Str "5."]
+, Para [Str "6",Space,Str ">",Space,Str "5."]
+, Para [Str "Backslash",Str ":",Space,Str "\\"]
+, Para [Str "Backtick",Str ":",Space,Str "`"]
+, Para [Str "Asterisk",Str ":",Space,Str "*"]
+, Para [Str "Underscore",Str ":",Space,Str "_"]
+, Para [Str "Left",Space,Str "brace",Str ":",Space,Str "{"]
+, Para [Str "Right",Space,Str "brace",Str ":",Space,Str "}"]
+, Para [Str "Left",Space,Str "bracket",Str ":",Space,Str "["]
+, Para [Str "Right",Space,Str "bracket",Str ":",Space,Str "]"]
+, Para [Str "Left",Space,Str "paren",Str ":",Space,Str "("]
+, Para [Str "Right",Space,Str "paren",Str ":",Space,Str ")"]
+, Para [Str "Greater",Str "-",Str "than",Str ":",Space,Str ">"]
+, Para [Str "Hash",Str ":",Space,Str "#"]
+, Para [Str "Period",Str ":",Space,Str "."]
+, Para [Str "Bang",Str ":",Space,Str "!"]
+, Para [Str "Plus",Str ":",Space,Str "+"]
+, Para [Str "Minus",Str ":",Space,Str "-"]
+, Header 1 [Str "Links"]
+, Para [Str "Explicit",Str ":",Space,Str "a",Space,Link [Str "URL"] (Src "/url/" ""),Str "."]
+, Para [Str "Two",Space,Str "anonymous",Space,Str "links",Str ":",Space,Link [Str "the",Space,Str "first"] (Src "/url1/" ""),Space,Str "and",Space,Link [Str "the",Space,Str "second"] (Src "/url2/" "")]
+, Para [Str "Reference",Space,Str "links",Str ":",Space,Link [Str "link1"] (Ref []),Space,Str "and",Space,Link [Str "link2"] (Ref []),Space,Str "and",Space,Link [Str "link1"] (Ref []),Space,Str "again."]
+, Key [Str "link1"] (Src "/url1/" "")
+, Key [Str "link2"] (Src "/url2/" "")
+, Para [Str "Here's",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] (Ref []),Str "."]
+, Para [Str "Here's",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text",Str ":",Space,Link [Str "AT&T"] (Src "/url/" ""),Str "."]
+, Key [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] (Src "http://example.com/?foo=1&bar=2" "")
+, Para [Str "Autolinks",Str ":",Space,Link [Str "http://example.com/?foo=1&bar=2"] (Src "http://example.com/?foo=1&bar=2" ""),Space,Str "and",Space,Link [Str "nobody@nowhere.net"] (Src "mailto:nobody@nowhere.net" ""),Str "."]
+, Para [Str "But",Space,Str "not",Space,Str "here",Str ":"]
+, CodeBlock "http://example.com/\n"
+, Header 1 [Str "Images"]
+, Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902)",Str ":"]
+, Plain [Image [Str "image"] (Src "lalune.jpg" "")]
+, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] (Ref [Str "movie"]),Space,Str "icon."]
+, Key [Str "movie"] (Src "movie.jpg" "")
+, Blank ]
diff --git a/tests/rst-reader.rst b/tests/rst-reader.rst
new file mode 100644
index 000000000..75716f7b4
--- /dev/null
+++ b/tests/rst-reader.rst
@@ -0,0 +1,341 @@
+Pandoc Test Suite
+#################
+Subtitle
+^^^^^^^^
+
+:Author: John MacFarlane
+:Author: Anonymous
+:Date: July 17, 2006
+:Revision: 3
+
+Level one header
+================
+
+This is a set of tests for pandoc. Most of them are adapted from
+John Gruber's markdown test suite.
+
+Level two header
+----------------
+
+Level three
++++++++++++
+
+Level four with *emphasis*
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Level five
+''''''''''
+
+Paragraphs
+==========
+
+Here's a regular paragraph.
+
+In Markdown 1.0.0 and earlier. Version
+8. This line turns into a list item.
+Because a hard-wrapped line in the
+middle of a paragraph looked like a
+list item.
+
+Here's one with a bullet.
+* criminey.
+
+Horizontal rule:
+
+-----
+
+Another:
+
+****
+
+Block Quotes
+============
+
+Here's a block quote:
+
+ This is a block quote.
+ It is pretty short.
+
+Here's another, differently indented:
+
+ This is a block quote.
+ It's indented with a tab.
+
+ Code in a block quote::
+
+ sub status {
+ print "working";
+ }
+
+ List in a block quote:
+
+ 1. item one
+ 2. item two
+
+ Nested block quotes:
+
+ nested
+
+ nested
+
+Code Blocks
+===========
+
+Code:
+
+::
+
+ ---- (should be four hyphens)
+
+ sub status {
+ print "working";
+ }
+
+::
+
+ this code block is indented by one tab
+
+And::
+
+ this block is indented by two tabs
+
+ These should not be escaped: \$ \\ \> \[ \{
+
+Lists
+=====
+
+Unordered
+---------
+
+Asterisks tight:
+
+* asterisk 1
+* asterisk 2
+* asterisk 3
+
+Asterisks loose:
+
+* asterisk 1
+
+* asterisk 2
+
+* asterisk 3
+
+Pluses tight:
+
++ Plus 1
++ Plus 2
++ Plus 3
+
+Pluses loose:
+
++ Plus 1
+
++ Plus 2
+
++ Plus 3
+
+Minuses tight:
+
+- Minus 1
+- Minus 2
+- Minus 3
+
+Minuses loose:
+
+- Minus 1
+
+- Minus 2
+
+- Minus 3
+
+Ordered
+-------
+
+Tight:
+
+1. First
+2. Second
+3. Third
+
+and:
+
+1. One
+2. Two
+3. Three
+
+Loose using tabs:
+
+1. First
+
+2. Second
+
+3. Third
+
+and using spaces:
+
+1. One
+
+2. Two
+
+3. Three
+
+Multiple paragraphs:
+
+1. Item 1, graf one.
+
+ Item 1. graf two. The quick brown fox jumped over the lazy dog's
+ back.
+
+2. Item 2.
+
+3. Item 3.
+
+Nested:
+
+* Tab
+
+ * Tab
+
+ * Tab
+
+Here's another:
+
+1. First
+
+2. Second:
+
+ * Fee
+ * Fie
+ * Foe
+
+3. Third
+
+HTML Blocks
+===========
+
+Simple block on one line:
+
+.. raw:: html
+
+ <div>foo</div>
+
+Now, nested:
+
+.. raw:: html
+
+ <div>
+ <div>
+ <div>
+ foo
+ </div>
+ </div>
+ </div>
+
+LaTeX Block
+===========
+
+.. raw:: latex
+
+ \begin{tabular}{|l|l|}\hline
+ Animal & Number \\ \hline
+ Dog & 2 \\
+ Cat & 1 \\ \hline
+ \end{tabular}
+
+Inline Markup
+=============
+
+This is *emphasized*. This is **strong**.
+
+This is code: ``>``, ``$``, ``\``, ``\$``, ``<html>``.
+
+Special Characters
+==================
+
+Here is some unicode:
+
+- I hat: Î
+- o umlaut: ö
+- section: §
+- set membership: ∈
+- copyright: ©
+
+AT&T has an ampersand in their name.
+
+This & that.
+
+4 < 5.
+
+6 > 5.
+
+Backslash: \\
+
+Backtick: \`
+
+Asterisk: \*
+
+Underscore: \_
+
+Left brace: \{
+
+Right brace: \}
+
+Left bracket: \[
+
+Right bracket: \]
+
+Left paren: \(
+
+Right paren: \)
+
+Greater-than: \>
+
+Hash: \#
+
+Period: \.
+
+Bang: \!
+
+Plus: \+
+
+Minus: \-
+
+Links
+=====
+
+Explicit: a `URL </url/>`_.
+
+Two anonymous links: `the first`__ and `the second`__
+
+__ /url1/
+__ /url2/
+
+Reference links: `link1`_ and `link2`_ and link1_ again.
+
+.. _link1: /url1/
+.. _`link2`: /url2/
+
+Here's a `link with an ampersand in the URL`_.
+
+Here's a link with an amersand in the link text: `AT&T </url/>`_.
+
+.. _link with an ampersand in the URL: http://example.com/?foo=1&bar=2
+
+Autolinks: http://example.com/?foo=1&bar=2 and nobody@nowhere.net.
+
+But not here::
+
+ http://example.com/
+
+Images
+======
+
+From "Voyage dans la Lune" by Georges Melies (1902):
+
+.. image:: lalune.jpg
+
+Here is a movie |movie| icon.
+
+.. |movie| image:: movie.jpg
+
diff --git a/tests/runtests.pl b/tests/runtests.pl
new file mode 100644
index 000000000..662862e44
--- /dev/null
+++ b/tests/runtests.pl
@@ -0,0 +1,97 @@
+#!/bin/perl -w
+
+$verbose = 1;
+my $diffexists = `which diff`;
+if ($diffexists eq "") { die "diff not found in path.\n"; }
+
+my $script = "./pandoc";
+
+use Getopt::Long;
+GetOptions("script=s" => \$script);
+
+unless (-f $script) { die "$script does not exist.\n"; }
+unless (-x $script) { die "$script is not executable.\n"; }
+
+print "Writer tests:\n";
+
+my @writeformats = ("html", "smart.html", "latex", "rst", "rtf", "markdown", "native"); # s5 separately
+my @readformats = ("latex", "native"); # handle html,markdown & rst separately
+my $source = "testsuite.native";
+
+sub test_results
+{
+ my $testname = $_[0];
+ my $output = $_[1];
+ my $norm = $_[2];
+ my $diffoutput = `diff $output $norm`;
+ if ($diffoutput eq "")
+ {
+ print "PASSED\n";
+ }
+ else
+ {
+ print "FAILED\n";
+ if ($verbose) { print $diffoutput; }
+ }
+}
+
+foreach my $format (@writeformats)
+{
+ $options = "";
+ if ($format =~ /smart\./)
+ {
+ $options = "-S ";
+ }
+
+ my $extension = $format;
+ $extension =~ s/smart\.//g;
+
+ print "Testing $format writer...";
+ `$script -r native -w $extension $options -s $source > tmp.$extension`;
+
+ test_results("$format writer", "tmp.$extension", "writer.$format");
+}
+
+print "Testing s5 writer (basic)...";
+`$script -r native -w s5 -s s5.native > tmp.html`;
+test_results("s5 writer (basic)", "tmp.html", "s5.basic.html");
+
+print "Testing s5 writer (fancy)...";
+`$script -r native -w s5 -s -S -m -i s5.native > tmp.html`;
+test_results("s5 writer (fancy)", "tmp.html", "s5.fancy.html");
+
+print "Testing html fragment...";
+`$script -r native -w html s5.native > tmp.html`;
+test_results("html fragment", "tmp.html", "s5.fragment.html");
+
+print "Testing -H -B -A -c options...";
+`$script -r native -s -w html -H insert -B insert -A insert -c main.css s5.native > tmp.html`;
+test_results("-B, -A, -H, -c options", "tmp.html", "s5.inserts.html");
+
+print "\nReader tests:\n";
+
+print "Testing markdown reader...";
+`$script -r markdown -w native -s testsuite.txt > tmp.native`;
+test_results("markdown reader", "tmp.native", "testsuite.native");
+
+print "Testing rst reader...";
+`$script -r rst -w native -s rst-reader.rst > tmp.native`;
+test_results("rst reader", "tmp.native", "rst-reader.native");
+
+print "Testing html reader...";
+`$script -r html -w native -s html-reader.html > tmp.native`;
+test_results("html reader", "tmp.native", "html-reader.native");
+
+print "\nReader tests (roundtrip: X -> native -> X -> native):\n";
+
+foreach my $format (@readformats)
+{
+ print "testing $format reader...";
+ `$script -r $format -w native -s -R writer.$format > tmp1.native`;
+ `$script -r native -w $format -s -R tmp1.native | $script -r $format -w native -s -R - > tmp2.native`;
+ test_results("$format reader", "tmp1.native", "tmp2.native");
+}
+
+`rm tmp?.*`;
+`rm tmp.*`;
+
diff --git a/tests/s5.basic.html b/tests/s5.basic.html
new file mode 100644
index 000000000..ddb4d8079
--- /dev/null
+++ b/tests/s5.basic.html
@@ -0,0 +1,761 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<!-- configuration parameters -->
+<meta name="defaultView" content="slideshow" />
+<meta name="controlVis" content="hidden" />
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta name="generator" content="pandoc" />
+<style type="text/css" media="projection" id="slideProj">
+/* Do not edit or override these styles! The system will likely break if you do. */
+
+div#header, div#footer, div#controls, .slide {position: absolute;}
+html>body div#header, html>body div#footer,
+ html>body div#controls, html>body .slide {position: fixed;}
+.handout {display: none;}
+.layout {display: block;}
+.slide, .hideme, .incremental {visibility: hidden;}
+#slide0 {visibility: visible;}
+
+/* The following styles size, place, and layer the slide components.
+ Edit these if you want to change the overall slide layout.
+ The commented lines can be uncommented (and modified, if necessary)
+ to help you with the rearrangement process. */
+
+/* target = 1024x768 */
+
+div#header, div#footer, .slide {width: 100%; top: 0; left: 0;}
+div#header {top: 0; height: 3em; z-index: 1;}
+div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;}
+.slide {top: 0; width: 92%; padding: 3.5em 4% 4%; z-index: 2; list-style: none;}
+div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;}
+div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;
+ margin: 0;}
+#currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; z-index: 10;}
+html>body #currentSlide {position: fixed;}
+
+/*
+div#header {background: #FCC;}
+div#footer {background: #CCF;}
+div#controls {background: #BBD;}
+div#currentSlide {background: #FFC;}
+*/
+
+/* Following are the presentation styles -- edit away! */
+
+body {background: #FFF url(bodybg.gif) -16px 0 no-repeat; color: #000; font-size: 2em;}
+:link, :visited {text-decoration: none; color: #00C;}
+#controls :active {color: #88A !important;}
+#controls :focus {outline: 1px dotted #227;}
+h1, h2, h3, h4 {font-size: 100%; margin: 0; padding: 0; font-weight: inherit;}
+ul, pre {margin: 0; line-height: 1em;}
+html, body {margin: 0; padding: 0;}
+
+blockquote, q {font-style: italic;}
+blockquote {padding: 0 2em 0.5em; margin: 0 1.5em 0.5em; text-align: center; font-size: 1em;}
+blockquote p {margin: 0;}
+blockquote i {font-style: normal;}
+blockquote b {display: block; margin-top: 0.5em; font-weight: normal; font-size: smaller; font-style: normal;}
+blockquote b i {font-style: italic;}
+
+kbd {font-weight: bold; font-size: 1em;}
+sup {font-size: smaller; line-height: 1px;}
+
+.slide code {padding: 2px 0.25em; font-weight: bold; color: #533;}
+.slide code.bad, code del {color: red;}
+.slide code.old {color: silver;}
+.slide pre {padding: 0; margin: 0.25em 0 0.5em 0.5em; color: #533; font-size: 90%;}
+.slide pre code {display: block;}
+.slide ul {margin-left: 5%; margin-right: 7%; list-style: disc;}
+.slide li {margin-top: 0.75em; margin-right: 0;}
+.slide ul ul {line-height: 1;}
+.slide ul ul li {margin: .2em; font-size: 85%; list-style: square;}
+.slide img.leader {display: block; margin: 0 auto;}
+
+div#header, div#footer {background: #005; color: #AAB;
+ font-family: Verdana, Helvetica, sans-serif;}
+div#header {background: #005 url(bodybg.gif) -16px 0 no-repeat;
+ line-height: 1px;}
+div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;}
+#footer h1, #footer h2 {display: block; padding: 0 1em;}
+#footer h2 {font-style: italic;}
+
+div.long {font-size: 0.75em;}
+.slide h1 {position: absolute; top: 0.7em; left: 87px; z-index: 1;
+ margin: 0; padding: 0.3em 0 0 50px; white-space: nowrap;
+ font: bold 150%/1em Helvetica, sans-serif; text-transform: capitalize;
+ color: #DDE; background: #005;}
+.slide h3 {font-size: 130%;}
+h1 abbr {font-variant: small-caps;}
+
+div#controls {position: absolute; left: 50%; bottom: 0;
+ width: 50%;
+ text-align: right; font: bold 0.9em Verdana, Helvetica, sans-serif;}
+html>body div#controls {position: fixed; padding: 0 0 1em 0;
+ top: auto;}
+div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;
+ margin: 0; padding: 0;}
+#controls #navLinks a {padding: 0; margin: 0 0.5em;
+ background: #005; border: none; color: #779;
+ cursor: pointer;}
+#controls #navList {height: 1em;}
+#controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;}
+
+#currentSlide {text-align: center; font-size: 0.5em; color: #449;}
+
+#slide0 {padding-top: 3.5em; font-size: 90%;}
+#slide0 h1 {position: static; margin: 1em 0 0; padding: 0;
+ font: bold 2em Helvetica, sans-serif; white-space: normal;
+ color: #000; background: transparent;}
+#slide0 h2 {font: bold italic 1em Helvetica, sans-serif; margin: 0.25em;}
+#slide0 h3 {margin-top: 1.5em; font-size: 1.5em;}
+#slide0 h4 {margin-top: 0; font-size: 1em;}
+
+ul.urls {list-style: none; display: inline; margin: 0;}
+.urls li {display: inline; margin: 0;}
+.note {display: none;}
+.external {border-bottom: 1px dotted gray;}
+html>body .external {border-bottom: none;}
+.external:after {content: " \274F"; font-size: smaller; color: #77B;}
+
+.incremental, .incremental *, .incremental *:after {color: #DDE; visibility: visible;}
+img.incremental {visibility: hidden;}
+.slide .current {color: #B02;}
+
+
+/* diagnostics
+
+li:after {content: " [" attr(class) "]"; color: #F88;}
+ */
+</style>
+<style type="text/css" media="projection" id="operaFix">
+/* DO NOT CHANGE THESE unless you really want to break Opera Show */
+.slide {
+ visibility: visible !important;
+ position: static !important;
+ page-break-before: always;
+}
+#slide0 {page-break-before: avoid;}
+
+</style>
+<style type="text/css" media="screen" id="outlineStyle">
+/* don't change this unless you want the layout stuff to show up in the outline view! */
+
+.layout div, #footer *, #controlForm * {display: none;}
+#footer, #controls, #controlForm, #navLinks, #toggle {
+ display: block; visibility: visible; margin: 0; padding: 0;}
+#toggle {float: right; padding: 0.5em;}
+html>body #toggle {position: fixed; top: 0; right: 0;}
+
+/* making the outline look pretty-ish */
+
+#slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;}
+#slide0 h1 {padding-top: 1.5em;}
+.slide h1 {margin: 1.5em 0 0; padding-top: 0.25em;
+ border-top: 1px solid #888; border-bottom: 1px solid #AAA;}
+#toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;}
+
+</style>
+<style type="text/css" media="print" id="slidePrint">
+/* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */ .slide, ul {page-break-inside: avoid; visibility: visible !important;} h1 {page-break-after: avoid;} body {font-size: 12pt; background: white;} * {color: black;} #slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;} #slide0 h3 {margin: 0; padding: 0;} #slide0 h4 {margin: 0 0 0.5em; padding: 0;} #slide0 {margin-bottom: 3em;} h1 {border-top: 2pt solid gray; border-bottom: 1px dotted silver;} .extra {background: transparent !important;} div.extra, pre.extra, .example {font-size: 10pt; color: #333;} ul.extra a {font-weight: bold;} p.example {display: none;} #header {display: none;} #footer h1 {margin: 0; border-bottom: 1px solid; color: gray; font-style: italic;} #footer h2, #controls {display: none;} /* The following rule keeps the layout stuff out of print. Remove at your own risk! */ .layout, .layout * {display: none !important;}
+</style>
+<script type="text/javascript">
+// S5 v1.1 slides.js -- released into the Public Domain
+//
+// Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information
+// about all the wonderful and talented contributors to this code!
+
+var undef;
+var slideCSS = '';
+var snum = 0;
+var smax = 1;
+var incpos = 0;
+var number = undef;
+var s5mode = true;
+var defaultView = 'slideshow';
+var controlVis = 'visible';
+
+var isIE = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0;
+var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;
+var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;
+
+function hasClass(object, className) {
+ if (!object.className) return false;
+ return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);
+}
+
+function hasValue(object, value) {
+ if (!object) return false;
+ return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);
+}
+
+function removeClass(object,className) {
+ if (!object) return;
+ object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);
+}
+
+function addClass(object,className) {
+ if (!object || hasClass(object, className)) return;
+ if (object.className) {
+ object.className += ' '+className;
+ } else {
+ object.className = className;
+ }
+}
+
+function GetElementsWithClassName(elementName,className) {
+ var allElements = document.getElementsByTagName(elementName);
+ var elemColl = new Array();
+ for (var i = 0; i< allElements.length; i++) {
+ if (hasClass(allElements[i], className)) {
+ elemColl[elemColl.length] = allElements[i];
+ }
+ }
+ return elemColl;
+}
+
+function isParentOrSelf(element, id) {
+ if (element == null || element.nodeName=='BODY') return false;
+ else if (element.id == id) return true;
+ else return isParentOrSelf(element.parentNode, id);
+}
+
+function nodeValue(node) {
+ var result = "";
+ if (node.nodeType == 1) {
+ var children = node.childNodes;
+ for (var i = 0; i < children.length; ++i) {
+ result += nodeValue(children[i]);
+ }
+ }
+ else if (node.nodeType == 3) {
+ result = node.nodeValue;
+ }
+ return(result);
+}
+
+function slideLabel() {
+ var slideColl = GetElementsWithClassName('*','slide');
+ var list = document.getElementById('jumplist');
+ smax = slideColl.length;
+ for (var n = 0; n < smax; n++) {
+ var obj = slideColl[n];
+
+ var did = 'slide' + n.toString();
+ obj.setAttribute('id',did);
+ if (isOp) continue;
+
+ var otext = '';
+ var menu = obj.firstChild;
+ if (!menu) continue; // to cope with empty slides
+ while (menu && menu.nodeType == 3) {
+ menu = menu.nextSibling;
+ }
+ if (!menu) continue; // to cope with slides with only text nodes
+
+ var menunodes = menu.childNodes;
+ for (var o = 0; o < menunodes.length; o++) {
+ otext += nodeValue(menunodes[o]);
+ }
+ list.options[list.length] = new Option(n + ' : ' + otext, n);
+ }
+}
+
+function currentSlide() {
+ var cs;
+ if (document.getElementById) {
+ cs = document.getElementById('currentSlide');
+ } else {
+ cs = document.currentSlide;
+ }
+ cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' +
+ '<span id="csSep">\/<\/span> ' +
+ '<span id="csTotal">' + (smax-1) + '<\/span>';
+ if (snum == 0) {
+ cs.style.visibility = 'hidden';
+ } else {
+ cs.style.visibility = 'visible';
+ }
+}
+
+function go(step) {
+ if (document.getElementById('slideProj').disabled || step == 0) return;
+ var jl = document.getElementById('jumplist');
+ var cid = 'slide' + snum;
+ var ce = document.getElementById(cid);
+ if (incrementals[snum].length > 0) {
+ for (var i = 0; i < incrementals[snum].length; i++) {
+ removeClass(incrementals[snum][i], 'current');
+ removeClass(incrementals[snum][i], 'incremental');
+ }
+ }
+ if (step != 'j') {
+ snum += step;
+ lmax = smax - 1;
+ if (snum > lmax) snum = lmax;
+ if (snum < 0) snum = 0;
+ } else
+ snum = parseInt(jl.value);
+ var nid = 'slide' + snum;
+ var ne = document.getElementById(nid);
+ if (!ne) {
+ ne = document.getElementById('slide0');
+ snum = 0;
+ }
+ if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}
+ if (incrementals[snum].length > 0 && incpos == 0) {
+ for (var i = 0; i < incrementals[snum].length; i++) {
+ if (hasClass(incrementals[snum][i], 'current'))
+ incpos = i + 1;
+ else
+ addClass(incrementals[snum][i], 'incremental');
+ }
+ }
+ if (incrementals[snum].length > 0 && incpos > 0)
+ addClass(incrementals[snum][incpos - 1], 'current');
+ ce.style.visibility = 'hidden';
+ ne.style.visibility = 'visible';
+ jl.selectedIndex = snum;
+ currentSlide();
+ number = 0;
+}
+
+function goTo(target) {
+ if (target >= smax || target == snum) return;
+ go(target - snum);
+}
+
+function subgo(step) {
+ if (step > 0) {
+ removeClass(incrementals[snum][incpos - 1],'current');
+ removeClass(incrementals[snum][incpos], 'incremental');
+ addClass(incrementals[snum][incpos],'current');
+ incpos++;
+ } else {
+ incpos--;
+ removeClass(incrementals[snum][incpos],'current');
+ addClass(incrementals[snum][incpos], 'incremental');
+ addClass(incrementals[snum][incpos - 1],'current');
+ }
+}
+
+function toggle() {
+ var slideColl = GetElementsWithClassName('*','slide');
+ var slides = document.getElementById('slideProj');
+ var outline = document.getElementById('outlineStyle');
+ if (!slides.disabled) {
+ slides.disabled = true;
+ outline.disabled = false;
+ s5mode = false;
+ fontSize('1em');
+ for (var n = 0; n < smax; n++) {
+ var slide = slideColl[n];
+ slide.style.visibility = 'visible';
+ }
+ } else {
+ slides.disabled = false;
+ outline.disabled = true;
+ s5mode = true;
+ fontScale();
+ for (var n = 0; n < smax; n++) {
+ var slide = slideColl[n];
+ slide.style.visibility = 'hidden';
+ }
+ slideColl[snum].style.visibility = 'visible';
+ }
+}
+
+function showHide(action) {
+ var obj = GetElementsWithClassName('*','hideme')[0];
+ switch (action) {
+ case 's': obj.style.visibility = 'visible'; break;
+ case 'h': obj.style.visibility = 'hidden'; break;
+ case 'k':
+ if (obj.style.visibility != 'visible') {
+ obj.style.visibility = 'visible';
+ } else {
+ obj.style.visibility = 'hidden';
+ }
+ break;
+ }
+}
+
+// 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)
+function keys(key) {
+ if (!key) {
+ key = event;
+ key.which = key.keyCode;
+ }
+ if (key.which == 84) {
+ toggle();
+ return;
+ }
+ if (s5mode) {
+ switch (key.which) {
+ case 10: // return
+ case 13: // enter
+ if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
+ if (key.target && isParentOrSelf(key.target, 'controls')) return;
+ if(number != undef) {
+ goTo(number);
+ break;
+ }
+ case 32: // spacebar
+ case 34: // page down
+ case 39: // rightkey
+ case 40: // downkey
+ if(number != undef) {
+ go(number);
+ } else if (!incrementals[snum] || incpos >= incrementals[snum].length) {
+ go(1);
+ } else {
+ subgo(1);
+ }
+ break;
+ case 33: // page up
+ case 37: // leftkey
+ case 38: // upkey
+ if(number != undef) {
+ go(-1 * number);
+ } else if (!incrementals[snum] || incpos <= 0) {
+ go(-1);
+ } else {
+ subgo(-1);
+ }
+ break;
+ case 36: // home
+ goTo(0);
+ break;
+ case 35: // end
+ goTo(smax-1);
+ break;
+ case 67: // c
+ showHide('k');
+ break;
+ }
+ if (key.which < 48 || key.which > 57) {
+ number = undef;
+ } else {
+ if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
+ if (key.target && isParentOrSelf(key.target, 'controls')) return;
+ number = (((number != undef) ? number : 0) * 10) + (key.which - 48);
+ }
+ }
+ return false;
+}
+
+function clicker(e) {
+ number = undef;
+ var target;
+ if (window.event) {
+ target = window.event.srcElement;
+ e = window.event;
+ } else target = e.target;
+ if (target.getAttribute('href') != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object')) return true;
+ if (!e.which || e.which == 1) {
+ if (!incrementals[snum] || incpos >= incrementals[snum].length) {
+ go(1);
+ } else {
+ subgo(1);
+ }
+ }
+}
+
+function findSlide(hash) {
+ var target = null;
+ var slides = GetElementsWithClassName('*','slide');
+ for (var i = 0; i < slides.length; i++) {
+ var targetSlide = slides[i];
+ if ( (targetSlide.name && targetSlide.name == hash)
+ || (targetSlide.id && targetSlide.id == hash) ) {
+ target = targetSlide;
+ break;
+ }
+ }
+ while(target != null && target.nodeName != 'BODY') {
+ if (hasClass(target, 'slide')) {
+ return parseInt(target.id.slice(5));
+ }
+ target = target.parentNode;
+ }
+ return null;
+}
+
+function slideJump() {
+ if (window.location.hash == null) return;
+ var sregex = /^#slide(\d+)$/;
+ var matches = sregex.exec(window.location.hash);
+ var dest = null;
+ if (matches != null) {
+ dest = parseInt(matches[1]);
+ } else {
+ dest = findSlide(window.location.hash.slice(1));
+ }
+ if (dest != null)
+ go(dest - snum);
+}
+
+function fixLinks() {
+ var thisUri = window.location.href;
+ thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);
+ var aelements = document.getElementsByTagName('A');
+ for (var i = 0; i < aelements.length; i++) {
+ var a = aelements[i].href;
+ var slideID = a.match('\#slide[0-9]{1,2}');
+ if ((slideID) && (slideID[0].slice(0,1) == '#')) {
+ var dest = findSlide(slideID[0].slice(1));
+ if (dest != null) {
+ if (aelements[i].addEventListener) {
+ aelements[i].addEventListener("click", new Function("e",
+ "if (document.getElementById('slideProj').disabled) return;" +
+ "go("+dest+" - snum); " +
+ "if (e.preventDefault) e.preventDefault();"), true);
+ } else if (aelements[i].attachEvent) {
+ aelements[i].attachEvent("onclick", new Function("",
+ "if (document.getElementById('slideProj').disabled) return;" +
+ "go("+dest+" - snum); " +
+ "event.returnValue = false;"));
+ }
+ }
+ }
+ }
+}
+
+function externalLinks() {
+ if (!document.getElementsByTagName) return;
+ var anchors = document.getElementsByTagName('a');
+ for (var i=0; i<anchors.length; i++) {
+ var anchor = anchors[i];
+ if (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) {
+ anchor.target = '_blank';
+ addClass(anchor,'external');
+ }
+ }
+}
+
+function createControls() {
+ var controlsDiv = document.getElementById("controls");
+ if (!controlsDiv) return;
+ var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';
+ var hideDiv, hideList = '';
+ if (controlVis == 'hidden') {
+ hideDiv = hider;
+ } else {
+ hideList = hider;
+ }
+ controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +
+ '<div id="navLinks">' +
+ '<a accesskey="t" id="toggle" href="javascript:toggle();">&#216;<\/a>' +
+ '<a accesskey="z" id="prev" href="javascript:go(-1);">&laquo;<\/a>' +
+ '<a accesskey="x" id="next" href="javascript:go(1);">&raquo;<\/a>' +
+ '<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' +
+ '<\/div><\/form>';
+ if (controlVis == 'hidden') {
+ var hidden = document.getElementById('navLinks');
+ } else {
+ var hidden = document.getElementById('jumplist');
+ }
+ addClass(hidden,'hideme');
+}
+
+function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers
+ if (!s5mode) return false;
+ var vScale = 22; // both yield 32 (after rounding) at 1024x768
+ var hScale = 32; // perhaps should auto-calculate based on theme's declared value?
+ if (window.innerHeight) {
+ var vSize = window.innerHeight;
+ var hSize = window.innerWidth;
+ } else if (document.documentElement.clientHeight) {
+ var vSize = document.documentElement.clientHeight;
+ var hSize = document.documentElement.clientWidth;
+ } else if (document.body.clientHeight) {
+ var vSize = document.body.clientHeight;
+ var hSize = document.body.clientWidth;
+ } else {
+ var vSize = 700; // assuming 1024x768, minus chrome and such
+ var hSize = 1024; // these do not account for kiosk mode or Opera Show
+ }
+ var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));
+ fontSize(newSize + 'px');
+ if (isGe) { // hack to counter incremental reflow bugs
+ var obj = document.getElementsByTagName('body')[0];
+ obj.style.display = 'none';
+ obj.style.display = 'block';
+ }
+}
+
+function fontSize(value) {
+ if (!(s5ss = document.getElementById('s5ss'))) {
+ if (!isIE) {
+ document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));
+ s5ss.setAttribute('media','screen, projection');
+ s5ss.setAttribute('id','s5ss');
+ } else {
+ document.createStyleSheet();
+ document.s5ss = document.styleSheets[document.styleSheets.length - 1];
+ }
+ }
+ if (!isIE) {
+ while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);
+ s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));
+ } else {
+ document.s5ss.addRule('body','font-size: ' + value + ' !important;');
+ }
+}
+
+function notOperaFix() {
+ slideCSS = document.getElementById('slideProj').href;
+ var slides = document.getElementById('slideProj');
+ var outline = document.getElementById('outlineStyle');
+ slides.setAttribute('media','screen');
+ outline.disabled = true;
+ if (isGe) {
+ slides.setAttribute('href','null'); // Gecko fix
+ slides.setAttribute('href',slideCSS); // Gecko fix
+ }
+ if (isIE && document.styleSheets && document.styleSheets[0]) {
+ document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');
+ document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');
+ document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');
+ }
+}
+
+function getIncrementals(obj) {
+ var incrementals = new Array();
+ if (!obj)
+ return incrementals;
+ var children = obj.childNodes;
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ if (hasClass(child, 'incremental')) {
+ if (child.nodeName == 'OL' || child.nodeName == 'UL') {
+ removeClass(child, 'incremental');
+ for (var j = 0; j < child.childNodes.length; j++) {
+ if (child.childNodes[j].nodeType == 1) {
+ addClass(child.childNodes[j], 'incremental');
+ }
+ }
+ } else {
+ incrementals[incrementals.length] = child;
+ removeClass(child,'incremental');
+ }
+ }
+ if (hasClass(child, 'show-first')) {
+ if (child.nodeName == 'OL' || child.nodeName == 'UL') {
+ removeClass(child, 'show-first');
+ if (child.childNodes[isGe].nodeType == 1) {
+ removeClass(child.childNodes[isGe], 'incremental');
+ }
+ } else {
+ incrementals[incrementals.length] = child;
+ }
+ }
+ incrementals = incrementals.concat(getIncrementals(child));
+ }
+ return incrementals;
+}
+
+function createIncrementals() {
+ var incrementals = new Array();
+ for (var i = 0; i < smax; i++) {
+ incrementals[i] = getIncrementals(document.getElementById('slide'+i));
+ }
+ return incrementals;
+}
+
+function defaultCheck() {
+ var allMetas = document.getElementsByTagName('meta');
+ for (var i = 0; i< allMetas.length; i++) {
+ if (allMetas[i].name == 'defaultView') {
+ defaultView = allMetas[i].content;
+ }
+ if (allMetas[i].name == 'controlVis') {
+ controlVis = allMetas[i].content;
+ }
+ }
+}
+
+// Key trap fix, new function body for trap()
+function trap(e) {
+ if (!e) {
+ e = event;
+ e.which = e.keyCode;
+ }
+ try {
+ modifierKey = e.ctrlKey || e.altKey || e.metaKey;
+ }
+ catch(e) {
+ modifierKey = false;
+ }
+ return modifierKey || e.which == 0;
+}
+
+function startup() {
+ defaultCheck();
+ if (!isOp)
+ createControls();
+ slideLabel();
+ fixLinks();
+ externalLinks();
+ fontScale();
+ if (!isOp) {
+ notOperaFix();
+ incrementals = createIncrementals();
+ slideJump();
+ if (defaultView == 'outline') {
+ toggle();
+ }
+ document.onkeyup = keys;
+ document.onkeypress = trap;
+ document.onclick = clicker;
+ }
+}
+
+window.onload = startup;
+window.onresize = function(){setTimeout('fontScale()', 50);}</script>
+<meta name="author" content="Sam Smith, Jen Jones" />
+<meta name="date" content="July 15, 2006" />
+<title>My S5 Document</title>
+</head>
+<body>
+<div class="layout">
+<div id="controls"></div>
+<div id="currentSlide"></div>
+<div id="header"></div>
+<div id="footer">
+<h1>July 15, 2006</h1>
+<h2>My S5 Document</h2>
+</div>
+</div>
+<div class="presentation">
+
+<div class="slide">
+<h1>My S5 Document</h1>
+<h3>Sam Smith, Jen Jones</h3>
+<h4>July 15, 2006</h4>
+</div>
+<div class="slide">
+<h1>First slide</h1>
+<ul>
+<li>first bullet</li>
+<li>second bullet</li>
+</ul>
+</div>
+<div class="slide">
+<h1>Smarty</h1>
+<ul class="incremental">
+<li>"Hello there"</li>
+<li>Here's a -- dash</li>
+<li>And 'ellipses'...</li>
+</ul>
+</div>
+<div class="slide">
+<h1>Math</h1>
+<ul>
+<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
+</ul>
+</div>
+</div>
+</body>
+</html>
+
diff --git a/tests/s5.fancy.html b/tests/s5.fancy.html
new file mode 100644
index 000000000..875bbfbaf
--- /dev/null
+++ b/tests/s5.fancy.html
@@ -0,0 +1,1673 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<!-- configuration parameters -->
+<meta name="defaultView" content="slideshow" />
+<meta name="controlVis" content="hidden" />
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta name="generator" content="pandoc" />
+<style type="text/css" media="projection" id="slideProj">
+/* Do not edit or override these styles! The system will likely break if you do. */
+
+div#header, div#footer, div#controls, .slide {position: absolute;}
+html>body div#header, html>body div#footer,
+ html>body div#controls, html>body .slide {position: fixed;}
+.handout {display: none;}
+.layout {display: block;}
+.slide, .hideme, .incremental {visibility: hidden;}
+#slide0 {visibility: visible;}
+
+/* The following styles size, place, and layer the slide components.
+ Edit these if you want to change the overall slide layout.
+ The commented lines can be uncommented (and modified, if necessary)
+ to help you with the rearrangement process. */
+
+/* target = 1024x768 */
+
+div#header, div#footer, .slide {width: 100%; top: 0; left: 0;}
+div#header {top: 0; height: 3em; z-index: 1;}
+div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;}
+.slide {top: 0; width: 92%; padding: 3.5em 4% 4%; z-index: 2; list-style: none;}
+div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;}
+div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;
+ margin: 0;}
+#currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; z-index: 10;}
+html>body #currentSlide {position: fixed;}
+
+/*
+div#header {background: #FCC;}
+div#footer {background: #CCF;}
+div#controls {background: #BBD;}
+div#currentSlide {background: #FFC;}
+*/
+
+/* Following are the presentation styles -- edit away! */
+
+body {background: #FFF url(bodybg.gif) -16px 0 no-repeat; color: #000; font-size: 2em;}
+:link, :visited {text-decoration: none; color: #00C;}
+#controls :active {color: #88A !important;}
+#controls :focus {outline: 1px dotted #227;}
+h1, h2, h3, h4 {font-size: 100%; margin: 0; padding: 0; font-weight: inherit;}
+ul, pre {margin: 0; line-height: 1em;}
+html, body {margin: 0; padding: 0;}
+
+blockquote, q {font-style: italic;}
+blockquote {padding: 0 2em 0.5em; margin: 0 1.5em 0.5em; text-align: center; font-size: 1em;}
+blockquote p {margin: 0;}
+blockquote i {font-style: normal;}
+blockquote b {display: block; margin-top: 0.5em; font-weight: normal; font-size: smaller; font-style: normal;}
+blockquote b i {font-style: italic;}
+
+kbd {font-weight: bold; font-size: 1em;}
+sup {font-size: smaller; line-height: 1px;}
+
+.slide code {padding: 2px 0.25em; font-weight: bold; color: #533;}
+.slide code.bad, code del {color: red;}
+.slide code.old {color: silver;}
+.slide pre {padding: 0; margin: 0.25em 0 0.5em 0.5em; color: #533; font-size: 90%;}
+.slide pre code {display: block;}
+.slide ul {margin-left: 5%; margin-right: 7%; list-style: disc;}
+.slide li {margin-top: 0.75em; margin-right: 0;}
+.slide ul ul {line-height: 1;}
+.slide ul ul li {margin: .2em; font-size: 85%; list-style: square;}
+.slide img.leader {display: block; margin: 0 auto;}
+
+div#header, div#footer {background: #005; color: #AAB;
+ font-family: Verdana, Helvetica, sans-serif;}
+div#header {background: #005 url(bodybg.gif) -16px 0 no-repeat;
+ line-height: 1px;}
+div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;}
+#footer h1, #footer h2 {display: block; padding: 0 1em;}
+#footer h2 {font-style: italic;}
+
+div.long {font-size: 0.75em;}
+.slide h1 {position: absolute; top: 0.7em; left: 87px; z-index: 1;
+ margin: 0; padding: 0.3em 0 0 50px; white-space: nowrap;
+ font: bold 150%/1em Helvetica, sans-serif; text-transform: capitalize;
+ color: #DDE; background: #005;}
+.slide h3 {font-size: 130%;}
+h1 abbr {font-variant: small-caps;}
+
+div#controls {position: absolute; left: 50%; bottom: 0;
+ width: 50%;
+ text-align: right; font: bold 0.9em Verdana, Helvetica, sans-serif;}
+html>body div#controls {position: fixed; padding: 0 0 1em 0;
+ top: auto;}
+div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;
+ margin: 0; padding: 0;}
+#controls #navLinks a {padding: 0; margin: 0 0.5em;
+ background: #005; border: none; color: #779;
+ cursor: pointer;}
+#controls #navList {height: 1em;}
+#controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;}
+
+#currentSlide {text-align: center; font-size: 0.5em; color: #449;}
+
+#slide0 {padding-top: 3.5em; font-size: 90%;}
+#slide0 h1 {position: static; margin: 1em 0 0; padding: 0;
+ font: bold 2em Helvetica, sans-serif; white-space: normal;
+ color: #000; background: transparent;}
+#slide0 h2 {font: bold italic 1em Helvetica, sans-serif; margin: 0.25em;}
+#slide0 h3 {margin-top: 1.5em; font-size: 1.5em;}
+#slide0 h4 {margin-top: 0; font-size: 1em;}
+
+ul.urls {list-style: none; display: inline; margin: 0;}
+.urls li {display: inline; margin: 0;}
+.note {display: none;}
+.external {border-bottom: 1px dotted gray;}
+html>body .external {border-bottom: none;}
+.external:after {content: " \274F"; font-size: smaller; color: #77B;}
+
+.incremental, .incremental *, .incremental *:after {color: #DDE; visibility: visible;}
+img.incremental {visibility: hidden;}
+.slide .current {color: #B02;}
+
+
+/* diagnostics
+
+li:after {content: " [" attr(class) "]"; color: #F88;}
+ */
+</style>
+<style type="text/css" media="projection" id="operaFix">
+/* DO NOT CHANGE THESE unless you really want to break Opera Show */
+.slide {
+ visibility: visible !important;
+ position: static !important;
+ page-break-before: always;
+}
+#slide0 {page-break-before: avoid;}
+
+</style>
+<style type="text/css" media="screen" id="outlineStyle">
+/* don't change this unless you want the layout stuff to show up in the outline view! */
+
+.layout div, #footer *, #controlForm * {display: none;}
+#footer, #controls, #controlForm, #navLinks, #toggle {
+ display: block; visibility: visible; margin: 0; padding: 0;}
+#toggle {float: right; padding: 0.5em;}
+html>body #toggle {position: fixed; top: 0; right: 0;}
+
+/* making the outline look pretty-ish */
+
+#slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;}
+#slide0 h1 {padding-top: 1.5em;}
+.slide h1 {margin: 1.5em 0 0; padding-top: 0.25em;
+ border-top: 1px solid #888; border-bottom: 1px solid #AAA;}
+#toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;}
+
+</style>
+<style type="text/css" media="print" id="slidePrint">
+/* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */ .slide, ul {page-break-inside: avoid; visibility: visible !important;} h1 {page-break-after: avoid;} body {font-size: 12pt; background: white;} * {color: black;} #slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;} #slide0 h3 {margin: 0; padding: 0;} #slide0 h4 {margin: 0 0 0.5em; padding: 0;} #slide0 {margin-bottom: 3em;} h1 {border-top: 2pt solid gray; border-bottom: 1px dotted silver;} .extra {background: transparent !important;} div.extra, pre.extra, .example {font-size: 10pt; color: #333;} ul.extra a {font-weight: bold;} p.example {display: none;} #header {display: none;} #footer h1 {margin: 0; border-bottom: 1px solid; color: gray; font-style: italic;} #footer h2, #controls {display: none;} /* The following rule keeps the layout stuff out of print. Remove at your own risk! */ .layout, .layout * {display: none !important;}
+</style>
+<script type="text/javascript">
+// S5 v1.1 slides.js -- released into the Public Domain
+//
+// Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information
+// about all the wonderful and talented contributors to this code!
+
+var undef;
+var slideCSS = '';
+var snum = 0;
+var smax = 1;
+var incpos = 0;
+var number = undef;
+var s5mode = true;
+var defaultView = 'slideshow';
+var controlVis = 'visible';
+
+var isIE = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0;
+var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;
+var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;
+
+function hasClass(object, className) {
+ if (!object.className) return false;
+ return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);
+}
+
+function hasValue(object, value) {
+ if (!object) return false;
+ return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);
+}
+
+function removeClass(object,className) {
+ if (!object) return;
+ object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);
+}
+
+function addClass(object,className) {
+ if (!object || hasClass(object, className)) return;
+ if (object.className) {
+ object.className += ' '+className;
+ } else {
+ object.className = className;
+ }
+}
+
+function GetElementsWithClassName(elementName,className) {
+ var allElements = document.getElementsByTagName(elementName);
+ var elemColl = new Array();
+ for (var i = 0; i< allElements.length; i++) {
+ if (hasClass(allElements[i], className)) {
+ elemColl[elemColl.length] = allElements[i];
+ }
+ }
+ return elemColl;
+}
+
+function isParentOrSelf(element, id) {
+ if (element == null || element.nodeName=='BODY') return false;
+ else if (element.id == id) return true;
+ else return isParentOrSelf(element.parentNode, id);
+}
+
+function nodeValue(node) {
+ var result = "";
+ if (node.nodeType == 1) {
+ var children = node.childNodes;
+ for (var i = 0; i < children.length; ++i) {
+ result += nodeValue(children[i]);
+ }
+ }
+ else if (node.nodeType == 3) {
+ result = node.nodeValue;
+ }
+ return(result);
+}
+
+function slideLabel() {
+ var slideColl = GetElementsWithClassName('*','slide');
+ var list = document.getElementById('jumplist');
+ smax = slideColl.length;
+ for (var n = 0; n < smax; n++) {
+ var obj = slideColl[n];
+
+ var did = 'slide' + n.toString();
+ obj.setAttribute('id',did);
+ if (isOp) continue;
+
+ var otext = '';
+ var menu = obj.firstChild;
+ if (!menu) continue; // to cope with empty slides
+ while (menu && menu.nodeType == 3) {
+ menu = menu.nextSibling;
+ }
+ if (!menu) continue; // to cope with slides with only text nodes
+
+ var menunodes = menu.childNodes;
+ for (var o = 0; o < menunodes.length; o++) {
+ otext += nodeValue(menunodes[o]);
+ }
+ list.options[list.length] = new Option(n + ' : ' + otext, n);
+ }
+}
+
+function currentSlide() {
+ var cs;
+ if (document.getElementById) {
+ cs = document.getElementById('currentSlide');
+ } else {
+ cs = document.currentSlide;
+ }
+ cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' +
+ '<span id="csSep">\/<\/span> ' +
+ '<span id="csTotal">' + (smax-1) + '<\/span>';
+ if (snum == 0) {
+ cs.style.visibility = 'hidden';
+ } else {
+ cs.style.visibility = 'visible';
+ }
+}
+
+function go(step) {
+ if (document.getElementById('slideProj').disabled || step == 0) return;
+ var jl = document.getElementById('jumplist');
+ var cid = 'slide' + snum;
+ var ce = document.getElementById(cid);
+ if (incrementals[snum].length > 0) {
+ for (var i = 0; i < incrementals[snum].length; i++) {
+ removeClass(incrementals[snum][i], 'current');
+ removeClass(incrementals[snum][i], 'incremental');
+ }
+ }
+ if (step != 'j') {
+ snum += step;
+ lmax = smax - 1;
+ if (snum > lmax) snum = lmax;
+ if (snum < 0) snum = 0;
+ } else
+ snum = parseInt(jl.value);
+ var nid = 'slide' + snum;
+ var ne = document.getElementById(nid);
+ if (!ne) {
+ ne = document.getElementById('slide0');
+ snum = 0;
+ }
+ if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}
+ if (incrementals[snum].length > 0 && incpos == 0) {
+ for (var i = 0; i < incrementals[snum].length; i++) {
+ if (hasClass(incrementals[snum][i], 'current'))
+ incpos = i + 1;
+ else
+ addClass(incrementals[snum][i], 'incremental');
+ }
+ }
+ if (incrementals[snum].length > 0 && incpos > 0)
+ addClass(incrementals[snum][incpos - 1], 'current');
+ ce.style.visibility = 'hidden';
+ ne.style.visibility = 'visible';
+ jl.selectedIndex = snum;
+ currentSlide();
+ number = 0;
+}
+
+function goTo(target) {
+ if (target >= smax || target == snum) return;
+ go(target - snum);
+}
+
+function subgo(step) {
+ if (step > 0) {
+ removeClass(incrementals[snum][incpos - 1],'current');
+ removeClass(incrementals[snum][incpos], 'incremental');
+ addClass(incrementals[snum][incpos],'current');
+ incpos++;
+ } else {
+ incpos--;
+ removeClass(incrementals[snum][incpos],'current');
+ addClass(incrementals[snum][incpos], 'incremental');
+ addClass(incrementals[snum][incpos - 1],'current');
+ }
+}
+
+function toggle() {
+ var slideColl = GetElementsWithClassName('*','slide');
+ var slides = document.getElementById('slideProj');
+ var outline = document.getElementById('outlineStyle');
+ if (!slides.disabled) {
+ slides.disabled = true;
+ outline.disabled = false;
+ s5mode = false;
+ fontSize('1em');
+ for (var n = 0; n < smax; n++) {
+ var slide = slideColl[n];
+ slide.style.visibility = 'visible';
+ }
+ } else {
+ slides.disabled = false;
+ outline.disabled = true;
+ s5mode = true;
+ fontScale();
+ for (var n = 0; n < smax; n++) {
+ var slide = slideColl[n];
+ slide.style.visibility = 'hidden';
+ }
+ slideColl[snum].style.visibility = 'visible';
+ }
+}
+
+function showHide(action) {
+ var obj = GetElementsWithClassName('*','hideme')[0];
+ switch (action) {
+ case 's': obj.style.visibility = 'visible'; break;
+ case 'h': obj.style.visibility = 'hidden'; break;
+ case 'k':
+ if (obj.style.visibility != 'visible') {
+ obj.style.visibility = 'visible';
+ } else {
+ obj.style.visibility = 'hidden';
+ }
+ break;
+ }
+}
+
+// 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)
+function keys(key) {
+ if (!key) {
+ key = event;
+ key.which = key.keyCode;
+ }
+ if (key.which == 84) {
+ toggle();
+ return;
+ }
+ if (s5mode) {
+ switch (key.which) {
+ case 10: // return
+ case 13: // enter
+ if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
+ if (key.target && isParentOrSelf(key.target, 'controls')) return;
+ if(number != undef) {
+ goTo(number);
+ break;
+ }
+ case 32: // spacebar
+ case 34: // page down
+ case 39: // rightkey
+ case 40: // downkey
+ if(number != undef) {
+ go(number);
+ } else if (!incrementals[snum] || incpos >= incrementals[snum].length) {
+ go(1);
+ } else {
+ subgo(1);
+ }
+ break;
+ case 33: // page up
+ case 37: // leftkey
+ case 38: // upkey
+ if(number != undef) {
+ go(-1 * number);
+ } else if (!incrementals[snum] || incpos <= 0) {
+ go(-1);
+ } else {
+ subgo(-1);
+ }
+ break;
+ case 36: // home
+ goTo(0);
+ break;
+ case 35: // end
+ goTo(smax-1);
+ break;
+ case 67: // c
+ showHide('k');
+ break;
+ }
+ if (key.which < 48 || key.which > 57) {
+ number = undef;
+ } else {
+ if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
+ if (key.target && isParentOrSelf(key.target, 'controls')) return;
+ number = (((number != undef) ? number : 0) * 10) + (key.which - 48);
+ }
+ }
+ return false;
+}
+
+function clicker(e) {
+ number = undef;
+ var target;
+ if (window.event) {
+ target = window.event.srcElement;
+ e = window.event;
+ } else target = e.target;
+ if (target.getAttribute('href') != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target,'object')) return true;
+ if (!e.which || e.which == 1) {
+ if (!incrementals[snum] || incpos >= incrementals[snum].length) {
+ go(1);
+ } else {
+ subgo(1);
+ }
+ }
+}
+
+function findSlide(hash) {
+ var target = null;
+ var slides = GetElementsWithClassName('*','slide');
+ for (var i = 0; i < slides.length; i++) {
+ var targetSlide = slides[i];
+ if ( (targetSlide.name && targetSlide.name == hash)
+ || (targetSlide.id && targetSlide.id == hash) ) {
+ target = targetSlide;
+ break;
+ }
+ }
+ while(target != null && target.nodeName != 'BODY') {
+ if (hasClass(target, 'slide')) {
+ return parseInt(target.id.slice(5));
+ }
+ target = target.parentNode;
+ }
+ return null;
+}
+
+function slideJump() {
+ if (window.location.hash == null) return;
+ var sregex = /^#slide(\d+)$/;
+ var matches = sregex.exec(window.location.hash);
+ var dest = null;
+ if (matches != null) {
+ dest = parseInt(matches[1]);
+ } else {
+ dest = findSlide(window.location.hash.slice(1));
+ }
+ if (dest != null)
+ go(dest - snum);
+}
+
+function fixLinks() {
+ var thisUri = window.location.href;
+ thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);
+ var aelements = document.getElementsByTagName('A');
+ for (var i = 0; i < aelements.length; i++) {
+ var a = aelements[i].href;
+ var slideID = a.match('\#slide[0-9]{1,2}');
+ if ((slideID) && (slideID[0].slice(0,1) == '#')) {
+ var dest = findSlide(slideID[0].slice(1));
+ if (dest != null) {
+ if (aelements[i].addEventListener) {
+ aelements[i].addEventListener("click", new Function("e",
+ "if (document.getElementById('slideProj').disabled) return;" +
+ "go("+dest+" - snum); " +
+ "if (e.preventDefault) e.preventDefault();"), true);
+ } else if (aelements[i].attachEvent) {
+ aelements[i].attachEvent("onclick", new Function("",
+ "if (document.getElementById('slideProj').disabled) return;" +
+ "go("+dest+" - snum); " +
+ "event.returnValue = false;"));
+ }
+ }
+ }
+ }
+}
+
+function externalLinks() {
+ if (!document.getElementsByTagName) return;
+ var anchors = document.getElementsByTagName('a');
+ for (var i=0; i<anchors.length; i++) {
+ var anchor = anchors[i];
+ if (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) {
+ anchor.target = '_blank';
+ addClass(anchor,'external');
+ }
+ }
+}
+
+function createControls() {
+ var controlsDiv = document.getElementById("controls");
+ if (!controlsDiv) return;
+ var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';
+ var hideDiv, hideList = '';
+ if (controlVis == 'hidden') {
+ hideDiv = hider;
+ } else {
+ hideList = hider;
+ }
+ controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +
+ '<div id="navLinks">' +
+ '<a accesskey="t" id="toggle" href="javascript:toggle();">&#216;<\/a>' +
+ '<a accesskey="z" id="prev" href="javascript:go(-1);">&laquo;<\/a>' +
+ '<a accesskey="x" id="next" href="javascript:go(1);">&raquo;<\/a>' +
+ '<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' +
+ '<\/div><\/form>';
+ if (controlVis == 'hidden') {
+ var hidden = document.getElementById('navLinks');
+ } else {
+ var hidden = document.getElementById('jumplist');
+ }
+ addClass(hidden,'hideme');
+}
+
+function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers
+ if (!s5mode) return false;
+ var vScale = 22; // both yield 32 (after rounding) at 1024x768
+ var hScale = 32; // perhaps should auto-calculate based on theme's declared value?
+ if (window.innerHeight) {
+ var vSize = window.innerHeight;
+ var hSize = window.innerWidth;
+ } else if (document.documentElement.clientHeight) {
+ var vSize = document.documentElement.clientHeight;
+ var hSize = document.documentElement.clientWidth;
+ } else if (document.body.clientHeight) {
+ var vSize = document.body.clientHeight;
+ var hSize = document.body.clientWidth;
+ } else {
+ var vSize = 700; // assuming 1024x768, minus chrome and such
+ var hSize = 1024; // these do not account for kiosk mode or Opera Show
+ }
+ var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));
+ fontSize(newSize + 'px');
+ if (isGe) { // hack to counter incremental reflow bugs
+ var obj = document.getElementsByTagName('body')[0];
+ obj.style.display = 'none';
+ obj.style.display = 'block';
+ }
+}
+
+function fontSize(value) {
+ if (!(s5ss = document.getElementById('s5ss'))) {
+ if (!isIE) {
+ document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));
+ s5ss.setAttribute('media','screen, projection');
+ s5ss.setAttribute('id','s5ss');
+ } else {
+ document.createStyleSheet();
+ document.s5ss = document.styleSheets[document.styleSheets.length - 1];
+ }
+ }
+ if (!isIE) {
+ while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);
+ s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));
+ } else {
+ document.s5ss.addRule('body','font-size: ' + value + ' !important;');
+ }
+}
+
+function notOperaFix() {
+ slideCSS = document.getElementById('slideProj').href;
+ var slides = document.getElementById('slideProj');
+ var outline = document.getElementById('outlineStyle');
+ slides.setAttribute('media','screen');
+ outline.disabled = true;
+ if (isGe) {
+ slides.setAttribute('href','null'); // Gecko fix
+ slides.setAttribute('href',slideCSS); // Gecko fix
+ }
+ if (isIE && document.styleSheets && document.styleSheets[0]) {
+ document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');
+ document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');
+ document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');
+ }
+}
+
+function getIncrementals(obj) {
+ var incrementals = new Array();
+ if (!obj)
+ return incrementals;
+ var children = obj.childNodes;
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ if (hasClass(child, 'incremental')) {
+ if (child.nodeName == 'OL' || child.nodeName == 'UL') {
+ removeClass(child, 'incremental');
+ for (var j = 0; j < child.childNodes.length; j++) {
+ if (child.childNodes[j].nodeType == 1) {
+ addClass(child.childNodes[j], 'incremental');
+ }
+ }
+ } else {
+ incrementals[incrementals.length] = child;
+ removeClass(child,'incremental');
+ }
+ }
+ if (hasClass(child, 'show-first')) {
+ if (child.nodeName == 'OL' || child.nodeName == 'UL') {
+ removeClass(child, 'show-first');
+ if (child.childNodes[isGe].nodeType == 1) {
+ removeClass(child.childNodes[isGe], 'incremental');
+ }
+ } else {
+ incrementals[incrementals.length] = child;
+ }
+ }
+ incrementals = incrementals.concat(getIncrementals(child));
+ }
+ return incrementals;
+}
+
+function createIncrementals() {
+ var incrementals = new Array();
+ for (var i = 0; i < smax; i++) {
+ incrementals[i] = getIncrementals(document.getElementById('slide'+i));
+ }
+ return incrementals;
+}
+
+function defaultCheck() {
+ var allMetas = document.getElementsByTagName('meta');
+ for (var i = 0; i< allMetas.length; i++) {
+ if (allMetas[i].name == 'defaultView') {
+ defaultView = allMetas[i].content;
+ }
+ if (allMetas[i].name == 'controlVis') {
+ controlVis = allMetas[i].content;
+ }
+ }
+}
+
+// Key trap fix, new function body for trap()
+function trap(e) {
+ if (!e) {
+ e = event;
+ e.which = e.keyCode;
+ }
+ try {
+ modifierKey = e.ctrlKey || e.altKey || e.metaKey;
+ }
+ catch(e) {
+ modifierKey = false;
+ }
+ return modifierKey || e.which == 0;
+}
+
+function startup() {
+ defaultCheck();
+ if (!isOp)
+ createControls();
+ slideLabel();
+ fixLinks();
+ externalLinks();
+ fontScale();
+ if (!isOp) {
+ notOperaFix();
+ incrementals = createIncrementals();
+ slideJump();
+ if (defaultView == 'outline') {
+ toggle();
+ }
+ document.onkeyup = keys;
+ document.onkeypress = trap;
+ document.onclick = clicker;
+ }
+}
+
+window.onload = startup;
+window.onresize = function(){setTimeout('fontScale()', 50);}</script>
+<script type="text/javascript">
+/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
+See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
+
+var checkForMathML = true; // check if browser can display MathML
+var notifyIfNoMathML = true; // display note if no MathML capability
+var alertIfNoMathML = false; // show alert box if no MathML capability
+var mathcolor = "red"; // change it to "" (to inherit) or any other color
+var mathfontfamily = "serif"; // change to "" to inherit (works in IE)
+ // or another family (e.g. "arial")
+var displaystyle = true; // puts limits above and below large operators
+var showasciiformulaonhover = true; // helps students learn ASCIIMath
+var decimalsign = "."; // change to "," if you like, beware of `(1,2)`!
+var AMdelimiter1 = "`", AMescape1 = "\\\\`"; // can use other characters
+var AMdelimiter2 = "$", AMescape2 = "\\\\\\$", AMdelimiter2regexp = "\\$";
+var doubleblankmathdelimiter = false; // if true, x+1 is equal to `x+1`
+ // for IE this works only in <!-- -->
+//var separatetokens;// has been removed (email me if this is a problem)
+var isIE = document.createElementNS==null;
+
+if (document.getElementById==null)
+ alert("This webpage requires a recent browser such as\
+\nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer")
+
+// all further global variables start with "AM"
+
+function AMcreateElementXHTML(t) {
+ if (isIE) return document.createElement(t);
+ else return document.createElementNS("http://www.w3.org/1999/xhtml",t);
+}
+
+function AMnoMathMLNote() {
+ var nd = AMcreateElementXHTML("h3");
+ nd.setAttribute("align","center")
+ nd.appendChild(AMcreateElementXHTML("p"));
+ nd.appendChild(document.createTextNode("To view the "));
+ var an = AMcreateElementXHTML("a");
+ an.appendChild(document.createTextNode("ASCIIMathML"));
+ an.setAttribute("href","http://www.chapman.edu/~jipsen/asciimath.html");
+ nd.appendChild(an);
+ nd.appendChild(document.createTextNode(" notation use Internet Explorer 6+"));
+ an = AMcreateElementXHTML("a");
+ an.appendChild(document.createTextNode("MathPlayer"));
+ an.setAttribute("href","http://www.dessci.com/en/products/mathplayer/download.htm");
+ nd.appendChild(an);
+ nd.appendChild(document.createTextNode(" or Netscape/Mozilla/Firefox"));
+ nd.appendChild(AMcreateElementXHTML("p"));
+ return nd;
+}
+
+function AMisMathMLavailable() {
+ var regex = /KHTML/; /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
+See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
+ if (navigator.appName.slice(0,8)=="Netscape")
+ if (navigator.appVersion.slice(0,1)>="5" && !regex.test(navigator.userAgent)) return null;
+ else return AMnoMathMLNote();
+ else if (navigator.appName.slice(0,9)=="Microsoft")
+ try {
+ var ActiveX = new ActiveXObject("MathPlayer.Factory.1");
+ return null;
+ } catch (e) {
+ return AMnoMathMLNote();
+ }
+ else return AMnoMathMLNote();
+}
+
+// character lists for Mozilla/Netscape fonts
+var AMcal = [0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];
+var AMfrk = [0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];
+var AMbbb = [0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];
+
+var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4,
+ RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8,
+ LEFTRIGHT = 9, TEXT = 10; // token types
+
+var AMsqrt = {input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY},
+ AMroot = {input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY},
+ AMfrac = {input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY},
+ AMdiv = {input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX},
+ AMover = {input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY},
+ AMsub = {input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX},
+ AMsup = {input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX},
+ AMtext = {input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT},
+ AMmbox = {input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT},
+ AMquote = {input:"\"", tag:"mtext", output:"mbox", tex:null, ttype:TEXT};
+
+var AMsymbols = [
+//some greek symbols
+{input:"alpha", tag:"mi", output:"\u03B1", tex:null, ttype:CONST},
+{input:"beta", tag:"mi", output:"\u03B2", tex:null, ttype:CONST},
+{input:"chi", tag:"mi", output:"\u03C7", tex:null, ttype:CONST},
+{input:"delta", tag:"mi", output:"\u03B4", tex:null, ttype:CONST},
+{input:"Delta", tag:"mo", output:"\u0394", tex:null, ttype:CONST},
+{input:"epsi", tag:"mi", output:"\u03B5", tex:"epsilon", ttype:CONST},
+{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST},
+{input:"eta", tag:"mi", output:"\u03B7", tex:null, ttype:CONST},
+{input:"gamma", tag:"mi", output:"\u03B3", tex:null, ttype:CONST},
+{input:"Gamma", tag:"mo", output:"\u0393", tex:null, ttype:CONST},
+{input:"iota", tag:"mi", output:"\u03B9", tex:null, ttype:CONST},
+{input:"kappa", tag:"mi", output:"\u03BA", tex:null, ttype:CONST},
+{input:"lambda", tag:"mi", output:"\u03BB", tex:null, ttype:CONST},
+{input:"Lambda", tag:"mo", output:"\u039B", tex:null, ttype:CONST},
+{input:"mu", tag:"mi", output:"\u03BC", tex:null, ttype:CONST},
+{input:"nu", tag:"mi", output:"\u03BD", tex:null, ttype:CONST},
+{input:"omega", tag:"mi", output:"\u03C9", tex:null, ttype:CONST},
+{input:"Omega", tag:"mo", output:"\u03A9", tex:null, ttype:CONST},
+{input:"phi", tag:"mi", output:"\u03C6", tex:null, ttype:CONST},
+{input:"varphi", tag:"mi", output:"\u03D5", tex:null, ttype:CONST},
+{input:"Phi", tag:"mo", output:"\u03A6", tex:null, ttype:CONST},
+{input:"pi", tag:"mi", output:"\u03C0", tex:null, ttype:CONST},
+{input:"Pi", tag:"mo", output:"\u03A0", tex:null, ttype:CONST},
+{input:"psi", tag:"mi", output:"\u03C8", tex:null, ttype:CONST},
+{input:"Psi", tag:"mi", output:"\u03A8", tex:null, ttype:CONST},
+{input:"rho", tag:"mi", output:"\u03C1", tex:null, ttype:CONST},
+{input:"sigma", tag:"mi", output:"\u03C3", tex:null, ttype:CONST},
+{input:"Sigma", tag:"mo", output:"\u03A3", tex:null, ttype:CONST},
+{input:"tau", tag:"mi", output:"\u03C4", tex:null, ttype:CONST},
+{input:"theta", tag:"mi", output:"\u03B8", tex:null, ttype:CONST},
+{input:"vartheta", tag:"mi", output:"\u03D1", tex:null, ttype:CONST},
+{input:"Theta", tag:"mo", output:"\u0398", tex:null, ttype:CONST},
+{input:"upsilon", tag:"mi", output:"\u03C5", tex:null, ttype:CONST},
+{input:"xi", tag:"mi", output:"\u03BE", tex:null, ttype:CONST},
+{input:"Xi", tag:"mo", output:"\u039E", tex:null, ttype:CONST},
+{input:"zeta", tag:"mi", output:"\u03B6", tex:null, ttype:CONST},
+
+//binary operation symbols
+{input:"*", tag:"mo", output:"\u22C5", tex:"cdot", ttype:CONST},
+{input:"**", tag:"mo", output:"\u22C6", tex:"star", ttype:CONST},
+{input:"//", tag:"mo", output:"/", tex:null, ttype:CONST},
+{input:"\\\\", tag:"mo", output:"\\", tex:"backslash", ttype:CONST},
+{input:"setminus", tag:"mo", output:"\\", tex:null, ttype:CONST},
+{input:"xx", tag:"mo", output:"\u00D7", tex:"times", ttype:CONST},
+{input:"-:", tag:"mo", output:"\u00F7", tex:"divide", ttype:CONST},
+{input:"@", tag:"mo", output:"\u2218", tex:"circ", ttype:CONST},
+{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST},
+{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST},
+{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST},
+{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER},
+{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER},
+{input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST},
+{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER},
+{input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST},
+{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER},
+{input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST},
+{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER},
+{input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST},
+{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER},
+
+//binary relation symbols
+{input:"!=", tag:"mo", output:"\u2260", tex:"ne", ttype:CONST},
+{input:":=", tag:"mo", output:":=", tex:null, ttype:CONST},
+{input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST},
+{input:"<=", tag:"mo", output:"\u2264", tex:"le", ttype:CONST},
+{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST},
+{input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST},
+{input:"geq", tag:"mo", output:"\u2265", tex:null, ttype:CONST},
+{input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST},
+{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST},
+{input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST},
+{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST},
+{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST},
+{input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST},
+{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST},
+{input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:CONST},
+{input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:CONST},
+{input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:CONST},
+{input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:CONST},
+{input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST},
+{input:"~=", tag:"mo", output:"\u2245", tex:"cong", ttype:CONST},
+{input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST},
+{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST},
+
+//logical symbols
+{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE},
+{input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE},
+{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST},
+{input:"=>", tag:"mo", output:"\u21D2", tex:"implies", ttype:CONST},
+{input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE},
+{input:"<=>", tag:"mo", output:"\u21D4", tex:"iff", ttype:CONST},
+{input:"AA", tag:"mo", output:"\u2200", tex:"forall", ttype:CONST},
+{input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST},
+{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST},
+{input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST},
+{input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST},
+{input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST},
+
+//grouping brackets
+{input:"(", tag:"mo", output:"(", tex:null, ttype:LEFTBRACKET},
+{input:")", tag:"mo", output:")", tex:null, ttype:RIGHTBRACKET},
+{input:"[", tag:"mo", output:"[", tex:null, ttype:LEFTBRACKET},
+{input:"]", tag:"mo", output:"]", tex:null, ttype:RIGHTBRACKET},
+{input:"{", tag:"mo", output:"{", tex:null, ttype:LEFTBRACKET},
+{input:"}", tag:"mo", output:"}", tex:null, ttype:RIGHTBRACKET},
+{input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT},
+//{input:"||", tag:"mo", output:"||", tex:null, ttype:LEFTRIGHT},
+{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET},
+{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET},
+{input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:LEFTBRACKET},
+{input:">>", tag:"mo", output:"\u232A", tex:null, ttype:RIGHTBRACKET},
+{input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true},
+{input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true},
+
+//miscellaneous symbols
+{input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST},
+{input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION},
+{input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION},
+{input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION},
+{input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION},
+{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST},
+{input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST},
+{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST},
+{input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST},
+{input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST},
+{input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST},
+{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST},
+{input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST},
+{input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST},
+{input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST},
+{input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST},
+{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST},
+{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST},
+{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST},
+{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST},
+{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST},
+{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST},
+{input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:CONST},
+{input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST},
+{input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST},
+{input:"|~", tag:"mo", output:"\u2308", tex:"lceiling", ttype:CONST},
+{input:"~|", tag:"mo", output:"\u2309", tex:"rceiling", ttype:CONST},
+{input:"CC", tag:"mo", output:"\u2102", tex:null, ttype:CONST},
+{input:"NN", tag:"mo", output:"\u2115", tex:null, ttype:CONST},
+{input:"QQ", tag:"mo", output:"\u211A", tex:null, ttype:CONST},
+{input:"RR", tag:"mo", output:"\u211D", tex:null, ttype:CONST},
+{input:"ZZ", tag:"mo", output:"\u2124", tex:null, ttype:CONST},
+{input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true},
+{input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true},
+
+//standard functions
+{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER},
+{input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER},
+{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true},
+{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true},
+{input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true},
+{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true},
+{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true},
+{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true},
+{input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true},
+{input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true},
+{input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true},
+{input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true},
+{input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true},
+{input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true},
+{input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST},
+{input:"mod", tag:"mo", output:"mod", tex:null, ttype:CONST},
+{input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true},
+{input:"lcm", tag:"mo", output:"lcm", tex:null, ttype:UNARY, func:true},
+{input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST},
+{input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST},
+{input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER},
+{input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER},
+
+//arrows
+{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST},
+{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST},
+{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST},
+{input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST},
+{input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST},
+{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST},
+{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST},
+{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST},
+{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST},
+{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST},
+
+//commands with argument
+AMsqrt, AMroot, AMfrac, AMdiv, AMover, AMsub, AMsup,
+{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true},
+{input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:UNARY, acc:true},
+{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true},
+{input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true},
+{input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true},
+{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true},
+AMtext, AMmbox, AMquote,
+{input:"bb", tag:"mstyle", atname:"fontweight", atval:"bold", output:"bb", tex:null, ttype:UNARY},
+{input:"mathbf", tag:"mstyle", atname:"fontweight", atval:"bold", output:"mathbf", tex:null, ttype:UNARY},
+{input:"sf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"sf", tex:null, ttype:UNARY},
+{input:"mathsf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY},
+{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:UNARY, codes:AMbbb},
+{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY, codes:AMbbb},
+{input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:UNARY, codes:AMcal},
+{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal},
+{input:"tt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"tt", tex:null, ttype:UNARY},
+{input:"mathtt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY},
+{input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:UNARY, codes:AMfrk},
+{input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY, codes:AMfrk}
+];
+
+function compareNames(s1,s2) {
+ if (s1.input > s2.input) return 1
+ else return -1;
+}
+
+var AMnames = []; //list of input symbols
+
+function AMinitSymbols() {
+ var texsymbols = [], i;
+ for (i=0; i<AMsymbols.length; i++)
+ if (AMsymbols[i].tex)
+ texsymbols[texsymbols.length] = {input:AMsymbols[i].tex,
+ tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype};
+ AMsymbols = AMsymbols.concat(texsymbols);
+ AMsymbols.sort(compareNames);
+ for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;
+}
+
+var AMmathml = "http://www.w3.org/1998/Math/MathML";
+
+function AMcreateElementMathML(t) {
+ if (isIE) return document.createElement("m:"+t);
+ else return document.createElementNS(AMmathml,t);
+}
+
+function AMcreateMmlNode(t,frag) {
+// var node = AMcreateElementMathML(name);
+ if (isIE) var node = document.createElement("m:"+t);
+ else var node = document.createElementNS(AMmathml,t);
+ node.appendChild(frag);
+ return node;
+}
+
+function newcommand(oldstr,newstr) {
+ AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,
+ tex:null, ttype:DEFINITION}]);
+}
+
+function AMremoveCharsAndBlanks(str,n) {
+//remove n characters and any following blanks
+ var st;
+ if (str.charAt(n)=="\\" && str.charAt(n+1)!="\\" && str.charAt(n+1)!=" ")
+ st = str.slice(n+1);
+ else st = str.slice(n);
+ for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);
+ return st.slice(i);
+}
+
+function AMposition(arr, str, n) {
+// return position >=n where str appears or would be inserted
+// assumes arr is sorted
+ if (n==0) {
+ var h,m;
+ n = -1;
+ h = arr.length;
+ while (n+1<h) {
+ m = (n+h) >> 1;
+ if (arr[m]<str) n = m; else h = m;
+ }
+ return h;
+ } else
+ for (var i=n; i<arr.length && arr[i]<str; i++);
+ return i; // i=arr.length || arr[i]>=str
+}
+
+function AMgetSymbol(str) {
+//return maximal initial substring of str that appears in names
+//return null if there is none
+ var k = 0; //new pos
+ var j = 0; //old pos
+ var mk; //match pos
+ var st;
+ var tagst;
+ var match = "";
+ var more = true;
+ for (var i=1; i<=str.length && more; i++) {
+ st = str.slice(0,i); //initial substring of length i
+ j = k;
+ k = AMposition(AMnames, st, j);
+ if (k<AMnames.length && str.slice(0,AMnames[k].length)==AMnames[k]){
+ match = AMnames[k];
+ mk = k;
+ i = match.length;
+ }
+ more = k<AMnames.length && str.slice(0,AMnames[k].length)>=AMnames[k];
+ }
+ AMpreviousSymbol=AMcurrentSymbol;
+ if (match!=""){
+ AMcurrentSymbol=AMsymbols[mk].ttype;
+ return AMsymbols[mk];
+ }
+// if str[0] is a digit or - return maxsubstring of digits.digits
+ AMcurrentSymbol=CONST;
+ k = 1;
+ st = str.slice(0,1);
+ var integ = true;
+ while ("0"<=st && st<="9" && k<=str.length) {
+ st = str.slice(k,k+1);
+ k++;
+ }
+ if (st == decimalsign) {
+ st = str.slice(k,k+1);
+ if ("0"<=st && st<="9") {
+ integ = false;
+ k++;
+ while ("0"<=st && st<="9" && k<=str.length) {
+ st = str.slice(k,k+1);
+ k++;
+ }
+ }
+ }
+ if ((integ && k>1) || k>2) {
+ st = str.slice(0,k-1);
+ tagst = "mn";
+ } else {
+ k = 2;
+ st = str.slice(0,1); //take 1 character
+ tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");
+ }
+ if (st=="-" && AMpreviousSymbol==INFIX) {
+ AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse
+ return {input:st, tag:tagst, output:st, ttype:UNARY, func:true};
+ }
+ return {input:st, tag:tagst, output:st, ttype:CONST};
+}
+
+function AMremoveBrackets(node) {
+ var st;
+ if (node.nodeName=="mrow") {
+ st = node.firstChild.firstChild.nodeValue;
+ if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild);
+ }
+ if (node.nodeName=="mrow") {
+ st = node.lastChild.firstChild.nodeValue;
+ if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild);
+ }
+}
+
+/* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
+See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
+
+var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol;
+
+function AMparseSexpr(str) { //parses str and returns [node,tailstr]
+ var symbol, node, result, i, st,// rightvert = false,
+ newFrag = document.createDocumentFragment();
+ str = AMremoveCharsAndBlanks(str,0);
+ symbol = AMgetSymbol(str); //either a token or a bracket or empty
+ if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) {
+ return [null,str];
+ }
+ if (symbol.ttype == DEFINITION) {
+ str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length);
+ symbol = AMgetSymbol(str);
+ }
+ switch (symbol.ttype) {
+ case UNDEROVER:
+ case CONST:
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ return [AMcreateMmlNode(symbol.tag, //its a constant
+ document.createTextNode(symbol.output)),str];
+ case LEFTBRACKET: //read (expr+)
+ AMnestingDepth++;
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ result = AMparseExpr(str,true);
+ AMnestingDepth--;
+ if (typeof symbol.invisible == "boolean" && symbol.invisible)
+ node = AMcreateMmlNode("mrow",result[0]);
+ else {
+ node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
+ node = AMcreateMmlNode("mrow",node);
+ node.appendChild(result[0]);
+ }
+ return [node,result[1]];
+ case TEXT:
+ if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ if (str.charAt(0)=="{") i=str.indexOf("}");
+ else if (str.charAt(0)=="(") i=str.indexOf(")");
+ else if (str.charAt(0)=="[") i=str.indexOf("]");
+ else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1;
+ else i = 0;
+ if (i==-1) i = str.length;
+ st = str.slice(1,i);
+ if (st.charAt(0) == " ") {
+ node = AMcreateElementMathML("mspace");
+ node.setAttribute("width","1ex");
+ newFrag.appendChild(node);
+ }
+ newFrag.appendChild(
+ AMcreateMmlNode(symbol.tag,document.createTextNode(st)));
+ if (st.charAt(st.length-1) == " ") {
+ node = AMcreateElementMathML("mspace");
+ node.setAttribute("width","1ex");
+ newFrag.appendChild(node);
+ }
+ str = AMremoveCharsAndBlanks(str,i+1);
+ return [AMcreateMmlNode("mrow",newFrag),str];
+ case UNARY:
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ result = AMparseSexpr(str);
+ if (result[0]==null) return [AMcreateMmlNode(symbol.tag,
+ document.createTextNode(symbol.output)),str];
+ if (typeof symbol.func == "boolean" && symbol.func) { // functions hack
+ st = str.charAt(0);
+ if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {
+ return [AMcreateMmlNode(symbol.tag,
+ document.createTextNode(symbol.output)),str];
+ } else {
+ node = AMcreateMmlNode("mrow",
+ AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)));
+ node.appendChild(result[0]);
+ return [node,result[1]];
+ }
+ }
+ AMremoveBrackets(result[0]);
+ if (symbol.input == "sqrt") { // sqrt
+ return [AMcreateMmlNode(symbol.tag,result[0]),result[1]];
+ } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent
+ node = AMcreateMmlNode(symbol.tag,result[0]);
+ node.appendChild(AMcreateMmlNode("mo",document.createTextNode(symbol.output)));
+ return [node,result[1]];
+ } else { // font change command
+ if (!isIE && typeof symbol.codes != "undefined") {
+ for (i=0; i<result[0].childNodes.length; i++)
+ if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {
+ st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:
+ result[0].childNodes[i].firstChild.nodeValue);
+ var newst = [];
+ for (var j=0; j<st.length; j++)
+ if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst +
+ String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);
+ else newst = newst + st.charAt(j);
+ if (result[0].nodeName=="mi")
+ result[0]=AMcreateElementMathML("mo").
+ appendChild(document.createTextNode(newst));
+ else result[0].replaceChild(AMcreateElementMathML("mo").
+ appendChild(document.createTextNode(newst)),result[0].childNodes[i]);
+ }
+ }
+ node = AMcreateMmlNode(symbol.tag,result[0]);
+ node.setAttribute(symbol.atname,symbol.atval);
+ return [node,result[1]];
+ }
+ case BINARY:
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ result = AMparseSexpr(str);
+ if (result[0]==null) return [AMcreateMmlNode("mo",
+ document.createTextNode(symbol.input)),str];
+ AMremoveBrackets(result[0]);
+ var result2 = AMparseSexpr(result[1]);
+ if (result2[0]==null) return [AMcreateMmlNode("mo",
+ document.createTextNode(symbol.input)),str];
+ AMremoveBrackets(result2[0]);
+ if (symbol.input=="root" || symbol.input=="stackrel")
+ newFrag.appendChild(result2[0]);
+ newFrag.appendChild(result[0]);
+ if (symbol.input=="frac") newFrag.appendChild(result2[0]);
+ return [AMcreateMmlNode(symbol.tag,newFrag),result2[1]];
+ case INFIX:
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ return [AMcreateMmlNode("mo",document.createTextNode(symbol.output)),str];
+ case SPACE:
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ node = AMcreateElementMathML("mspace");
+ node.setAttribute("width","1ex");
+ newFrag.appendChild(node);
+ newFrag.appendChild(
+ AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)));
+ node = AMcreateElementMathML("mspace");
+ node.setAttribute("width","1ex");
+ newFrag.appendChild(node);
+ return [AMcreateMmlNode("mrow",newFrag),str];
+ case LEFTRIGHT:
+// if (rightvert) return [null,str]; else rightvert = true;
+ AMnestingDepth++;
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ result = AMparseExpr(str,false);
+ AMnestingDepth--;
+ var st = "";
+ if (result[0].lastChild!=null)
+ st = result[0].lastChild.firstChild.nodeValue;
+ if (st == "|") { // its an absolute value subterm
+ node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
+ node = AMcreateMmlNode("mrow",node);
+ node.appendChild(result[0]);
+ return [node,result[1]];
+ } else { // the "|" is a \mid
+ node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
+ node = AMcreateMmlNode("mrow",node);
+ return [node,str];
+ }
+ default:
+//alert("default");
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ return [AMcreateMmlNode(symbol.tag, //its a constant
+ document.createTextNode(symbol.output)),str];
+ }
+}
+
+function AMparseIexpr(str) {
+ var symbol, sym1, sym2, node, result, underover;
+ str = AMremoveCharsAndBlanks(str,0);
+ sym1 = AMgetSymbol(str);
+ result = AMparseSexpr(str);
+ node = result[0];
+ str = result[1];
+ symbol = AMgetSymbol(str);
+ if (symbol.ttype == INFIX && symbol.input != "/") {
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+// if (symbol.input == "/") result = AMparseIexpr(str); else ...
+ result = AMparseSexpr(str);
+ if (result[0] == null) // show box in place of missing argument
+ result[0] = AMcreateMmlNode("mo",document.createTextNode("\u25A1"));
+ else AMremoveBrackets(result[0]);
+ str = result[1];
+// if (symbol.input == "/") AMremoveBrackets(node);
+ if (symbol.input == "_") {
+ sym2 = AMgetSymbol(str);
+ underover = (sym1.ttype == UNDEROVER);
+ if (sym2.input == "^") {
+ str = AMremoveCharsAndBlanks(str,sym2.input.length);
+ var res2 = AMparseSexpr(str);
+ AMremoveBrackets(res2[0]);
+ str = res2[1];
+ node = AMcreateMmlNode((underover?"munderover":"msubsup"),node);
+ node.appendChild(result[0]);
+ node.appendChild(res2[0]);
+ node = AMcreateMmlNode("mrow",node); // so sum does not stretch
+ } else {
+ node = AMcreateMmlNode((underover?"munder":"msub"),node);
+ node.appendChild(result[0]);
+ }
+ } else {
+ node = AMcreateMmlNode(symbol.tag,node);
+ node.appendChild(result[0]);
+ }
+ }
+ return [node,str];
+}
+
+function AMparseExpr(str,rightbracket) {
+ var symbol, node, result, i, nodeList = [],
+ newFrag = document.createDocumentFragment();
+ do {
+ str = AMremoveCharsAndBlanks(str,0);
+ result = AMparseIexpr(str);
+ node = result[0];
+ str = result[1];
+ symbol = AMgetSymbol(str);
+ if (symbol.ttype == INFIX && symbol.input == "/") {
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ result = AMparseIexpr(str);
+ if (result[0] == null) // show box in place of missing argument
+ result[0] = AMcreateMmlNode("mo",document.createTextNode("\u25A1"));
+ else AMremoveBrackets(result[0]);
+ str = result[1];
+ AMremoveBrackets(node);
+ node = AMcreateMmlNode(symbol.tag,node);
+ node.appendChild(result[0]);
+ newFrag.appendChild(node);
+ symbol = AMgetSymbol(str);
+ }
+ else if (node!=undefined) newFrag.appendChild(node);
+ } while ((symbol.ttype != RIGHTBRACKET &&
+ (symbol.ttype != LEFTRIGHT || rightbracket)
+ || AMnestingDepth == 0) && symbol!=null && symbol.output!="");
+ if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) {
+// if (AMnestingDepth > 0) AMnestingDepth--;
+ var len = newFrag.childNodes.length;
+ if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&
+ newFrag.childNodes[len-2].nodeName == "mo" &&
+ newFrag.childNodes[len-2].firstChild.nodeValue == ",") { //matrix
+ var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue;
+ if (right==")" || right=="]") {
+ var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue;
+ if (left=="(" && right==")" && symbol.output != "}" ||
+ left=="[" && right=="]") {
+ var pos = []; // positions of commas
+ var matrix = true;
+ var m = newFrag.childNodes.length;
+ for (i=0; matrix && i<m; i=i+2) {
+ pos[i] = [];
+ node = newFrag.childNodes[i];
+ if (matrix) matrix = node.nodeName=="mrow" &&
+ (i==m-1 || node.nextSibling.nodeName=="mo" &&
+ node.nextSibling.firstChild.nodeValue==",")&&
+ node.firstChild.firstChild.nodeValue==left &&
+ node.lastChild.firstChild.nodeValue==right;
+ if (matrix)
+ for (var j=0; j<node.childNodes.length; j++)
+ if (node.childNodes[j].firstChild.nodeValue==",")
+ pos[i][pos[i].length]=j;
+ if (matrix && i>1) matrix = pos[i].length == pos[i-2].length;
+ }
+ if (matrix) {
+ var row, frag, n, k, table = document.createDocumentFragment();
+ for (i=0; i<m; i=i+2) {
+ row = document.createDocumentFragment();
+ frag = document.createDocumentFragment();
+ node = newFrag.firstChild; // <mrow>(-,-,...,-,-)</mrow>
+ n = node.childNodes.length;
+ k = 0;
+ node.removeChild(node.firstChild); //remove (
+ for (j=1; j<n-1; j++) {
+ if (typeof pos[i][k] != "undefined" && j==pos[i][k]){
+ node.removeChild(node.firstChild); //remove ,
+ row.appendChild(AMcreateMmlNode("mtd",frag));
+ k++;
+ } else frag.appendChild(node.firstChild);
+ }
+ row.appendChild(AMcreateMmlNode("mtd",frag));
+ if (newFrag.childNodes.length>2) {
+ newFrag.removeChild(newFrag.firstChild); //remove <mrow>)</mrow>
+ newFrag.removeChild(newFrag.firstChild); //remove <mo>,</mo>
+ }
+ table.appendChild(AMcreateMmlNode("mtr",row));
+ }
+ node = AMcreateMmlNode("mtable",table);
+ if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left");
+ newFrag.replaceChild(node,newFrag.firstChild);
+ }
+ }
+ }
+ }
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ if (typeof symbol.invisible != "boolean" || !symbol.invisible) {
+ node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
+ newFrag.appendChild(node);
+ }
+ }
+ return [newFrag,str];
+}
+
+function AMparseMath(str) {
+ var result, node = AMcreateElementMathML("mstyle");
+ if (mathcolor != "") node.setAttribute("mathcolor",mathcolor);
+ if (displaystyle) node.setAttribute("displaystyle","true");
+ if (mathfontfamily != "") node.setAttribute("fontfamily",mathfontfamily);
+ AMnestingDepth = 0;
+ node.appendChild(AMparseExpr(str.replace(/^\s+/g,""),false)[0]);
+ node = AMcreateMmlNode("math",node);
+ if (showasciiformulaonhover) //fixed by djhsu so newline
+ node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko
+ if (mathfontfamily != "" && (isIE || mathfontfamily != "serif")) {
+ var fnode = AMcreateElementXHTML("font");
+ fnode.setAttribute("face",mathfontfamily);
+ fnode.appendChild(node);
+ return fnode;
+ }
+ return node;
+}
+
+function AMstrarr2docFrag(arr, linebreaks) {
+ var newFrag=document.createDocumentFragment();
+ var expr = false;
+ for (var i=0; i<arr.length; i++) {
+ if (expr) newFrag.appendChild(AMparseMath(arr[i]));
+ else {
+ var arri = (linebreaks ? arr[i].split("\n\n") : [arr[i]]);
+ newFrag.appendChild(AMcreateElementXHTML("span").
+ appendChild(document.createTextNode(arri[0])));
+ for (var j=1; j<arri.length; j++) {
+ newFrag.appendChild(AMcreateElementXHTML("p"));
+ newFrag.appendChild(AMcreateElementXHTML("span").
+ appendChild(document.createTextNode(arri[j])));
+ }
+ }
+ expr = !expr;
+ }
+ return newFrag;
+}
+
+function AMprocessNodeR(n, linebreaks) {
+ var mtch, str, arr, frg, i;
+ if (n.childNodes.length == 0) {
+ if ((n.nodeType!=8 || linebreaks) &&
+ n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" &&
+ n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" &&
+ n.parentNode.nodeName!="code" && n.parentNode.nodeName!="CODE" && /* ASCIIMathML.js - copyright Peter Jipsen, released under the GPL
+See http://www1.chapman.edu/~jipsen/mathml/asciimath.html/ */
+ n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE") {
+ str = n.nodeValue;
+ if (!(str == null)) {
+ str = str.replace(/\r\n\r\n/g,"\n\n");
+ if (doubleblankmathdelimiter) {
+ str = str.replace(/\x20\x20\./g," "+AMdelimiter1+".");
+ str = str.replace(/\x20\x20,/g," "+AMdelimiter1+",");
+ str = str.replace(/\x20\x20/g," "+AMdelimiter1+" ");
+ }
+ str = str.replace(/\x20+/g," ");
+ str = str.replace(/\s*\r\n/g," ");
+ mtch = false;
+ str = str.replace(new RegExp(AMescape2, "g"),
+ function(st){mtch=true;return "AMescape2"});
+ str = str.replace(new RegExp(AMescape1, "g"),
+ function(st){mtch=true;return "AMescape1"});
+ str = str.replace(new RegExp(AMdelimiter2regexp, "g"),AMdelimiter1);
+ arr = str.split(AMdelimiter1);
+ for (i=0; i<arr.length; i++)
+ arr[i]=arr[i].replace(/AMescape2/g,AMdelimiter2).
+ replace(/AMescape1/g,AMdelimiter1);
+ if (arr.length>1 || mtch) {
+ if (checkForMathML) {
+ checkForMathML = false;
+ var nd = AMisMathMLavailable();
+ AMnoMathML = nd != null;
+ if (AMnoMathML && notifyIfNoMathML)
+ if (alertIfNoMathML)
+ alert("To view the ASCIIMathML notation use Internet Explorer 6 +\nMathPlayer (free from www.dessci.com)\n\
+ or Firefox/Mozilla/Netscape");
+ else AMbody.insertBefore(nd,AMbody.childNodes[0]);
+ }
+ if (!AMnoMathML) {
+ frg = AMstrarr2docFrag(arr,n.nodeType==8);
+ var len = frg.childNodes.length;
+ n.parentNode.replaceChild(frg,n);
+ return len-1;
+ } else return 0;
+ }
+ }
+ } else return 0;
+ } else if (n.nodeName!="math") {
+ for (i=0; i<n.childNodes.length; i++)
+ i += AMprocessNodeR(n.childNodes[i], linebreaks);
+ }
+ return 0;
+}
+
+function AMprocessNode(n, linebreaks, spanclassAM) {
+ var frag,st;
+ if (spanclassAM!=null) {
+ frag = document.getElementsByTagName("span")
+ for (var i=0;i<frag.length;i++)
+ if (frag[i].className == "AM")
+ AMprocessNodeR(frag[i],linebreaks);
+ } else {
+ try {
+ st = n.innerHTML;
+ } catch(err) {}
+ if (st==null ||
+ st.indexOf(AMdelimiter1)!=-1 || st.indexOf(AMdelimiter2)!=-1)
+ AMprocessNodeR(n,linebreaks);
+ }
+ if (isIE) { //needed to match size and font of formula to surrounding text
+ frag = document.getElementsByTagName('math');
+ for (var i=0;i<frag.length;i++) frag[i].update()
+ }
+}
+
+var AMbody;
+var AMnoMathML = false, AMtranslated = false;
+
+function translate(spanclassAM) {
+ if (!AMtranslated) { // run this only once
+ AMtranslated = true;
+ AMinitSymbols();
+ AMbody = document.getElementsByTagName("body")[0];
+ AMprocessNode(AMbody, false, spanclassAM);
+ }
+}
+
+if (isIE) { // avoid adding MathPlayer info explicitly to each webpage
+ document.write("<object id=\"mathplayer\"\
+ classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");
+ document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");
+}
+
+// GO1.1 Generic onload by Brothercake
+// http://www.brothercake.com/
+//onload function (replaces the onload="translate()" in the <body> tag)
+function generic()
+{
+ translate();
+};
+//setup onload function
+if(typeof window.addEventListener != 'undefined')
+{
+ //.. gecko, safari, konqueror and standard
+ window.addEventListener('load', generic, false);
+}
+else if(typeof document.addEventListener != 'undefined')
+{
+ //.. opera 7
+ document.addEventListener('load', generic, false);
+}
+else if(typeof window.attachEvent != 'undefined')
+{
+ //.. win/ie
+ window.attachEvent('onload', generic);
+}
+//** remove this condition to degrade older browsers
+else
+{
+ //.. mac/ie5 and anything else that gets this far
+ //if there's an existing onload function
+ if(typeof window.onload == 'function')
+ {
+ //store it
+ var existing = onload;
+ //add new onload handler
+ window.onload = function()
+ {
+ //call existing onload function
+ existing();
+ //call generic onload function
+ generic();
+ };
+ }
+ else
+ {
+ //setup onload function
+ window.onload = generic;
+ }
+}
+</script>
+<meta name="author" content="Sam Smith, Jen Jones" />
+<meta name="date" content="July 15, 2006" />
+<title>My S5 Document</title>
+</head>
+<body>
+<div class="layout">
+<div id="controls"></div>
+<div id="currentSlide"></div>
+<div id="header"></div>
+<div id="footer">
+<h1>July 15, 2006</h1>
+<h2>My S5 Document</h2>
+</div>
+</div>
+<div class="presentation">
+
+<div class="slide">
+<h1>My S5 Document</h1>
+<h3>Sam Smith, Jen Jones</h3>
+<h4>July 15, 2006</h4>
+</div>
+<div class="slide">
+<h1>First slide</h1>
+<ul class="incremental">
+<li>first bullet</li>
+<li>second bullet</li>
+</ul>
+</div>
+<div class="slide">
+<h1>Smarty</h1>
+<ul>
+<li>&ldquo;Hello there&rdquo;</li>
+<li>Here&rsquo;s a&mdash;dash</li>
+<li>And &lsquo;ellipses&rsquo;&hellip;</li>
+</ul>
+</div>
+<div class="slide">
+<h1>Math</h1>
+<ul class="incremental">
+<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
+</ul>
+</div>
+</div>
+</body>
+</html>
+
diff --git a/tests/s5.fragment.html b/tests/s5.fragment.html
new file mode 100644
index 000000000..d77c484dc
--- /dev/null
+++ b/tests/s5.fragment.html
@@ -0,0 +1,18 @@
+<h1>First slide</h1>
+<ul>
+<li>first bullet</li>
+<li>second bullet</li>
+</ul>
+<h1>Smarty</h1>
+<blockquote>
+<ul>
+<li>"Hello there"</li>
+<li>Here's a -- dash</li>
+<li>And 'ellipses'...</li>
+</ul>
+</blockquote>
+<h1>Math</h1>
+<ul>
+<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
+</ul>
+
diff --git a/tests/s5.inserts.html b/tests/s5.inserts.html
new file mode 100644
index 000000000..7ebdf23e4
--- /dev/null
+++ b/tests/s5.inserts.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta name="generator" content="pandoc" />
+<style type="text/css">
+div.pandocNote { border-left: 1px solid grey; padding-left: 1em; }
+span.pandocNoteRef { vertical-align: super; font-size: 80%; }
+span.pandocNoteMarker { }
+</style>
+<link rel="stylesheet" href="main.css" type="text/css" media="all" />
+STUFF INSERTED
+<meta name="author" content="Sam Smith, Jen Jones" />
+<meta name="date" content="July 15, 2006" />
+<title>My S5 Document</title>
+</head>
+<body>
+STUFF INSERTED
+<h1 class="title">My S5 Document</h1>
+<h1>First slide</h1>
+<ul>
+<li>first bullet</li>
+<li>second bullet</li>
+</ul>
+<h1>Smarty</h1>
+<blockquote>
+<ul>
+<li>"Hello there"</li>
+<li>Here's a -- dash</li>
+<li>And 'ellipses'...</li>
+</ul>
+</blockquote>
+<h1>Math</h1>
+<ul>
+<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
+</ul>
+STUFF INSERTED
+</body>
+</html>
+
diff --git a/tests/s5.native b/tests/s5.native
new file mode 100644
index 000000000..154011f68
--- /dev/null
+++ b/tests/s5.native
@@ -0,0 +1,15 @@
+Pandoc (Meta [Str "My",Space,Str "S5",Space,Str "Document"] ["Sam Smith","Jen Jones"] "July 15, 2006")
+[ Header 1 [Str "First",Space,Str "slide"]
+, BulletList
+ [ [ Plain [Str "first",Space,Str "bullet"] ]
+ , [ Plain [Str "second",Space,Str "bullet"] ] ]
+, Header 1 [Str "Smarty"]
+, BlockQuote
+ [ BulletList
+ [ [ Plain [Str "\"Hello",Space,Str "there\""] ]
+ , [ Plain [Str "Here's",Space,Str "a",Space,Str "--",Space,Str "dash"] ]
+ , [ Plain [Str "And",Space,Str "'ellipses'..."] ] ] ]
+, Header 1 [Str "Math"]
+, BulletList
+ [ [ Plain [TeX "$\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}$"] ]
+ ] ]
diff --git a/tests/testsuite.native b/tests/testsuite.native
new file mode 100644
index 000000000..8ec543e89
--- /dev/null
+++ b/tests/testsuite.native
@@ -0,0 +1,329 @@
+Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane","Anonymous"] "July 17, 2006")
+[ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber's",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
+, HorizontalRule
+, Header 1 [Str "Headers"]
+, Header 2 [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embedded",Space,Str "link"] (Src "/url" "")]
+, Header 3 [Str "Level",Space,Str "3",Space,Str "with",Space,Emph [Str "emphasis"]]
+, Header 4 [Str "Level",Space,Str "4"]
+, Header 5 [Str "Level",Space,Str "5"]
+, Header 1 [Str "Level",Space,Str "1"]
+, Header 2 [Str "Level",Space,Str "2",Space,Str "with",Space,Emph [Str "emphasis"]]
+, Header 3 [Str "Level",Space,Str "3"]
+, Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
+, Header 2 [Str "Level",Space,Str "2"]
+, Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
+, HorizontalRule
+, Header 1 [Str "Paragraphs"]
+, Para [Str "Here's",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
+, Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",Space,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item.",Space,Str "Because",Space,Str "a",Space,Str "hard",Str "-",Str "wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item."]
+, Para [Str "Here's",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
+, Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here."]
+, HorizontalRule
+, Header 1 [Str "Block",Space,Str "Quotes"]
+, Para [Str "E",Str "-",Str "mail",Space,Str "style:"]
+, BlockQuote
+ [ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."] ]
+
+, BlockQuote
+ [ Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
+ , CodeBlock "sub status {\n print \"working\";\n}\n"
+ , Para [Str "A",Space,Str "list:"]
+ , OrderedList
+ [ [ Plain [Str "item",Space,Str "one"] ]
+ , [ Plain [Str "item",Space,Str "two"] ] ]
+ , Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
+ , BlockQuote
+ [ Para [Str "nested"] ]
+
+ , BlockQuote
+ [ Para [Str "nested"] ]
+ ]
+, Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "block",Space,Str "quote:",Space,Str "2",Space,Str ">",Space,Str "1."]
+, Para [Str "Box",Str "-",Str "style:"]
+, BlockQuote
+ [ Para [Str "Example:"]
+ , CodeBlock "sub status {\n print \"working\";\n}\n" ]
+, BlockQuote
+ [ OrderedList
+ [ [ Plain [Str "do",Space,Str "laundry"] ]
+ , [ Plain [Str "take",Space,Str "out",Space,Str "the",Space,Str "trash"] ] ] ]
+, Para [Str "Here's",Space,Str "a",Space,Str "nested",Space,Str "one:"]
+, BlockQuote
+ [ Para [Str "Joe",Space,Str "said:"]
+ , BlockQuote
+ [ Para [Str "Don't",Space,Str "quote",Space,Str "me."] ]
+ ]
+, Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
+, HorizontalRule
+, Header 1 [Str "Code",Space,Str "Blocks"]
+, Para [Str "Code:"]
+, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab\n"
+, Para [Str "And:"]
+, CodeBlock " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{\n"
+, HorizontalRule
+, Header 1 [Str "Lists"]
+, Header 2 [Str "Unordered"]
+, Para [Str "Asterisks",Space,Str "tight:"]
+, BulletList
+ [ [ Plain [Str "asterisk",Space,Str "1"] ]
+ , [ Plain [Str "asterisk",Space,Str "2"] ]
+ , [ Plain [Str "asterisk",Space,Str "3"] ] ]
+, Para [Str "Asterisks",Space,Str "loose:"]
+, BulletList
+ [ [ Para [Str "asterisk",Space,Str "1"] ]
+ , [ Para [Str "asterisk",Space,Str "2"] ]
+ , [ Para [Str "asterisk",Space,Str "3"] ] ]
+, Para [Str "Pluses",Space,Str "tight:"]
+, BulletList
+ [ [ Plain [Str "Plus",Space,Str "1"] ]
+ , [ Plain [Str "Plus",Space,Str "2"] ]
+ , [ Plain [Str "Plus",Space,Str "3"] ] ]
+, Para [Str "Pluses",Space,Str "loose:"]
+, BulletList
+ [ [ Para [Str "Plus",Space,Str "1"] ]
+ , [ Para [Str "Plus",Space,Str "2"] ]
+ , [ Para [Str "Plus",Space,Str "3"] ] ]
+, Para [Str "Minuses",Space,Str "tight:"]
+, BulletList
+ [ [ Plain [Str "Minus",Space,Str "1"] ]
+ , [ Plain [Str "Minus",Space,Str "2"] ]
+ , [ Plain [Str "Minus",Space,Str "3"] ] ]
+, Para [Str "Minuses",Space,Str "loose:"]
+, BulletList
+ [ [ Para [Str "Minus",Space,Str "1"] ]
+ , [ Para [Str "Minus",Space,Str "2"] ]
+ , [ Para [Str "Minus",Space,Str "3"] ] ]
+, Header 2 [Str "Ordered"]
+, Para [Str "Tight:"]
+, OrderedList
+ [ [ Plain [Str "First"] ]
+ , [ Plain [Str "Second"] ]
+ , [ Plain [Str "Third"] ] ]
+, Para [Str "and:"]
+, OrderedList
+ [ [ Plain [Str "One"] ]
+ , [ Plain [Str "Two"] ]
+ , [ Plain [Str "Three"] ] ]
+, Para [Str "Loose",Space,Str "using",Space,Str "tabs:"]
+, OrderedList
+ [ [ Para [Str "First"] ]
+ , [ Para [Str "Second"] ]
+ , [ Para [Str "Third"] ] ]
+, Para [Str "and",Space,Str "using",Space,Str "spaces:"]
+, OrderedList
+ [ [ Para [Str "One"] ]
+ , [ Para [Str "Two"] ]
+ , [ Para [Str "Three"] ] ]
+, Para [Str "Multiple",Space,Str "paragraphs:"]
+, OrderedList
+ [ [ Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
+ , Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog's",Space,Str "back."] ], [ Para [Str "Item",Space,Str "2."] ]
+ , [ Para [Str "Item",Space,Str "3."] ] ]
+, Header 2 [Str "Nested"]
+, BulletList
+ [ [ Plain [Str "Tab"]
+ , BulletList
+ [ [ Plain [Str "Tab"]
+ , BulletList
+ [ [ Plain [Str "Tab"] ]
+ ] ] ] ] ]
+, Para [Str "Here's",Space,Str "another:"]
+, OrderedList
+ [ [ Plain [Str "First"] ]
+ , [ Plain [Str "Second:"]
+ , BulletList
+ [ [ Plain [Str "Fee"] ]
+ , [ Plain [Str "Fie"] ]
+ , [ Plain [Str "Foe"] ] ] ], [ Plain [Str "Third"] ] ]
+, Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs:"]
+, OrderedList
+ [ [ Para [Str "First"] ]
+ , [ Para [Str "Second:"]
+ , BulletList
+ [ [ Plain [Str "Fee"] ]
+ , [ Plain [Str "Fie"] ]
+ , [ Plain [Str "Foe"] ] ] ], [ Para [Str "Third"] ] ]
+, Header 2 [Str "Tabs",Space,Str "and",Space,Str "spaces"]
+, BulletList
+ [ [ Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"] ]
+ , [ Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"]
+ , BulletList
+ [ [ Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"] ]
+ , [ Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"] ] ] ] ]
+, HorizontalRule
+, Header 1 [Str "HTML",Space,Str "Blocks"]
+, Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
+, RawHtml "<div>"
+, Plain [Str "foo"]
+, RawHtml "</div>\n"
+, Para [Str "And",Space,Str "nested",Space,Str "without",Space,Str "indentation:"]
+, RawHtml "<div>\n<div>\n<div>"
+, Plain [Str "foo"]
+, RawHtml "</div>\n</div>\n<div>"
+, Plain [Str "bar"]
+, RawHtml "</div>\n</div>\n"
+, Para [Str "Interpreted",Space,Str "markdown",Space,Str "in",Space,Str "a",Space,Str "table:"]
+, RawHtml "<table>\n<tr>\n<td>"
+, Plain [Str "This",Space,Str "is",Space,Emph [Str "emphasized"]]
+, RawHtml "</td>\n<td>"
+, Plain [Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"]]
+, RawHtml "</td>\n</tr>\n</table>\n\n<script type=\"text/javascript\">document.write('This *should not* be interpreted as markdown');</script>\n"
+, Para [Str "Here's",Space,Str "a",Space,Str "simple",Space,Str "block:"]
+, RawHtml "<div>\n "
+, Plain [Str "foo"]
+, RawHtml "</div>\n"
+, Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]
+, CodeBlock "<div>\n foo\n</div>\n"
+, Para [Str "As",Space,Str "should",Space,Str "this:"]
+, CodeBlock "<div>foo</div>\n"
+, Para [Str "Now,",Space,Str "nested:"]
+, RawHtml "<div>\n <div>\n <div>\n "
+, Plain [Str "foo"]
+, RawHtml "</div>\n </div>\n</div>\n"
+, Para [Str "This",Space,Str "should",Space,Str "just",Space,Str "be",Space,Str "an",Space,Str "HTML",Space,Str "comment:"]
+, RawHtml "<!-- Comment -->\n"
+, Para [Str "Multiline:"]
+, RawHtml "<!--\nBlah\nBlah\n-->\n\n<!--\n This is another comment.\n-->\n"
+, Para [Str "Code",Space,Str "block:"]
+, CodeBlock "<!-- Comment -->\n"
+, Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"]
+, RawHtml "<!-- foo --> \n"
+, Para [Str "Code:"]
+, CodeBlock "<hr />\n"
+, Para [Str "Hr's:"]
+, RawHtml "<hr>\n\n<hr />\n\n<hr />\n\n<hr> \n\n<hr /> \n\n<hr /> \n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\">\n"
+, HorizontalRule
+, Header 1 [Str "Inline",Space,Str "Markup"]
+, Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str "."]
+, Para [Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str "."]
+, Para [Str "An",Space,Emph [Link [Str "emphasized",Space,Str "link"] (Src "/url" "")],Str "."]
+, Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
+, Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
+, Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
+, Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
+, Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ">",Str ",",Space,Code "$",Str ",",Space,Code "\\",Str ",",Space,Code "\\$",Str ",",Space,Code "<html>",Str "."]
+, HorizontalRule
+, Header 1 [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
+, Para [Str "\"Hello,\"",Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Str "\"'Shelob'",Space,Str "is",Space,Str "my",Space,Str "name.\""]
+, Para [Str "'A',",Space,Str "'B',",Space,Str "and",Space,Str "'C'",Space,Str "are",Space,Str "letters."]
+, Para [Str "'Oak,'",Space,Str "'elm,'",Space,Str "and",Space,Str "'beech'",Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees.",Space,Str "So",Space,Str "is",Space,Str "'pine.'"]
+, Para [Str "'He",Space,Str "said,",Space,Str "\"I",Space,Str "want",Space,Str "to",Space,Str "go.\"'",Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70's?"]
+, Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Str "'",Code "code",Str "'",Space,Str "and",Space,Str "a",Space,Str "\"",Link [Str "quoted",Space,Str "link"] (Ref [Str "1"]),Str "\"."]
+, Para [Str "Some",Space,Str "dashes:",Space,Str "one",Str "---",Str "two",Space,Str "---",Space,Str "three",Str "--",Str "four",Space,Str "--",Space,Str "five."]
+, Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5",Str "-",Str "7,",Space,Str "255",Str "-",Str "66,",Space,Str "1987",Str "-",Str "1999."]
+, Para [Str "Ellipses...and.",Space,Str ".",Space,Str ".and",Space,Str ".",Space,Str ".",Space,Str ".",Space,Str "."]
+, HorizontalRule
+, Header 1 [Str "LaTeX"]
+, BulletList
+ [ [ Plain [TeX "\\cite[22-23]{smith.1899}"] ]
+ , [ Plain [TeX "\\doublespacing"] ]
+ , [ Plain [TeX "$2+2=4$"] ]
+ , [ Plain [TeX "$x \\in y$"] ]
+ , [ Plain [TeX "$\\alpha \\wedge \\omega$"] ]
+ , [ Plain [TeX "$223$"] ]
+ , [ Plain [TeX "$p$",Str "-",Str "Tree"] ]
+ , [ Plain [TeX "$\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}$"] ]
+ , [ Plain [Str "Here's",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,TeX "$\\alpha + \\omega \\times x^2$",Str "."] ] ]
+, Para [Str "These",Space,Str "shouldn't",Space,Str "be",Space,Str "math:"]
+, BulletList
+ [ [ Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ]
+ , [ Plain [Str "$",Str "22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money.",Space,Str "So",Space,Str "is",Space,Str "$",Str "34,000.",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Str "\"lot\"",Space,Str "is",Space,Str "emphasized.)"] ]
+ , [ Plain [Str "Escaped",Space,Code "$",Str ":",Space,Str "$",Str "73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23",Str "$",Str "."] ] ]
+, Para [Str "Here's",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
+, Para [TeX "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}"]
+, HorizontalRule
+, Header 1 [Str "Special",Space,Str "Characters"]
+, Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
+, BulletList
+ [ [ Plain [Str "I",Space,Str "hat:",Space,Str "\206"] ]
+ , [ Plain [Str "o",Space,Str "umlaut:",Space,Str "\246"] ]
+ , [ Plain [Str "section:",Space,Str "\167"] ]
+ , [ Plain [Str "set",Space,Str "membership:",Space,Str "\8712"] ]
+ , [ Plain [Str "copyright:",Space,Str "\169"] ] ]
+, Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
+, Para [Str "AT&T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it."]
+, Para [Str "This",Space,Str "&",Space,Str "that."]
+, Para [Str "4",Space,Str "<",Space,Str "5."]
+, Para [Str "6",Space,Str ">",Space,Str "5."]
+, Para [Str "Backslash:",Space,Str "\\"]
+, Para [Str "Backtick:",Space,Str "`"]
+, Para [Str "Asterisk:",Space,Str "*"]
+, Para [Str "Underscore:",Space,Str "_"]
+, Para [Str "Left",Space,Str "brace:",Space,Str "{"]
+, Para [Str "Right",Space,Str "brace:",Space,Str "}"]
+, Para [Str "Left",Space,Str "bracket:",Space,Str "["]
+, Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
+, Para [Str "Left",Space,Str "paren:",Space,Str "("]
+, Para [Str "Right",Space,Str "paren:",Space,Str ")"]
+, Para [Str "Greater",Str "-",Str "than:",Space,Str ">"]
+, Para [Str "Hash:",Space,Str "#"]
+, Para [Str "Period:",Space,Str "."]
+, Para [Str "Bang:",Space,Str "!"]
+, Para [Str "Plus:",Space,Str "+"]
+, Para [Str "Minus:",Space,Str "-"]
+, HorizontalRule
+, Header 1 [Str "Links"]
+, Header 2 [Str "Explicit"]
+, Para [Str "Just",Space,Str "a",Space,Link [Str "URL"] (Src "/url/" ""),Str "."]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Src "/url/" "title"),Str "."]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Src "/url/" "title preceded by two spaces"),Str "."]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Src "/url/" "title preceded by a tab"),Str "."]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Src "/url/" "title with &quot;quotes&quot; in it")]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Src "/url/" "title with single quotes")]
+, Para [Link [Str "Email",Space,Str "link"] (Src "mailto:nobody@nowhere.net" "")]
+, Para [Link [Str "Empty"] (Src "" ""),Str "."]
+, Header 2 [Str "Reference"]
+, Para [Str "Foo",Space,Link [Str "bar"] (Ref [Str "a"]),Str "."]
+, Para [Str "Foo",Space,Link [Str "bar"] (Ref [Str "a"]),Str "."]
+, Para [Str "Foo",Space,Link [Str "bar"] (Ref [Str "a"]),Str "."]
+, Key [Str "a"] (Src "/url/" "")
+, Para [Str "With",Space,Link [Str "embedded",Space,Link [Str "brackets"] (Ref [])] (Ref [Str "b"]),Str "."]
+, Para [Link [Str "b"] (Ref []),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link."]
+, Para [Str "Indented",Space,Link [Str "once"] (Ref []),Str "."]
+, Para [Str "Indented",Space,Link [Str "twice"] (Ref []),Str "."]
+, Para [Str "Indented",Space,Link [Str "thrice"] (Ref []),Str "."]
+, Para [Str "This",Space,Str "should",Space,Link [Str "not"] (Ref []),Space,Str "be",Space,Str "a",Space,Str "link."]
+, Key [Str "once"] (Src "/url" "")
+, Key [Str "twice"] (Src "/url" "")
+, Key [Str "thrice"] (Src "/url" "")
+, CodeBlock "[not]: /url\n"
+, Key [Str "b"] (Src "/url/" "")
+, Para [Str "Foo",Space,Link [Str "bar"] (Ref []),Str "."]
+, Para [Str "Foo",Space,Link [Str "biz"] (Src "/url/" "Title with &quot;quote&quot; inside"),Str "."]
+, Key [Str "bar"] (Src "/url/" "Title with &quot;quotes&quot; inside")
+, Header 2 [Str "With",Space,Str "ampersands"]
+, Para [Str "Here's",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] (Ref [Str "1"]),Str "."]
+, Para [Str "Here's",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link [Str "AT&T"] (Ref [Str "2"]),Str "."]
+, Para [Str "Here's",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] (Src "/script?foo=1&bar=2" ""),Str "."]
+, Para [Str "Here's",Space,Str "an",Space,Link [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] (Src "/script?foo=1&bar=2" ""),Str "."]
+, Key [Str "1"] (Src "http://example.com/?foo=1&bar=2" "")
+, Key [Str "2"] (Src "http://att.com/" "AT&T")
+, Header 2 [Str "Autolinks"]
+, Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link [Str "http://example.com/?foo=1&bar=2"] (Src "http://example.com/?foo=1&bar=2" "")]
+, BulletList
+ [ [ Plain [Str "In",Space,Str "a",Space,Str "list?"] ]
+ , [ Plain [Link [Str "http://example.com/"] (Src "http://example.com/" "")] ]
+ , [ Plain [Str "It",Space,Str "should."] ] ]
+, Para [Str "An",Space,Str "e",Str "-",Str "mail",Space,Str "address:",Space,Link [Str "nobody@nowhere.net"] (Src "mailto:nobody@nowhere.net" "")]
+, BlockQuote
+ [ Para [Str "Blockquoted:",Space,Link [Str "http://example.com/"] (Src "http://example.com/" "")] ]
+
+, Para [Str "Auto",Str "-",Str "links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code "<http://example.com/>"]
+, CodeBlock "or here: <http://example.com/>\n"
+, HorizontalRule
+, Header 1 [Str "Images"]
+, Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
+, Para [Image [Str "lalune"] (Ref [])]
+, Key [Str "lalune"] (Src "lalune.jpg" "Voyage dans la Lune")
+, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] (Src "movie.jpg" ""),Space,Str "icon."]
+, HorizontalRule
+, Header 1 [Str "Footnotes"]
+, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",NoteRef "1",Str ",",Space,Str "and",Space,Str "another",NoteRef "longnote",Str ".",Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space",Str "^",Str "(my",Space,Str "note)."]
+, Note "1"
+ [ Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "in",Space,Str "the",Space,Str "document,",Space,Str "not",Space,Str "just",Space,Str "at",Space,Str "the",Space,Str "end."] ]
+
+, Note "longnote"
+ [ Para [Str "Here's",Space,Str "the",Space,Str "other",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."]
+ , Para [Str "Caret",Space,Str "characters",Space,Str "are",Space,Str "used",Space,Str "to",Space,Str "indicate",Space,Str "that",Space,Str "the",Space,Str "blocks",Space,Str "all",Space,Str "belong",Space,Str "to",Space,Str "a",Space,Str "single",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "block",Space,Str "quotes)."]
+ , CodeBlock " { <code> }\n"
+ , Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "use",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "every",Space,Str "line,",Space,Str "as",Space,Str "with",Space,Str "blockquotes,",Space,Str "but",Space,Str "all",Space,Str "that",Space,Str "you",Space,Str "need",Space,Str "is",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "the",Space,Str "block",Space,Str "and",Space,Str "any",Space,Str "preceding",Space,Str "blank",Space,Str "lines."] ] ]
diff --git a/tests/testsuite.txt b/tests/testsuite.txt
new file mode 100644
index 000000000..8bcbbd0f9
--- /dev/null
+++ b/tests/testsuite.txt
@@ -0,0 +1,612 @@
+% Pandoc Test Suite
+% John MacFarlane, Anonymous
+% July 17, 2006
+
+This is a set of tests for pandoc. Most of them are adapted from
+John Gruber's markdown test suite.
+
+-----
+
+# Headers
+
+## Level 2 with an [embedded link](/url)
+
+### Level 3 with *emphasis*
+
+#### Level 4
+
+##### Level 5
+
+Level 1
+=======
+
+Level 2 with *emphasis*
+-----------------------
+
+### Level 3
+with no blank line
+
+Level 2
+-------
+with no blank line
+
+----------
+
+# Paragraphs
+
+Here's a regular paragraph.
+
+In Markdown 1.0.0 and earlier. Version
+8. This line turns into a list item.
+Because a hard-wrapped line in the
+middle of a paragraph looked like a
+list item.
+
+Here's one with a bullet.
+* criminey.
+
+There should be a hard line break
+here.
+
+---
+
+# Block Quotes
+
+E-mail style:
+
+> This is a block quote.
+> It is pretty short.
+
+> Code in a block quote:
+>
+> sub status {
+> print "working";
+> }
+>
+> A list:
+>
+> 1. item one
+> 2. item two
+>
+> Nested block quotes:
+>
+> > nested
+>
+>> nested
+>
+
+This should not be a block quote: 2
+> 1.
+
+Box-style:
+
+,----
+| Example:
+|
+| sub status {
+| print "working";
+| }
+`----
+
+,----
+| 1. do laundry
+| 2. take out the trash
+`----
+
+Here's a nested one:
+
+,----
+| Joe said:
+|
+| ,----
+| | Don't quote me.
+| `----
+`----
+
+And a following paragraph.
+
+* * * *
+
+# Code Blocks
+
+Code:
+
+ ---- (should be four hyphens)
+
+ sub status {
+ print "working";
+ }
+
+ this code block is indented by one tab
+
+And:
+
+ this code block is indented by two tabs
+
+ These should not be escaped: \$ \\ \> \[ \{
+
+___________
+
+# Lists
+
+## Unordered
+
+Asterisks tight:
+
+* asterisk 1
+* asterisk 2
+* asterisk 3
+
+Asterisks loose:
+
+* asterisk 1
+
+* asterisk 2
+
+* asterisk 3
+
+Pluses tight:
+
++ Plus 1
++ Plus 2
++ Plus 3
+
+Pluses loose:
+
++ Plus 1
+
++ Plus 2
+
++ Plus 3
+
+Minuses tight:
+
+- Minus 1
+- Minus 2
+- Minus 3
+
+Minuses loose:
+
+- Minus 1
+
+- Minus 2
+
+- Minus 3
+
+## Ordered
+
+Tight:
+
+1. First
+2. Second
+3. Third
+
+and:
+
+1. One
+2. Two
+3. Three
+
+Loose using tabs:
+
+1. First
+
+2. Second
+
+3. Third
+
+and using spaces:
+
+1. One
+
+2. Two
+
+3. Three
+
+Multiple paragraphs:
+
+1. Item 1, graf one.
+
+ Item 1. graf two. The quick brown fox jumped over the lazy dog's
+ back.
+
+2. Item 2.
+
+3. Item 3.
+
+## Nested
+
+* Tab
+ * Tab
+ * Tab
+
+Here's another:
+
+1. First
+2. Second:
+ * Fee
+ * Fie
+ * Foe
+3. Third
+
+Same thing but with paragraphs:
+
+1. First
+
+2. Second:
+
+ * Fee
+ * Fie
+ * Foe
+
+3. Third
+
+## Tabs and spaces
+
++ this is a list item
+ indented with tabs
+
++ this is a list item
+ indented with spaces
+
+ + this is an example list item
+ indented with tabs
+
+ + this is an example list item
+ indented with spaces
+
+ * * * * *
+
+# HTML Blocks
+
+Simple block on one line:
+
+<div>foo</div>
+
+And nested without indentation:
+
+<div>
+<div>
+<div>
+foo
+</div>
+</div>
+<div>bar</div>
+</div>
+
+Interpreted markdown in a table:
+
+<table>
+<tr>
+<td>This is *emphasized*</td>
+<td>And this is **strong**</td>
+</tr>
+</table>
+
+<script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>
+
+Here's a simple block:
+
+<div>
+ foo
+</div>
+
+This should be a code block, though:
+
+ <div>
+ foo
+ </div>
+
+As should this:
+
+ <div>foo</div>
+
+Now, nested:
+
+<div>
+ <div>
+ <div>
+ foo
+ </div>
+ </div>
+</div>
+
+This should just be an HTML comment:
+
+<!-- Comment -->
+
+Multiline:
+
+<!--
+Blah
+Blah
+-->
+
+<!--
+ This is another comment.
+-->
+
+Code block:
+
+ <!-- Comment -->
+
+Just plain comment, with trailing spaces on the line:
+
+<!-- foo -->
+
+Code:
+
+ <hr />
+
+Hr's:
+
+<hr>
+
+<hr/>
+
+<hr />
+
+<hr>
+
+<hr/>
+
+<hr />
+
+<hr class="foo" id="bar" />
+
+<hr class="foo" id="bar"/>
+
+<hr class="foo" id="bar" >
+
+-----
+
+# Inline Markup
+
+This is *emphasized*, and so _is this_.
+
+This is **strong**, and so __is this__.
+
+An *[emphasized link](/url)*.
+
+***This is strong and em.***
+
+So is ***this*** word.
+
+___This is strong and em.___
+
+So is ___this___ word.
+
+This is code: `>`, `$`, `\`, `\$`, `<html>`.
+
+-----
+
+# Smart quotes, ellipses, dashes
+
+"Hello," said the spider. "'Shelob' is my name."
+
+'A', 'B', and 'C' are letters.
+
+'Oak,' 'elm,' and 'beech' are names of trees.
+So is 'pine.'
+
+'He said, "I want to go."' Were you alive in the
+70's?
+
+Here is some quoted '`code`' and a "[quoted link][1]".
+
+Some dashes: one---two --- three--four -- five.
+
+Dashes between numbers: 5-7, 255-66, 1987-1999.
+
+Ellipses...and. . .and . . . .
+
+-----
+
+# LaTeX
+
+- \cite[22-23]{smith.1899}
+- \doublespacing
+- $2+2=4$
+- $x \in y$
+- $\alpha \wedge \omega$
+- $223$
+- $p$-Tree
+- $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
+- Here's one that has a line break in it: $\alpha + \omega \times
+x^2$.
+
+These shouldn't be math:
+
+- To get the famous equation, write `$e = mc^2$`.
+- $22,000 is a *lot* of money. So is $34,000.
+ (It worked if "lot" is emphasized.)
+- Escaped `$`: $73 *this should be emphasized* 23\$.
+
+Here's a LaTeX table:
+
+\begin{tabular}{|l|l|}\hline
+Animal & Number \\ \hline
+Dog & 2 \\
+Cat & 1 \\ \hline
+\end{tabular}
+
+* * * * *
+
+# Special Characters
+
+Here is some unicode:
+
+- I hat: Î
+- o umlaut: ö
+- section: §
+- set membership: ∈
+- copyright: ©
+
+AT&T has an ampersand in their name.
+
+AT&amp;T is another way to write it.
+
+This & that.
+
+4 < 5.
+
+6 > 5.
+
+Backslash: \\
+
+Backtick: \`
+
+Asterisk: \*
+
+Underscore: \_
+
+Left brace: \{
+
+Right brace: \}
+
+Left bracket: \[
+
+Right bracket: \]
+
+Left paren: \(
+
+Right paren: \)
+
+Greater-than: \>
+
+Hash: \#
+
+Period: \.
+
+Bang: \!
+
+Plus: \+
+
+Minus: \-
+
+- - - - - - - - - - - - -
+
+# Links
+
+## Explicit
+
+Just a [URL](/url/).
+
+[URL and title](/url/ "title").
+
+[URL and title](/url/ "title preceded by two spaces").
+
+[URL and title](/url/ "title preceded by a tab").
+
+[URL and title](/url/ "title with \"quotes\" in it")
+
+[URL and title](/url/ 'title with single quotes')
+
+[Email link](mailto:nobody@nowhere.net)
+
+[Empty]().
+
+## Reference
+
+Foo [bar] [a].
+
+Foo [bar][a].
+
+Foo [bar]
+[a].
+
+[a]: /url/
+
+With [embedded [brackets]] [b].
+
+[b] by itself should be a link.
+
+Indented [once][].
+
+Indented [twice][].
+
+Indented [thrice][].
+
+This should [not][] be a link.
+
+ [once]: /url
+
+ [twice]: /url
+
+ [thrice]: /url
+
+ [not]: /url
+
+[b]: /url/
+
+Foo [bar][].
+
+Foo [biz](/url/ "Title with \"quote\" inside").
+
+ [bar]: /url/ "Title with \"quotes\" inside"
+
+## With ampersands
+
+Here's a [link with an ampersand in the URL] [1].
+
+Here's a link with an amersand in the link text: [AT&T] [2].
+
+Here's an [inline link](/script?foo=1&bar=2).
+
+Here's an [inline link in pointy braces](</script?foo=1&bar=2>).
+
+[1]: http://example.com/?foo=1&bar=2
+[2]: http://att.com/ "AT&T"
+
+## Autolinks
+
+With an ampersand: <http://example.com/?foo=1&bar=2>
+
+* In a list?
+* <http://example.com/>
+* It should.
+
+An e-mail address: <nobody@nowhere.net>
+
+> Blockquoted: <http://example.com/>
+
+Auto-links should not occur here: `<http://example.com/>`
+
+ or here: <http://example.com/>
+
+----
+
+# Images
+
+From "Voyage dans la Lune" by Georges Melies (1902):
+
+![lalune][]
+
+ [lalune]: lalune.jpg "Voyage dans la Lune"
+
+Here is a movie ![movie](movie.jpg) icon.
+
+----
+
+# Footnotes
+
+Here is a footnote reference^(1), and another^(longnote).
+This should *not* be a footnote reference, because it
+contains a space^(my note).
+
+^(1) Here is the footnote. It can go anywhere in the document,
+not just at the end.
+
+^(longnote) Here's the other note. This one contains multiple
+blocks.
+^
+^ Caret characters are used to indicate that the blocks all belong
+to a single footnote (as with block quotes).
+^
+^ { <code> }
+^
+^ If you want, you can use a caret at the beginning of every line,
+^ as with blockquotes, but all that you need is a caret at the
+^ beginning of the first line of the block and any preceding
+^ blank lines.
+
diff --git a/tests/writer.html b/tests/writer.html
new file mode 100644
index 000000000..0eb528a63
--- /dev/null
+++ b/tests/writer.html
@@ -0,0 +1,456 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta name="generator" content="pandoc" />
+<style type="text/css">
+div.pandocNote { border-left: 1px solid grey; padding-left: 1em; }
+span.pandocNoteRef { vertical-align: super; font-size: 80%; }
+span.pandocNoteMarker { }
+</style>
+<meta name="author" content="John MacFarlane, Anonymous" />
+<meta name="date" content="July 17, 2006" />
+<title>Pandoc Test Suite</title>
+</head>
+<body>
+<h1 class="title">Pandoc Test Suite</h1>
+<p>This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite.</p>
+<hr />
+<h1>Headers</h1>
+<h2>Level 2 with an <a href="/url">embedded link</a></h2>
+<h3>Level 3 with <em>emphasis</em></h3>
+<h4>Level 4</h4>
+<h5>Level 5</h5>
+<h1>Level 1</h1>
+<h2>Level 2 with <em>emphasis</em></h2>
+<h3>Level 3</h3>
+<p>with no blank line</p>
+<h2>Level 2</h2>
+<p>with no blank line</p>
+<hr />
+<h1>Paragraphs</h1>
+<p>Here's a regular paragraph.</p>
+<p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</p>
+<p>Here's one with a bullet. * criminey.</p>
+<p>There should be a hard line break<br />
+here.</p>
+<hr />
+<h1>Block Quotes</h1>
+<p>E-mail style:</p>
+<blockquote>
+<p>This is a block quote. It is pretty short.</p>
+</blockquote>
+<blockquote>
+<p>Code in a block quote:</p>
+<pre><code>sub status {
+ print "working";
+}
+</code></pre>
+<p>A list:</p>
+<ol>
+<li>item one</li>
+<li>item two</li>
+</ol>
+<p>Nested block quotes:</p>
+<blockquote>
+<p>nested</p>
+</blockquote>
+<blockquote>
+<p>nested</p>
+</blockquote>
+</blockquote>
+<p>This should not be a block quote: 2 &gt; 1.</p>
+<p>Box-style:</p>
+<blockquote>
+<p>Example:</p>
+<pre><code>sub status {
+ print "working";
+}
+</code></pre>
+</blockquote>
+<blockquote>
+<ol>
+<li>do laundry</li>
+<li>take out the trash</li>
+</ol>
+</blockquote>
+<p>Here's a nested one:</p>
+<blockquote>
+<p>Joe said:</p>
+<blockquote>
+<p>Don't quote me.</p>
+</blockquote>
+</blockquote>
+<p>And a following paragraph.</p>
+<hr />
+<h1>Code Blocks</h1>
+<p>Code:</p>
+<pre><code>---- (should be four hyphens)
+
+sub status {
+ print "working";
+}
+
+this code block is indented by one tab
+</code></pre>
+<p>And:</p>
+<pre><code> this code block is indented by two tabs
+
+These should not be escaped: \$ \\ \> \[ \{
+</code></pre>
+<hr />
+<h1>Lists</h1>
+<h2>Unordered</h2>
+<p>Asterisks tight:</p>
+<ul>
+<li>asterisk 1</li>
+<li>asterisk 2</li>
+<li>asterisk 3</li>
+</ul>
+<p>Asterisks loose:</p>
+<ul>
+<li><p>asterisk 1</p>
+</li>
+<li><p>asterisk 2</p>
+</li>
+<li><p>asterisk 3</p>
+</li>
+</ul>
+<p>Pluses tight:</p>
+<ul>
+<li>Plus 1</li>
+<li>Plus 2</li>
+<li>Plus 3</li>
+</ul>
+<p>Pluses loose:</p>
+<ul>
+<li><p>Plus 1</p>
+</li>
+<li><p>Plus 2</p>
+</li>
+<li><p>Plus 3</p>
+</li>
+</ul>
+<p>Minuses tight:</p>
+<ul>
+<li>Minus 1</li>
+<li>Minus 2</li>
+<li>Minus 3</li>
+</ul>
+<p>Minuses loose:</p>
+<ul>
+<li><p>Minus 1</p>
+</li>
+<li><p>Minus 2</p>
+</li>
+<li><p>Minus 3</p>
+</li>
+</ul>
+<h2>Ordered</h2>
+<p>Tight:</p>
+<ol>
+<li>First</li>
+<li>Second</li>
+<li>Third</li>
+</ol>
+<p>and:</p>
+<ol>
+<li>One</li>
+<li>Two</li>
+<li>Three</li>
+</ol>
+<p>Loose using tabs:</p>
+<ol>
+<li><p>First</p>
+</li>
+<li><p>Second</p>
+</li>
+<li><p>Third</p>
+</li>
+</ol>
+<p>and using spaces:</p>
+<ol>
+<li><p>One</p>
+</li>
+<li><p>Two</p>
+</li>
+<li><p>Three</p>
+</li>
+</ol>
+<p>Multiple paragraphs:</p>
+<ol>
+<li><p>Item 1, graf one.</p>
+<p>Item 1. graf two. The quick brown fox jumped over the lazy dog's back.</p>
+</li>
+<li><p>Item 2.</p>
+</li>
+<li><p>Item 3.</p>
+</li>
+</ol>
+<h2>Nested</h2>
+<ul>
+<li>Tab<ul>
+<li>Tab<ul>
+<li>Tab</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+<p>Here's another:</p>
+<ol>
+<li>First</li>
+<li>Second:<ul>
+<li>Fee</li>
+<li>Fie</li>
+<li>Foe</li>
+</ul>
+</li>
+<li>Third</li>
+</ol>
+<p>Same thing but with paragraphs:</p>
+<ol>
+<li><p>First</p>
+</li>
+<li><p>Second:</p>
+<ul>
+<li>Fee</li>
+<li>Fie</li>
+<li>Foe</li>
+</ul>
+</li>
+<li><p>Third</p>
+</li>
+</ol>
+<h2>Tabs and spaces</h2>
+<ul>
+<li><p>this is a list item indented with tabs</p>
+</li>
+<li><p>this is a list item indented with spaces</p>
+<ul>
+<li><p>this is an example list item indented with tabs</p>
+</li>
+<li><p>this is an example list item indented with spaces</p>
+</li>
+</ul>
+</li>
+</ul>
+<hr />
+<h1>HTML Blocks</h1>
+<p>Simple block on one line:</p>
+<div>foo</div>
+<p>And nested without indentation:</p>
+<div>
+<div>
+<div>foo</div>
+</div>
+<div>bar</div>
+</div>
+<p>Interpreted markdown in a table:</p>
+<table>
+<tr>
+<td>This is <em>emphasized</em></td>
+<td>And this is <strong>strong</strong></td>
+</tr>
+</table>
+
+<script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>
+<p>Here's a simple block:</p>
+<div>
+ foo</div>
+<p>This should be a code block, though:</p>
+<pre><code>&lt;div>
+ foo
+&lt;/div>
+</code></pre>
+<p>As should this:</p>
+<pre><code>&lt;div>foo&lt;/div>
+</code></pre>
+<p>Now, nested:</p>
+<div>
+ <div>
+ <div>
+ foo</div>
+ </div>
+</div>
+<p>This should just be an HTML comment:</p>
+<!-- Comment -->
+<p>Multiline:</p>
+<!--
+Blah
+Blah
+-->
+
+<!--
+ This is another comment.
+-->
+<p>Code block:</p>
+<pre><code>&lt;!-- Comment -->
+</code></pre>
+<p>Just plain comment, with trailing spaces on the line:</p>
+<!-- foo -->
+<p>Code:</p>
+<pre><code>&lt;hr />
+</code></pre>
+<p>Hr's:</p>
+<hr>
+
+<hr />
+
+<hr />
+
+<hr>
+
+<hr />
+
+<hr />
+
+<hr class="foo" id="bar" />
+
+<hr class="foo" id="bar" />
+
+<hr class="foo" id="bar">
+<hr />
+<h1>Inline Markup</h1>
+<p>This is <em>emphasized</em>, and so <em>is this</em>.</p>
+<p>This is <strong>strong</strong>, and so <strong>is this</strong>.</p>
+<p>An <em><a href="/url">emphasized link</a></em>.</p>
+<p><strong><em>This is strong and em.</em></strong></p>
+<p>So is <strong><em>this</em></strong> word.</p>
+<p><strong><em>This is strong and em.</em></strong></p>
+<p>So is <strong><em>this</em></strong> word.</p>
+<p>This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>, <code>&lt;html></code>.</p>
+<hr />
+<h1>Smart quotes, ellipses, dashes</h1>
+<p>"Hello," said the spider. "'Shelob' is my name."</p>
+<p>'A', 'B', and 'C' are letters.</p>
+<p>'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.'</p>
+<p>'He said, "I want to go."' Were you alive in the 70's?</p>
+<p>Here is some quoted '<code>code</code>' and a "<a href="http://example.com/?foo=1&amp;bar=2">quoted link</a>".</p>
+<p>Some dashes: one---two --- three--four -- five.</p>
+<p>Dashes between numbers: 5-7, 255-66, 1987-1999.</p>
+<p>Ellipses...and. . .and . . . .</p>
+<hr />
+<h1>LaTeX</h1>
+<ul>
+<li>\cite[22-23]{smith.1899}</li>
+<li>\doublespacing</li>
+<li>$2+2=4$</li>
+<li>$x \in y$</li>
+<li>$\alpha \wedge \omega$</li>
+<li>$223$</li>
+<li>$p$-Tree</li>
+<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
+<li>Here's one that has a line break in it: $\alpha + \omega \times x^2$.</li>
+</ul>
+<p>These shouldn't be math:</p>
+<ul>
+<li>To get the famous equation, write <code>$e = mc^2$</code>.</li>
+<li>$22,000 is a <em>lot</em> of money. So is $34,000. (It worked if "lot" is emphasized.)</li>
+<li>Escaped <code>$</code>: $73 <em>this should be emphasized</em> 23$.</li>
+</ul>
+<p>Here's a LaTeX table:</p>
+<p>\begin{tabular}{|l|l|}\hline
+Animal &amp; Number \\ \hline
+Dog &amp; 2 \\
+Cat &amp; 1 \\ \hline
+\end{tabular}</p>
+<hr />
+<h1>Special Characters</h1>
+<p>Here is some unicode:</p>
+<ul>
+<li>I hat: Î</li>
+<li>o umlaut: ö</li>
+<li>section: §</li>
+<li>set membership: ∈</li>
+<li>copyright: ©</li>
+</ul>
+<p>AT&amp;T has an ampersand in their name.</p>
+<p>AT&amp;T is another way to write it.</p>
+<p>This &amp; that.</p>
+<p>4 &lt; 5.</p>
+<p>6 &gt; 5.</p>
+<p>Backslash: \</p>
+<p>Backtick: `</p>
+<p>Asterisk: *</p>
+<p>Underscore: _</p>
+<p>Left brace: {</p>
+<p>Right brace: }</p>
+<p>Left bracket: [</p>
+<p>Right bracket: ]</p>
+<p>Left paren: (</p>
+<p>Right paren: )</p>
+<p>Greater-than: &gt;</p>
+<p>Hash: #</p>
+<p>Period: .</p>
+<p>Bang: !</p>
+<p>Plus: +</p>
+<p>Minus: -</p>
+<hr />
+<h1>Links</h1>
+<h2>Explicit</h2>
+<p>Just a <a href="/url/">URL</a>.</p>
+<p><a href="/url/" title="title">URL and title</a>.</p>
+<p><a href="/url/" title="title preceded by two spaces">URL and title</a>.</p>
+<p><a href="/url/" title="title preceded by a tab">URL and title</a>.</p>
+<p><a href="/url/" title="title with &quot;quotes&quot; in it">URL and title</a></p>
+<p><a href="/url/" title="title with single quotes">URL and title</a></p>
+<p><script type="text/javascript">h='nowhere.net';n='nobody';e=n+'@'+h;document.write('<a href="mailto:'+e+'">'+'Email link'+'<\/a>');</script><noscript>Email link (nobody [at] nowhere.net)</noscript></p>
+<p><a href="">Empty</a>.</p>
+<h2>Reference</h2>
+<p>Foo <a href="/url/">bar</a>.</p>
+<p>Foo <a href="/url/">bar</a>.</p>
+<p>Foo <a href="/url/">bar</a>.</p>
+<p>With <a href="/url/">embedded [brackets]</a>.</p>
+<p><a href="/url/">b</a> by itself should be a link.</p>
+<p>Indented <a href="/url">once</a>.</p>
+<p>Indented <a href="/url">twice</a>.</p>
+<p>Indented <a href="/url">thrice</a>.</p>
+<p>This should [not] be a link.</p>
+<pre><code>[not]: /url
+</code></pre>
+<p>Foo <a href="/url/" title="Title with &quot;quotes&quot; inside">bar</a>.</p>
+<p>Foo <a href="/url/" title="Title with &quot;quote&quot; inside">biz</a>.</p>
+<h2>With ampersands</h2>
+<p>Here's a <a href="http://example.com/?foo=1&amp;bar=2">link with an ampersand in the URL</a>.</p>
+<p>Here's a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&amp;T</a>.</p>
+<p>Here's an <a href="/script?foo=1&amp;bar=2">inline link</a>.</p>
+<p>Here's an <a href="/script?foo=1&amp;bar=2">inline link in pointy braces</a>.</p>
+<h2>Autolinks</h2>
+<p>With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</a></p>
+<ul>
+<li>In a list?</li>
+<li><a href="http://example.com/">http://example.com/</a></li>
+<li>It should.</li>
+</ul>
+<p>An e-mail address: <script type="text/javascript">h='nowhere.net';n='nobody';e=n+'@'+h;document.write('<a href="mailto:'+e+'">'+e+'<\/a>');</script><noscript>nobody [at] nowhere.net</noscript></p>
+<blockquote>
+<p>Blockquoted: <a href="http://example.com/">http://example.com/</a></p>
+</blockquote>
+<p>Auto-links should not occur here: <code>&lt;http://example.com/></code></p>
+<pre><code>or here: &lt;http://example.com/>
+</code></pre>
+<hr />
+<h1>Images</h1>
+<p>From "Voyage dans la Lune" by Georges Melies (1902):</p>
+<p><img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune"></p>
+<p>Here is a movie <img src="movie.jpg" alt="movie"> icon.</p>
+<hr />
+<h1>Footnotes</h1>
+<p>Here is a footnote reference<span class="pandocNoteRef"><a name="ref_1" href="#note_1">(1)</a></span>, and another<span class="pandocNoteRef"><a name="ref_longnote" href="#note_longnote">(longnote)</a></span>. This should <em>not</em> be a footnote reference, because it contains a space^(my note).</p>
+<div class="pandocNote">
+<p class="first"><span class="pandocNoteMarker"><a name="note_1" href="#ref_1">(1)</a></span> Here is the footnote. It can go anywhere in the document, not just at the end.</p>
+
+</div>
+<div class="pandocNote">
+<p class="first"><span class="pandocNoteMarker"><a name="note_longnote" href="#ref_longnote">(longnote)</a></span> Here's the other note. This one contains multiple blocks.</p>
+<p>Caret characters are used to indicate that the blocks all belong to a single footnote (as with block quotes).</p>
+<pre><code> { &lt;code> }
+</code></pre>
+<p>If you want, you can use a caret at the beginning of every line, as with blockquotes, but all that you need is a caret at the beginning of the first line of the block and any preceding blank lines.</p>
+
+</div>
+</body>
+</html>
+
diff --git a/tests/writer.latex b/tests/writer.latex
new file mode 100644
index 000000000..6f3efc710
--- /dev/null
+++ b/tests/writer.latex
@@ -0,0 +1,581 @@
+\documentclass{article}
+\usepackage{hyperref}
+\usepackage{ucs}
+\usepackage[utf8x]{inputenc}
+\usepackage{graphicx}
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{6pt plus 2pt minus 1pt}
+% This is needed for code blocks in footnotes:
+\usepackage{fancyvrb}
+\VerbatimFootnotes
+\setcounter{secnumdepth}{0}
+\title{Pandoc Test Suite}
+\author{John MacFarlane\\Anonymous}
+\date{July 17, 2006}
+\begin{document}
+\maketitle
+This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite.
+
+\begin{center}\rule{3in}{0.4pt}\end{center}
+
+\section{Headers}
+
+\subsection{Level 2 with an \href{/url}{embedded link}}
+
+\subsubsection{Level 3 with \emph{emphasis}}
+
+Level 4
+
+Level 5
+
+\section{Level 1}
+
+\subsection{Level 2 with \emph{emphasis}}
+
+\subsubsection{Level 3}
+
+with no blank line
+
+\subsection{Level 2}
+
+with no blank line
+
+\begin{center}\rule{3in}{0.4pt}\end{center}
+
+\section{Paragraphs}
+
+Here's a regular paragraph.
+
+In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.
+
+Here's one with a bullet. * criminey.
+
+There should be a hard line break\\
+here.
+
+\begin{center}\rule{3in}{0.4pt}\end{center}
+
+\section{Block Quotes}
+
+E-mail style:
+
+\begin{quote}
+This is a block quote. It is pretty short.
+
+\end{quote}
+\begin{quote}
+Code in a block quote:
+
+\begin{verbatim}
+sub status {
+ print "working";
+}
+\end{verbatim}
+A list:
+
+\begin{enumerate}
+\item item one
+\item item two
+\end{enumerate}
+Nested block quotes:
+
+\begin{quote}
+nested
+
+\end{quote}
+\begin{quote}
+nested
+
+\end{quote}
+\end{quote}
+This should not be a block quote: 2 \textgreater{} 1.
+
+Box-style:
+
+\begin{quote}
+Example:
+
+\begin{verbatim}
+sub status {
+ print "working";
+}
+\end{verbatim}
+\end{quote}
+\begin{quote}
+\begin{enumerate}
+\item do laundry
+\item take out the trash
+\end{enumerate}
+\end{quote}
+Here's a nested one:
+
+\begin{quote}
+Joe said:
+
+\begin{quote}
+Don't quote me.
+
+\end{quote}
+\end{quote}
+And a following paragraph.
+
+\begin{center}\rule{3in}{0.4pt}\end{center}
+
+\section{Code Blocks}
+
+Code:
+
+\begin{verbatim}
+---- (should be four hyphens)
+
+sub status {
+ print "working";
+}
+
+this code block is indented by one tab
+\end{verbatim}
+And:
+
+\begin{verbatim}
+ this code block is indented by two tabs
+
+These should not be escaped: \$ \\ \> \[ \{
+\end{verbatim}
+\begin{center}\rule{3in}{0.4pt}\end{center}
+
+\section{Lists}
+
+\subsection{Unordered}
+
+Asterisks tight:
+
+\begin{itemize}
+\item asterisk 1
+\item asterisk 2
+\item asterisk 3
+\end{itemize}
+Asterisks loose:
+
+\begin{itemize}
+\item asterisk 1
+
+\item asterisk 2
+
+\item asterisk 3
+
+\end{itemize}
+Pluses tight:
+
+\begin{itemize}
+\item Plus 1
+\item Plus 2
+\item Plus 3
+\end{itemize}
+Pluses loose:
+
+\begin{itemize}
+\item Plus 1
+
+\item Plus 2
+
+\item Plus 3
+
+\end{itemize}
+Minuses tight:
+
+\begin{itemize}
+\item Minus 1
+\item Minus 2
+\item Minus 3
+\end{itemize}
+Minuses loose:
+
+\begin{itemize}
+\item Minus 1
+
+\item Minus 2
+
+\item Minus 3
+
+\end{itemize}
+\subsection{Ordered}
+
+Tight:
+
+\begin{enumerate}
+\item First
+\item Second
+\item Third
+\end{enumerate}
+and:
+
+\begin{enumerate}
+\item One
+\item Two
+\item Three
+\end{enumerate}
+Loose using tabs:
+
+\begin{enumerate}
+\item First
+
+\item Second
+
+\item Third
+
+\end{enumerate}
+and using spaces:
+
+\begin{enumerate}
+\item One
+
+\item Two
+
+\item Three
+
+\end{enumerate}
+Multiple paragraphs:
+
+\begin{enumerate}
+\item Item 1, graf one.
+
+Item 1. graf two. The quick brown fox jumped over the lazy dog's back.
+
+\item Item 2.
+
+\item Item 3.
+
+\end{enumerate}
+\subsection{Nested}
+
+\begin{itemize}
+\item Tab
+\begin{itemize}
+\item Tab
+\begin{itemize}
+\item Tab
+\end{itemize}
+\end{itemize}
+\end{itemize}
+Here's another:
+
+\begin{enumerate}
+\item First
+\item Second:
+\begin{itemize}
+\item Fee
+\item Fie
+\item Foe
+\end{itemize}
+\item Third
+\end{enumerate}
+Same thing but with paragraphs:
+
+\begin{enumerate}
+\item First
+
+\item Second:
+
+\begin{itemize}
+\item Fee
+\item Fie
+\item Foe
+\end{itemize}
+\item Third
+
+\end{enumerate}
+\subsection{Tabs and spaces}
+
+\begin{itemize}
+\item this is a list item indented with tabs
+
+\item this is a list item indented with spaces
+
+\begin{itemize}
+\item this is an example list item indented with tabs
+
+\item this is an example list item indented with spaces
+
+\end{itemize}
+\end{itemize}
+\begin{center}\rule{3in}{0.4pt}\end{center}
+
+\section{HTML Blocks}
+
+Simple block on one line:
+
+foo
+And nested without indentation:
+
+foo
+bar
+Interpreted markdown in a table:
+
+This is \emph{emphasized}
+And this is \textbf{strong}
+Here's a simple block:
+
+foo
+This should be a code block, though:
+
+\begin{verbatim}
+<div>
+ foo
+</div>
+\end{verbatim}
+As should this:
+
+\begin{verbatim}
+<div>foo</div>
+\end{verbatim}
+Now, nested:
+
+foo
+This should just be an HTML comment:
+
+Multiline:
+
+Code block:
+
+\begin{verbatim}
+<!-- Comment -->
+\end{verbatim}
+Just plain comment, with trailing spaces on the line:
+
+Code:
+
+\begin{verbatim}
+<hr />
+\end{verbatim}
+Hr's:
+
+\begin{center}\rule{3in}{0.4pt}\end{center}
+
+\section{Inline Markup}
+
+This is \emph{emphasized}, and so \emph{is this}.
+
+This is \textbf{strong}, and so \textbf{is this}.
+
+An \emph{\href{/url}{emphasized link}}.
+
+\textbf{\emph{This is strong and em.}}
+
+So is \textbf{\emph{this}} word.
+
+\textbf{\emph{This is strong and em.}}
+
+So is \textbf{\emph{this}} word.
+
+This is code: \verb!>!, \verb!$!, \verb!\!, \verb!\$!, \verb!<html>!.
+
+\begin{center}\rule{3in}{0.4pt}\end{center}
+
+\section{Smart quotes, ellipses, dashes}
+
+``Hello,'' said the spider. ``{}`Shelob' is my name.''
+
+`A', `B', and `C' are letters.
+
+`Oak,' `elm,' and `beech' are names of trees. So is `pine.'
+
+`He said, ``I want to go.''' Were you alive in the 70's?
+
+Here is some quoted `\verb!code!' and a ``\href{http://example.com/?foo=1&bar=2}{quoted link}''.
+
+Some dashes: one---two --- three---four---five.
+
+Dashes between numbers: 5--7, 255--66, 1987--1999.
+
+Ellipses\ldots{}and\ldots{}and \ldots{} .
+
+\begin{center}\rule{3in}{0.4pt}\end{center}
+
+\section{LaTeX}
+
+\begin{itemize}
+\item \cite[22-23]{smith.1899}
+\item \doublespacing
+\item $2+2=4$
+\item $x \in y$
+\item $\alpha \wedge \omega$
+\item $223$
+\item $p$-Tree
+\item $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
+\item Here's one that has a line break in it: $\alpha + \omega \times x^2$.
+\end{itemize}
+These shouldn't be math:
+
+\begin{itemize}
+\item To get the famous equation, write \verb!$e = mc^2$!.
+\item \$22,000 is a \emph{lot} of money. So is \$34,000. (It worked if ``lot'' is emphasized.)
+\item Escaped \verb!$!: \$73 \emph{this should be emphasized} 23\$.
+\end{itemize}
+Here's a LaTeX table:
+
+\begin{tabular}{|l|l|}\hline
+Animal & Number \\ \hline
+Dog & 2 \\
+Cat & 1 \\ \hline
+\end{tabular}
+
+\begin{center}\rule{3in}{0.4pt}\end{center}
+
+\section{Special Characters}
+
+Here is some unicode:
+
+\begin{itemize}
+\item I hat: Î
+\item o umlaut: ö
+\item section: §
+\item set membership: ∈
+\item copyright: ©
+\end{itemize}
+AT\&T has an ampersand in their name.
+
+AT\&T is another way to write it.
+
+This \& that.
+
+4 \textless{} 5.
+
+6 \textgreater{} 5.
+
+Backslash: \textbackslash{}
+
+Backtick: `
+
+Asterisk: *
+
+Underscore: \_
+
+Left brace: \{
+
+Right brace: \}
+
+Left bracket: [
+
+Right bracket: ]
+
+Left paren: (
+
+Right paren: )
+
+Greater-than: \textgreater{}
+
+Hash: \#
+
+Period: .
+
+Bang: !
+
+Plus: +
+
+Minus: -
+
+\begin{center}\rule{3in}{0.4pt}\end{center}
+
+\section{Links}
+
+\subsection{Explicit}
+
+Just a \href{/url/}{URL}.
+
+\href{/url/}{URL and title}.
+
+\href{/url/}{URL and title}.
+
+\href{/url/}{URL and title}.
+
+\href{/url/}{URL and title}
+
+\href{/url/}{URL and title}
+
+\href{mailto:nobody@nowhere.net}{Email link}
+
+\href{}{Empty}.
+
+\subsection{Reference}
+
+Foo \href{/url/}{bar}.
+
+Foo \href{/url/}{bar}.
+
+Foo \href{/url/}{bar}.
+
+With \href{/url/}{embedded [brackets]}.
+
+\href{/url/}{b} by itself should be a link.
+
+Indented \href{/url}{once}.
+
+Indented \href{/url}{twice}.
+
+Indented \href{/url}{thrice}.
+
+This should [not] be a link.
+
+\begin{verbatim}
+[not]: /url
+\end{verbatim}
+Foo \href{/url/}{bar}.
+
+Foo \href{/url/}{biz}.
+
+\subsection{With ampersands}
+
+Here's a \href{http://example.com/?foo=1&bar=2}{link with an ampersand in the URL}.
+
+Here's a link with an amersand in the link text: \href{http://att.com/}{AT\&T}.
+
+Here's an \href{/script?foo=1&bar=2}{inline link}.
+
+Here's an \href{/script?foo=1&bar=2}{inline link in pointy braces}.
+
+\subsection{Autolinks}
+
+With an ampersand: \href{http://example.com/?foo=1&bar=2}{http://example.com/?foo=1\&bar=2}
+
+\begin{itemize}
+\item In a list?
+\item \href{http://example.com/}{http://example.com/}
+\item It should.
+\end{itemize}
+An e-mail address: \href{mailto:nobody@nowhere.net}{nobody@nowhere.net}
+
+\begin{quote}
+Blockquoted: \href{http://example.com/}{http://example.com/}
+
+\end{quote}
+Auto-links should not occur here: \verb!<http://example.com/>!
+
+\begin{verbatim}
+or here: <http://example.com/>
+\end{verbatim}
+\begin{center}\rule{3in}{0.4pt}\end{center}
+
+\section{Images}
+
+From ``Voyage dans la Lune'' by Georges Melies (1902):
+
+\includegraphics{lalune.jpg}
+
+Here is a movie \includegraphics{movie.jpg} icon.
+
+\begin{center}\rule{3in}{0.4pt}\end{center}
+
+\section{Footnotes}
+
+Here is a footnote reference\footnote{Here is the footnote. It can go anywhere in the document, not just at the end.}, and another\footnote{Here's the other note. This one contains multiple blocks.
+
+Caret characters are used to indicate that the blocks all belong to a single footnote (as with block quotes).
+
+\begin{verbatim}
+ { <code> }
+\end{verbatim}
+If you want, you can use a caret at the beginning of every line, as with blockquotes, but all that you need is a caret at the beginning of the first line of the block and any preceding blank lines.}. This should \emph{not} be a footnote reference, because it contains a space\^{}(my note).
+
+
+\end{document}
+
diff --git a/tests/writer.markdown b/tests/writer.markdown
new file mode 100644
index 000000000..c086190d2
--- /dev/null
+++ b/tests/writer.markdown
@@ -0,0 +1,628 @@
+% Pandoc Test Suite
+% John MacFarlane, Anonymous
+% July 17, 2006
+
+This is a set of tests for pandoc. Most of them are adapted from
+John Gruber's markdown test suite.
+
+
+* * * * *
+
+# Headers
+
+## Level 2 with an [embedded link](/url)
+
+### Level 3 with *emphasis*
+
+#### Level 4
+
+##### Level 5
+
+# Level 1
+
+## Level 2 with *emphasis*
+
+### Level 3
+
+with no blank line
+
+## Level 2
+
+with no blank line
+
+
+* * * * *
+
+# Paragraphs
+
+Here's a regular paragraph.
+
+In Markdown 1.0.0 and earlier. Version 8. This line turns into a
+list item. Because a hard-wrapped line in the middle of a paragraph
+looked like a list item.
+
+Here's one with a bullet. \* criminey.
+
+There should be a hard line break
+here.
+
+
+* * * * *
+
+# Block Quotes
+
+E-mail style:
+
+> This is a block quote. It is pretty short.
+
+> Code in a block quote:
+>
+> sub status {
+> print "working";
+> }
+>
+> A list:
+>
+> 1. item one
+> 2. item two
+>
+> Nested block quotes:
+>
+> > nested
+>
+> > nested
+
+This should not be a block quote: 2 > 1.
+
+Box-style:
+
+> Example:
+>
+> sub status {
+> print "working";
+> }
+
+> 1. do laundry
+> 2. take out the trash
+
+Here's a nested one:
+
+> Joe said:
+>
+> > Don't quote me.
+
+And a following paragraph.
+
+
+* * * * *
+
+# Code Blocks
+
+Code:
+
+ ---- (should be four hyphens)
+
+ sub status {
+ print "working";
+ }
+
+ this code block is indented by one tab
+
+And:
+
+ this code block is indented by two tabs
+
+ These should not be escaped: \$ \\ \> \[ \{
+
+
+* * * * *
+
+# Lists
+
+## Unordered
+
+Asterisks tight:
+
+- asterisk 1
+- asterisk 2
+- asterisk 3
+
+Asterisks loose:
+
+- asterisk 1
+
+- asterisk 2
+
+- asterisk 3
+
+
+Pluses tight:
+
+- Plus 1
+- Plus 2
+- Plus 3
+
+Pluses loose:
+
+- Plus 1
+
+- Plus 2
+
+- Plus 3
+
+
+Minuses tight:
+
+- Minus 1
+- Minus 2
+- Minus 3
+
+Minuses loose:
+
+- Minus 1
+
+- Minus 2
+
+- Minus 3
+
+
+## Ordered
+
+Tight:
+
+1. First
+2. Second
+3. Third
+
+and:
+
+1. One
+2. Two
+3. Three
+
+Loose using tabs:
+
+1. First
+
+2. Second
+
+3. Third
+
+
+and using spaces:
+
+1. One
+
+2. Two
+
+3. Three
+
+
+Multiple paragraphs:
+
+1. Item 1, graf one.
+
+ Item 1. graf two. The quick brown fox jumped over the lazy dog's
+ back.
+
+2. Item 2.
+
+3. Item 3.
+
+
+## Nested
+
+- Tab
+ - Tab
+ - Tab
+
+
+
+Here's another:
+
+1. First
+2. Second:
+ - Fee
+ - Fie
+ - Foe
+
+3. Third
+
+Same thing but with paragraphs:
+
+1. First
+
+2. Second:
+
+ - Fee
+ - Fie
+ - Foe
+
+3. Third
+
+
+## Tabs and spaces
+
+- this is a list item indented with tabs
+
+- this is a list item indented with spaces
+
+ - this is an example list item indented with tabs
+
+ - this is an example list item indented with spaces
+
+
+
+
+* * * * *
+
+# HTML Blocks
+
+Simple block on one line:
+
+<div>
+foo
+</div>
+
+And nested without indentation:
+
+<div>
+<div>
+<div>
+foo
+</div>
+</div>
+<div>
+bar
+</div>
+</div>
+
+Interpreted markdown in a table:
+
+<table>
+<tr>
+<td>
+This is *emphasized*
+</td>
+<td>
+And this is **strong**
+</td>
+</tr>
+</table>
+
+<script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>
+
+Here's a simple block:
+
+<div>
+
+foo
+</div>
+
+This should be a code block, though:
+
+ <div>
+ foo
+ </div>
+
+As should this:
+
+ <div>foo</div>
+
+Now, nested:
+
+<div>
+ <div>
+ <div>
+
+foo
+</div>
+ </div>
+</div>
+
+This should just be an HTML comment:
+
+<!-- Comment -->
+
+Multiline:
+
+<!--
+Blah
+Blah
+-->
+
+<!--
+ This is another comment.
+-->
+
+Code block:
+
+ <!-- Comment -->
+
+Just plain comment, with trailing spaces on the line:
+
+<!-- foo -->
+
+Code:
+
+ <hr />
+
+Hr's:
+
+<hr>
+
+<hr />
+
+<hr />
+
+<hr>
+
+<hr />
+
+<hr />
+
+<hr class="foo" id="bar" />
+
+<hr class="foo" id="bar" />
+
+<hr class="foo" id="bar">
+
+
+* * * * *
+
+# Inline Markup
+
+This is *emphasized*, and so *is this*.
+
+This is **strong**, and so **is this**.
+
+An *[emphasized link](/url)*.
+
+***This is strong and em.***
+
+So is ***this*** word.
+
+***This is strong and em.***
+
+So is ***this*** word.
+
+This is code: `>`, `$`, `\`, `\$`, `<html>`.
+
+
+* * * * *
+
+# Smart quotes, ellipses, dashes
+
+"Hello," said the spider. "'Shelob' is my name."
+
+'A', 'B', and 'C' are letters.
+
+'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.'
+
+'He said, "I want to go."' Were you alive in the 70's?
+
+Here is some quoted '`code`' and a "[quoted link][1]".
+
+Some dashes: one---two --- three--four -- five.
+
+Dashes between numbers: 5-7, 255-66, 1987-1999.
+
+Ellipses...and. . .and . . . .
+
+
+* * * * *
+
+# LaTeX
+
+- \cite[22-23]{smith.1899}
+- \doublespacing
+- $2+2=4$
+- $x \in y$
+- $\alpha \wedge \omega$
+- $223$
+- $p$-Tree
+- $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
+- Here's one that has a line break in it:
+ $\alpha + \omega \times x^2$.
+
+These shouldn't be math:
+
+- To get the famous equation, write `$e = mc^2$`.
+- $22,000 is a *lot* of money. So is $34,000. (It worked if "lot"
+ is emphasized.)
+- Escaped `$`: $73 *this should be emphasized* 23$.
+
+Here's a LaTeX table:
+
+\begin{tabular}{|l|l|}\hline
+Animal & Number \\ \hline
+Dog & 2 \\
+Cat & 1 \\ \hline
+\end{tabular}
+
+
+* * * * *
+
+# Special Characters
+
+Here is some unicode:
+
+- I hat: Î
+- o umlaut: ö
+- section: §
+- set membership: ∈
+- copyright: ©
+
+AT&T has an ampersand in their name.
+
+AT&T is another way to write it.
+
+This & that.
+
+4 \< 5.
+
+6 > 5.
+
+Backslash: \\
+
+Backtick: \`
+
+Asterisk: \*
+
+Underscore: \_
+
+Left brace: {
+
+Right brace: }
+
+Left bracket: [
+
+Right bracket: ]
+
+Left paren: (
+
+Right paren: )
+
+Greater-than: >
+
+Hash: #
+
+Period: .
+
+Bang: !
+
+Plus: +
+
+Minus: -
+
+
+* * * * *
+
+# Links
+
+## Explicit
+
+Just a [URL](/url/).
+
+[URL and title](/url/ "title").
+
+[URL and title](/url/ "title preceded by two spaces").
+
+[URL and title](/url/ "title preceded by a tab").
+
+[URL and title](/url/ "title with &quot;quotes&quot; in it")
+
+[URL and title](/url/ "title with single quotes")
+
+[Email link](mailto:nobody@nowhere.net)
+
+[Empty]().
+
+## Reference
+
+Foo [bar][a].
+
+Foo [bar][a].
+
+Foo [bar][a].
+
+
+ [a]: /url/
+
+With [embedded [brackets][]][b].
+
+[b][] by itself should be a link.
+
+Indented [once][].
+
+Indented [twice][].
+
+Indented [thrice][].
+
+This should [not][] be a link.
+
+
+ [once]: /url
+ [twice]: /url
+ [thrice]: /url
+ [not]: /url
+
+
+ [b]: /url/
+
+Foo [bar][].
+
+Foo [biz](/url/ "Title with &quot;quote&quot; inside").
+
+
+ [bar]: /url/ "Title with &quot;quotes&quot; inside"
+
+## With ampersands
+
+Here's a [link with an ampersand in the URL][1].
+
+Here's a link with an amersand in the link text: [AT&T][2].
+
+Here's an [inline link](/script?foo=1&bar=2).
+
+Here's an [inline link in pointy braces](/script?foo=1&bar=2).
+
+
+ [1]: http://example.com/?foo=1&bar=2
+ [2]: http://att.com/ "AT&T"
+
+## Autolinks
+
+With an ampersand:
+[http://example.com/?foo=1&bar=2](http://example.com/?foo=1&bar=2)
+
+- In a list?
+- [http://example.com/](http://example.com/)
+- It should.
+
+An e-mail address: [nobody@nowhere.net](mailto:nobody@nowhere.net)
+
+> Blockquoted: [http://example.com/](http://example.com/)
+
+Auto-links should not occur here: `<http://example.com/>`
+
+ or here: <http://example.com/>
+
+
+* * * * *
+
+# Images
+
+From "Voyage dans la Lune" by Georges Melies (1902):
+
+![lalune]
+
+
+ [lalune]: lalune.jpg "Voyage dans la Lune"
+
+Here is a movie ![movie](movie.jpg) icon.
+
+
+* * * * *
+
+# Footnotes
+
+Here is a footnote reference^(1), and another^(longnote). This
+should *not* be a footnote reference, because it contains a
+space\^(my note).
+
+^(1) Here is the footnote. It can go anywhere in the document, not just
+^ at the end.
+
+^(longnote) Here's the other note. This one contains multiple blocks.
+^
+^ Caret characters are used to indicate that the blocks all belong to
+^ a single footnote (as with block quotes).
+^
+^ { <code> }
+^
+^ If you want, you can use a caret at the beginning of every line, as
+^ with blockquotes, but all that you need is a caret at the beginning
+^ of the first line of the block and any preceding blank lines.
+
+
diff --git a/tests/writer.native b/tests/writer.native
new file mode 100644
index 000000000..8ec543e89
--- /dev/null
+++ b/tests/writer.native
@@ -0,0 +1,329 @@
+Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite"] ["John MacFarlane","Anonymous"] "July 17, 2006")
+[ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber's",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
+, HorizontalRule
+, Header 1 [Str "Headers"]
+, Header 2 [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embedded",Space,Str "link"] (Src "/url" "")]
+, Header 3 [Str "Level",Space,Str "3",Space,Str "with",Space,Emph [Str "emphasis"]]
+, Header 4 [Str "Level",Space,Str "4"]
+, Header 5 [Str "Level",Space,Str "5"]
+, Header 1 [Str "Level",Space,Str "1"]
+, Header 2 [Str "Level",Space,Str "2",Space,Str "with",Space,Emph [Str "emphasis"]]
+, Header 3 [Str "Level",Space,Str "3"]
+, Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
+, Header 2 [Str "Level",Space,Str "2"]
+, Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
+, HorizontalRule
+, Header 1 [Str "Paragraphs"]
+, Para [Str "Here's",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
+, Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",Space,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item.",Space,Str "Because",Space,Str "a",Space,Str "hard",Str "-",Str "wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item."]
+, Para [Str "Here's",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
+, Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here."]
+, HorizontalRule
+, Header 1 [Str "Block",Space,Str "Quotes"]
+, Para [Str "E",Str "-",Str "mail",Space,Str "style:"]
+, BlockQuote
+ [ Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."] ]
+
+, BlockQuote
+ [ Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
+ , CodeBlock "sub status {\n print \"working\";\n}\n"
+ , Para [Str "A",Space,Str "list:"]
+ , OrderedList
+ [ [ Plain [Str "item",Space,Str "one"] ]
+ , [ Plain [Str "item",Space,Str "two"] ] ]
+ , Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
+ , BlockQuote
+ [ Para [Str "nested"] ]
+
+ , BlockQuote
+ [ Para [Str "nested"] ]
+ ]
+, Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "block",Space,Str "quote:",Space,Str "2",Space,Str ">",Space,Str "1."]
+, Para [Str "Box",Str "-",Str "style:"]
+, BlockQuote
+ [ Para [Str "Example:"]
+ , CodeBlock "sub status {\n print \"working\";\n}\n" ]
+, BlockQuote
+ [ OrderedList
+ [ [ Plain [Str "do",Space,Str "laundry"] ]
+ , [ Plain [Str "take",Space,Str "out",Space,Str "the",Space,Str "trash"] ] ] ]
+, Para [Str "Here's",Space,Str "a",Space,Str "nested",Space,Str "one:"]
+, BlockQuote
+ [ Para [Str "Joe",Space,Str "said:"]
+ , BlockQuote
+ [ Para [Str "Don't",Space,Str "quote",Space,Str "me."] ]
+ ]
+, Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
+, HorizontalRule
+, Header 1 [Str "Code",Space,Str "Blocks"]
+, Para [Str "Code:"]
+, CodeBlock "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab\n"
+, Para [Str "And:"]
+, CodeBlock " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{\n"
+, HorizontalRule
+, Header 1 [Str "Lists"]
+, Header 2 [Str "Unordered"]
+, Para [Str "Asterisks",Space,Str "tight:"]
+, BulletList
+ [ [ Plain [Str "asterisk",Space,Str "1"] ]
+ , [ Plain [Str "asterisk",Space,Str "2"] ]
+ , [ Plain [Str "asterisk",Space,Str "3"] ] ]
+, Para [Str "Asterisks",Space,Str "loose:"]
+, BulletList
+ [ [ Para [Str "asterisk",Space,Str "1"] ]
+ , [ Para [Str "asterisk",Space,Str "2"] ]
+ , [ Para [Str "asterisk",Space,Str "3"] ] ]
+, Para [Str "Pluses",Space,Str "tight:"]
+, BulletList
+ [ [ Plain [Str "Plus",Space,Str "1"] ]
+ , [ Plain [Str "Plus",Space,Str "2"] ]
+ , [ Plain [Str "Plus",Space,Str "3"] ] ]
+, Para [Str "Pluses",Space,Str "loose:"]
+, BulletList
+ [ [ Para [Str "Plus",Space,Str "1"] ]
+ , [ Para [Str "Plus",Space,Str "2"] ]
+ , [ Para [Str "Plus",Space,Str "3"] ] ]
+, Para [Str "Minuses",Space,Str "tight:"]
+, BulletList
+ [ [ Plain [Str "Minus",Space,Str "1"] ]
+ , [ Plain [Str "Minus",Space,Str "2"] ]
+ , [ Plain [Str "Minus",Space,Str "3"] ] ]
+, Para [Str "Minuses",Space,Str "loose:"]
+, BulletList
+ [ [ Para [Str "Minus",Space,Str "1"] ]
+ , [ Para [Str "Minus",Space,Str "2"] ]
+ , [ Para [Str "Minus",Space,Str "3"] ] ]
+, Header 2 [Str "Ordered"]
+, Para [Str "Tight:"]
+, OrderedList
+ [ [ Plain [Str "First"] ]
+ , [ Plain [Str "Second"] ]
+ , [ Plain [Str "Third"] ] ]
+, Para [Str "and:"]
+, OrderedList
+ [ [ Plain [Str "One"] ]
+ , [ Plain [Str "Two"] ]
+ , [ Plain [Str "Three"] ] ]
+, Para [Str "Loose",Space,Str "using",Space,Str "tabs:"]
+, OrderedList
+ [ [ Para [Str "First"] ]
+ , [ Para [Str "Second"] ]
+ , [ Para [Str "Third"] ] ]
+, Para [Str "and",Space,Str "using",Space,Str "spaces:"]
+, OrderedList
+ [ [ Para [Str "One"] ]
+ , [ Para [Str "Two"] ]
+ , [ Para [Str "Three"] ] ]
+, Para [Str "Multiple",Space,Str "paragraphs:"]
+, OrderedList
+ [ [ Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
+ , Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog's",Space,Str "back."] ], [ Para [Str "Item",Space,Str "2."] ]
+ , [ Para [Str "Item",Space,Str "3."] ] ]
+, Header 2 [Str "Nested"]
+, BulletList
+ [ [ Plain [Str "Tab"]
+ , BulletList
+ [ [ Plain [Str "Tab"]
+ , BulletList
+ [ [ Plain [Str "Tab"] ]
+ ] ] ] ] ]
+, Para [Str "Here's",Space,Str "another:"]
+, OrderedList
+ [ [ Plain [Str "First"] ]
+ , [ Plain [Str "Second:"]
+ , BulletList
+ [ [ Plain [Str "Fee"] ]
+ , [ Plain [Str "Fie"] ]
+ , [ Plain [Str "Foe"] ] ] ], [ Plain [Str "Third"] ] ]
+, Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs:"]
+, OrderedList
+ [ [ Para [Str "First"] ]
+ , [ Para [Str "Second:"]
+ , BulletList
+ [ [ Plain [Str "Fee"] ]
+ , [ Plain [Str "Fie"] ]
+ , [ Plain [Str "Foe"] ] ] ], [ Para [Str "Third"] ] ]
+, Header 2 [Str "Tabs",Space,Str "and",Space,Str "spaces"]
+, BulletList
+ [ [ Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"] ]
+ , [ Para [Str "this",Space,Str "is",Space,Str "a",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"]
+ , BulletList
+ [ [ Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "tabs"] ]
+ , [ Para [Str "this",Space,Str "is",Space,Str "an",Space,Str "example",Space,Str "list",Space,Str "item",Space,Str "indented",Space,Str "with",Space,Str "spaces"] ] ] ] ]
+, HorizontalRule
+, Header 1 [Str "HTML",Space,Str "Blocks"]
+, Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
+, RawHtml "<div>"
+, Plain [Str "foo"]
+, RawHtml "</div>\n"
+, Para [Str "And",Space,Str "nested",Space,Str "without",Space,Str "indentation:"]
+, RawHtml "<div>\n<div>\n<div>"
+, Plain [Str "foo"]
+, RawHtml "</div>\n</div>\n<div>"
+, Plain [Str "bar"]
+, RawHtml "</div>\n</div>\n"
+, Para [Str "Interpreted",Space,Str "markdown",Space,Str "in",Space,Str "a",Space,Str "table:"]
+, RawHtml "<table>\n<tr>\n<td>"
+, Plain [Str "This",Space,Str "is",Space,Emph [Str "emphasized"]]
+, RawHtml "</td>\n<td>"
+, Plain [Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"]]
+, RawHtml "</td>\n</tr>\n</table>\n\n<script type=\"text/javascript\">document.write('This *should not* be interpreted as markdown');</script>\n"
+, Para [Str "Here's",Space,Str "a",Space,Str "simple",Space,Str "block:"]
+, RawHtml "<div>\n "
+, Plain [Str "foo"]
+, RawHtml "</div>\n"
+, Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]
+, CodeBlock "<div>\n foo\n</div>\n"
+, Para [Str "As",Space,Str "should",Space,Str "this:"]
+, CodeBlock "<div>foo</div>\n"
+, Para [Str "Now,",Space,Str "nested:"]
+, RawHtml "<div>\n <div>\n <div>\n "
+, Plain [Str "foo"]
+, RawHtml "</div>\n </div>\n</div>\n"
+, Para [Str "This",Space,Str "should",Space,Str "just",Space,Str "be",Space,Str "an",Space,Str "HTML",Space,Str "comment:"]
+, RawHtml "<!-- Comment -->\n"
+, Para [Str "Multiline:"]
+, RawHtml "<!--\nBlah\nBlah\n-->\n\n<!--\n This is another comment.\n-->\n"
+, Para [Str "Code",Space,Str "block:"]
+, CodeBlock "<!-- Comment -->\n"
+, Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"]
+, RawHtml "<!-- foo --> \n"
+, Para [Str "Code:"]
+, CodeBlock "<hr />\n"
+, Para [Str "Hr's:"]
+, RawHtml "<hr>\n\n<hr />\n\n<hr />\n\n<hr> \n\n<hr /> \n\n<hr /> \n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\">\n"
+, HorizontalRule
+, Header 1 [Str "Inline",Space,Str "Markup"]
+, Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str "."]
+, Para [Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str "."]
+, Para [Str "An",Space,Emph [Link [Str "emphasized",Space,Str "link"] (Src "/url" "")],Str "."]
+, Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
+, Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
+, Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
+, Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
+, Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ">",Str ",",Space,Code "$",Str ",",Space,Code "\\",Str ",",Space,Code "\\$",Str ",",Space,Code "<html>",Str "."]
+, HorizontalRule
+, Header 1 [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
+, Para [Str "\"Hello,\"",Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Str "\"'Shelob'",Space,Str "is",Space,Str "my",Space,Str "name.\""]
+, Para [Str "'A',",Space,Str "'B',",Space,Str "and",Space,Str "'C'",Space,Str "are",Space,Str "letters."]
+, Para [Str "'Oak,'",Space,Str "'elm,'",Space,Str "and",Space,Str "'beech'",Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees.",Space,Str "So",Space,Str "is",Space,Str "'pine.'"]
+, Para [Str "'He",Space,Str "said,",Space,Str "\"I",Space,Str "want",Space,Str "to",Space,Str "go.\"'",Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70's?"]
+, Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Str "'",Code "code",Str "'",Space,Str "and",Space,Str "a",Space,Str "\"",Link [Str "quoted",Space,Str "link"] (Ref [Str "1"]),Str "\"."]
+, Para [Str "Some",Space,Str "dashes:",Space,Str "one",Str "---",Str "two",Space,Str "---",Space,Str "three",Str "--",Str "four",Space,Str "--",Space,Str "five."]
+, Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5",Str "-",Str "7,",Space,Str "255",Str "-",Str "66,",Space,Str "1987",Str "-",Str "1999."]
+, Para [Str "Ellipses...and.",Space,Str ".",Space,Str ".and",Space,Str ".",Space,Str ".",Space,Str ".",Space,Str "."]
+, HorizontalRule
+, Header 1 [Str "LaTeX"]
+, BulletList
+ [ [ Plain [TeX "\\cite[22-23]{smith.1899}"] ]
+ , [ Plain [TeX "\\doublespacing"] ]
+ , [ Plain [TeX "$2+2=4$"] ]
+ , [ Plain [TeX "$x \\in y$"] ]
+ , [ Plain [TeX "$\\alpha \\wedge \\omega$"] ]
+ , [ Plain [TeX "$223$"] ]
+ , [ Plain [TeX "$p$",Str "-",Str "Tree"] ]
+ , [ Plain [TeX "$\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}$"] ]
+ , [ Plain [Str "Here's",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,TeX "$\\alpha + \\omega \\times x^2$",Str "."] ] ]
+, Para [Str "These",Space,Str "shouldn't",Space,Str "be",Space,Str "math:"]
+, BulletList
+ [ [ Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code "$e = mc^2$",Str "."] ]
+ , [ Plain [Str "$",Str "22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money.",Space,Str "So",Space,Str "is",Space,Str "$",Str "34,000.",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Str "\"lot\"",Space,Str "is",Space,Str "emphasized.)"] ]
+ , [ Plain [Str "Escaped",Space,Code "$",Str ":",Space,Str "$",Str "73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23",Str "$",Str "."] ] ]
+, Para [Str "Here's",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
+, Para [TeX "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}"]
+, HorizontalRule
+, Header 1 [Str "Special",Space,Str "Characters"]
+, Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
+, BulletList
+ [ [ Plain [Str "I",Space,Str "hat:",Space,Str "\206"] ]
+ , [ Plain [Str "o",Space,Str "umlaut:",Space,Str "\246"] ]
+ , [ Plain [Str "section:",Space,Str "\167"] ]
+ , [ Plain [Str "set",Space,Str "membership:",Space,Str "\8712"] ]
+ , [ Plain [Str "copyright:",Space,Str "\169"] ] ]
+, Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
+, Para [Str "AT&T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it."]
+, Para [Str "This",Space,Str "&",Space,Str "that."]
+, Para [Str "4",Space,Str "<",Space,Str "5."]
+, Para [Str "6",Space,Str ">",Space,Str "5."]
+, Para [Str "Backslash:",Space,Str "\\"]
+, Para [Str "Backtick:",Space,Str "`"]
+, Para [Str "Asterisk:",Space,Str "*"]
+, Para [Str "Underscore:",Space,Str "_"]
+, Para [Str "Left",Space,Str "brace:",Space,Str "{"]
+, Para [Str "Right",Space,Str "brace:",Space,Str "}"]
+, Para [Str "Left",Space,Str "bracket:",Space,Str "["]
+, Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
+, Para [Str "Left",Space,Str "paren:",Space,Str "("]
+, Para [Str "Right",Space,Str "paren:",Space,Str ")"]
+, Para [Str "Greater",Str "-",Str "than:",Space,Str ">"]
+, Para [Str "Hash:",Space,Str "#"]
+, Para [Str "Period:",Space,Str "."]
+, Para [Str "Bang:",Space,Str "!"]
+, Para [Str "Plus:",Space,Str "+"]
+, Para [Str "Minus:",Space,Str "-"]
+, HorizontalRule
+, Header 1 [Str "Links"]
+, Header 2 [Str "Explicit"]
+, Para [Str "Just",Space,Str "a",Space,Link [Str "URL"] (Src "/url/" ""),Str "."]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Src "/url/" "title"),Str "."]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Src "/url/" "title preceded by two spaces"),Str "."]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Src "/url/" "title preceded by a tab"),Str "."]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Src "/url/" "title with &quot;quotes&quot; in it")]
+, Para [Link [Str "URL",Space,Str "and",Space,Str "title"] (Src "/url/" "title with single quotes")]
+, Para [Link [Str "Email",Space,Str "link"] (Src "mailto:nobody@nowhere.net" "")]
+, Para [Link [Str "Empty"] (Src "" ""),Str "."]
+, Header 2 [Str "Reference"]
+, Para [Str "Foo",Space,Link [Str "bar"] (Ref [Str "a"]),Str "."]
+, Para [Str "Foo",Space,Link [Str "bar"] (Ref [Str "a"]),Str "."]
+, Para [Str "Foo",Space,Link [Str "bar"] (Ref [Str "a"]),Str "."]
+, Key [Str "a"] (Src "/url/" "")
+, Para [Str "With",Space,Link [Str "embedded",Space,Link [Str "brackets"] (Ref [])] (Ref [Str "b"]),Str "."]
+, Para [Link [Str "b"] (Ref []),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link."]
+, Para [Str "Indented",Space,Link [Str "once"] (Ref []),Str "."]
+, Para [Str "Indented",Space,Link [Str "twice"] (Ref []),Str "."]
+, Para [Str "Indented",Space,Link [Str "thrice"] (Ref []),Str "."]
+, Para [Str "This",Space,Str "should",Space,Link [Str "not"] (Ref []),Space,Str "be",Space,Str "a",Space,Str "link."]
+, Key [Str "once"] (Src "/url" "")
+, Key [Str "twice"] (Src "/url" "")
+, Key [Str "thrice"] (Src "/url" "")
+, CodeBlock "[not]: /url\n"
+, Key [Str "b"] (Src "/url/" "")
+, Para [Str "Foo",Space,Link [Str "bar"] (Ref []),Str "."]
+, Para [Str "Foo",Space,Link [Str "biz"] (Src "/url/" "Title with &quot;quote&quot; inside"),Str "."]
+, Key [Str "bar"] (Src "/url/" "Title with &quot;quotes&quot; inside")
+, Header 2 [Str "With",Space,Str "ampersands"]
+, Para [Str "Here's",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] (Ref [Str "1"]),Str "."]
+, Para [Str "Here's",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link [Str "AT&T"] (Ref [Str "2"]),Str "."]
+, Para [Str "Here's",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] (Src "/script?foo=1&bar=2" ""),Str "."]
+, Para [Str "Here's",Space,Str "an",Space,Link [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] (Src "/script?foo=1&bar=2" ""),Str "."]
+, Key [Str "1"] (Src "http://example.com/?foo=1&bar=2" "")
+, Key [Str "2"] (Src "http://att.com/" "AT&T")
+, Header 2 [Str "Autolinks"]
+, Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link [Str "http://example.com/?foo=1&bar=2"] (Src "http://example.com/?foo=1&bar=2" "")]
+, BulletList
+ [ [ Plain [Str "In",Space,Str "a",Space,Str "list?"] ]
+ , [ Plain [Link [Str "http://example.com/"] (Src "http://example.com/" "")] ]
+ , [ Plain [Str "It",Space,Str "should."] ] ]
+, Para [Str "An",Space,Str "e",Str "-",Str "mail",Space,Str "address:",Space,Link [Str "nobody@nowhere.net"] (Src "mailto:nobody@nowhere.net" "")]
+, BlockQuote
+ [ Para [Str "Blockquoted:",Space,Link [Str "http://example.com/"] (Src "http://example.com/" "")] ]
+
+, Para [Str "Auto",Str "-",Str "links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code "<http://example.com/>"]
+, CodeBlock "or here: <http://example.com/>\n"
+, HorizontalRule
+, Header 1 [Str "Images"]
+, Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
+, Para [Image [Str "lalune"] (Ref [])]
+, Key [Str "lalune"] (Src "lalune.jpg" "Voyage dans la Lune")
+, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] (Src "movie.jpg" ""),Space,Str "icon."]
+, HorizontalRule
+, Header 1 [Str "Footnotes"]
+, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",NoteRef "1",Str ",",Space,Str "and",Space,Str "another",NoteRef "longnote",Str ".",Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space",Str "^",Str "(my",Space,Str "note)."]
+, Note "1"
+ [ Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "in",Space,Str "the",Space,Str "document,",Space,Str "not",Space,Str "just",Space,Str "at",Space,Str "the",Space,Str "end."] ]
+
+, Note "longnote"
+ [ Para [Str "Here's",Space,Str "the",Space,Str "other",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."]
+ , Para [Str "Caret",Space,Str "characters",Space,Str "are",Space,Str "used",Space,Str "to",Space,Str "indicate",Space,Str "that",Space,Str "the",Space,Str "blocks",Space,Str "all",Space,Str "belong",Space,Str "to",Space,Str "a",Space,Str "single",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "block",Space,Str "quotes)."]
+ , CodeBlock " { <code> }\n"
+ , Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "use",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "every",Space,Str "line,",Space,Str "as",Space,Str "with",Space,Str "blockquotes,",Space,Str "but",Space,Str "all",Space,Str "that",Space,Str "you",Space,Str "need",Space,Str "is",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "the",Space,Str "block",Space,Str "and",Space,Str "any",Space,Str "preceding",Space,Str "blank",Space,Str "lines."] ] ]
diff --git a/tests/writer.rst b/tests/writer.rst
new file mode 100644
index 000000000..cd67cdaba
--- /dev/null
+++ b/tests/writer.rst
@@ -0,0 +1,743 @@
+=================
+Pandoc Test Suite
+=================
+
+:Author: John MacFarlane
+:Author: Anonymous
+:Date: July 17, 2006
+
+This is a set of tests for pandoc. Most of them are adapted from
+John Gruber's markdown test suite.
+
+--------------
+
+Headers
+=======
+
+Level 2 with an `embedded link`_
+--------------------------------
+
+Level 3 with *emphasis*
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Level 4
+^^^^^^^
+
+Level 5
+'''''''
+
+Level 1
+=======
+
+Level 2 with *emphasis*
+-----------------------
+
+Level 3
+~~~~~~~
+
+with no blank line
+
+Level 2
+-------
+
+with no blank line
+
+--------------
+
+Paragraphs
+==========
+
+Here's a regular paragraph.
+
+In Markdown 1.0.0 and earlier. Version 8. This line turns into a
+list item. Because a hard-wrapped line in the middle of a paragraph
+looked like a list item.
+
+Here's one with a bullet. \* criminey.
+
+There should be a hard line break here.
+
+--------------
+
+Block Quotes
+============
+
+E-mail style:
+
+ This is a block quote. It is pretty short.
+
+
+ Code in a block quote:
+
+ ::
+
+ sub status {
+ print "working";
+ }
+
+ A list:
+
+ 1. item one
+ 2. item two
+
+ Nested block quotes:
+
+ nested
+
+
+ nested
+
+
+
+This should not be a block quote: 2 > 1.
+
+Box-style:
+
+ Example:
+
+ ::
+
+ sub status {
+ print "working";
+ }
+
+
+ 1. do laundry
+ 2. take out the trash
+
+
+Here's a nested one:
+
+ Joe said:
+
+ Don't quote me.
+
+
+
+And a following paragraph.
+
+--------------
+
+Code Blocks
+===========
+
+Code:
+
+::
+
+ ---- (should be four hyphens)
+
+ sub status {
+ print "working";
+ }
+
+ this code block is indented by one tab
+
+And:
+
+::
+
+ this code block is indented by two tabs
+
+ These should not be escaped: \$ \\ \> \[ \{
+
+--------------
+
+Lists
+=====
+
+Unordered
+---------
+
+Asterisks tight:
+
+- asterisk 1
+- asterisk 2
+- asterisk 3
+
+Asterisks loose:
+
+- asterisk 1
+
+- asterisk 2
+
+- asterisk 3
+
+
+Pluses tight:
+
+- Plus 1
+- Plus 2
+- Plus 3
+
+Pluses loose:
+
+- Plus 1
+
+- Plus 2
+
+- Plus 3
+
+
+Minuses tight:
+
+- Minus 1
+- Minus 2
+- Minus 3
+
+Minuses loose:
+
+- Minus 1
+
+- Minus 2
+
+- Minus 3
+
+
+Ordered
+-------
+
+Tight:
+
+1. First
+2. Second
+3. Third
+
+and:
+
+1. One
+2. Two
+3. Three
+
+Loose using tabs:
+
+1. First
+
+2. Second
+
+3. Third
+
+
+and using spaces:
+
+1. One
+
+2. Two
+
+3. Three
+
+
+Multiple paragraphs:
+
+1. Item 1, graf one.
+
+ Item 1. graf two. The quick brown fox jumped over the lazy dog's
+ back.
+
+2. Item 2.
+
+3. Item 3.
+
+
+Nested
+------
+
+- Tab
+
+ - Tab
+
+ - Tab
+
+
+
+Here's another:
+
+1. First
+2. Second:
+
+ - Fee
+ - Fie
+ - Foe
+
+3. Third
+
+Same thing but with paragraphs:
+
+1. First
+
+2. Second:
+
+ - Fee
+ - Fie
+ - Foe
+
+3. Third
+
+
+Tabs and spaces
+---------------
+
+- this is a list item indented with tabs
+
+- this is a list item indented with spaces
+
+ - this is an example list item indented with tabs
+
+ - this is an example list item indented with spaces
+
+
+
+--------------
+
+HTML Blocks
+===========
+
+Simple block on one line:
+
+
+.. raw:: html
+
+ <div>
+
+foo
+
+.. raw:: html
+
+ </div>
+
+And nested without indentation:
+
+
+.. raw:: html
+
+ <div>
+ <div>
+ <div>
+
+foo
+
+.. raw:: html
+
+ </div>
+ </div>
+ <div>
+
+bar
+
+.. raw:: html
+
+ </div>
+ </div>
+
+Interpreted markdown in a table:
+
+
+.. raw:: html
+
+ <table>
+ <tr>
+ <td>
+
+This is *emphasized*
+
+.. raw:: html
+
+ </td>
+ <td>
+
+And this is **strong**
+
+.. raw:: html
+
+ </td>
+ </tr>
+ </table>
+
+ <script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>
+
+Here's a simple block:
+
+
+.. raw:: html
+
+ <div>
+
+
+foo
+
+.. raw:: html
+
+ </div>
+
+This should be a code block, though:
+
+::
+
+ <div>
+ foo
+ </div>
+
+As should this:
+
+::
+
+ <div>foo</div>
+
+Now, nested:
+
+
+.. raw:: html
+
+ <div>
+ <div>
+ <div>
+
+
+foo
+
+.. raw:: html
+
+ </div>
+ </div>
+ </div>
+
+This should just be an HTML comment:
+
+
+.. raw:: html
+
+ <!-- Comment -->
+
+Multiline:
+
+
+.. raw:: html
+
+ <!--
+ Blah
+ Blah
+ -->
+
+ <!--
+ This is another comment.
+ -->
+
+Code block:
+
+::
+
+ <!-- Comment -->
+
+Just plain comment, with trailing spaces on the line:
+
+
+.. raw:: html
+
+ <!-- foo -->
+
+Code:
+
+::
+
+ <hr />
+
+Hr's:
+
+
+.. raw:: html
+
+ <hr>
+
+ <hr />
+
+ <hr />
+
+ <hr>
+
+ <hr />
+
+ <hr />
+
+ <hr class="foo" id="bar" />
+
+ <hr class="foo" id="bar" />
+
+ <hr class="foo" id="bar">
+
+--------------
+
+Inline Markup
+=============
+
+This is *emphasized*, and so *is this*.
+
+This is **strong**, and so **is this**.
+
+An *`emphasized link`_*.
+
+***This is strong and em.***
+
+So is ***this*** word.
+
+***This is strong and em.***
+
+So is ***this*** word.
+
+This is code: ``>``, ``$``, ``\``, ``\$``, ``<html>``.
+
+--------------
+
+Smart quotes, ellipses, dashes
+==============================
+
+"Hello," said the spider. "'Shelob' is my name."
+
+'A', 'B', and 'C' are letters.
+
+'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.'
+
+'He said, "I want to go."' Were you alive in the 70's?
+
+Here is some quoted '``code``' and a "`quoted link`_".
+
+Some dashes: one---two --- three--four -- five.
+
+Dashes between numbers: 5-7, 255-66, 1987-1999.
+
+Ellipses...and. . .and . . . .
+
+--------------
+
+LaTeX
+=====
+
+- \cite[22-23]{smith.1899}
+- \doublespacing
+- $2+2=4$
+- $x \in y$
+- $\alpha \wedge \omega$
+- $223$
+- $p$-Tree
+- $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
+- Here's one that has a line break in it:
+ $\alpha + \omega \times x^2$.
+
+These shouldn't be math:
+
+- To get the famous equation, write ``$e = mc^2$``.
+- $22,000 is a *lot* of money. So is $34,000. (It worked if "lot"
+ is emphasized.)
+- Escaped ``$``: $73 *this should be emphasized* 23$.
+
+Here's a LaTeX table:
+
+
+.. raw:: latex
+
+ \begin{tabular}{|l|l|}\hline
+ Animal & Number \\ \hline
+ Dog & 2 \\
+ Cat & 1 \\ \hline
+ \end{tabular}
+
+--------------
+
+Special Characters
+==================
+
+Here is some unicode:
+
+- I hat: Î
+- o umlaut: ö
+- section: §
+- set membership: ∈
+- copyright: ©
+
+AT&T has an ampersand in their name.
+
+AT&T is another way to write it.
+
+This & that.
+
+4 < 5.
+
+6 > 5.
+
+Backslash: \\
+
+Backtick: \`
+
+Asterisk: \*
+
+Underscore: \_
+
+Left brace: {
+
+Right brace: }
+
+Left bracket: [
+
+Right bracket: ]
+
+Left paren: (
+
+Right paren: )
+
+Greater-than: >
+
+Hash: #
+
+Period: .
+
+Bang: !
+
+Plus: +
+
+Minus: -
+
+--------------
+
+Links
+=====
+
+Explicit
+--------
+
+Just a `URL`_.
+
+`URL and title`_.
+
+`URL and title`_.
+
+`URL and title`_.
+
+`URL and title`_
+
+`URL and title`_
+
+`Email link`_
+
+`Empty`_.
+
+Reference
+---------
+
+Foo `bar`_.
+
+Foo `bar`_.
+
+Foo `bar`_.
+
+With `embedded [brackets]`_.
+
+`b`_ by itself should be a link.
+
+Indented `once`_.
+
+Indented `twice`_.
+
+Indented `thrice`_.
+
+This should [not] be a link.
+
+::
+
+ [not]: /url
+
+Foo `bar`_.
+
+Foo `biz`_.
+
+With ampersands
+---------------
+
+Here's a `link with an ampersand in the URL`_.
+
+Here's a link with an amersand in the link text: `AT&T`_.
+
+Here's an `inline link`_.
+
+Here's an `inline link in pointy braces`_.
+
+Autolinks
+---------
+
+With an ampersand: `http://example.com/?foo=1&bar=2`_
+
+- In a list?
+- `http://example.com/`_
+- It should.
+
+An e-mail address: `nobody@nowhere.net`_
+
+ Blockquoted: `http://example.com/`_
+
+
+Auto-links should not occur here: ``<http://example.com/>``
+
+::
+
+ or here: <http://example.com/>
+
+--------------
+
+Images
+======
+
+From "Voyage dans la Lune" by Georges Melies (1902):
+
+|lalune|
+
+Here is a movie |movie| icon.
+
+--------------
+
+Footnotes
+=========
+
+Here is a footnote reference [1]_, and another [longnote]_. This
+should *not* be a footnote reference, because it contains a
+space^(my note).
+
+.. [1]
+ Here is the footnote. It can go anywhere in the document, not just
+ at the end.
+
+.. [longnote]
+ Here's the other note. This one contains multiple blocks.
+
+ Caret characters are used to indicate that the blocks all belong to
+ a single footnote (as with block quotes).
+
+ ::
+
+ { <code> }
+
+ If you want, you can use a caret at the beginning of every line, as
+ with blockquotes, but all that you need is a caret at the beginning
+ of the first line of the block and any preceding blank lines.
+
+
+.. _embedded link: /url
+.. _emphasized link: /url
+.. _quoted link: http://example.com/?foo=1&bar=2
+.. _URL: /url/
+.. _URL and title: /url/
+.. _Email link: mailto:nobody@nowhere.net
+.. _Empty:
+.. _bar: /url/
+.. _embedded [brackets]: /url/
+.. _b: /url/
+.. _once: /url
+.. _twice: /url
+.. _thrice: /url
+.. _biz: /url/
+.. _link with an ampersand in the URL: http://example.com/?foo=1&bar=2
+.. _AT&T: http://att.com/
+.. _inline link: /script?foo=1&bar=2
+.. _inline link in pointy braces: /script?foo=1&bar=2
+.. _`http://example.com/?foo=1&bar=2`: http://example.com/?foo=1&bar=2
+.. _`http://example.com/`: http://example.com/
+.. _nobody@nowhere.net: mailto:nobody@nowhere.net
+.. |lalune| image:: lalune.jpg
+.. |movie| image:: movie.jpg
diff --git a/tests/writer.rtf b/tests/writer.rtf
new file mode 100644
index 000000000..84c82aa9b
--- /dev/null
+++ b/tests/writer.rtf
@@ -0,0 +1,378 @@
+{\rtf1\ansi\deff0{\fonttbl{\f0 Times New Roman;}{\f1 Courier;}}
+{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}
+\widowctrl\hyphauto
+
+{\pard \sa180 \li0 \fi0 \qc \b \fs36 Pandoc Test Suite\par}
+{\pard \sa180 \li0 \fi0 \qc John MacFarlane\Anonymous\par}
+{\pard \sa180 \li0 \fi0 \qc July 17, 2006\par}
+{\pard \sa180 \li0 \fi0 \par}
+{\pard \sa180 \li0 \fi0 This is a set of tests for pandoc. Most of them are adapted from John Gruber's markdown test suite.\par}
+{\pard \sa180 \li0 \fi0 \qc \emdash\emdash\emdash\emdash\emdash\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 Headers\par}
+{\pard \sa180 \li0 \fi0 \b \fs32 Level 2 with an {\field{\*\fldinst{HYPERLINK "/url"}}{\fldrslt{\ul
+embedded link
+}}}
+\par}
+{\pard \sa180 \li0 \fi0 \b \fs28 Level 3 with {\i emphasis} \par}
+{\pard \sa180 \li0 \fi0 \b \fs24 Level 4\par}
+{\pard \sa180 \li0 \fi0 \b \fs20 Level 5\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 Level 1\par}
+{\pard \sa180 \li0 \fi0 \b \fs32 Level 2 with {\i emphasis} \par}
+{\pard \sa180 \li0 \fi0 \b \fs28 Level 3\par}
+{\pard \sa180 \li0 \fi0 with no blank line\par}
+{\pard \sa180 \li0 \fi0 \b \fs32 Level 2\par}
+{\pard \sa180 \li0 \fi0 with no blank line\par}
+{\pard \sa180 \li0 \fi0 \qc \emdash\emdash\emdash\emdash\emdash\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 Paragraphs\par}
+{\pard \sa180 \li0 \fi0 Here's a regular paragraph.\par}
+{\pard \sa180 \li0 \fi0 In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.\par}
+{\pard \sa180 \li0 \fi0 Here's one with a bullet. * criminey.\par}
+{\pard \sa180 \li0 \fi0 There should be a hard line break\line here.\par}
+{\pard \sa180 \li0 \fi0 \qc \emdash\emdash\emdash\emdash\emdash\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 Block Quotes\par}
+{\pard \sa180 \li0 \fi0 E-mail style:\par}
+{\pard \sa180 \li720 \fi0 This is a block quote. It is pretty short.\par}
+{\pard \sa180 \li720 \fi0 Code in a block quote:\par}
+{\pard \sa180 \li720 \fi0 \f1 sub status \{\line
+ print "working";\line
+\}\par}
+{\pard \sa180 \li720 \fi0 A list:\par}
+{\pard \sa0 \li1080 \fi-360 1.\tx360\tab item one\par}
+{\pard \sa0 \li1080 \fi-360 2.\tx360\tab item two\sa180\par}
+{\pard \sa180 \li720 \fi0 Nested block quotes:\par}
+{\pard \sa180 \li1440 \fi0 nested\par}
+{\pard \sa180 \li1440 \fi0 nested\par}
+{\pard \sa180 \li0 \fi0 This should not be a block quote: 2 > 1.\par}
+{\pard \sa180 \li0 \fi0 Box-style:\par}
+{\pard \sa180 \li720 \fi0 Example:\par}
+{\pard \sa180 \li720 \fi0 \f1 sub status \{\line
+ print "working";\line
+\}\par}
+{\pard \sa0 \li1080 \fi-360 1.\tx360\tab do laundry\par}
+{\pard \sa0 \li1080 \fi-360 2.\tx360\tab take out the trash\sa180\par}
+{\pard \sa180 \li0 \fi0 Here's a nested one:\par}
+{\pard \sa180 \li720 \fi0 Joe said:\par}
+{\pard \sa180 \li1440 \fi0 Don't quote me.\par}
+{\pard \sa180 \li0 \fi0 And a following paragraph.\par}
+{\pard \sa180 \li0 \fi0 \qc \emdash\emdash\emdash\emdash\emdash\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 Code Blocks\par}
+{\pard \sa180 \li0 \fi0 Code:\par}
+{\pard \sa180 \li0 \fi0 \f1 ---- (should be four hyphens)\line
+\line
+sub status \{\line
+ print "working";\line
+\}\line
+\line
+this code block is indented by one tab\par}
+{\pard \sa180 \li0 \fi0 And:\par}
+{\pard \sa180 \li0 \fi0 \f1 this code block is indented by two tabs\line
+\line
+These should not be escaped: \\$ \\\\ \\> \\[ \\\{\par}
+{\pard \sa180 \li0 \fi0 \qc \emdash\emdash\emdash\emdash\emdash\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 Lists\par}
+{\pard \sa180 \li0 \fi0 \b \fs32 Unordered\par}
+{\pard \sa180 \li0 \fi0 Asterisks tight:\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab asterisk 1\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab asterisk 2\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab asterisk 3\sa180\par}
+{\pard \sa180 \li0 \fi0 Asterisks loose:\par}
+{\pard \sa180 \li360 \fi-360 \bullet \tx360\tab asterisk 1\par}
+{\pard \sa180 \li360 \fi-360 \bullet \tx360\tab asterisk 2\par}
+{\pard \sa180 \li360 \fi-360 \bullet \tx360\tab asterisk 3\sa180\par}
+{\pard \sa180 \li0 \fi0 Pluses tight:\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab Plus 1\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab Plus 2\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab Plus 3\sa180\par}
+{\pard \sa180 \li0 \fi0 Pluses loose:\par}
+{\pard \sa180 \li360 \fi-360 \bullet \tx360\tab Plus 1\par}
+{\pard \sa180 \li360 \fi-360 \bullet \tx360\tab Plus 2\par}
+{\pard \sa180 \li360 \fi-360 \bullet \tx360\tab Plus 3\sa180\par}
+{\pard \sa180 \li0 \fi0 Minuses tight:\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab Minus 1\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab Minus 2\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab Minus 3\sa180\par}
+{\pard \sa180 \li0 \fi0 Minuses loose:\par}
+{\pard \sa180 \li360 \fi-360 \bullet \tx360\tab Minus 1\par}
+{\pard \sa180 \li360 \fi-360 \bullet \tx360\tab Minus 2\par}
+{\pard \sa180 \li360 \fi-360 \bullet \tx360\tab Minus 3\sa180\par}
+{\pard \sa180 \li0 \fi0 \b \fs32 Ordered\par}
+{\pard \sa180 \li0 \fi0 Tight:\par}
+{\pard \sa0 \li360 \fi-360 1.\tx360\tab First\par}
+{\pard \sa0 \li360 \fi-360 2.\tx360\tab Second\par}
+{\pard \sa0 \li360 \fi-360 3.\tx360\tab Third\sa180\par}
+{\pard \sa180 \li0 \fi0 and:\par}
+{\pard \sa0 \li360 \fi-360 1.\tx360\tab One\par}
+{\pard \sa0 \li360 \fi-360 2.\tx360\tab Two\par}
+{\pard \sa0 \li360 \fi-360 3.\tx360\tab Three\sa180\par}
+{\pard \sa180 \li0 \fi0 Loose using tabs:\par}
+{\pard \sa180 \li360 \fi-360 1.\tx360\tab First\par}
+{\pard \sa180 \li360 \fi-360 2.\tx360\tab Second\par}
+{\pard \sa180 \li360 \fi-360 3.\tx360\tab Third\sa180\par}
+{\pard \sa180 \li0 \fi0 and using spaces:\par}
+{\pard \sa180 \li360 \fi-360 1.\tx360\tab One\par}
+{\pard \sa180 \li360 \fi-360 2.\tx360\tab Two\par}
+{\pard \sa180 \li360 \fi-360 3.\tx360\tab Three\sa180\par}
+{\pard \sa180 \li0 \fi0 Multiple paragraphs:\par}
+{\pard \sa180 \li360 \fi-360 1.\tx360\tab Item 1, graf one.\par}
+{\pard \sa180 \li360 \fi0 Item 1. graf two. The quick brown fox jumped over the lazy dog's back.\par}
+{\pard \sa180 \li360 \fi-360 2.\tx360\tab Item 2.\par}
+{\pard \sa180 \li360 \fi-360 3.\tx360\tab Item 3.\sa180\par}
+{\pard \sa180 \li0 \fi0 \b \fs32 Nested\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab Tab\par}
+{\pard \sa0 \li720 \fi-360 \endash \tx360\tab Tab\par}
+{\pard \sa0 \li1080 \fi-360 \bullet \tx360\tab Tab\sa180\sa180\sa180\par}
+{\pard \sa180 \li0 \fi0 Here's another:\par}
+{\pard \sa0 \li360 \fi-360 1.\tx360\tab First\par}
+{\pard \sa0 \li360 \fi-360 2.\tx360\tab Second:\par}
+{\pard \sa0 \li720 \fi-360 \endash \tx360\tab Fee\par}
+{\pard \sa0 \li720 \fi-360 \endash \tx360\tab Fie\par}
+{\pard \sa0 \li720 \fi-360 \endash \tx360\tab Foe\sa180\par}
+{\pard \sa0 \li360 \fi-360 3.\tx360\tab Third\sa180\par}
+{\pard \sa180 \li0 \fi0 Same thing but with paragraphs:\par}
+{\pard \sa180 \li360 \fi-360 1.\tx360\tab First\par}
+{\pard \sa180 \li360 \fi-360 2.\tx360\tab Second:\par}
+{\pard \sa0 \li720 \fi-360 \endash \tx360\tab Fee\par}
+{\pard \sa0 \li720 \fi-360 \endash \tx360\tab Fie\par}
+{\pard \sa0 \li720 \fi-360 \endash \tx360\tab Foe\sa180\par}
+{\pard \sa180 \li360 \fi-360 3.\tx360\tab Third\sa180\par}
+{\pard \sa180 \li0 \fi0 \b \fs32 Tabs and spaces\par}
+{\pard \sa180 \li360 \fi-360 \bullet \tx360\tab this is a list item indented with tabs\par}
+{\pard \sa180 \li360 \fi-360 \bullet \tx360\tab this is a list item indented with spaces\par}
+{\pard \sa180 \li720 \fi-360 \endash \tx360\tab this is an example list item indented with tabs\par}
+{\pard \sa180 \li720 \fi-360 \endash \tx360\tab this is an example list item indented with spaces\sa180\sa180\par}
+{\pard \sa180 \li0 \fi0 \qc \emdash\emdash\emdash\emdash\emdash\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 HTML Blocks\par}
+{\pard \sa180 \li0 \fi0 Simple block on one line:\par}
+{\pard \sa0 \li0 \fi0 foo\par}
+{\pard \sa180 \li0 \fi0 And nested without indentation:\par}
+{\pard \sa0 \li0 \fi0 foo\par}
+{\pard \sa0 \li0 \fi0 bar\par}
+{\pard \sa180 \li0 \fi0 Interpreted markdown in a table:\par}
+{\pard \sa0 \li0 \fi0 This is {\i emphasized} \par}
+{\pard \sa0 \li0 \fi0 And this is {\b strong} \par}
+{\pard \sa180 \li0 \fi0 Here's a simple block:\par}
+{\pard \sa0 \li0 \fi0 foo\par}
+{\pard \sa180 \li0 \fi0 This should be a code block, though:\par}
+{\pard \sa180 \li0 \fi0 \f1 <div>\line
+ foo\line
+</div>\par}
+{\pard \sa180 \li0 \fi0 As should this:\par}
+{\pard \sa180 \li0 \fi0 \f1 <div>foo</div>\par}
+{\pard \sa180 \li0 \fi0 Now, nested:\par}
+{\pard \sa0 \li0 \fi0 foo\par}
+{\pard \sa180 \li0 \fi0 This should just be an HTML comment:\par}
+{\pard \sa180 \li0 \fi0 Multiline:\par}
+{\pard \sa180 \li0 \fi0 Code block:\par}
+{\pard \sa180 \li0 \fi0 \f1 <!-- Comment -->\par}
+{\pard \sa180 \li0 \fi0 Just plain comment, with trailing spaces on the line:\par}
+{\pard \sa180 \li0 \fi0 Code:\par}
+{\pard \sa180 \li0 \fi0 \f1 <hr />\par}
+{\pard \sa180 \li0 \fi0 Hr's:\par}
+{\pard \sa180 \li0 \fi0 \qc \emdash\emdash\emdash\emdash\emdash\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 Inline Markup\par}
+{\pard \sa180 \li0 \fi0 This is {\i emphasized} , and so {\i is this} .\par}
+{\pard \sa180 \li0 \fi0 This is {\b strong} , and so {\b is this} .\par}
+{\pard \sa180 \li0 \fi0 An {\i {\field{\*\fldinst{HYPERLINK "/url"}}{\fldrslt{\ul
+emphasized link
+}}}
+} .\par}
+{\pard \sa180 \li0 \fi0 {\b {\i This is strong and em.} } \par}
+{\pard \sa180 \li0 \fi0 So is {\b {\i this} } word.\par}
+{\pard \sa180 \li0 \fi0 {\b {\i This is strong and em.} } \par}
+{\pard \sa180 \li0 \fi0 So is {\b {\i this} } word.\par}
+{\pard \sa180 \li0 \fi0 This is code: {\f1 >} , {\f1 $} , {\f1 \\} , {\f1 \\$} , {\f1 <html>} .\par}
+{\pard \sa180 \li0 \fi0 \qc \emdash\emdash\emdash\emdash\emdash\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 Smart quotes, ellipses, dashes\par}
+{\pard \sa180 \li0 \fi0 "Hello," said the spider. "'Shelob' is my name."\par}
+{\pard \sa180 \li0 \fi0 'A', 'B', and 'C' are letters.\par}
+{\pard \sa180 \li0 \fi0 'Oak,' 'elm,' and 'beech' are names of trees. So is 'pine.'\par}
+{\pard \sa180 \li0 \fi0 'He said, "I want to go."' Were you alive in the 70's?\par}
+{\pard \sa180 \li0 \fi0 Here is some quoted '{\f1 code} ' and a "{\field{\*\fldinst{HYPERLINK "http://example.com/?foo=1&bar=2"}}{\fldrslt{\ul
+quoted link
+}}}
+".\par}
+{\pard \sa180 \li0 \fi0 Some dashes: one---two --- three--four -- five.\par}
+{\pard \sa180 \li0 \fi0 Dashes between numbers: 5-7, 255-66, 1987-1999.\par}
+{\pard \sa180 \li0 \fi0 Ellipses...and. . .and . . . .\par}
+{\pard \sa180 \li0 \fi0 \qc \emdash\emdash\emdash\emdash\emdash\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 LaTeX\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab {\cf1 \\cite[22-23]\{smith.1899\}\cf0 } \par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab {\cf1 \\doublespacing\cf0 } \par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab {\cf1 $2+2=4$\cf0 } \par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab {\cf1 $x \\in y$\cf0 } \par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab {\cf1 $\\alpha \\wedge \\omega$\cf0 } \par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab {\cf1 $223$\cf0 } \par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab {\cf1 $p$\cf0 } -Tree\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab {\cf1 $\\frac\{d\}\{dx\}f(x)=\\lim_\{h\\to 0\}\\frac\{f(x+h)-f(x)\}\{h\}$\cf0 } \par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab Here's one that has a line break in it: {\cf1 $\\alpha + \\omega \\times x^2$\cf0 } .\sa180\par}
+{\pard \sa180 \li0 \fi0 These shouldn't be math:\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab To get the famous equation, write {\f1 $e = mc^2$} .\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab $22,000 is a {\i lot} of money. So is $34,000. (It worked if "lot" is emphasized.)\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab Escaped {\f1 $} : $73 {\i this should be emphasized} 23$.\sa180\par}
+{\pard \sa180 \li0 \fi0 Here's a LaTeX table:\par}
+{\pard \sa180 \li0 \fi0 {\cf1 \\begin\{tabular\}\{|l|l|\}\\hline
+Animal & Number \\\\ \\hline
+Dog & 2 \\\\
+Cat & 1 \\\\ \\hline
+\\end\{tabular\}\cf0 } \par}
+{\pard \sa180 \li0 \fi0 \qc \emdash\emdash\emdash\emdash\emdash\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 Special Characters\par}
+{\pard \sa180 \li0 \fi0 Here is some unicode:\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab I hat: \u206?\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab o umlaut: \u246?\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab section: \u167?\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab set membership: \u8712?\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab copyright: \u169?\sa180\par}
+{\pard \sa180 \li0 \fi0 AT&T has an ampersand in their name.\par}
+{\pard \sa180 \li0 \fi0 AT&T is another way to write it.\par}
+{\pard \sa180 \li0 \fi0 This & that.\par}
+{\pard \sa180 \li0 \fi0 4 < 5.\par}
+{\pard \sa180 \li0 \fi0 6 > 5.\par}
+{\pard \sa180 \li0 \fi0 Backslash: \\\par}
+{\pard \sa180 \li0 \fi0 Backtick: `\par}
+{\pard \sa180 \li0 \fi0 Asterisk: *\par}
+{\pard \sa180 \li0 \fi0 Underscore: _\par}
+{\pard \sa180 \li0 \fi0 Left brace: \{\par}
+{\pard \sa180 \li0 \fi0 Right brace: \}\par}
+{\pard \sa180 \li0 \fi0 Left bracket: [\par}
+{\pard \sa180 \li0 \fi0 Right bracket: ]\par}
+{\pard \sa180 \li0 \fi0 Left paren: (\par}
+{\pard \sa180 \li0 \fi0 Right paren: )\par}
+{\pard \sa180 \li0 \fi0 Greater-than: >\par}
+{\pard \sa180 \li0 \fi0 Hash: #\par}
+{\pard \sa180 \li0 \fi0 Period: .\par}
+{\pard \sa180 \li0 \fi0 Bang: !\par}
+{\pard \sa180 \li0 \fi0 Plus: +\par}
+{\pard \sa180 \li0 \fi0 Minus: -\par}
+{\pard \sa180 \li0 \fi0 \qc \emdash\emdash\emdash\emdash\emdash\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 Links\par}
+{\pard \sa180 \li0 \fi0 \b \fs32 Explicit\par}
+{\pard \sa180 \li0 \fi0 Just a {\field{\*\fldinst{HYPERLINK "/url/"}}{\fldrslt{\ul
+URL
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 {\field{\*\fldinst{HYPERLINK "/url/"}}{\fldrslt{\ul
+URL and title
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 {\field{\*\fldinst{HYPERLINK "/url/"}}{\fldrslt{\ul
+URL and title
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 {\field{\*\fldinst{HYPERLINK "/url/"}}{\fldrslt{\ul
+URL and title
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 {\field{\*\fldinst{HYPERLINK "/url/"}}{\fldrslt{\ul
+URL and title
+}}}
+\par}
+{\pard \sa180 \li0 \fi0 {\field{\*\fldinst{HYPERLINK "/url/"}}{\fldrslt{\ul
+URL and title
+}}}
+\par}
+{\pard \sa180 \li0 \fi0 {\field{\*\fldinst{HYPERLINK "mailto:nobody@nowhere.net"}}{\fldrslt{\ul
+Email link
+}}}
+\par}
+{\pard \sa180 \li0 \fi0 {\field{\*\fldinst{HYPERLINK ""}}{\fldrslt{\ul
+Empty
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 \b \fs32 Reference\par}
+{\pard \sa180 \li0 \fi0 Foo {\field{\*\fldinst{HYPERLINK "/url/"}}{\fldrslt{\ul
+bar
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 Foo {\field{\*\fldinst{HYPERLINK "/url/"}}{\fldrslt{\ul
+bar
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 Foo {\field{\*\fldinst{HYPERLINK "/url/"}}{\fldrslt{\ul
+bar
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 With {\field{\*\fldinst{HYPERLINK "/url/"}}{\fldrslt{\ul
+embedded [brackets]
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 {\field{\*\fldinst{HYPERLINK "/url/"}}{\fldrslt{\ul
+b
+}}}
+ by itself should be a link.\par}
+{\pard \sa180 \li0 \fi0 Indented {\field{\*\fldinst{HYPERLINK "/url"}}{\fldrslt{\ul
+once
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 Indented {\field{\*\fldinst{HYPERLINK "/url"}}{\fldrslt{\ul
+twice
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 Indented {\field{\*\fldinst{HYPERLINK "/url"}}{\fldrslt{\ul
+thrice
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 This should [not] be a link.\par}
+{\pard \sa180 \li0 \fi0 \f1 [not]: /url\par}
+{\pard \sa180 \li0 \fi0 Foo {\field{\*\fldinst{HYPERLINK "/url/"}}{\fldrslt{\ul
+bar
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 Foo {\field{\*\fldinst{HYPERLINK "/url/"}}{\fldrslt{\ul
+biz
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 \b \fs32 With ampersands\par}
+{\pard \sa180 \li0 \fi0 Here's a {\field{\*\fldinst{HYPERLINK "http://example.com/?foo=1&bar=2"}}{\fldrslt{\ul
+link with an ampersand in the URL
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 Here's a link with an amersand in the link text: {\field{\*\fldinst{HYPERLINK "http://att.com/"}}{\fldrslt{\ul
+AT&T
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 Here's an {\field{\*\fldinst{HYPERLINK "/script?foo=1&bar=2"}}{\fldrslt{\ul
+inline link
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 Here's an {\field{\*\fldinst{HYPERLINK "/script?foo=1&bar=2"}}{\fldrslt{\ul
+inline link in pointy braces
+}}}
+.\par}
+{\pard \sa180 \li0 \fi0 \b \fs32 Autolinks\par}
+{\pard \sa180 \li0 \fi0 With an ampersand: {\field{\*\fldinst{HYPERLINK "http://example.com/?foo=1&bar=2"}}{\fldrslt{\ul
+http://example.com/?foo=1&bar=2
+}}}
+\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab In a list?\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab {\field{\*\fldinst{HYPERLINK "http://example.com/"}}{\fldrslt{\ul
+http://example.com/
+}}}
+\par}
+{\pard \sa0 \li360 \fi-360 \bullet \tx360\tab It should.\sa180\par}
+{\pard \sa180 \li0 \fi0 An e-mail address: {\field{\*\fldinst{HYPERLINK "mailto:nobody@nowhere.net"}}{\fldrslt{\ul
+nobody@nowhere.net
+}}}
+\par}
+{\pard \sa180 \li720 \fi0 Blockquoted: {\field{\*\fldinst{HYPERLINK "http://example.com/"}}{\fldrslt{\ul
+http://example.com/
+}}}
+\par}
+{\pard \sa180 \li0 \fi0 Auto-links should not occur here: {\f1 <http://example.com/>} \par}
+{\pard \sa180 \li0 \fi0 \f1 or here: <http://example.com/>\par}
+{\pard \sa180 \li0 \fi0 \qc \emdash\emdash\emdash\emdash\emdash\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 Images\par}
+{\pard \sa180 \li0 \fi0 From "Voyage dans la Lune" by Georges Melies (1902):\par}
+{\pard \sa180 \li0 \fi0 {\cf1 [image: lalune.jpg]\cf0}\par}
+{\pard \sa180 \li0 \fi0 Here is a movie {\cf1 [image: movie.jpg]\cf0} icon.\par}
+{\pard \sa180 \li0 \fi0 \qc \emdash\emdash\emdash\emdash\emdash\par}
+{\pard \sa180 \li0 \fi0 \b \fs36 Footnotes\par}
+{\pard \sa180 \li0 \fi0 Here is a footnote reference{\super\chftn}{\*\footnote\chftn\~\plain\pard {\pard \sa180 \li0 \fi0 Here is the footnote. It can go anywhere in the document, not just at the end.\par}
+}, and another{\super\chftn}{\*\footnote\chftn\~\plain\pard {\pard \sa180 \li0 \fi0 Here's the other note. This one contains multiple blocks.\par}
+{\pard \sa180 \li0 \fi0 Caret characters are used to indicate that the blocks all belong to a single footnote (as with block quotes).\par}
+{\pard \sa180 \li0 \fi0 \f1 \{ <code> \}\par}
+{\pard \sa180 \li0 \fi0 If you want, you can use a caret at the beginning of every line, as with blockquotes, but all that you need is a caret at the beginning of the first line of the block and any preceding blank lines.\par}
+}. This should {\i not} be a footnote reference, because it contains a space^(my note).\par}
+
+}
+
diff --git a/tests/writer.smart.html b/tests/writer.smart.html
new file mode 100644
index 000000000..1ab182558
--- /dev/null
+++ b/tests/writer.smart.html
@@ -0,0 +1,456 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta name="generator" content="pandoc" />
+<style type="text/css">
+div.pandocNote { border-left: 1px solid grey; padding-left: 1em; }
+span.pandocNoteRef { vertical-align: super; font-size: 80%; }
+span.pandocNoteMarker { }
+</style>
+<meta name="author" content="John MacFarlane, Anonymous" />
+<meta name="date" content="July 17, 2006" />
+<title>Pandoc Test Suite</title>
+</head>
+<body>
+<h1 class="title">Pandoc Test Suite</h1>
+<p>This is a set of tests for pandoc. Most of them are adapted from John Gruber&rsquo;s markdown test suite.</p>
+<hr />
+<h1>Headers</h1>
+<h2>Level 2 with an <a href="/url">embedded link</a></h2>
+<h3>Level 3 with <em>emphasis</em></h3>
+<h4>Level 4</h4>
+<h5>Level 5</h5>
+<h1>Level 1</h1>
+<h2>Level 2 with <em>emphasis</em></h2>
+<h3>Level 3</h3>
+<p>with no blank line</p>
+<h2>Level 2</h2>
+<p>with no blank line</p>
+<hr />
+<h1>Paragraphs</h1>
+<p>Here&rsquo;s a regular paragraph.</p>
+<p>In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. Because a hard-wrapped line in the middle of a paragraph looked like a list item.</p>
+<p>Here&rsquo;s one with a bullet. * criminey.</p>
+<p>There should be a hard line break<br />
+here.</p>
+<hr />
+<h1>Block Quotes</h1>
+<p>E-mail style:</p>
+<blockquote>
+<p>This is a block quote. It is pretty short.</p>
+</blockquote>
+<blockquote>
+<p>Code in a block quote:</p>
+<pre><code>sub status {
+ print "working";
+}
+</code></pre>
+<p>A list:</p>
+<ol>
+<li>item one</li>
+<li>item two</li>
+</ol>
+<p>Nested block quotes:</p>
+<blockquote>
+<p>nested</p>
+</blockquote>
+<blockquote>
+<p>nested</p>
+</blockquote>
+</blockquote>
+<p>This should not be a block quote: 2 &gt; 1.</p>
+<p>Box-style:</p>
+<blockquote>
+<p>Example:</p>
+<pre><code>sub status {
+ print "working";
+}
+</code></pre>
+</blockquote>
+<blockquote>
+<ol>
+<li>do laundry</li>
+<li>take out the trash</li>
+</ol>
+</blockquote>
+<p>Here&rsquo;s a nested one:</p>
+<blockquote>
+<p>Joe said:</p>
+<blockquote>
+<p>Don&rsquo;t quote me.</p>
+</blockquote>
+</blockquote>
+<p>And a following paragraph.</p>
+<hr />
+<h1>Code Blocks</h1>
+<p>Code:</p>
+<pre><code>---- (should be four hyphens)
+
+sub status {
+ print "working";
+}
+
+this code block is indented by one tab
+</code></pre>
+<p>And:</p>
+<pre><code> this code block is indented by two tabs
+
+These should not be escaped: \$ \\ \> \[ \{
+</code></pre>
+<hr />
+<h1>Lists</h1>
+<h2>Unordered</h2>
+<p>Asterisks tight:</p>
+<ul>
+<li>asterisk 1</li>
+<li>asterisk 2</li>
+<li>asterisk 3</li>
+</ul>
+<p>Asterisks loose:</p>
+<ul>
+<li><p>asterisk 1</p>
+</li>
+<li><p>asterisk 2</p>
+</li>
+<li><p>asterisk 3</p>
+</li>
+</ul>
+<p>Pluses tight:</p>
+<ul>
+<li>Plus 1</li>
+<li>Plus 2</li>
+<li>Plus 3</li>
+</ul>
+<p>Pluses loose:</p>
+<ul>
+<li><p>Plus 1</p>
+</li>
+<li><p>Plus 2</p>
+</li>
+<li><p>Plus 3</p>
+</li>
+</ul>
+<p>Minuses tight:</p>
+<ul>
+<li>Minus 1</li>
+<li>Minus 2</li>
+<li>Minus 3</li>
+</ul>
+<p>Minuses loose:</p>
+<ul>
+<li><p>Minus 1</p>
+</li>
+<li><p>Minus 2</p>
+</li>
+<li><p>Minus 3</p>
+</li>
+</ul>
+<h2>Ordered</h2>
+<p>Tight:</p>
+<ol>
+<li>First</li>
+<li>Second</li>
+<li>Third</li>
+</ol>
+<p>and:</p>
+<ol>
+<li>One</li>
+<li>Two</li>
+<li>Three</li>
+</ol>
+<p>Loose using tabs:</p>
+<ol>
+<li><p>First</p>
+</li>
+<li><p>Second</p>
+</li>
+<li><p>Third</p>
+</li>
+</ol>
+<p>and using spaces:</p>
+<ol>
+<li><p>One</p>
+</li>
+<li><p>Two</p>
+</li>
+<li><p>Three</p>
+</li>
+</ol>
+<p>Multiple paragraphs:</p>
+<ol>
+<li><p>Item 1, graf one.</p>
+<p>Item 1. graf two. The quick brown fox jumped over the lazy dog&rsquo;s back.</p>
+</li>
+<li><p>Item 2.</p>
+</li>
+<li><p>Item 3.</p>
+</li>
+</ol>
+<h2>Nested</h2>
+<ul>
+<li>Tab<ul>
+<li>Tab<ul>
+<li>Tab</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+<p>Here&rsquo;s another:</p>
+<ol>
+<li>First</li>
+<li>Second:<ul>
+<li>Fee</li>
+<li>Fie</li>
+<li>Foe</li>
+</ul>
+</li>
+<li>Third</li>
+</ol>
+<p>Same thing but with paragraphs:</p>
+<ol>
+<li><p>First</p>
+</li>
+<li><p>Second:</p>
+<ul>
+<li>Fee</li>
+<li>Fie</li>
+<li>Foe</li>
+</ul>
+</li>
+<li><p>Third</p>
+</li>
+</ol>
+<h2>Tabs and spaces</h2>
+<ul>
+<li><p>this is a list item indented with tabs</p>
+</li>
+<li><p>this is a list item indented with spaces</p>
+<ul>
+<li><p>this is an example list item indented with tabs</p>
+</li>
+<li><p>this is an example list item indented with spaces</p>
+</li>
+</ul>
+</li>
+</ul>
+<hr />
+<h1>HTML Blocks</h1>
+<p>Simple block on one line:</p>
+<div>foo</div>
+<p>And nested without indentation:</p>
+<div>
+<div>
+<div>foo</div>
+</div>
+<div>bar</div>
+</div>
+<p>Interpreted markdown in a table:</p>
+<table>
+<tr>
+<td>This is <em>emphasized</em></td>
+<td>And this is <strong>strong</strong></td>
+</tr>
+</table>
+
+<script type="text/javascript">document.write('This *should not* be interpreted as markdown');</script>
+<p>Here&rsquo;s a simple block:</p>
+<div>
+ foo</div>
+<p>This should be a code block, though:</p>
+<pre><code>&lt;div>
+ foo
+&lt;/div>
+</code></pre>
+<p>As should this:</p>
+<pre><code>&lt;div>foo&lt;/div>
+</code></pre>
+<p>Now, nested:</p>
+<div>
+ <div>
+ <div>
+ foo</div>
+ </div>
+</div>
+<p>This should just be an HTML comment:</p>
+<!-- Comment -->
+<p>Multiline:</p>
+<!--
+Blah
+Blah
+-->
+
+<!--
+ This is another comment.
+-->
+<p>Code block:</p>
+<pre><code>&lt;!-- Comment -->
+</code></pre>
+<p>Just plain comment, with trailing spaces on the line:</p>
+<!-- foo -->
+<p>Code:</p>
+<pre><code>&lt;hr />
+</code></pre>
+<p>Hr&rsquo;s:</p>
+<hr>
+
+<hr />
+
+<hr />
+
+<hr>
+
+<hr />
+
+<hr />
+
+<hr class="foo" id="bar" />
+
+<hr class="foo" id="bar" />
+
+<hr class="foo" id="bar">
+<hr />
+<h1>Inline Markup</h1>
+<p>This is <em>emphasized</em>, and so <em>is this</em>.</p>
+<p>This is <strong>strong</strong>, and so <strong>is this</strong>.</p>
+<p>An <em><a href="/url">emphasized link</a></em>.</p>
+<p><strong><em>This is strong and em.</em></strong></p>
+<p>So is <strong><em>this</em></strong> word.</p>
+<p><strong><em>This is strong and em.</em></strong></p>
+<p>So is <strong><em>this</em></strong> word.</p>
+<p>This is code: <code>></code>, <code>$</code>, <code>\</code>, <code>\$</code>, <code>&lt;html></code>.</p>
+<hr />
+<h1>Smart quotes, ellipses, dashes</h1>
+<p>&ldquo;Hello,&rdquo; said the spider. &ldquo;&lsquo;Shelob&rsquo; is my name.&rdquo;</p>
+<p>&lsquo;A&rsquo;, &lsquo;B&rsquo;, and &lsquo;C&rsquo; are letters.</p>
+<p>&lsquo;Oak,&rsquo; &lsquo;elm,&rsquo; and &lsquo;beech&rsquo; are names of trees. So is &lsquo;pine.&rsquo;</p>
+<p>&lsquo;He said, &ldquo;I want to go.&rdquo;&rsquo; Were you alive in the 70&rsquo;s?</p>
+<p>Here is some quoted &lsquo;<code>code</code>&rsquo; and a &ldquo;<a href="http://example.com/?foo=1&amp;bar=2">quoted link</a>&rdquo;.</p>
+<p>Some dashes: one&mdash;two&mdash;three&mdash;four&mdash;five.</p>
+<p>Dashes between numbers: 5&ndash;7, 255&ndash;66, 1987&ndash;1999.</p>
+<p>Ellipses&hellip;and&hellip;and &hellip; .</p>
+<hr />
+<h1>LaTeX</h1>
+<ul>
+<li>\cite[22-23]{smith.1899}</li>
+<li>\doublespacing</li>
+<li>$2+2=4$</li>
+<li>$x \in y$</li>
+<li>$\alpha \wedge \omega$</li>
+<li>$223$</li>
+<li>$p$-Tree</li>
+<li>$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</li>
+<li>Here&rsquo;s one that has a line break in it: $\alpha + \omega \times x^2$.</li>
+</ul>
+<p>These shouldn&rsquo;t be math:</p>
+<ul>
+<li>To get the famous equation, write <code>$e = mc^2$</code>.</li>
+<li>$22,000 is a <em>lot</em> of money. So is $34,000. (It worked if &ldquo;lot&rdquo; is emphasized.)</li>
+<li>Escaped <code>$</code>: $73 <em>this should be emphasized</em> 23$.</li>
+</ul>
+<p>Here&rsquo;s a LaTeX table:</p>
+<p>\begin{tabular}{|l|l|}\hline
+Animal &amp; Number \\ \hline
+Dog &amp; 2 \\
+Cat &amp; 1 \\ \hline
+\end{tabular}</p>
+<hr />
+<h1>Special Characters</h1>
+<p>Here is some unicode:</p>
+<ul>
+<li>I hat: Î</li>
+<li>o umlaut: ö</li>
+<li>section: §</li>
+<li>set membership: ∈</li>
+<li>copyright: ©</li>
+</ul>
+<p>AT&amp;T has an ampersand in their name.</p>
+<p>AT&amp;T is another way to write it.</p>
+<p>This &amp; that.</p>
+<p>4 &lt; 5.</p>
+<p>6 &gt; 5.</p>
+<p>Backslash: \</p>
+<p>Backtick: &lsquo;</p>
+<p>Asterisk: *</p>
+<p>Underscore: _</p>
+<p>Left brace: {</p>
+<p>Right brace: }</p>
+<p>Left bracket: [</p>
+<p>Right bracket: ]</p>
+<p>Left paren: (</p>
+<p>Right paren: )</p>
+<p>Greater-than: &gt;</p>
+<p>Hash: #</p>
+<p>Period: .</p>
+<p>Bang: !</p>
+<p>Plus: +</p>
+<p>Minus: -</p>
+<hr />
+<h1>Links</h1>
+<h2>Explicit</h2>
+<p>Just a <a href="/url/">URL</a>.</p>
+<p><a href="/url/" title="title">URL and title</a>.</p>
+<p><a href="/url/" title="title preceded by two spaces">URL and title</a>.</p>
+<p><a href="/url/" title="title preceded by a tab">URL and title</a>.</p>
+<p><a href="/url/" title="title with &quot;quotes&quot; in it">URL and title</a></p>
+<p><a href="/url/" title="title with single quotes">URL and title</a></p>
+<p><script type="text/javascript">h='nowhere.net';n='nobody';e=n+'@'+h;document.write('<a href="mailto:'+e+'">'+'Email link'+'<\/a>');</script><noscript>Email link (nobody [at] nowhere.net)</noscript></p>
+<p><a href="">Empty</a>.</p>
+<h2>Reference</h2>
+<p>Foo <a href="/url/">bar</a>.</p>
+<p>Foo <a href="/url/">bar</a>.</p>
+<p>Foo <a href="/url/">bar</a>.</p>
+<p>With <a href="/url/">embedded [brackets]</a>.</p>
+<p><a href="/url/">b</a> by itself should be a link.</p>
+<p>Indented <a href="/url">once</a>.</p>
+<p>Indented <a href="/url">twice</a>.</p>
+<p>Indented <a href="/url">thrice</a>.</p>
+<p>This should [not] be a link.</p>
+<pre><code>[not]: /url
+</code></pre>
+<p>Foo <a href="/url/" title="Title with &quot;quotes&quot; inside">bar</a>.</p>
+<p>Foo <a href="/url/" title="Title with &quot;quote&quot; inside">biz</a>.</p>
+<h2>With ampersands</h2>
+<p>Here&rsquo;s a <a href="http://example.com/?foo=1&amp;bar=2">link with an ampersand in the URL</a>.</p>
+<p>Here&rsquo;s a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&amp;T</a>.</p>
+<p>Here&rsquo;s an <a href="/script?foo=1&amp;bar=2">inline link</a>.</p>
+<p>Here&rsquo;s an <a href="/script?foo=1&amp;bar=2">inline link in pointy braces</a>.</p>
+<h2>Autolinks</h2>
+<p>With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</a></p>
+<ul>
+<li>In a list?</li>
+<li><a href="http://example.com/">http://example.com/</a></li>
+<li>It should.</li>
+</ul>
+<p>An e-mail address: <script type="text/javascript">h='nowhere.net';n='nobody';e=n+'@'+h;document.write('<a href="mailto:'+e+'">'+e+'<\/a>');</script><noscript>nobody [at] nowhere.net</noscript></p>
+<blockquote>
+<p>Blockquoted: <a href="http://example.com/">http://example.com/</a></p>
+</blockquote>
+<p>Auto-links should not occur here: <code>&lt;http://example.com/></code></p>
+<pre><code>or here: &lt;http://example.com/>
+</code></pre>
+<hr />
+<h1>Images</h1>
+<p>From &ldquo;Voyage dans la Lune&rdquo; by Georges Melies (1902):</p>
+<p><img src="lalune.jpg" title="Voyage dans la Lune" alt="lalune"></p>
+<p>Here is a movie <img src="movie.jpg" alt="movie"> icon.</p>
+<hr />
+<h1>Footnotes</h1>
+<p>Here is a footnote reference<span class="pandocNoteRef"><a name="ref_1" href="#note_1">(1)</a></span>, and another<span class="pandocNoteRef"><a name="ref_longnote" href="#note_longnote">(longnote)</a></span>. This should <em>not</em> be a footnote reference, because it contains a space^(my note).</p>
+<div class="pandocNote">
+<p class="first"><span class="pandocNoteMarker"><a name="note_1" href="#ref_1">(1)</a></span> Here is the footnote. It can go anywhere in the document, not just at the end.</p>
+
+</div>
+<div class="pandocNote">
+<p class="first"><span class="pandocNoteMarker"><a name="note_longnote" href="#ref_longnote">(longnote)</a></span> Here&rsquo;s the other note. This one contains multiple blocks.</p>
+<p>Caret characters are used to indicate that the blocks all belong to a single footnote (as with block quotes).</p>
+<pre><code> { &lt;code> }
+</code></pre>
+<p>If you want, you can use a caret at the beginning of every line, as with blockquotes, but all that you need is a caret at the beginning of the first line of the block and any preceding blank lines.</p>
+
+</div>
+</body>
+</html>
+