git.iko.soy/typeable/pandoc
on master help sign in
Asciidoc writer: shorter delimiters for tables, blockquotes.

This matches asciidoctor reference docs. Closes #4364.

commit599327bee1eac3662ec2ab32e32d794246940e25 authorJohn MacFarlane <jgm@berkeley.edu> dateMon 7 Jan 2019, 22:10 (8 years ago) parentc1d058a
4 files changed+34−35
src/Text/Pandoc/Writers/AsciiDoc.hs+2−3 test/Tests/Writers/AsciiDoc.hs+4−4 test/tables.asciidoc+14−14 test/writer.asciidoc+14−14
src/Text/Pandoc/Writers/AsciiDoc.hs+2−3
@@ -194,8 +194,7 @@ blockToAsciiDoc opts (BlockQuote blocks) = do
194194 let contents' = if any isBlock blocks
195195 then "--" $$ contents $$ "--"
196196 else contents
197− let cols = offset contents'
198− let bar = text $ replicate cols '_'
197+ let bar = text "____"
199198 return $ bar $$ chomp contents' $$ bar <> blankline
200199blockToAsciiDoc opts (Table caption aligns widths headers rows) = do
201200 caption' <- inlineListToAsciiDoc opts caption
@@ -252,7 +251,7 @@ blockToAsciiDoc opts (Table caption aligns widths headers rows) = do
252251 else 100000
253252 let maxwidth = maximum $ map offset (head':rows')
254253 let body = if maxwidth > colwidth then vsep rows' else vcat rows'
255− let border = text $ "|" ++ replicate (max 5 (min maxwidth colwidth) - 1) '='
254+ let border = text "|==="
256255 return $
257256 caption'' $$ tablespec $$ border $$ head'' $$ body $$ border $$ blankline
258257blockToAsciiDoc opts (BulletList items) = do
test/Tests/Writers/AsciiDoc.hs+4−4
@@ -37,22 +37,22 @@ tests = [ testGroup "emphasis"
3737 [ test asciidoc "empty cells" $
3838 simpleTable [] [[mempty],[mempty]] =?> unlines
3939 [ "[cols=\"\",]"
40− , "|===="
40+ , "|==="
4141 , "|"
4242 , "|"
43− , "|===="
43+ , "|==="
4444 ]
4545 , test asciidoc "multiblock cells" $
4646 simpleTable [] [[para (text "Para 1") <> para (text "Para 2")]]
4747 =?> unlines
4848 [ "[cols=\"\",]"
49− , "|====="
49+ , "|==="
5050 , "a|"
5151 , "Para 1"
5252 , ""
5353 , "Para 2"
5454 , ""
55− , "|====="
55+ , "|==="
5656 ]
5757 ]
5858 ]
test/tables.asciidoc+14−14
@@ -2,66 +2,66 @@ Simple table with caption:
22
33.Demonstration of simple table syntax.
44[cols=">,<,^,",options="header",]
5−|============================
5+|===
66|Right |Left |Center |Default
77|12 |12 |12 |12
88|123 |123 |123 |123
99|1 |1 |1 |1
10−|============================
10+|===
1111
1212Simple table without caption:
1313
1414[cols=">,<,^,",options="header",]
15−|============================
15+|===
1616|Right |Left |Center |Default
1717|12 |12 |12 |12
1818|123 |123 |123 |123
1919|1 |1 |1 |1
20−|============================
20+|===
2121
2222Simple table indented two spaces:
2323
2424.Demonstration of simple table syntax.
2525[cols=">,<,^,",options="header",]
26−|============================
26+|===
2727|Right |Left |Center |Default
2828|12 |12 |12 |12
2929|123 |123 |123 |123
3030|1 |1 |1 |1
31−|============================
31+|===
3232
3333Multiline table with caption:
3434
3535.Here’s the caption. It may span multiple lines.
3636[width="80%",cols="^20%,<17%,>20%,<43%",options="header",]
37−|=======================================================================
37+|===
3838|Centered Header |Left Aligned |Right Aligned |Default aligned
3939|First |row |12.0 |Example of a row that spans multiple lines.
4040|Second |row |5.0 |Here’s another one. Note the blank line between rows.
41−|=======================================================================
41+|===
4242
4343Multiline table without caption:
4444
4545[width="80%",cols="^20%,<17%,>20%,<43%",options="header",]
46−|=======================================================================
46+|===
4747|Centered Header |Left Aligned |Right Aligned |Default aligned
4848|First |row |12.0 |Example of a row that spans multiple lines.
4949|Second |row |5.0 |Here’s another one. Note the blank line between rows.
50−|=======================================================================
50+|===
5151
5252Table without column headers:
5353
5454[cols=">,<,^,>",]
55−|==================
55+|===
5656|12 |12 |12 |12
5757|123 |123 |123 |123
5858|1 |1 |1 |1
59−|==================
59+|===
6060
6161Multiline table without column headers:
6262
6363[width="80%",cols="^20%,<17%,>20%,43%",]
64−|=======================================================================
64+|===
6565|First |row |12.0 |Example of a row that spans multiple lines.
6666|Second |row |5.0 |Here’s another one. Note the blank line between rows.
67−|=======================================================================
67+|===
test/writer.asciidoc+14−14
@@ -50,11 +50,11 @@ here.
5050
5151E-mail style:
5252
53−__________________________________________
53+____
5454This is a block quote. It is pretty short.
55−__________________________________________
55+____
5656
57−______________________
57+____
5858--
5959Code in a block quote:
6060
@@ -72,16 +72,16 @@ A list:
7272
7373Nested block quotes:
7474
75−______
75+____
7676nested
77−______
77+____
7878
79−______
79+____
8080nested
81−______
81+____
8282
8383--
84−______________________
84+____
8585
8686This should not be a block quote: 2 > 1.
8787
@@ -306,9 +306,9 @@ _orange_::
306306{ orange code block }
307307....
308308 +
309− __________________
309+ ____
310310 orange block quote
311− __________________
311+ ____
312312
313313Multiple definitions, tight:
314314
@@ -602,9 +602,9 @@ With an ampersand: http://example.com/?foo=1&bar=2
602602
603603An e-mail address: nobody@nowhere.net
604604
605−________________________________
605+____
606606Blockquoted: http://example.com/
607−________________________________
607+____
608608
609609Auto-links should not occur here: `<http://example.com/>`
610610
@@ -634,9 +634,9 @@ note.footnote:[This is _easier_ to type. Inline notes may contain
634634http://google.com[links] and `]` verbatim characters, as well as [bracketed
635635text].]
636636
637−___________________________________________
637+____
638638Notes can go in quotes.footnote:[In quote.]
639−___________________________________________
639+____
640640
641641[arabic]
642642. And in list items.footnote:[In list.]