The demo package provides an example implementation of the {@link com.arsdigita.templating.html.ContentHandler} interface.

To test {@link com.arsdigita.templating.html.demo.DemoTagHandler}, you may use the following JSP. Call it `demo-test.jsp`.

>     <%@page import="com.arsdigita.templating.html.HTMLParserException" %>
>     <%@page import="com.arsdigita.templating.html.demo.DemoTagHandler" %>
>     <%@page import="com.arsdigita.util.StringUtils" %>
>     <html>
>     <head>
>       <title>DemoTagHandler</title>
>     </head>
>     <body>
>     <h1>DemoTagHandler</h1>

>     <%
>      String text = request.getParameter("text");
>      String renderedText = "";
>      String error = null;
>      if ( text == null ) {
>          text = "";
>      } else {
>         try {
>             renderedText = DemoTagHandler.getExtrapolatedDocument(text);
>         } catch (HTMLParserException ex) {
>             error = ex.hasRootCause() ? ex.getRootCause().getMessage() :
>                                         ex.getMessage();
>             if ( error != null ) {
>                 error = StringUtils.quoteHtml(error);
>             }
>         }
>      }
>     %>

>     <form action="demo-test.jsp" method="POST">
>     <textarea name="text" cols="60" rows="20"><%= text %></textarea>
>     <br/>
>     <input type="submit" name="submit" value=" Post ">
>     </form>

>     <hr size="1" width="67%" align="center">

>     <%
>       if ( error == null ) {
>           out.println(renderedText);
>       } else {
>     %>
>     <p>An error has occurred:</p>

>     <blockquote style="color: FireBrick;">
>     <%= error %>
>     </blockquote>

>     <%
>       }
>     %>

>     </body>
>     </html>

To test the tag handler, copy and paste the following text into the submission form, and post it.

>     <toc/>

>     <h1>Introduction</h1>

>     <h2>What is Truth?</h2>

>     <p>We've bandied about the term truth,<footnote>Strictly speaking,
>     this is not true.</footnote> and we've mentioned that certain
>     operators return a true or false value. Before we go any further, we
>     really ought to explain exactly what we mean by that.  </p>

>     <h1>Conclusion</h1>

>     <h2>More Footnotes</h2>

>     <p>Here's another footnote<footnote>The last one.</footnote>.  This
>     pretty much wraps it up.</p>

The result of the processed submission should look like so:

> 1. Introduction
>    1. What is Truth?
> 2. Conclusion
>    1. More Footnotes

> # Introduction

> ## What is Truth?

> We've bandied about the term truth,1 and we've mentioned that certain operators return a true or false value. Before we go any further, we really ought to explain exactly what we mean by that.

> # Conclusion

> ## More Footnotes

> Here's another footnote2. This pretty much wraps it up.

> 1. Strictly speaking, this is not true.back

> 2. The last one.back