Tablify 0.8 → 0.8.1
raw patch · 2 files changed
+20/−2 lines, 2 files
Files
- Tablify.cabal +2/−2
- src/LaTeX.hs +18/−0
Tablify.cabal view
@@ -1,6 +1,6 @@ Cabal-Version: >= 1.2 Name: Tablify-Version: 0.8+Version: 0.8.1 License: BSD3 License-File: LICENSE.txt Author: Daniel Lyons@@ -15,6 +15,6 @@ Executable tablify Main-Is: Tablify.hs- Other-Modules: ASCII, CSV, Converter, FixedWidth, HTML, TBL, Tablify, Unicode, Utilities+ Other-Modules: ASCII, CSV, Converter, FixedWidth, LaTeX, HTML, TBL, Tablify, Unicode, Utilities Build-Depends: base < 5, utf8-string, parsec, regex-compat, haskell98, xhtml, safer-file-handles HS-Source-Dirs: src
+ src/LaTeX.hs view
@@ -0,0 +1,18 @@+module LaTeX (converter) where++import Prelude hiding (length, replicate)+import Utilities+import Converter++-- Some TeX.+texify :: Table -> String+texify table = intercalate "\n" [tblstart, body, tblend]+ where+ columns = length $ head table+ tblstart = "\\begin{tabular}" ++ "{" ++ heading 'l' ++ "}"+ tblend = "\\end{tabular}"+ heading c = intersperse ' ' $ replicate columns c+ body = intercalate "\\\\\n" $ map (intercalate " & ") table++converter :: Converter+converter = Converter "LaTeX" texify "L" "latex"