literatex 0.2.0.0 → 0.2.0.1
raw patch · 4 files changed
+39/−20 lines, 4 filesdep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: text
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- app/LibOA.hs +23/−11
- app/Main.hs +6/−6
- literatex.cabal +4/−3
CHANGELOG.md view
@@ -24,6 +24,12 @@ [KaC]: <https://keepachangelog.com/en/1.0.0/> +## 0.2.0.1 (2021-12-25)++### Non-Breaking++* Bump `text` dependency version upper bound+ ## 0.2.0.0 (2021-06-25) ### Breaking
app/LibOA.hs view
@@ -11,10 +11,12 @@ -- projects as required. If the library grows to a substantial size or others -- with to use it, I will reconsider. ----- Revision: 2021-06-24+-- Revision: 2021-07-20 ------------------------------------------------------------------------------ {-# LANGUAGE CPP #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE TupleSections #-} module LibOA ( -- * Options@@ -27,6 +29,7 @@ , (<||>) , section , table+ , table_ , vspace ) where @@ -35,7 +38,8 @@ import Text.PrettyPrint.ANSI.Leijen (Doc) -- https://hackage.haskell.org/package/base-import qualified Data.List as List+import Data.List (intersperse, transpose)+import Data.Maybe (fromMaybe) #if !MIN_VERSION_base (4,11,0) import Data.Monoid ((<>)) #endif@@ -115,15 +119,23 @@ section :: String -> Doc -> Doc section title = (Doc.text title Doc.<$$>) . Doc.indent 2 --- | Create a two-column table-table :: [(String, String)] -> Doc-table rows =- let width = 1 + maximum (map (length . fst) rows)- in Doc.vcat- [ Doc.fillBreak width (Doc.text l) Doc.<+> Doc.text r- | (l, r) <- rows- ]+-- | Create a table, with formatting+table :: Int -> [[(String, Doc -> Doc)]] -> Doc+table sep rows = Doc.vcat $+ map (fromMaybe Doc.empty . foldr go Nothing . zip lengths) rows+ where+ lengths :: [Int]+ lengths = map ((+) sep . maximum . map (length . fst)) $ transpose rows + go :: (Int, (String, Doc -> Doc)) -> Maybe Doc -> Maybe Doc+ go (len, (s, f)) = Just . \case+ Just doc -> Doc.fill len (f $ Doc.string s) <> doc+ Nothing -> f $ Doc.string s++-- | Create a table, without formatting+table_ :: Int -> [[String]] -> Doc+table_ sep = table sep . (map . map) (, id)+ -- | Vertically space documents with blank lines between them vspace :: [Doc] -> Doc-vspace = mconcat . List.intersperse (Doc.line <> Doc.line)+vspace = mconcat . intersperse (Doc.line <> Doc.line)
app/Main.hs view
@@ -192,19 +192,19 @@ ] sourceFormatHelp :: Doc- sourceFormatHelp = LibOA.section "SOURCE options:" $ LibOA.table- [ (TTC.render format, SourceFormat.describe format)+ sourceFormatHelp = LibOA.section "SOURCE options:" $ LibOA.table_ 2+ [ [TTC.render format, SourceFormat.describe format] | format <- SourceFormat.list ] targetFormatHelp :: Doc- targetFormatHelp = LibOA.section "TARGET options:" $ LibOA.table- [ (TTC.render format, TargetFormat.describe format)+ targetFormatHelp = LibOA.section "TARGET options:" $ LibOA.table_ 2+ [ [TTC.render format, TargetFormat.describe format] | format <- TargetFormat.list ] defaultsHelp :: Doc- defaultsHelp = LibOA.section "Default options:" $ LibOA.table- [ (ext, TTC.render lang ++ " (" ++ TTC.render format ++ ")")+ defaultsHelp = LibOA.section "Default options:" $ LibOA.table_ 2+ [ [ext, TTC.render lang ++ " (" ++ TTC.render format ++ ")"] | (ext, (format, lang)) <- SourceDefaults.extensionDefaults ]
literatex.cabal view
@@ -1,5 +1,5 @@ name: literatex-version: 0.2.0.0+version: 0.2.0.1 category: Utils synopsis: transform literate source code to Markdown description:@@ -22,8 +22,9 @@ || ==8.4.4 || ==8.6.5 || ==8.8.4- || ==8.10.4+ || ==8.10.7 || ==9.0.1+ || ==9.2.1 extra-source-files: CHANGELOG.md@@ -59,7 +60,7 @@ base >=4.7 && <5 , bytestring >=0.10.8 && <0.12 , conduit >=1.3 && <1.4- , text >=1.2.3 && <1.3+ , text >=1.2.3 && <2.1 , ttc >=0.4 && <1.2 , unliftio >=0.2 && <0.3 default-language: Haskell2010