packages feed

xlsx 0.2.1 → 0.2.1.1

raw patch · 4 files changed

+27/−3 lines, 4 filesdep ~zip-archive

Dependency ranges changed: zip-archive

Files

CHANGELOG.markdown view
@@ -1,3 +1,7 @@+0.2.1.1+-------+* fixed parsing shared string table entries with no content (thanks to Yuji Yamamoto <whosekiteneverfly@gmail.com>)+ 0.2.1 ------- * added number formats (thanks to Alan Zimmerman <alan.zimm@gmail.com>)
src/Codec/Xlsx/Types/SharedStringTable.hs view
@@ -130,7 +130,11 @@ instance FromCursor StringItem where   fromCursor cur = do     let-      ts = cur $/ element (n"t") &/ content+      ts = cur $/ element (n"t") >=> contentOrEmpty+      contentOrEmpty c = case c $/ content of+        [t] -> [t]+        []  -> [""]+        _   -> error "invalid item: more than one text nodes under <t>!"       rs = cur $/ element (n"r") >=> fromCursor     case (ts,rs) of       ([t], []) ->
test/DataTest.hs view
@@ -34,6 +34,8 @@          testStyleSheet @=? fromRight (parseStyleSheet (renderStyleSheet  testStyleSheet))     , testCase "correct shared strings parsing" $          [testSharedStringTable] @=? testParsedSharedStringTables+    , testCase "correct shared strings parsing even when one of the shared strings entry is just <t/>" $+         [testSharedStringTableWithEmpty] @=? testParsedSharedStringTablesWithEmpty     ]  testXlsx :: Xlsx@@ -87,6 +89,7 @@   where     items = [text, rich]     text = StringItemText "plain text"+    empty = StringItemText ""     rich = StringItemRich [ RichTextRun Nothing "Just "                           , RichTextRun (Just props) "example" ]     props = def & runPropertiesBold .~ Just True@@ -95,13 +98,26 @@                 & runPropertiesFont .~ Just "Arial"                 & runPropertiesFontFamily .~ Just FontFamilySwiss +testSharedStringTableWithEmpty :: SharedStringTable+testSharedStringTableWithEmpty =+  SharedStringTable $ V.fromList [StringItemText ""]+ testParsedSharedStringTables ::[SharedStringTable] testParsedSharedStringTables = fromCursor . fromDocument $ parseLBS_ def testStrings +testParsedSharedStringTablesWithEmpty :: [SharedStringTable]+testParsedSharedStringTablesWithEmpty = fromCursor . fromDocument $ parseLBS_ def testStringsWithEmpty+ testStrings :: ByteString testStrings = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\   \<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"2\" uniqueCount=\"2\">\   \<si><t>plain text</t></si>\   \<si><r><t>Just </t></r><r><rPr><b val=\"true\"/><u val=\"single\"/>\   \<sz val=\"10\"/><rFont val=\"Arial\"/><family val=\"2\"/></rPr><t>example</t></r></si>\+  \</sst>"++testStringsWithEmpty :: ByteString+testStringsWithEmpty = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\+  \<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"2\" uniqueCount=\"2\">\+  \<si><t/></si>\   \</sst>"
xlsx.cabal view
@@ -1,6 +1,6 @@ Name:                xlsx -Version:             0.2.1+Version:             0.2.1.1  Synopsis:            Simple and incomplete Excel file parser/writer Description:@@ -92,7 +92,7 @@                      , conduit     >= 1.0.0                      , xml-types   == 0.3.*                      , xml-conduit >= 1.1.0-                     , zip-archive == 0.2.*+                     , zip-archive >= 0.2                      , lens        >= 3.8 && < 5                      , digest      >  0.0.0.1                      , zlib