packages feed

pandoc-csv2table 1.0.5 → 1.0.6

raw patch · 5 files changed

+45/−9 lines, 5 filesdep ~pandoc-csv2tablenew-uploader

Dependency ranges changed: pandoc-csv2table

Files

CHANGELOG.md view
@@ -6,7 +6,12 @@  ## [Unreleased] +## [1.0.6] - 2018-11-29 +- Made compatibile with Pandoc 2.0+ (Merged pull request by @vmandela)+- Updated cabal file+- Updated stack version+ ## [1.0.5] - 2017-05-05  @@ -38,7 +43,8 @@ - The first release.  -[Unreleased]: https://github.com/baig/pandoc-csv2table-filter/compare/1.0.5...HEAD+[Unreleased]: https://github.com/baig/pandoc-csv2table-filter/compare/1.0.6...HEAD+[1.0.6]: https://github.com/baig/pandoc-csv2table-filter/compare/1.0.5...1.0.6 [1.0.5]: https://github.com/baig/pandoc-csv2table-filter/compare/1.0.4...1.0.5 [1.0.4]: https://github.com/baig/pandoc-csv2table-filter/compare/1.0.3...1.0.4 [1.0.2]: https://github.com/baig/pandoc-csv2table-filter/compare/1.0.1...1.0.3
README.md view
@@ -149,7 +149,7 @@  ## License -Copyright © 2015-2017 [Wasif Hasan Baig](https://twitter.com/_wbaig)+Copyright © 2015-2018 [Wasif Hasan Baig](https://twitter.com/_wbaig)  Source code is released under the Terms and Conditions of [MIT License](http://opensource.org/licenses/MIT). 
pandoc-csv2table.cabal view
@@ -1,5 +1,5 @@ Name:                 pandoc-csv2table-Version:              1.0.5+Version:              1.0.6 Synopsis:             Convert CSV to Pandoc Table Markdown Description:          A Pandoc filter that replaces image inline or fenced code                       blocks with pandoc table markdown. CSV contents will be@@ -41,12 +41,9 @@                       csv >= 0.1.2,                       pandoc >= 1.13.0.0,                       pandoc-types >= 1.12.0.0,-                      pandoc-csv2table >= 1.0.0+                      pandoc-csv2table   Hs-Source-Dirs:     .   Main-Is:            csv2table.hs   Buildable:          True   Default-Language:   Haskell2010-  -  -  -  +
src/Text/Table/Helper.hs view
@@ -56,6 +56,11 @@ -- Local imports import Text.Table.Definition import Text.Table.Builder+-- imports for compatibility with Pandoc 2.0++#if MIN_VERSION_pandoc(2,0,0)+import Text.Pandoc (runPure)+import Data.Text (pack)+#endif  -- Helper functions to manipulate the Pandoc Document and parse the  -- Configuration String.@@ -130,6 +135,18 @@ getAtr a (_:xs)               = getAtr a xs getAtr a []                   = "" +-- The conversion happens in three stages+-- 1. Convert the CSV to an internal table representation+-- 2. Convert internal table representation to markdown+-- 3. Convert markdown into Pandoc AST.+--+-- Converting from internal table representation to Pandoc AST+-- via markdown decouples internal table representation from+-- Pandoc AST changes.+--+-- TODO: What is the downside of going directly from CSV to Pandoc+-- table representation?+ -- | Make Pandoc Table from Image Inline  tableFromImageInline :: [J.Inline] -> CSV -> J.Pandoc tableFromImageInline l = addInlineLabel (removeConfigString l) .@@ -144,8 +161,19 @@                         mkTable (getAtr "caption" as)                                 (toAlign $ getAtr "aligns" as)                                 (isHeaderPresent1 $ getAtr "header" as)+#if MIN_VERSION_pandoc(2,0,0)+-- Pandoc now operates on Data.Text instead of String. So we pack the string+-- before calling readMarkdown.+-- The function signature of readMarkdown has changed. It now returns a PandocMonad+-- instead of Pandoc. We run readMarkdown in runPure to indicate we are not doing IO+-- and handle the output in the same manner as in 1.14 migration.+readMarkdown' :: ReaderOptions -> String -> J.Pandoc+readMarkdown' o s = case parsed of+  (Left _) -> J.Pandoc J.nullMeta []+  (Right p) -> p+  where parsed = runPure (readMarkdown o $ pack s) -#if MIN_VERSION_pandoc(1,14,0)+#elif MIN_VERSION_pandoc(1,14,0) readMarkdown' :: ReaderOptions -> String -> J.Pandoc readMarkdown' o s = case read of                       (Left _)  -> J.Pandoc J.nullMeta []
src/Text/Table/Tablify.hs view
@@ -45,6 +45,7 @@ import Text.Table.Helper  tablifyCsvLinks :: Block -> IO [Block]+-- variant 1: Referencing CSV file in Image Links #if MIN_VERSION_pandoc(1,16,0) -- Image Attr [Inline] Target -- ^ Image:  alt text (list of inlines), target tablifyCsvLinks (Para [(Image _ l (f, _))]) | "csv" `isSuffixOf` f = do@@ -59,9 +60,11 @@                        toBlocks .                        tableFromImageInline l $                        xss+-- variant 2 and 3: Fenced Code Blocks tablifyCsvLinks b@(CodeBlock (_, cs, as) s) | "table" `elem` cs = do     let file = getAtr "source" as     case file of+      -- variant 2: Referencing CSV file in Fenced Code Blocks       "" -> case s of               "" -> return [b]               _  -> case (parseCSV "" s) of@@ -70,6 +73,7 @@                                      toBlocks .                                      tableFromCodeBlock as $                                      xss+      -- variant 3:Including CSV content inside Fenced Code Blocks       _  -> do               csv <- parseCSVFromFile file               case csv of@@ -78,4 +82,5 @@                                toBlocks .                                tableFromCodeBlock as $                                xss+-- Return input unchanged in case of no match tablifyCsvLinks x = return [x]