git.iko.soy/typeable/pandoc
on master help sign in
Fixed haddock documentation errors.
f3cf1ccfiddlosopher
src/Text/Pandoc/Definition.hs+5−5
@@ -63,11 +63,11 @@ data Block
63 | HorizontalRule -- ^ Horizontal rule
63 | HorizontalRule -- ^ Horizontal rule
64 | Note String [Block] -- ^ Footnote or endnote - reference (string),
64 | Note String [Block] -- ^ Footnote or endnote - reference (string),
65 -- text (list of blocks)
65 -- text (list of blocks)
66− | Table [Inline] -- ^ Table caption,
66+ | Table [Inline] [Alignment] [Float] [[Block]] [[[Block]]] -- ^ Table,
67− [Alignment] -- column alignments,
67+ -- with caption, column alignments,
68− [Float] -- column widths (relative to page),
69− [[Block]] -- column headers, and
68+ -- relative column widths, column headers
70− [[[Block]]] -- rows
69+ -- (each a list of blocks), and rows
70+ -- (each a list of lists of blocks)
71 deriving (Eq, Read, Show)
71 deriving (Eq, Read, Show)
72
72
73-- | Target for a link: either a URL or an indirect (labeled) reference.
73-- | Target for a link: either a URL or an indirect (labeled) reference.
src/Text/Pandoc/Readers/Markdown.hs+25−25
@@ -528,15 +528,15 @@ rawLaTeXEnvironment' = do
528-- Tables
528-- Tables
529--
529--
530
530
531−-- | Parse a dashed line with optional trailing spaces; return its length
531+-- Parse a dashed line with optional trailing spaces; return its length
532−-- and the length including trailing space.
532+-- and the length including trailing space.
533dashedLine ch = do
533dashedLine ch = do
534 dashes <- many1 (char ch)
534 dashes <- many1 (char ch)
535 sp <- many spaceChar
535 sp <- many spaceChar
536 return $ (length dashes, length $ dashes ++ sp)
536 return $ (length dashes, length $ dashes ++ sp)
537
537
538−-- | Parse a table header with dashed lines of '-' preceded by
538+-- Parse a table header with dashed lines of '-' preceded by
539−-- one line of text.
539+-- one line of text.
540simpleTableHeader = do
540simpleTableHeader = do
541 rawContent <- anyLine
541 rawContent <- anyLine
542 initSp <- nonindentSpaces
542 initSp <- nonindentSpaces
@@ -548,41 +548,41 @@ simpleTableHeader = do
548 let aligns = zipWith alignType (map (\a -> [a]) rawHeads) lengths
548 let aligns = zipWith alignType (map (\a -> [a]) rawHeads) lengths
549 return $ (rawHeads, aligns, indices)
549 return $ (rawHeads, aligns, indices)
550
550
551−-- | Parse a table footer - dashed lines followed by blank line.
551+-- Parse a table footer - dashed lines followed by blank line.
552tableFooter = try $ do
552tableFooter = try $ do
553 nonindentSpaces
553 nonindentSpaces
554 many1 (dashedLine '-')
554 many1 (dashedLine '-')
555 blanklines
555 blanklines
556
556
557−-- | Parse a table separator - dashed line.
557+-- Parse a table separator - dashed line.
558tableSep = try $ do
558tableSep = try $ do
559 nonindentSpaces
559 nonindentSpaces
560 many1 (dashedLine '-')
560 many1 (dashedLine '-')
561 string "\n"
561 string "\n"
562
562
563−-- | Parse a raw line and split it into chunks by indices.
563+-- Parse a raw line and split it into chunks by indices.
564rawTableLine indices = do
564rawTableLine indices = do
565 notFollowedBy' (blanklines <|> tableFooter)
565 notFollowedBy' (blanklines <|> tableFooter)
566 line <- many1Till anyChar newline
566 line <- many1Till anyChar newline
567 return $ map removeLeadingTrailingSpace $ tail $
567 return $ map removeLeadingTrailingSpace $ tail $
568 splitByIndices (init indices) line
568 splitByIndices (init indices) line
569
569
570−-- | Parse a table line and return a list of lists of blocks (columns).
570+-- Parse a table line and return a list of lists of blocks (columns).
571tableLine indices = try $ do
571tableLine indices = try $ do
572 rawline <- rawTableLine indices
572 rawline <- rawTableLine indices
573 mapM (parseFromStr (many plain)) rawline
573 mapM (parseFromStr (many plain)) rawline
574
574
575−-- | Parse a multiline table row and return a list of blocks (columns).
575+-- Parse a multiline table row and return a list of blocks (columns).
576multilineRow indices = try $ do
576multilineRow indices = try $ do
577 colLines <- many1 (rawTableLine indices)
577 colLines <- many1 (rawTableLine indices)
578 option "" blanklines
578 option "" blanklines
579 let cols = map unlines $ transpose colLines
579 let cols = map unlines $ transpose colLines
580 mapM (parseFromStr (many plain)) cols
580 mapM (parseFromStr (many plain)) cols
581
581
582−-- | Calculate relative widths of table columns, based on indices
582+-- Calculate relative widths of table columns, based on indices
583−widthsFromIndices :: Int -- ^ Number of columns on terminal
583+widthsFromIndices :: Int -- Number of columns on terminal
584− -> [Int] -- ^ Indices
584+ -> [Int] -- Indices
585− -> [Float] -- ^ Fractional relative sizes of columns
585+ -> [Float] -- Fractional relative sizes of columns
586widthsFromIndices _ [] = []
586widthsFromIndices _ [] = []
587widthsFromIndices numColumns indices =
587widthsFromIndices numColumns indices =
588 let lengths = zipWith (-) indices (0:indices)
588 let lengths = zipWith (-) indices (0:indices)
@@ -593,8 +593,8 @@ widthsFromIndices numColumns indices =
593 fracs = map (\l -> (fromIntegral l) / quotient) lengths in
593 fracs = map (\l -> (fromIntegral l) / quotient) lengths in
594 tail fracs
594 tail fracs
595
595
596−-- | Parses a table caption: inlines beginning with 'Table:'
596+-- Parses a table caption: inlines beginning with 'Table:'
597−-- and followed by blank lines
597+-- and followed by blank lines.
598tableCaption = try $ do
598tableCaption = try $ do
599 nonindentSpaces
599 nonindentSpaces
600 string "Table:"
600 string "Table:"
@@ -602,7 +602,7 @@ tableCaption = try $ do
602 blanklines
602 blanklines
603 return $ normalizeSpaces result
603 return $ normalizeSpaces result
604
604
605−-- | Parse a table using 'headerParser', 'lineParser', and 'footerParser'
605+-- Parse a table using 'headerParser', 'lineParser', and 'footerParser'.
606tableWith headerParser lineParser footerParser = try $ do
606tableWith headerParser lineParser footerParser = try $ do
607 (rawHeads, aligns, indices) <- headerParser
607 (rawHeads, aligns, indices) <- headerParser
608 lines <- many1Till (lineParser indices) footerParser
608 lines <- many1Till (lineParser indices) footerParser
@@ -613,13 +613,13 @@ tableWith headerParser lineParser footerParser = try $ do
613 let widths = widthsFromIndices numColumns indices
613 let widths = widthsFromIndices numColumns indices
614 return $ Table caption aligns widths heads lines
614 return $ Table caption aligns widths heads lines
615
615
616−-- | Parse a simple table with '---' header and one line per row.
616+-- Parse a simple table with '---' header and one line per row.
617simpleTable = tableWith simpleTableHeader tableLine blanklines
617simpleTable = tableWith simpleTableHeader tableLine blanklines
618
618
619−-- | Parse a multiline table: starts with row of '-' on top, then header
619+-- Parse a multiline table: starts with row of '-' on top, then header
620−-- (which may be multiline), then the rows,
620+-- (which may be multiline), then the rows,
621−-- which may be multiline, separated by blank lines, and
621+-- which may be multiline, separated by blank lines, and
622−-- ending with a footer (dashed line followed by blank line).
622+-- ending with a footer (dashed line followed by blank line).
623multilineTable = tableWith multilineTableHeader multilineRow tableFooter
623multilineTable = tableWith multilineTableHeader multilineRow tableFooter
624
624
625multilineTableHeader = try $ do
625multilineTableHeader = try $ do
@@ -639,7 +639,7 @@ multilineTableHeader = try $ do
639 return $ ((map removeLeadingTrailingSpace rawHeads),
639 return $ ((map removeLeadingTrailingSpace rawHeads),
640 aligns, indices)
640 aligns, indices)
641
641
642−-- | Returns the longest of a list of strings.
642+-- Returns the longest of a list of strings.
643longest :: [String] -> String
643longest :: [String] -> String
644longest [] = ""
644longest [] = ""
645longest [x] = x
645longest [x] = x
@@ -648,9 +648,9 @@ longest (x:xs) =
648 then x
648 then x
649 else longest xs
649 else longest xs
650
650
651−-- | Returns an alignment type for a table, based on a list of strings
651+-- Returns an alignment type for a table, based on a list of strings
652−-- (the rows of the column header) and a number (the length of the
652+-- (the rows of the column header) and a number (the length of the
653−-- dashed line under the rows.
653+-- dashed line under the rows.
654alignType :: [String] -> Int -> Alignment
654alignType :: [String] -> Int -> Alignment
655alignType [] len = AlignDefault
655alignType [] len = AlignDefault
656alignType strLst len =
656alignType strLst len =