<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/asciidoctor-006.xml"
        name="asciidoctor-006.xml"
        expected="pass">
   <t:info>
      <t:title>asciidoctor-006</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2025-02-21</t:date>
            <t:author>
               <t:name>Norm Tovey-Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Created test.</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Tests that Asciidoctor creates a whole document.</p>
   </t:description>
   <t:pipeline>
      <p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
                      xmlns:p="http://www.w3.org/ns/xproc"
                      name="main"
                      version="3.0">
         <p:import href="https://xmlcalabash.com/ext/library/asciidoctor.xpl"/>
         <p:output port="result" sequence="true"/>
         <cx:asciidoctor backend="html5"
                         parameters="map{'standalone': true()}"
                         attributes="map{'title': 'The Document Title'}">
            <p:with-input>
               <p:inline content-type="text/plain">
This is a paragraph.

So is this.

And this.
      </p:inline>
            </p:with-input>
         </cx:asciidoctor>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
         <s:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="h:html">The root is incorrect.</s:assert>
               <s:assert test="h:html/h:head">The document has no head.</s:assert>
               <s:assert test="h:html/h:body">The document has no body.</s:assert>
            </s:rule>
         </s:pattern>
         <s:pattern>
            <s:rule context="h:head">
               <s:assert test="h:title = 'The Document Title'">The title is incorrect.</s:assert>
            </s:rule>
         </s:pattern>
         <s:pattern>
            <s:rule context="h:body">
               <s:assert test="count(//h:div[h:p]) = 3">The number of paragraphs is incorrect.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="asciidoctor-006.xml">
      <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
         <head>
            <meta charset="UTF-8"/>
            <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
            <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
            <meta name="generator" content="Asciidoctor 2.0.26"/>
            <title>The Document Title</title>
         </head>
         <body class="article">
            <div id="header"/>
            <div id="content">
               <div class="paragraph">
                  <p>This is a paragraph.</p>
               </div>
               <div class="paragraph">
                  <p>So is this.</p>
               </div>
               <div class="paragraph">
                  <p>And this.</p>
               </div>
            </div>
            <div id="footer">
               <div id="footer-text">
Last updated 2026-07-18 16:01:39 UTC
</div>
            </div>
         </body>
      </html>
   </t:result>
</t:test>
