# Defines multiple-line tests
#
# Input format is:
#
# LaTeX (multiple lines)
# ---- (divider)
# Resulting set of Nodes, as many lines as required.
# ==== (divider)
#
# Lines starting with '#' are documentation and are stripped out when running tests
#
##############################
Hello

There
----
<p>Hello</p>
<p>There</p>
====
Hello

There

Again
----
<p>Hello</p>
<p>There</p>
<p>Again</p>
====
Hello

\begin{itemize}
\item A
\item B
\end{itemize}

There
----
<p>Hello</p>
<ul>
  <li>A</li>
  <li>B</li>
</ul>
<p>There</p>
====
# Comments mixed in with blank lines should not be treated as new paragraphs
Hello

%

There
----
<p>Hello</p>
<p>There</p>
====
# Similarly, macros which produce no output should have the same effect
Hello

\newcommand{\bob}{Hello}

\bob
----
<p>Hello</p>
<p>Hello</p>
====
## Test Whitespace in lists
\begin{itemize}
  \item A
\end{itemize}
----
<ul>
  <li>A</li>
</ul>
====
# Test mixes of itemize and paragraphs
\begin{itemize}

\item
  First Item

  New Paragraph

\item
  Second Item


\end{itemize}
----
<ul>
  <li>
    <p>First Item</p>
    <p>New Paragraph</p>
  </li>
  <li>
    Second Item
  </li>
</ul>
====
# Verbatim tests are a bit limited by my crappy whitespace stripping in the test classes,
# so you need to be add explicit &#x0a; into the XML to specify where explicit line breaks
# should occur
\begin{verbatim}
Hello
\end{verbatim}
----
<pre class="verbatim">&#x0a;Hello&#x0a;</pre>
====
# Compact input gives compact output
Hello
----
Hello
====
# Leading or trailing whitespace shouldn't trigger a pointless paragraph
%


Hello


%
----
Hello
====
# Paragraphs inside mbox
Hello \mbox{Hello

There}
----
Hello <span class="mbox">Hello There</span>
====
# Multi-line bold font handling
{\bf Hello

There}
----
<div class="bf">
  <p>Hello</p>
  <p>There</p>
</div>
====
# Tests spacing between 2 block elements
\xmlBlockElement{urn}{qName}{Content}
\xmlBlockElement{urn}{qName}{Content}
----
<qName xmlns="urn">Content</qName>
<qName xmlns="urn">Content</qName>
====
# Tests spacing between 2 environments
\begin{itemize} \item A\end{itemize}
\begin{itemize} \item B\end{itemize}
----
<ul>
  <li>A</li>
</ul>
<ul>
  <li>B</li>
</ul>
====
# Tests spacing between 2 user-defined block elements
\newcommand{\bob}{\xmlBlockElement{urn}{qName}{Content}}

\bob
\bob
----
<qName xmlns="urn">Content</qName>
<qName xmlns="urn">Content</qName>
====
# Tests additional spacing between 2 user-defined block elements
\newcommand{\bob}{\xmlBlockElement{urn}{qName}{Content}}

\bob

