Skip to content

Commit 589d56d

Browse files
committed
Unit tests written for new cases with role attrib.
1 parent abb62dc commit 589d56d

File tree

2 files changed

+185
-38
lines changed

2 files changed

+185
-38
lines changed

test/docbook-reader.docbook

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
This is a set of tests for pandoc. Most of them are adapted from John
2828
Gruber’s markdown test suite.
2929
</para>
30-
<sect1 id="headers">
30+
<sect1 id="headers" role="sect1role">
3131
<title>Headers</title>
32-
<sect2 id="level-2-with-an-embedded-link">
32+
<sect2 id="level-2-with-an-embedded-link" role="sect2role">
3333
<title>Level 2 with an <ulink url="/url">embedded link</ulink></title>
3434
<sect3 id="level-3-with-emphasis">
3535
<title>Level 3 with <emphasis>emphasis</emphasis></title>
@@ -74,6 +74,9 @@
7474
<para>
7575
Here’s a regular paragraph.
7676
</para>
77+
<para role="pararole">
78+
And here’s a regular paragraph with a role.
79+
</para>
7780
<para>
7881
In Markdown 1.0.0 and earlier. Version 8. This line turns into a list
7982
item. Because a hard-wrapped line in the middle of a paragraph looked like
@@ -93,6 +96,11 @@
9396
This is a block quote. It is pretty short.
9497
</para>
9598
</blockquote>
99+
<blockquote role="roleblockquote">
100+
<para>
101+
This is a block quote with a role.
102+
</para>
103+
</blockquote>
96104
<blockquote>
97105
<para>
98106
Code in a block quote:
@@ -233,6 +241,26 @@ These should not be escaped: \$ \\ \&gt; \[ \{
233241
</para>
234242
</listitem>
235243
</orderedlist>
244+
<para>
245+
with role:
246+
</para>
247+
<orderedlist role="listrole" numeration="arabic">
248+
<listitem>
249+
<para>
250+
First
251+
</para>
252+
</listitem>
253+
<listitem>
254+
<para>
255+
Second
256+
</para>
257+
</listitem>
258+
<listitem>
259+
<para>
260+
Third
261+
</para>
262+
</listitem>
263+
</orderedlist>
236264
<para>
237265
and tight:
238266
</para>
@@ -702,6 +730,12 @@ These should not be escaped: \$ \\ \&gt; \[ \{
702730
<para>
703731
So is <emphasis role="strong"><emphasis>this</emphasis></emphasis> word.
704732
</para>
733+
<para>
734+
So is <emphasis role="emphasisrole"><emphasis>this</emphasis></emphasis> word with a role.
735+
</para>
736+
<para>
737+
So is <phrase role="phraserole"><phrase>this</phrase></phrase> phrase with a role.
738+
</para>
705739
<para>
706740
This is code: <literal>&gt;</literal>, <literal>$</literal>,
707741
<literal>\</literal>, <literal>\$</literal>,
@@ -1408,7 +1442,7 @@ or here: &lt;http://example.com/&gt;
14081442
<para>
14091443
Table with attributes
14101444
</para>
1411-
<table xml:id="mytableid1" class="mytableclass1 mytableclass2" tabstyle="mytabstyle1">
1445+
<table xml:id="mytableid1" class="mytableclass1 mytableclass2" tabstyle="mytabstyle1" role="tablerole1">
14121446
<title>
14131447
Attribute table caption
14141448
</title>
@@ -1444,7 +1478,7 @@ or here: &lt;http://example.com/&gt;
14441478
<para>
14451479
Table with attributes, without caption
14461480
</para>
1447-
<informaltable xml:id="mytableid2" class="mytableclass3 mytableclass4" tabstyle="mytabstyle2">
1481+
<informaltable xml:id="mytableid2" class="mytableclass3 mytableclass4" tabstyle="mytabstyle2" role="tablerole2">
14481482
<tgroup>
14491483
<thead>
14501484
<th>

test/docbook-reader.native

Lines changed: 147 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -62,39 +62,55 @@ Pandoc
6262
, Space
6363
, Str "suite."
6464
]
65-
, Header 1 ( "headers" , [] , [] ) [ Str "Headers" ]
66-
, Header
67-
2
68-
( "level-2-with-an-embedded-link" , [] , [] )
69-
[ Str "Level"
70-
, Space
71-
, Str "2"
72-
, Space
73-
, Str "with"
74-
, Space
75-
, Str "an"
76-
, Space
77-
, Link
78-
( "" , [] , [] )
79-
[ Str "embedded" , Space , Str "link" ]
80-
( "/url" , "" )
81-
]
82-
, Header
83-
3
84-
( "level-3-with-emphasis" , [] , [] )
85-
[ Str "Level"
86-
, Space
87-
, Str "3"
88-
, Space
89-
, Str "with"
90-
, Space
91-
, Emph [ Str "emphasis" ]
65+
, Div
66+
( ""
67+
, [ "section" ]
68+
, [ ( "role" , "sect1role" ) , ( "level" , "1" ) ]
69+
)
70+
[ Header 1 ( "headers" , [] , [] ) [ Str "Headers" ]
71+
, Div
72+
( ""
73+
, [ "section" ]
74+
, [ ( "role" , "sect2role" ) , ( "level" , "2" ) ]
75+
)
76+
[ Header
77+
2
78+
( "level-2-with-an-embedded-link" , [] , [] )
79+
[ Str "Level"
80+
, Space
81+
, Str "2"
82+
, Space
83+
, Str "with"
84+
, Space
85+
, Str "an"
86+
, Space
87+
, Link
88+
( "" , [] , [] )
89+
[ Str "embedded" , Space , Str "link" ]
90+
( "/url" , "" )
91+
]
92+
, Header
93+
3
94+
( "level-3-with-emphasis" , [] , [] )
95+
[ Str "Level"
96+
, Space
97+
, Str "3"
98+
, Space
99+
, Str "with"
100+
, Space
101+
, Emph [ Str "emphasis" ]
102+
]
103+
, Header
104+
4
105+
( "level-4" , [] , [] )
106+
[ Str "Level" , Space , Str "4" ]
107+
, Header
108+
5
109+
( "level-5" , [] , [] )
110+
[ Str "Level" , Space , Str "5" ]
111+
, Para [ Str "Hi." ]
112+
]
92113
]
93-
, Header
94-
4 ( "level-4" , [] , [] ) [ Str "Level" , Space , Str "4" ]
95-
, Header
96-
5 ( "level-5" , [] , [] ) [ Str "Level" , Space , Str "5" ]
97-
, Para [ Str "Hi." ]
98114
, Header
99115
1 ( "level-1" , [] , [] ) [ Str "Level" , Space , Str "1" ]
100116
, Header
@@ -151,6 +167,29 @@ Pandoc
151167
, Space
152168
, Str "paragraph."
153169
]
170+
, Div
171+
( ""
172+
, []
173+
, [ ( "wrapper" , "1" ) , ( "role" , "pararole" ) ]
174+
)
175+
[ Para
176+
[ Str "And"
177+
, Space
178+
, Str "here\8217s"
179+
, Space
180+
, Str "a"
181+
, Space
182+
, Str "regular"
183+
, Space
184+
, Str "paragraph"
185+
, Space
186+
, Str "with"
187+
, Space
188+
, Str "a"
189+
, Space
190+
, Str "role."
191+
]
192+
]
154193
, Para
155194
[ Str "In"
156195
, Space
@@ -251,6 +290,31 @@ Pandoc
251290
, Str "short."
252291
]
253292
]
293+
, Div
294+
( ""
295+
, []
296+
, [ ( "wrapper" , "1" ) , ( "role" , "roleblockquote" ) ]
297+
)
298+
[ BlockQuote
299+
[ Para
300+
[ Str "This"
301+
, Space
302+
, Str "is"
303+
, Space
304+
, Str "a"
305+
, Space
306+
, Str "block"
307+
, Space
308+
, Str "quote"
309+
, Space
310+
, Str "with"
311+
, Space
312+
, Str "a"
313+
, Space
314+
, Str "role."
315+
]
316+
]
317+
]
254318
, BlockQuote
255319
[ Para
256320
[ Str "Code"
@@ -348,6 +412,19 @@ Pandoc
348412
, [ Para [ Str "Second" ] ]
349413
, [ Para [ Str "Third" ] ]
350414
]
415+
, Para [ Str "with" , Space , Str "role:" ]
416+
, Div
417+
( ""
418+
, []
419+
, [ ( "wrapper" , "1" ) , ( "role" , "listrole" ) ]
420+
)
421+
[ OrderedList
422+
( 1 , Decimal , DefaultDelim )
423+
[ [ Para [ Str "First" ] ]
424+
, [ Para [ Str "Second" ] ]
425+
, [ Para [ Str "Third" ] ]
426+
]
427+
]
351428
, Para [ Str "and" , Space , Str "tight:" ]
352429
, OrderedList
353430
( 1 , Decimal , DefaultDelim )
@@ -931,6 +1008,38 @@ Pandoc
9311008
, Space
9321009
, Str "word."
9331010
]
1011+
, Para
1012+
[ Str "So"
1013+
, Space
1014+
, Str "is"
1015+
, Space
1016+
, Emph [ Emph [ Str "this" ] ]
1017+
, Space
1018+
, Str "word"
1019+
, Space
1020+
, Str "with"
1021+
, Space
1022+
, Str "a"
1023+
, Space
1024+
, Str "role."
1025+
]
1026+
, Para
1027+
[ Str "So"
1028+
, Space
1029+
, Str "is"
1030+
, Space
1031+
, Span
1032+
( "" , [ "phraserole" ] , [ ( "role" , "phraserole" ) ] )
1033+
[ Str "this" ]
1034+
, Space
1035+
, Str "phrase"
1036+
, Space
1037+
, Str "with"
1038+
, Space
1039+
, Str "a"
1040+
, Space
1041+
, Str "role."
1042+
]
9341043
, Para
9351044
[ Str "This"
9361045
, Space
@@ -2570,7 +2679,9 @@ Pandoc
25702679
, Table
25712680
( "mytableid1"
25722681
, [ "mytableclass1" , "mytableclass2" ]
2573-
, [ ( "custom-style" , "mytabstyle1" ) ]
2682+
, [ ( "role" , "tablerole1" )
2683+
, ( "custom-style" , "mytabstyle1" )
2684+
]
25742685
)
25752686
(Caption
25762687
Nothing
@@ -2636,7 +2747,9 @@ Pandoc
26362747
, Table
26372748
( "mytableid2"
26382749
, [ "mytableclass3" , "mytableclass4" ]
2639-
, [ ( "custom-style" , "mytabstyle2" ) ]
2750+
, [ ( "role" , "tablerole2" )
2751+
, ( "custom-style" , "mytabstyle2" )
2752+
]
26402753
)
26412754
(Caption Nothing [])
26422755
[ ( AlignDefault , ColWidthDefault )

0 commit comments

Comments
 (0)