diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-09-06 02:51:44 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2008-09-06 02:51:44 +0000 |
commit | 2127b7d5135af88dc3f2e7d78136ce24547bca3b (patch) | |
tree | 2f2153999cc1bb5ad70bacbb7cffd7bb18ac3b4e /Text/Pandoc/Writers | |
parent | 4dca8f6e75948d489e8127119ce3787cb97ee1e2 (diff) | |
download | pandoc-2127b7d5135af88dc3f2e7d78136ce24547bca3b.tar.gz |
Changed Float to Double in definition of Table element.
(Double is more efficient in GHC.)
Truncate width in opendocument output to 2 decimal places.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1418 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Text/Pandoc/Writers')
-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 |
6 files changed, 11 insertions, 11 deletions
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 |