packages feed

pandoc 1.12 → 1.12.0.1

raw patch · 10 files changed

+150/−47 lines, 10 filesdep ~pandoc-typesPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: pandoc-types

API changes (from Hackage documentation)

Files

INSTALL view
@@ -59,6 +59,22 @@          cabal install pandoc-citeproc +    By default `pandoc-citeproc` uses the "i;unicode-casemap" method+    to sort bibliography entries (RFC 5051).  If you would like to+    use the locale-sensitive unicode collation algorithm instead,+    specify the `unicode_collation` flag:++       cabal install pandoc-citeproc -funicode_collation++    Note that this requires the `text-icu` library, which in turn+    depends on the C library `icu4c`.  Installation directions+    vary by platform.  Here is how it might work on OSX with homebrew:++       brew install icu4c+       cabal install --extra-lib-dirs=/usr/local/Cellar/icu4c/51.1/lib \+         --extra-include-dirs=/usr/local/Cellar/icu4c/51.1/include \+         -funicode_collation text-icu pandoc-citeproc+ [GHC]: http://www.haskell.org/ghc/ [Haskell platform]: http://hackage.haskell.org/platform/ [cabal-install]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall
README view
@@ -286,10 +286,14 @@     preface the filename with `./`.  `-M` *KEY[=VAL]*, `--metadata=`*KEY[:VAL]*-:   Set the metadata field *KEY* to the value *VAL* after-    parsing.  A value specified on the command line overrides a value-    specified in the document.  Values will be interpreted as raw strings.-    If no value is specified, the value will be treated as Boolean true.+:   Set the metadata field *KEY* to the value *VAL*.  A value specified+    on the command line overrides a value specified in the document.+    Values will be parsed as YAML boolean or string values. If no value is+    specified, the value will be treated as Boolean true.  Like+    `--variable`, `--metadata` causes template variables to be set.+    But unlike `--variable`, `--metadata` affects the metadata of the+    underlying document (which is accessible from filters and may be+    printed in some output formats).  `--normalize` :   Normalize the document after reading:  merge adjacent
changelog view
@@ -1,3 +1,38 @@+pandoc (1.12.0.1)++  * Allow `--metadata` to be repeated for the same key to form a list.+    This also has the effect that `--bibliography` can be repeated,+    as before.++  * Handle boolean values in `--metadata`.  Note that anything not parseable+    as a YAML boolean or string is treated as a literal string.+    You can get a string value with "yes", or any of the strings interpretable+    as booleans, by quoting it:++        -M boolvalue=yes -M stringvalue='"yes"'++  * LaTeX writer: Don't print references if `--natbib` or `--biblatex`+    option used.++  * DOCX writer: Add `settings.xml` to the zip container.  Fixes a bug+    in which docx files could not be read by some versions of Word+    and LibreOffice (#990).++  * Fixed a regression involving slide shows with bibliographies.+    The Div container around references messed up the procedure for carving+    a document into slides.  So we now remove the surrounding Div in+    `prepSlides`.++  * More informative error message when a filter is not found in path.++  * Depend on pandoc-types 1.12.1.  This provide `ToJSONFilter`+    instances for `Data a => a -> [a]` and `Data a => a -> IO [a]`.++  * Don't use unicode_collation in building OSX package:+    it adds something like 50MB of dependencies to the package.++  * Declare alex and happy as build-tools (#986).+ pandoc (1.12)    [new features]@@ -252,7 +287,7 @@    * The `Text.Pandoc.Biblio` module has been removed.  Users of the     pandoc library who want citation support will need to use-    `Text.CSL.Pandoc` from `pandoc-citations`.+    `Text.CSL.Pandoc` from `pandoc-citeproc`.      [bug fixes]
man/man1/pandoc.1 view
@@ -379,12 +379,16 @@ .TP .B \f[C]\-M\f[] \f[I]KEY[=VAL]\f[], \f[C]\-\-metadata=\f[]\f[I]KEY[:VAL]\f[]-Set the metadata field \f[I]KEY\f[] to the value \f[I]VAL\f[] after-parsing.+Set the metadata field \f[I]KEY\f[] to the value \f[I]VAL\f[]. A value specified on the command line overrides a value specified in the document.-Values will be interpreted as raw strings.+Values will be parsed as YAML boolean or string values. If no value is specified, the value will be treated as Boolean true.+Like \f[C]\-\-variable\f[], \f[C]\-\-metadata\f[] causes template+variables to be set.+But unlike \f[C]\-\-variable\f[], \f[C]\-\-metadata\f[] affects the+metadata of the underlying document (which is accessible from filters+and may be printed in some output formats). .RS .RE .TP
pandoc.cabal view
@@ -1,5 +1,5 @@ Name:            pandoc-Version:         1.12+Version:         1.12.0.1 Cabal-Version:   >= 1.10 Build-Type:      Custom License:         GPL@@ -242,7 +242,7 @@                  xml >= 1.3.12 && < 1.4,                  random >= 1 && < 1.1,                  extensible-exceptions >= 0.1 && < 0.2,-                 pandoc-types >= 1.12 && < 1.13,+                 pandoc-types >= 1.12.1 && < 1.13,                  aeson >= 0.6 && < 0.7,                  tagsoup >= 0.12.5 && < 0.14,                  base64-bytestring >= 0.1 && < 1.1,@@ -257,13 +257,14 @@                  yaml >= 0.8.3 && < 0.9,                  vector >= 0.10 && < 0.11,                  hslua >= 0.3 && < 0.4+  Build-Tools:   alex, happy   if flag(http-conduit)      Build-Depends: http-conduit >= 1.9 && < 1.10,                     http-types >= 0.8 && < 0.9      cpp-options:   -DHTTP_CONDUIT   if flag(embed_data_files)      cpp-options:   -DEMBED_DATA_FILES-     -- build-tools:   hsb2hs+     -- Build-Tools:   hsb2hs -- not yet recognized by cabal      other-modules: Text.Pandoc.Data   Ghc-Options:   -rtsopts -Wall -fno-warn-unused-do-bind   Ghc-Prof-Options: -auto-all -caf-all -rtsopts@@ -334,7 +335,7 @@  Executable pandoc   Build-Depends: pandoc,-                 pandoc-types >= 1.12 && < 1.13,+                 pandoc-types >= 1.12.1 && < 1.13,                  base >= 4.2 && <5,                  directory >= 1 && < 1.3,                  filepath >= 1.1 && < 1.4,@@ -344,6 +345,9 @@                  extensible-exceptions >= 0.1 && < 0.2,                  highlighting-kate >= 0.5.5 && < 0.6,                  aeson >= 0.6 && < 0.7,+                 text >= 0.11 && < 0.12,+                 yaml >= 0.8.3 && < 0.9,+                 containers >= 0.1 && < 0.6,                  HTTP >= 4000.0.5 && < 4000.3   Ghc-Options:   -rtsopts -with-rtsopts=-K16m -Wall -fno-warn-unused-do-bind   Ghc-Prof-Options: -auto-all -caf-all -rtsopts -with-rtsopts=-K16m@@ -377,7 +381,7 @@   Build-Depends:  base >= 4.2 && < 5,                   syb >= 0.1 && < 0.5,                   pandoc,-                  pandoc-types >= 1.12 && < 1.13,+                  pandoc-types >= 1.12.1 && < 1.13,                   bytestring >= 0.9 && < 0.11,                   text >= 0.11 && < 0.12,                   directory >= 1 && < 1.3,
pandoc.hs view
@@ -60,6 +60,12 @@ import qualified Data.ByteString.Lazy as B import qualified Data.ByteString as BS import Data.Aeson (eitherDecode', encode)+import qualified Data.Map as M+import System.IO.Error(ioeGetErrorType)+import GHC.IO.Exception (IOErrorType(ResourceVanished))+import Data.Yaml (decode)+import qualified Data.Yaml as Yaml+import qualified Data.Text as T  copyrightMessage :: String copyrightMessage = "\nCopyright (C) 2006-2013 John MacFarlane\n" ++@@ -98,8 +104,11 @@            ExitSuccess    -> return $ either error id $ eitherDecode' outbs            ExitFailure _  -> err 83 $ "Error running filter " ++ f  where filterException :: E.SomeException -> IO a-       filterException e = err 83 $ "Error running filter " ++ f ++-                                     "\n" ++ show e+       filterException e = err 83 $ "Error running filter " ++ f ++ "\n" +++                                  if ioeGetErrorType `fmap` E.fromException e ==+                                          Just ResourceVanished+                                     then f ++ " not found in path"+                                     else show e  -- | Data structure for command line options. data Opt = Opt@@ -113,7 +122,7 @@     , optTransforms        :: [Pandoc -> Pandoc]  -- ^ Doc transforms to apply     , optTemplate          :: Maybe FilePath  -- ^ Custom template     , optVariables         :: [(String,String)] -- ^ Template variables to set-    , optMetadata          :: [(String,MetaValue)] -- ^ Metadata fields to set+    , optMetadata          :: M.Map String MetaValue -- ^ Metadata fields to set     , optOutputFile        :: String  -- ^ Name of output file     , optNumberSections    :: Bool    -- ^ Number sections in LaTeX     , optNumberOffset      :: [Int]   -- ^ Starting number for sections@@ -168,7 +177,7 @@     , optTransforms            = []     , optTemplate              = Nothing     , optVariables             = []-    , optMetadata              = []+    , optMetadata              = M.empty     , optOutputFile            = "-"    -- "-" means stdout     , optNumberSections        = False     , optNumberOffset          = [0,0,0,0,0,0]@@ -327,9 +336,10 @@                  (ReqArg                   (\arg opt -> do                      let (key,val) = case break (`elem` ":=") arg of-                                       (k,_:v) -> (k, MetaString v)+                                       (k,_:v) -> (k, readMetaValue v)                                        (k,_)   -> (k, MetaBool True)-                     return opt{ optMetadata = (key,val) : optMetadata opt })+                     return opt{ optMetadata = addMetadata key val+                                             $ optMetadata opt })                   "KEY[:VALUE]")                  "" @@ -656,27 +666,29 @@      , Option "" ["bibliography"]                  (ReqArg-                  (\arg opt ->-                     return opt{ optMetadata = ("bibliography",MetaString arg) :-                                 optMetadata opt-                               })+                  (\arg opt -> return opt{ optMetadata = addMetadata+                                             "bibliography" (readMetaValue arg)+                                             $ optMetadata opt+                                         })                    "FILE")                  ""       , Option "" ["csl"]                  (ReqArg                   (\arg opt ->-                     return opt{ optMetadata = ("csl", MetaString arg) :-                                 optMetadata opt })+                     return opt{ optMetadata = addMetadata "csl"+                                               (readMetaValue arg)+                                               $ optMetadata opt })                    "FILE")                  ""       , Option "" ["citation-abbreviations"]                  (ReqArg                   (\arg opt ->-                     return opt{ optMetadata = ("citation-abbreviations",-                                                MetaString arg) :-                                 optMetadata opt })+                     return opt{ optMetadata = addMetadata+                                               "citation-abbreviations"+                                               (readMetaValue arg)+                                               $ optMetadata opt })                    "FILE")                  "" @@ -776,6 +788,20 @@      ] +addMetadata :: String -> MetaValue -> M.Map String MetaValue+            -> M.Map String MetaValue+addMetadata k v m = case M.lookup k m of+                         Nothing -> M.insert k v m+                         Just (MetaList xs) -> M.insert k+                                              (MetaList (xs ++ [v])) m+                         Just x -> M.insert k (MetaList [v, x]) m++readMetaValue :: String -> MetaValue+readMetaValue s = case decode (UTF8.fromString s) of+                       Just (Yaml.String t) -> MetaString $ T.unpack t+                       Just (Yaml.Bool b)   -> MetaBool b+                       _                    -> MetaString s+ -- Returns usage message usageMessage :: String -> [OptDescr (Opt -> IO Opt)] -> String usageMessage programName = usageInfo@@ -933,7 +959,7 @@        exitWith ExitSuccess    -- --bibliography implies -F pandoc-citeproc for backwards compatibility:-  let filters' = case lookup "bibliography" metadata of+  let filters' = case M.lookup "bibliography" metadata of                        Just _ | all (\f -> takeBaseName f /= "pandoc-citeproc")                                 filters -> "pandoc-citeproc" : filters                        _                -> filters@@ -1109,7 +1135,7 @@            reader readerOpts  -  let doc0 = foldr (\(k,v) -> setMeta k v) doc metadata+  let doc0 = M.foldWithKey setMeta doc metadata   let doc1 = foldr ($) doc0 transforms   doc2 <- foldrM ($) doc1 $ map ($ [writerName']) plugins 
src/Text/Pandoc/Slides.hs view
@@ -46,13 +46,18 @@  -- | Prepare a block list to be passed to hierarchicalize. prepSlides :: Int -> [Block] -> [Block]-prepSlides slideLevel = ensureStartWithH . splitHrule+prepSlides slideLevel = ensureStartWithH . splitHrule . extractRefsHeader   where splitHrule (HorizontalRule : Header n attr xs : ys)                        | n == slideLevel = Header slideLevel attr xs : splitHrule ys         splitHrule (HorizontalRule : xs) = Header slideLevel nullAttr [Str "\0"] :                                            splitHrule xs         splitHrule (x : xs)              = x : splitHrule xs         splitHrule []                    = []+        extractRefsHeader bs             =+          case reverse bs of+               (Div (_,["references"],_) (Header n attrs xs : ys) : zs)+                 -> reverse zs ++ (Header n attrs xs : ys)+               _ -> bs         ensureStartWithH bs@(Header n _ _:_)                        | n <= slideLevel = bs         ensureStartWithH bs              = Header slideLevel nullAttr [Str "\0"] : bs
src/Text/Pandoc/Writers/Docx.hs view
@@ -257,6 +257,7 @@   docPropsAppEntry <- entryFromArchive "docProps/app.xml"   themeEntry <- entryFromArchive "word/theme/theme1.xml"   fontTableEntry <- entryFromArchive "word/fontTable.xml"+  settingsEntry <- entryFromArchive "word/settings.xml"   webSettingsEntry <- entryFromArchive "word/webSettings.xml"    -- Create archive@@ -264,7 +265,8 @@                   contentTypesEntry : relsEntry : contentEntry : relEntry :                   footnoteRelEntry : numEntry : styleEntry : footnotesEntry :                   docPropsEntry : docPropsAppEntry : themeEntry :-                  fontTableEntry : webSettingsEntry : imageEntries+                  fontTableEntry : settingsEntry : webSettingsEntry :+                  imageEntries   return $ fromArchive archive  styleToOpenXml :: Style -> [Element]
src/Text/Pandoc/Writers/LaTeX.hs view
@@ -82,10 +82,17 @@  pandocToLaTeX :: WriterOptions -> Pandoc -> State WriterState String pandocToLaTeX options (Pandoc meta blocks) = do+  -- Strip off final 'references' header if --natbib or --biblatex+  let method = writerCiteMethod options+  let blocks' = if method == Biblatex || method == Natbib+                   then case reverse blocks of+                             (Div (_,["references"],_) _):xs -> reverse xs+                             _ -> blocks+                   else blocks   -- see if there are internal links   let isInternalLink (Link _ ('#':xs,_))  = [xs]       isInternalLink _                    = []-  modify $ \s -> s{ stInternalLinks = query isInternalLink blocks }+  modify $ \s -> s{ stInternalLinks = query isInternalLink blocks' }   let template = writerTemplate options   -- set stBook depending on documentclass   let bookClasses = ["memoir","book","report","scrreprt","scrbook"]@@ -107,15 +114,15 @@               (fmap (render colwidth) . blockListToLaTeX)               (fmap (render colwidth) . inlineListToLaTeX)               meta-  let (blocks', lastHeader) = if writerCiteMethod options == Citeproc then-                                (blocks, [])-                              else case last blocks of-                                Header 1 _ il -> (init blocks, il)-                                _             -> (blocks, [])-  blocks'' <- if writerBeamer options-                 then toSlides blocks'-                 else return blocks'-  body <- mapM (elementToLaTeX options) $ hierarchicalize blocks''+  let (blocks'', lastHeader) = if writerCiteMethod options == Citeproc then+                                 (blocks', [])+                               else case last blocks' of+                                 Header 1 _ il -> (init blocks', il)+                                 _             -> (blocks', [])+  blocks''' <- if writerBeamer options+                  then toSlides blocks''+                  else return blocks''+  body <- mapM (elementToLaTeX options) $ hierarchicalize blocks'''   (biblioTitle :: String) <- liftM (render colwidth) $ inlineListToLaTeX lastHeader   let main = render colwidth $ vsep body   st <- get
src/Text/Pandoc/Writers/Markdown.hs view
@@ -187,11 +187,11 @@                then tableOfContents opts headerBlocks                else empty   -- Strip off final 'references' header if markdown citations enabled-  let blocks' = case reverse blocks of-                     (Div (_,["references"],_) _):xs-                       | not isPlain && isEnabled Ext_citations opts-                       -> reverse xs-                     _ -> blocks+  let blocks' = if not isPlain && isEnabled Ext_citations opts+                   then case reverse blocks of+                             (Div (_,["references"],_) _):xs -> reverse xs+                             _ -> blocks+                   else blocks   body <- blockListToMarkdown opts blocks'   st <- get   notes' <- notesToMarkdown opts (reverse $ stNotes st)