git.iko.soy/typeable/pandoc
on master help sign in
Muse writer: Indent tables with one space (#3649)

It is required to trigger Muse table rendering.

commit69110cde81a7bad260cdca579b4dcca306d4be2b authorAlexander Krotov <ilabdsf@gmail.com> dateSun 7 May 2017, 22:41 (9 years ago) parent6b086ac
3 files changed+37−37
src/Text/Pandoc/Writers/Muse.hs+2−2 test/Tests/Writers/Muse.hs+9−9 test/tables.muse+26−26
src/Text/Pandoc/Writers/Muse.hs+2−2
@@ -216,7 +216,7 @@ blockToMuse (Table caption _ _ headers rows) = do
216216 let hpipeBlocks sep blocks = hcat $ intersperse sep' blocks
217217 where h = maximum (1 : map height blocks)
218218 sep' = lblock (length sep) $ vcat (map text $ replicate h sep)
219− let makeRow sep = hpipeBlocks sep . zipWith lblock widthsInChars
219+ let makeRow sep = (" " <>) . (hpipeBlocks sep . zipWith lblock widthsInChars)
220220 let head' = makeRow " || " headers'
221221 let rowSeparator = if noHeaders then " | " else " | "
222222 rows'' <- mapM (\row -> do cols <- mapM blockListToMuse row
@@ -224,7 +224,7 @@ blockToMuse (Table caption _ _ headers rows) = do
224224 let body = vcat rows''
225225 return $ (if noHeaders then empty else head')
226226 $$ body
227− $$ (if null caption then empty else "|+ " <> caption' <> " +|")
227+ $$ (if null caption then empty else " |+ " <> caption' <> " +|")
228228 $$ blankline
229229blockToMuse (Div _ bs) = blockListToMuse bs
230230blockToMuse Null = return empty
test/Tests/Writers/Muse.hs+9−9
@@ -155,8 +155,8 @@ tests = [ testGroup "block elements"
155155 ,[para $ text "Para 2.1", para $ text "Para 2.2"]]
156156 in simpleTable [] rows
157157 =?>
158− unlines [ "Para 1.1 | Para 1.2"
159− , "Para 2.1 | Para 2.2"
158+ unlines [ " Para 1.1 | Para 1.2"
159+ , " Para 2.1 | Para 2.2"
160160 ]
161161 , "table with header" =:
162162 let headers = [plain $ text "header 1", plain $ text "header 2"]
@@ -164,9 +164,9 @@ tests = [ testGroup "block elements"
164164 ,[para $ text "Para 2.1", para $ text "Para 2.2"]]
165165 in simpleTable headers rows
166166 =?>
167− unlines [ "header 1 || header 2"
168− , "Para 1.1 | Para 1.2"
169− , "Para 2.1 | Para 2.2"
167+ unlines [ " header 1 || header 2"
168+ , " Para 1.1 | Para 1.2"
169+ , " Para 2.1 | Para 2.2"
170170 ]
171171 , "table with header and caption" =:
172172 let caption = text "Table 1"
@@ -174,10 +174,10 @@ tests = [ testGroup "block elements"
174174 rows = [[para $ text "Para 1.1", para $ text "Para 1.2"]
175175 ,[para $ text "Para 2.1", para $ text "Para 2.2"]]
176176 in table caption mempty headers rows
177− =?> unlines [ "header 1 || header 2"
178− , "Para 1.1 | Para 1.2"
179− , "Para 2.1 | Para 2.2"
180− , "|+ Table 1 +|"
177+ =?> unlines [ " header 1 || header 2"
178+ , " Para 1.1 | Para 1.2"
179+ , " Para 2.1 | Para 2.2"
180+ , " |+ Table 1 +|"
181181 ]
182182 ]
183183 -- Div is trivial
test/tables.muse+26−26
@@ -1,46 +1,46 @@
11Simple table with caption:
22
3−Right || Left || Center || Default
4−12 | 12 | 12 | 12
5−123 | 123 | 123 | 123
6−1 | 1 | 1 | 1
7−|+ Demonstration of simple table syntax. +|
3+ Right || Left || Center || Default
4+ 12 | 12 | 12 | 12
5+ 123 | 123 | 123 | 123
6+ 1 | 1 | 1 | 1
7+ |+ Demonstration of simple table syntax. +|
88
99Simple table without caption:
1010
11−Right || Left || Center || Default
12−12 | 12 | 12 | 12
13−123 | 123 | 123 | 123
14−1 | 1 | 1 | 1
11+ Right || Left || Center || Default
12+ 12 | 12 | 12 | 12
13+ 123 | 123 | 123 | 123
14+ 1 | 1 | 1 | 1
1515
1616Simple table indented two spaces:
1717
18−Right || Left || Center || Default
19−12 | 12 | 12 | 12
20−123 | 123 | 123 | 123
21−1 | 1 | 1 | 1
22−|+ Demonstration of simple table syntax. +|
18+ Right || Left || Center || Default
19+ 12 | 12 | 12 | 12
20+ 123 | 123 | 123 | 123
21+ 1 | 1 | 1 | 1
22+ |+ Demonstration of simple table syntax. +|
2323
2424Multiline table with caption:
2525
26−Centered Header || Left Aligned || Right Aligned || Default aligned
27−First | row | 12.0 | Example of a row that spans multiple lines.
28−Second | row | 5.0 | Here’s another one. Note the blank line between rows.
29−|+ Here’s the caption. It may span multiple lines. +|
26+ Centered Header || Left Aligned || Right Aligned || Default aligned
27+ First | row | 12.0 | Example of a row that spans multiple lines.
28+ Second | row | 5.0 | Here’s another one. Note the blank line between rows.
29+ |+ Here’s the caption. It may span multiple lines. +|
3030
3131Multiline table without caption:
3232
33−Centered Header || Left Aligned || Right Aligned || Default aligned
34−First | row | 12.0 | Example of a row that spans multiple lines.
35−Second | row | 5.0 | Here’s another one. Note the blank line between rows.
33+ Centered Header || Left Aligned || Right Aligned || Default aligned
34+ First | row | 12.0 | Example of a row that spans multiple lines.
35+ Second | row | 5.0 | Here’s another one. Note the blank line between rows.
3636
3737Table without column headers:
3838
39−12 | 12 | 12 | 12
40−123 | 123 | 123 | 123
41−1 | 1 | 1 | 1
39+ 12 | 12 | 12 | 12
40+ 123 | 123 | 123 | 123
41+ 1 | 1 | 1 | 1
4242
4343Multiline table without column headers:
4444
45−First | row | 12.0 | Example of a row that spans multiple lines.
46−Second | row | 5.0 | Here’s another one. Note the blank line between rows.
45+ First | row | 12.0 | Example of a row that spans multiple lines.
46+ Second | row | 5.0 | Here’s another one. Note the blank line between rows.