\bob
----
<qName xmlns="urn">Content</qName>
<qName xmlns="urn">Content</qName>
====
# Tests nested user-defined block elements
\newcommand{\xml}[2]{\xmlBlockElement{urn}{#1}{#2}}
\newcommand{\bob}{\xml{qName}{Content}}

\bob
\bob
----
<qName xmlns="urn">Content</qName>
<qName xmlns="urn">Content</qName>
====
# From Aardvark
\newcommand{\blockElement}[2][]{\xmlBlockElement[#1]{urn:aardvark}{a:#2}}
\newcommand{\topic*}[1]{\blockElement{topic}{#1}}

\topic*{Hello}

----
<a:topic xmlns:a="urn:aardvark">Hello</a:topic>
====
# Comment Test. LaTeX comments eat up the newline at the end of the line...
White%
Space
----
WhiteSpace
====
# Comment Test 2: ...they also eat up any following whitespace on the next line...
White%
   Space
----
WhiteSpace
====
# Comment Test 3: ...but not the line after
White%
  
Space
----
<p>White</p>
<p>Space</p>
====
# Breathing space test. When splitting up multi-line commands, we often use
# '%' at the end of a line to do a continuation that absorbs leading whitespace on
# the next line. The following is an example of this.
\newcommand{\bob}{%
  \xmlBlockElement{urn}{qName}{Content}
}

\bob
\bob
----
<qName xmlns="urn">Content</qName>
<qName xmlns="urn">Content</qName>
====
## Comments between arguments
\newcommand{\a}[2]{#1 #2}
\a{x}%
{y}
----
x y
====
## Horrible deep environment!
\newenvironment{a}{\begin{itemize}}{\end{itemize}}
\newenvironment{b}{\begin{a}}{\end{a}}
\begin{b}
  \item Hello!
\end{b}
----
<ul>
  <li>Hello!</li>
</ul>
====
## This was added to test removal of first/last siblings when they're whitespace
\newenvironment{columns}{\begin{xmlBlockElement}{}{columns}}{\end{xmlBlockElement}}
\newenvironment{column}{\begin{xmlBlockElement}{}{column}}{\end{xmlBlockElement}}
\begin{columns}
  \begin{column}
    Hello
  \end{column}
\end{columns}
----
<columns xmlns="">
  <column>Hello</column>
</columns>
====
## Regression test for a bug involving leading new paragraphs, related to whitespace handling
\newenvironment{keypoint}{\begin{xmlBlockElement}{}{keypoint}}{\end{xmlBlockElement}}
\begin{keypoint}

The velocity
\end{keypoint}
----
<keypoint xmlns="">The velocity</keypoint>
====
## It is useful to allow user-defined commands/environments which do nothing before first item in a list
\newcommand{\vspace}[1]{}
\begin{itemize}

  \vspace{0.1cm}

  \item A

\end{itemize}
----
<ul>
  <li>A</li>
</ul>
====
\Huge
This is some big huge text.

New paragraph
----
<div class="huge2">
  <p>This is some big huge text.</p>
  <p>New paragraph</p>
</div>
====
\Huge


This is some big huge text.

New paragraph
----
<div class="huge2">
  <p>This is some big huge text.</p>
  <p>New paragraph</p>
</div>
====
## I haven't done much to support this in a nice way, but what we get by default is acceptable:
\begin{center}
Line 1\\
Line 2\\
\end{center}
----
<div class="center">
Line 1<br/>
&#x0a;Line 2<br/>
</div>
====
## Fancy table 1
\begin{tabular}{|r|l|}
 1 & 2 \\
 3 & 4
\end{tabular}
----
<table class="tabular">
  <tbody>
    <tr>
      <td class="tabular align-right left-border">1</td>
      <td class="tabular align-left left-border right-border">2</td>
    </tr>
    <tr>
      <td class="tabular align-right left-border">3</td>
      <td class="tabular align-left left-border right-border">4</td>
    </tr>
  </tbody>
</table>
====
## Fancy table 2 (with \hline)
\begin{tabular}{|r|l|}
 1 & 2 \\
 \hline
 3 & 4 \\
 \hline
\end{tabular}
----
<table class="tabular">
  <tbody>
    <tr>
      <td class="tabular align-right left-border">1</td>
      <td class="tabular align-left left-border right-border">2</td>
    </tr>
    <tr>
      <td class="tabular align-right left-border top-border bottom-border">3</td>
      <td class="tabular align-left left-border right-border top-border bottom-border">4</td>
    </tr>
  </tbody>
</table>
====
## Comments inside tabulars need to be handled correctly (this is no longer a problem)
\begin{tabular}{|r|l|}
 \hline
 1 & 2 \\ %Blah
 \hline %Blah
\end{tabular}
----
<table class="tabular">
  <tbody>
    <tr>
      <td class="tabular align-right left-border top-border bottom-border">1</td>
      <td class="tabular align-left left-border right-border top-border bottom-border">2</td>
    </tr>
  </tbody>
</table>
====
## Regression: this was breaking in the token fixer; caused by bad recording of compound token slices
\begin{eqnarray*}
& 1 \\
\end{eqnarray*}
----
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mtable>
    <mtr>
      <mtd columnalign="right"></mtd>
      <mtd columnalign="center"><mn>1</mn></mtd>
    </mtr>
  </mtable>
</math>
====
## Regression: this trivial endpoint case was producing no output due to a silly error by me.
\begin{tabular}{c}
  Hello
\end{tabular}
----
<table class="tabular">
  <tbody>
    <tr>
      <td class="tabular align-center">Hello</td>
    </tr>
  </tbody>
</table>
====
## Regression: support '\' at the end of a line so that it is treated as '\ '
\ae\
X
----
&#xe6;&#xa0;X
====
## Regression: comments were not being skipped when matching up curly/square brackets
\newcommand{\bob}{%} This close bracket should not be counted!
A}
\bob
----
A
====
## Similar regression case to above
\newcommand{\bob}[1]{x#1x}
\bob{A%}
B}
----
xABx
====
## Similar regression but with square brackets
\newcommand{\bob}[1][]{x#1x}
\bob[A%]
B]
----
xABx
====
## Regression: commands at end of lines were eating up the newline as trailing whitespace
Hello\ldots

There\ldots
----
<p>Hello&#x2026;</p>
<p>There&#x2026;</p>
====
## Regression: bug handing comments introduced when changing comment behaviour for 1.1.0-beta1
%
%
Hello
----
Hello
====
#######################################################
## Required fixes for SnuggleTeX 1.3.0
A \bf B

C
----
<p>A <b>B</b></p>
<div class="bf"><p>C</p></div>
====
A \begin{bf}B

C\end{bf}
----
<p>A <b>B</b></p>
<div class="bf"><p>C</p></div>
====
A{ B

C}
----
<p>A B</p>
<p>C</p>
====
A \em B

C
----
<p>A <em>B</em></p>
<div class="em"><p>C</p></div>
====
A {\em B

C} D
----
<p>A <em>B</em></p>
<div class="em"><p>C<span class="rm"> D</span></p></div>
====
A {\huge B

C} D
----
<p>A <span class="huge">B</span></p>
<div class="huge"><p>C<span class="normalsize"> D</span></p></div>
====
\huge{A

B}
----
<div class="huge">
<p>A</p>
<p>B</p>
</div>
====
\begin{itemize}
\item A
\begin{em} \item B\end{em}
\end{itemize}
----
<ul>
  <li>A</li>
  <li><em>B</em></li>
</ul>
====
## This one would be equivalent to \frac{a \bf b}{\bf c}
$$ a \bf b \over c $$
----
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mfrac>
    <mrow>
      <mi>a</mi>
      <mstyle mathvariant="bold"><mi>b</mi></mstyle>
    </mrow>
    <mstyle mathvariant="bold"><mi>c</mi></mstyle>
  </mfrac>
</math>
====
## Make sure styles go into maths correctly: font size, but not family
\bf \huge $ 1 $
----
<span class="huge">
  <b>
    <math xmlns="http://www.w3.org/1998/Math/MathML">
      <mn>1</mn>
    </math>
  </b>
</span>
====
\begin{tabular}{c}
\small 1\\
\hline
\end{tabular}
----
<table class="tabular">
  <tbody>
    <tr>
      <td class="tabular align-center bottom-border">
        <span class="small">1</span>
      </td>
    </tr>
  </tbody>
</table>
====
