diff options
-rw-r--r-- | Text/Pandoc/Definition.hs | 2 | ||||
-rw-r--r-- | Text/Pandoc/Readers/Markdown.hs | 6 | ||||
-rw-r--r-- | Text/Pandoc/Writers/ConTeXt.hs | 2 | ||||
-rw-r--r-- | Text/Pandoc/Writers/Docbook.hs | 4 | ||||
-rw-r--r-- | Text/Pandoc/Writers/HTML.hs | 4 | ||||
-rw-r--r-- | Text/Pandoc/Writers/MediaWiki.hs | 4 | ||||
-rw-r--r-- | Text/Pandoc/Writers/OpenDocument.hs | 6 | ||||
-rw-r--r-- | Text/Pandoc/Writers/RTF.hs | 2 | ||||
-rw-r--r-- | tests/tables.opendocument | 40 |
9 files changed, 35 insertions, 35 deletions
diff --git a/Text/Pandoc/Definition.hs b/Text/Pandoc/Definition.hs index 66c3ab878..3c783b1b9 100644 --- a/Text/Pandoc/Definition.hs +++ b/Text/Pandoc/Definition.hs @@ -84,7 +84,7 @@ data Block -- the term, and a block list) | Header Int [Inline] -- ^ Header - level (integer) and text (inlines) | HorizontalRule -- ^ Horizontal rule - | Table [Inline] [Alignment] [Float] [[Block]] [[[Block]]] -- ^ Table, + | Table [Inline] [Alignment] [Double] [[Block]] [[[Block]]] -- ^ Table, -- with caption, column alignments, -- relative column widths, column headers -- (each a list of blocks), and rows diff --git a/Text/Pandoc/Readers/Markdown.hs b/Text/Pandoc/Readers/Markdown.hs index f030f07ad..88ab38fcf 100644 --- a/Text/Pandoc/Readers/Markdown.hs +++ b/Text/Pandoc/Readers/Markdown.hs @@ -696,9 +696,9 @@ multilineRow indices = do mapM (parseFromString (many plain)) cols -- Calculate relative widths of table columns, based on indices -widthsFromIndices :: Int -- Number of columns on terminal - -> [Int] -- Indices - -> [Float] -- Fractional relative sizes of columns +widthsFromIndices :: Int -- Number of columns on terminal + -> [Int] -- Indices + -> [Double] -- Fractional relative sizes of columns widthsFromIndices _ [] = [] widthsFromIndices numColumns indices = let lengths = zipWith (-) indices (0:indices) diff --git a/Text/Pandoc/Writers/ConTeXt.hs b/Text/Pandoc/Writers/ConTeXt.hs index 7f5af4191..3af997374 100644 --- a/Text/Pandoc/Writers/ConTeXt.hs +++ b/Text/Pandoc/Writers/ConTeXt.hs @@ -210,7 +210,7 @@ blockToConTeXt (Table caption aligns widths heads rows) = do text "\\HL" $$ headers $$ text "\\HL" $$ vcat rows' $$ text "\\HL\n\\stoptable" -printDecimal :: Float -> String +printDecimal :: Double -> String printDecimal = printf "%.2f" tableRowToConTeXt :: [[Block]] -> State WriterState Doc diff --git a/Text/Pandoc/Writers/Docbook.hs b/Text/Pandoc/Writers/Docbook.hs index 9ed4e808f..025727076 100644 --- a/Text/Pandoc/Writers/Docbook.hs +++ b/Text/Pandoc/Writers/Docbook.hs @@ -165,7 +165,7 @@ blockToDocbook opts (Table caption aligns widths headers rows) = colHeadsToDocbook :: WriterOptions -> [[Char]] - -> [Float] + -> [Double] -> [[Block]] -> Doc colHeadsToDocbook opts alignStrings widths headers = @@ -188,7 +188,7 @@ tableRowToDocbook opts aligns cols = inTagsIndented "tr" $ tableItemToDocbook :: WriterOptions -> [Char] -> [Char] - -> Float + -> Double -> [Block] -> Doc tableItemToDocbook opts tag align width item = diff --git a/Text/Pandoc/Writers/HTML.hs b/Text/Pandoc/Writers/HTML.hs index 4af644a91..066a39090 100644 --- a/Text/Pandoc/Writers/HTML.hs +++ b/Text/Pandoc/Writers/HTML.hs @@ -380,7 +380,7 @@ blockToHtml opts (Table capt aligns widths headers rows') = do colHeadsToHtml :: WriterOptions -> [[Char]] - -> [Float] + -> [Double] -> [[Block]] -> State WriterState Html colHeadsToHtml opts alignStrings widths headers = do @@ -407,7 +407,7 @@ tableRowToHtml opts aligns columns = tableItemToHtml :: WriterOptions -> (Html -> Html) -> [Char] - -> Float + -> Double -> [Block] -> State WriterState Html tableItemToHtml opts tag' align' width' item = do diff --git a/Text/Pandoc/Writers/MediaWiki.hs b/Text/Pandoc/Writers/MediaWiki.hs index 7d43c6fc4..050781d37 100644 --- a/Text/Pandoc/Writers/MediaWiki.hs +++ b/Text/Pandoc/Writers/MediaWiki.hs @@ -259,7 +259,7 @@ vcat (x:xs) = x ++ "\n" ++ vcat xs colHeadsToMediaWiki :: WriterOptions -> [[Char]] - -> [Float] + -> [Double] -> [[Block]] -> State WriterState String colHeadsToMediaWiki opts alignStrings widths headers = do @@ -286,7 +286,7 @@ tableRowToMediaWiki opts aligns columns = tableItemToMediaWiki :: WriterOptions -> [Char] -> [Char] - -> Float + -> Double -> [Block] -> State WriterState String tableItemToMediaWiki opts tag' align' width' item = do diff --git a/Text/Pandoc/Writers/OpenDocument.hs b/Text/Pandoc/Writers/OpenDocument.hs index 875ab5fa8..5ba92368e 100644 --- a/Text/Pandoc/Writers/OpenDocument.hs +++ b/Text/Pandoc/Writers/OpenDocument.hs @@ -34,7 +34,7 @@ import Text.Pandoc.Shared import Text.Pandoc.XML import Text.Pandoc.Readers.TeXMath import Text.PrettyPrint.HughesPJ hiding ( Str ) - +import Text.Printf ( printf ) import Control.Applicative ( (<$>) ) import Control.Arrow ( (***), (>>>) ) import Control.Monad.State hiding ( when ) @@ -460,7 +460,7 @@ listLevelStyle i = [ ("text:space-before" , indent ++ "in") , ("text:min-label-width", "0.25in")] -tableStyle :: Int -> [(Char,Float)] -> Doc +tableStyle :: Int -> [(Char,Double)] -> Doc tableStyle num wcs = let tableId = "Table" ++ show (num + 1) table = inTags True "style:style" @@ -472,7 +472,7 @@ tableStyle num wcs = [ ("style:name" , tableId ++ "." ++ [c]) , ("style:family", "table-column" )] $ selfClosingTag "style:table-column-properties" - [("style:column-width", show (7 * w) ++ "in")] + [("style:column-width", printf "%.2f" (7 * w) ++ "in")] cellStyle = inTags True "style:style" [ ("style:name" , tableId ++ ".A1") , ("style:family", "table-cell" )] $ diff --git a/Text/Pandoc/Writers/RTF.hs b/Text/Pandoc/Writers/RTF.hs index e31a162a5..002ef7edc 100644 --- a/Text/Pandoc/Writers/RTF.hs +++ b/Text/Pandoc/Writers/RTF.hs @@ -190,7 +190,7 @@ blockToRTF indent alignment (Table caption aligns sizes headers rows) = concatMap (tableRowToRTF False indent aligns sizes) rows ++ rtfPar indent 0 alignment (inlineListToRTF caption) -tableRowToRTF :: Bool -> Int -> [Alignment] -> [Float] -> [[Block]] -> String +tableRowToRTF :: Bool -> Int -> [Alignment] -> [Double] -> [[Block]] -> String tableRowToRTF header indent aligns sizes cols = let columns = concat $ zipWith (tableItemToRTF indent) aligns cols totalTwips = 6 * 1440 -- 6 inches diff --git a/tests/tables.opendocument b/tests/tables.opendocument index d3d646b99..1b81cddf2 100644 --- a/tests/tables.opendocument +++ b/tests/tables.opendocument @@ -70,16 +70,16 @@ <style:table-properties style:rel-width="100%" table:align="center" /> </style:style> <style:style style:name="Table1.A" style:family="table-column"> - <style:table-column-properties style:column-width="1.0500001in" /> + <style:table-column-properties style:column-width="1.05in" /> </style:style> <style:style style:name="Table1.B" style:family="table-column"> - <style:table-column-properties style:column-width="0.6125in" /> + <style:table-column-properties style:column-width="0.61in" /> </style:style> <style:style style:name="Table1.C" style:family="table-column"> - <style:table-column-properties style:column-width="1.1374999in" /> + <style:table-column-properties style:column-width="1.14in" /> </style:style> <style:style style:name="Table1.D" style:family="table-column"> - <style:table-column-properties style:column-width="0.875in" /> + <style:table-column-properties style:column-width="0.88in" /> </style:style> <style:style style:name="Table1.A1" style:family="table-cell"> <style:table-cell-properties fo:border="none" /> @@ -88,16 +88,16 @@ <style:table-properties style:rel-width="100%" table:align="center" /> </style:style> <style:style style:name="Table2.A" style:family="table-column"> - <style:table-column-properties style:column-width="1.0500001in" /> + <style:table-column-properties style:column-width="1.05in" /> </style:style> <style:style style:name="Table2.B" style:family="table-column"> - <style:table-column-properties style:column-width="0.6125in" /> + <style:table-column-properties style:column-width="0.61in" /> </style:style> <style:style style:name="Table2.C" style:family="table-column"> - <style:table-column-properties style:column-width="1.1374999in" /> + <style:table-column-properties style:column-width="1.14in" /> </style:style> <style:style style:name="Table2.D" style:family="table-column"> - <style:table-column-properties style:column-width="0.875in" /> + <style:table-column-properties style:column-width="0.88in" /> </style:style> <style:style style:name="Table2.A1" style:family="table-cell"> <style:table-cell-properties fo:border="none" /> @@ -106,16 +106,16 @@ <style:table-properties style:rel-width="100%" table:align="center" /> </style:style> <style:style style:name="Table3.A" style:family="table-column"> - <style:table-column-properties style:column-width="1.0500001in" /> + <style:table-column-properties style:column-width="1.05in" /> </style:style> <style:style style:name="Table3.B" style:family="table-column"> - <style:table-column-properties style:column-width="0.6125in" /> + <style:table-column-properties style:column-width="0.61in" /> </style:style> <style:style style:name="Table3.C" style:family="table-column"> - <style:table-column-properties style:column-width="1.1374999in" /> + <style:table-column-properties style:column-width="1.14in" /> </style:style> <style:style style:name="Table3.D" style:family="table-column"> - <style:table-column-properties style:column-width="0.875in" /> + <style:table-column-properties style:column-width="0.88in" /> </style:style> <style:style style:name="Table3.A1" style:family="table-cell"> <style:table-cell-properties fo:border="none" /> @@ -124,16 +124,16 @@ <style:table-properties style:rel-width="100%" table:align="center" /> </style:style> <style:style style:name="Table4.A" style:family="table-column"> - <style:table-column-properties style:column-width="1.0500001in" /> + <style:table-column-properties style:column-width="1.05in" /> </style:style> <style:style style:name="Table4.B" style:family="table-column"> - <style:table-column-properties style:column-width="0.96250004in" /> + <style:table-column-properties style:column-width="0.96in" /> </style:style> <style:style style:name="Table4.C" style:family="table-column"> - <style:table-column-properties style:column-width="1.1374999in" /> + <style:table-column-properties style:column-width="1.14in" /> </style:style> <style:style style:name="Table4.D" style:family="table-column"> - <style:table-column-properties style:column-width="2.3625in" /> + <style:table-column-properties style:column-width="2.36in" /> </style:style> <style:style style:name="Table4.A1" style:family="table-cell"> <style:table-cell-properties fo:border="none" /> @@ -142,16 +142,16 @@ <style:table-properties style:rel-width="100%" table:align="center" /> </style:style> <style:style style:name="Table5.A" style:family="table-column"> - <style:table-column-properties style:column-width="1.0500001in" /> + <style:table-column-properties style:column-width="1.05in" /> </style:style> <style:style style:name="Table5.B" style:family="table-column"> - <style:table-column-properties style:column-width="0.96250004in" /> + <style:table-column-properties style:column-width="0.96in" /> </style:style> <style:style style:name="Table5.C" style:family="table-column"> - <style:table-column-properties style:column-width="1.1374999in" /> + <style:table-column-properties style:column-width="1.14in" /> </style:style> <style:style style:name="Table5.D" style:family="table-column"> - <style:table-column-properties style:column-width="2.3625in" /> + <style:table-column-properties style:column-width="2.36in" /> </style:style> <style:style style:name="Table5.A1" style:family="table-cell"> <style:table-cell-properties fo:border="none" /> |