asciidoctor-003

Tests that Asciidoctor creates a whole document.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
                xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" name="main" version="3.0">
   <p:import href="https://xmlcalabash.com/ext/library/asciidoctor.xpl"/>
   <p:output port="result" sequence="true"/>
   <cx:asciidoctor 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>

Result

<article xmlns="http://docbook.org/ns/docbook"
         xmlns:t="http://xproc.org/ns/testsuite/3.0" xmlns:xl="http://www.w3.org/1999/xlink"
         version="5.0" xml:lang="en">
   <info>
      <title>The Document Title</title>
      <date>2025-06-19</date>
   </info>
   <simpara>This is a paragraph.</simpara>
   <simpara>So is this.</simpara>
   <simpara>And this.</simpara>
</article>

Schematron checks

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
          xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
   <s:ns prefix="db"
         uri="http://docbook.org/ns/docbook"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="db:article">The root is incorrect.</s:assert>
         <s:assert test="db:article/db:info">There is no info.</s:assert>
      </s:rule>
      <s:rule context="/db:article/db:info">
         <s:assert test="db:title='The Document Title'">The title is incorrect.</s:assert>
      </s:rule>
      <s:rule context="/db:article">
         <s:assert test="count(db:simpara)=3">The number of paragraphs is incorrect.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

21 Feb 2025, Norm Tovey-Walsh
Created test.