diff options
| author | Yann Trividic <[email protected]> | 2026-01-03 18:36:19 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-03 12:36:19 -0500 |
| commit | 2a426718bc7c6cc88ceac0359b60f840d0f27bf9 (patch) | |
| tree | 711e67997dab13da56e99a012aae69650eb1e323 /test | |
| parent | 12ad483674e5447bb4258017385263f42fe457de (diff) | |
DocBook reader: support "role" attribute (#11255)
The `role` attribute is parsed and added to Pandoc AST elements,
using a wrapper Div if needed.
Diffstat (limited to 'test')
| -rw-r--r-- | test/docbook-reader.docbook | 42 | ||||
| -rw-r--r-- | test/docbook-reader.native | 111 |
2 files changed, 145 insertions, 8 deletions
diff --git a/test/docbook-reader.docbook b/test/docbook-reader.docbook index 6b7e7e1bc..076908583 100644 --- a/test/docbook-reader.docbook +++ b/test/docbook-reader.docbook @@ -27,9 +27,9 @@ This is a set of tests for pandoc. Most of them are adapted from John Gruber’s markdown test suite. </para> -<sect1 id="headers"> +<sect1 id="headers" role="sect1role"> <title>Headers</title> - <sect2 id="level-2-with-an-embedded-link"> + <sect2 id="level-2-with-an-embedded-link" role="sect2role"> <title>Level 2 with an <ulink url="/url">embedded link</ulink></title> <sect3 id="level-3-with-emphasis"> <title>Level 3 with <emphasis>emphasis</emphasis></title> @@ -74,6 +74,9 @@ <para> Here’s a regular paragraph. </para> + <para role="pararole"> + And here’s a regular paragraph with a role. + </para> <para> 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 @@ -93,6 +96,11 @@ This is a block quote. It is pretty short. </para> </blockquote> + <blockquote role="roleblockquote"> + <para> + This is a block quote with a role. + </para> + </blockquote> <blockquote> <para> Code in a block quote: @@ -234,6 +242,26 @@ These should not be escaped: \$ \\ \> \[ \{ </listitem> </orderedlist> <para> + with role: + </para> + <orderedlist role="listrole" numeration="arabic"> + <listitem> + <para> + First + </para> + </listitem> + <listitem> + <para> + Second + </para> + </listitem> + <listitem> + <para> + Third + </para> + </listitem> + </orderedlist> + <para> and tight: </para> <orderedlist spacing="compact" numeration="arabic"> @@ -703,6 +731,12 @@ These should not be escaped: \$ \\ \> \[ \{ So is <emphasis role="strong"><emphasis>this</emphasis></emphasis> word. </para> <para> + So is <emphasis role="emphasisrole"><emphasis>this</emphasis></emphasis> word with a role. + </para> + <para> + So is <phrase role="phraserole"><phrase>this</phrase></phrase> phrase with a role. + </para> + <para> This is code: <literal>></literal>, <literal>$</literal>, <literal>\</literal>, <literal>\$</literal>, <literal><html></literal>. @@ -1408,7 +1442,7 @@ or here: <http://example.com/> <para> Table with attributes </para> - <table xml:id="mytableid1" class="mytableclass1 mytableclass2" tabstyle="mytabstyle1"> + <table xml:id="mytableid1" class="mytableclass1 mytableclass2" tabstyle="mytabstyle1" role="tablerole1"> <title> Attribute table caption </title> @@ -1444,7 +1478,7 @@ or here: <http://example.com/> <para> Table with attributes, without caption </para> - <informaltable xml:id="mytableid2" class="mytableclass3 mytableclass4" tabstyle="mytabstyle2"> + <informaltable xml:id="mytableid2" class="mytableclass3 mytableclass4" tabstyle="mytabstyle2" role="tablerole2"> <tgroup> <thead> <th> diff --git a/test/docbook-reader.native b/test/docbook-reader.native index 6d0f72811..94bca827a 100644 --- a/test/docbook-reader.native +++ b/test/docbook-reader.native @@ -62,10 +62,16 @@ Pandoc , Space , Str "suite." ] - , Header 1 ( "headers" , [] , [] ) [ Str "Headers" ] + , Header + 1 + ( "headers" , [] , [ ( "role" , "sect1role" ) ] ) + [ Str "Headers" ] , Header 2 - ( "level-2-with-an-embedded-link" , [] , [] ) + ( "level-2-with-an-embedded-link" + , [] + , [ ( "role" , "sect2role" ) ] + ) [ Str "Level" , Space , Str "2" @@ -151,6 +157,29 @@ Pandoc , Space , Str "paragraph." ] + , Div + ( "" + , [] + , [ ( "wrapper" , "1" ) , ( "role" , "pararole" ) ] + ) + [ Para + [ Str "And" + , Space + , Str "here\8217s" + , Space + , Str "a" + , Space + , Str "regular" + , Space + , Str "paragraph" + , Space + , Str "with" + , Space + , Str "a" + , Space + , Str "role." + ] + ] , Para [ Str "In" , Space @@ -251,6 +280,31 @@ Pandoc , Str "short." ] ] + , Div + ( "" + , [] + , [ ( "wrapper" , "1" ) , ( "role" , "roleblockquote" ) ] + ) + [ BlockQuote + [ Para + [ Str "This" + , Space + , Str "is" + , Space + , Str "a" + , Space + , Str "block" + , Space + , Str "quote" + , Space + , Str "with" + , Space + , Str "a" + , Space + , Str "role." + ] + ] + ] , BlockQuote [ Para [ Str "Code" @@ -348,6 +402,19 @@ Pandoc , [ Para [ Str "Second" ] ] , [ Para [ Str "Third" ] ] ] + , Para [ Str "with" , Space , Str "role:" ] + , Div + ( "" + , [] + , [ ( "wrapper" , "1" ) , ( "role" , "listrole" ) ] + ) + [ OrderedList + ( 1 , Decimal , DefaultDelim ) + [ [ Para [ Str "First" ] ] + , [ Para [ Str "Second" ] ] + , [ Para [ Str "Third" ] ] + ] + ] , Para [ Str "and" , Space , Str "tight:" ] , OrderedList ( 1 , Decimal , DefaultDelim ) @@ -932,6 +999,38 @@ Pandoc , Str "word." ] , Para + [ Str "So" + , Space + , Str "is" + , Space + , Emph [ Emph [ Str "this" ] ] + , Space + , Str "word" + , Space + , Str "with" + , Space + , Str "a" + , Space + , Str "role." + ] + , Para + [ Str "So" + , Space + , Str "is" + , Space + , Span + ( "" , [ "phraserole" ] , [ ( "role" , "phraserole" ) ] ) + [ Str "this" ] + , Space + , Str "phrase" + , Space + , Str "with" + , Space + , Str "a" + , Space + , Str "role." + ] + , Para [ Str "This" , Space , Str "is" @@ -2570,7 +2669,9 @@ Pandoc , Table ( "mytableid1" , [ "mytableclass1" , "mytableclass2" ] - , [ ( "custom-style" , "mytabstyle1" ) ] + , [ ( "role" , "tablerole1" ) + , ( "custom-style" , "mytabstyle1" ) + ] ) (Caption Nothing @@ -2636,7 +2737,9 @@ Pandoc , Table ( "mytableid2" , [ "mytableclass3" , "mytableclass4" ] - , [ ( "custom-style" , "mytabstyle2" ) ] + , [ ( "role" , "tablerole2" ) + , ( "custom-style" , "mytabstyle2" ) + ] ) (Caption Nothing []) [ ( AlignDefault , ColWidthDefault ) |
