packages feed

forms-data-format 0.1 → 0.2

raw patch · 3 files changed

+13/−12 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -1,15 +1,12 @@ Forms Data Format ================= -The Forms Data Format, or FDF for short, is a horrible data format thought up-by Adobe. Its only redeeming feature is that in practice it's much simpler-than PDF.+The Forms Data Format, or [FDF](https://helpx.adobe.com/acrobat/kb/acrobat-forms-form-data-web.html) for short, is a+horrible data format thought up by Adobe. Its only redeeming feature is that in practice it's much simpler than PDF. -This Haskell package is hacked together to parse and re-serialize *some* files-in FDF format. It certainly does not support the full range of possible FDF-files. I tried to follow the specification but gave up.+This Haskell package is hacked together to parse and re-serialize *some* files in FDF format. It certainly does not+support the full range of possible FDF files. I tried to follow the specification but gave up. -The main purpose of the package is to allow parsing and serializing [Canadian-tax forms](https://github.com/blamario/canadian-income-tax) in FDF format.-For that purpose this hack seems sufficient. If you find it doesn't work for-some other FDF files, feel free to contribute.+The main purpose of the package is to allow parsing and serializing [Canadian tax+forms](https://github.com/blamario/canadian-income-tax) in FDF format.  For that purpose this hack seems+sufficient. If you find it doesn't work for some other FDF files, feel free to contribute some code.
forms-data-format.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               forms-data-format-version:            0.1+version:            0.2  synopsis: Parse and serialize FDF, the Forms Data Format 
src/Text/FDF.hs view
@@ -3,6 +3,8 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeApplications #-} +-- | Parse and serialize between FDF files and `Map [Text] Text`.+ module Text.FDF (FDF (FDF, body), Field (Field, name, value, kids),                  mapWithKey, mapFieldWithKey,                  foldMapWithKey, foldMapFieldWithKey,@@ -26,12 +28,14 @@  type Parser = PEG.Parser (Rank2.Only FDF) +-- | Parsed FDF data structure data FDF = FDF {   header :: ByteString,   body :: Field,   trailer :: ByteString}   deriving (Show) +-- | The body of FDF is a tree of nestable 'Field's. data Field = Field {   name :: Text,   value :: Maybe Text,@@ -121,7 +125,7 @@ begin = string "<<" *> lineEnd <?> "<<"  end :: Parser ByteStringUTF8 ByteStringUTF8-end = string ">>" *> takeCharsWhile (== ' ') *> moptional lineEnd <?> ">>"+end = string ">>" *> takeCharsWhile (== ' ') *> moptional lineEnd *> pure mempty <?> ">>"  line :: Parser ByteStringUTF8 ByteStringUTF8 line = takeCharsWhile (`notElem` ['\r', '\n']) <> lineEnd <?> "line"