pandoc-citeproc 0.10.4 → 0.10.4.1
raw patch · 11 files changed
+88/−62 lines, 11 filesdep ~aesondep ~xml-conduitPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, xml-conduit
API changes (from Hackage documentation)
Files
- changelog +10/−0
- compat/Text/CSL/Compat/Pandoc.hs +45/−22
- pandoc-citeproc.cabal +5/−2
- src/Text/CSL/Input/Bibtex.hs +2/−5
- src/Text/CSL/Input/Bibutils.hs +1/−2
- src/Text/CSL/Output/Plain.hs +2/−2
- src/Text/CSL/Pandoc.hs +7/−5
- src/Text/CSL/Style.hs +4/−7
- stack.yaml +6/−10
- tests/test-citeproc.hs +3/−2
- tests/test-pandoc-citeproc.hs +3/−5
changelog view
@@ -1,3 +1,13 @@+pandoc-citeproc (0.10.4.1)++ * Raise version bounds for xml-conduit.+ * Use cpphs if embed_data_files on darwin.+ * Fixed Compat module so it compiles with pandoc 1.9.x and 2.0.+ * Allow colon to belong to locator numbers (#275).+ This at least allows 1:22-23 to be interpreted as a page number, though+ this won't really be useful until we modify the number collapsing code to+ be sensitive to the colon.+ pandoc-citeproc (0.10.4) * Fixed 'et al' in certain styles (#274). The `et al` phrase was
compat/Text/CSL/Compat/Pandoc.hs view
@@ -17,7 +17,8 @@ import System.Exit (ExitCode) import Data.ByteString.Lazy as BL import Data.ByteString as B-import Text.Pandoc (Pandoc, ReaderOptions, WriterOptions)+import Text.Pandoc (Pandoc, ReaderOptions(..), def, WrapOption(..),+ WriterOptions(..)) import qualified Text.Pandoc as Pandoc import qualified Text.Pandoc.Process #if MIN_VERSION_pandoc(2,0,0)@@ -26,6 +27,8 @@ import Text.Pandoc.Class (runPure, runIO) import qualified Text.Pandoc.Class (fetchItem) import Control.Monad.Except (runExceptT, lift)+import Text.Pandoc.Extensions (extensionsFromList, Extension(..),+ pandocExtensions, disableExtension) #else import System.IO (stderr) import qualified Text.Pandoc.Shared (fetchItem)@@ -33,34 +36,54 @@ type MimeType = String #endif +readHtml, readLaTeX, readMarkdown, readNative :: String -> Pandoc+writeMarkdown, writePlain, writeNative, writeHtmlString :: Pandoc -> String+ #if MIN_VERSION_pandoc(2,0,0)-#define WRAPREADER(f) f o = either mempty id . runPure . Pandoc.f o-#define WRAPWRITER(f) f o = either mempty id . runPure . Pandoc.f o-#else-#define WRAPREADER(f) f o = either mempty id . Pandoc.f o-#define WRAPWRITER(f) f = Pandoc.f-#endif+readHtml = either mempty id . runPure . Pandoc.readHtml+ def{ readerExtensions = extensionsFromList [Ext_native_divs,+ Ext_native_spans, Ext_raw_html, Ext_smart] } -readHtml, readLaTeX, readMarkdown, readNative ::- ReaderOptions -> String -> Pandoc+readMarkdown = either mempty id . runPure . Pandoc.readMarkdown+ def{ readerExtensions = pandocExtensions, readerStandalone = True } -WRAPREADER(readHtml)-WRAPREADER(readLaTeX)-WRAPREADER(readMarkdown)+readLaTeX = either mempty id . runPure . Pandoc.readLaTeX+ def{ readerExtensions = extensionsFromList [Ext_raw_tex, Ext_smart] } -#if MIN_VERSION_pandoc(2,0,0)-WRAPREADER(readNative)+readNative = either mempty id . runPure . Pandoc.readNative def++writeMarkdown = either mempty id . runPure . Pandoc.writeMarkdown+ def{ writerExtensions = disableExtension Ext_smart pandocExtensions,+ writerWrapText = WrapNone }++writePlain = either mempty id . runPure . Pandoc.writePlain def++writeNative = either mempty id . runPure . Pandoc.writeNative def++writeHtmlString = either mempty id . runPure . Pandoc.writeHtml4String+ def{ writerExtensions = extensionsFromList+ [Ext_native_divs, Ext_native_spans, Ext_raw_html] }+ #else-readNative _ = either mempty id . Pandoc.readNative-#endif+readHtml = either mempty id . Pandoc.readHtml+ def{ readerSmart = True, readerParseRaw = True } -writeMarkdown, writePlain, writeNative, writeHtmlString ::- WriterOptions -> Pandoc -> String+readMarkdown = either mempty id . Pandoc.readMarkdown+ def{ readerSmart = True, readerStandalone = True} -WRAPWRITER(writeMarkdown)-WRAPWRITER(writePlain)-WRAPWRITER(writeNative)-WRAPWRITER(writeHtmlString)+readLaTeX = either mempty id . Pandoc.readLaTeX+ def{ readerSmart = True, readerParseRaw = True }++readNative = either mempty id . Pandoc.readNative++writeMarkdown = Pandoc.writeMarkdown def{ writerWrapText = WrapNone }++writePlain = Pandoc.writePlain def++writeNative = Pandoc.writeNative def++writeHtmlString = Pandoc.writeHtmlString def+#endif pipeProcess :: Maybe [(String, String)] -> FilePath -> [String] -> BL.ByteString -> IO (ExitCode,BL.ByteString)
pandoc-citeproc.cabal view
@@ -1,5 +1,5 @@ name: pandoc-citeproc-version: 0.10.4+version: 0.10.4.1 cabal-version: >= 1.12 synopsis: Supports using pandoc with citeproc @@ -103,7 +103,7 @@ aeson >= 0.7 && < 1.2, text, vector,- xml-conduit >= 1.2 && < 1.5,+ xml-conduit >= 1.2 && < 1.6, unordered-containers >= 0.2 && < 0.3, data-default, setenv >= 0.1 && < 0.2,@@ -126,6 +126,9 @@ Build-Tools: hsb2hs >= 0.3.1 cpp-options: -DEMBED_DATA_FILES other-modules: Text.CSL.Data.Embedded+ if os(darwin)+ Build-Tools: cpphs >= 1.19+ ghc-options: -pgmP cpphs -optP --cpp if flag(unicode_collation) build-depends: text, text-icu
src/Text/CSL/Input/Bibtex.hs view
@@ -20,11 +20,9 @@ import Text.Parsec hiding (optional, (<|>), many, State) import Control.Applicative-import Text.Pandoc (ReaderOptions(..)) import Text.CSL.Compat.Pandoc (readLaTeX) import Text.Pandoc.Definition import Text.Pandoc.Generic (bottomUp)-import Data.Default (Default(def)) import Data.List.Split (splitOn, splitWhen, wordsBy) import Data.List (intercalate) import Data.Maybe@@ -1124,9 +1122,8 @@ _ -> False latex' :: String -> [Block]-latex' s = Walk.walk removeSoftBreak $- case readLaTeX def{readerParseRaw = True, readerSmart = True} s of- (Pandoc _ bs) -> bs+latex' s = Walk.walk removeSoftBreak bs+ where Pandoc _ bs = readLaTeX s removeSoftBreak :: Inline -> Inline removeSoftBreak SoftBreak = Space
src/Text/CSL/Input/Bibutils.hs view
@@ -148,8 +148,7 @@ readYamlBib :: String -> Either String [Reference] readYamlBib s =- case readMarkdown def{ readerStandalone = True- , readerSmart = True } s of+ case readMarkdown s of (Pandoc meta _) -> convertRefs (lookupMeta "references" meta) convertRefs :: Maybe MetaValue -> Either String [Reference]
src/Text/CSL/Output/Plain.hs view
@@ -19,9 +19,9 @@ import Text.CSL.Style import Text.CSL.Compat.Pandoc (writePlain)-import Text.Pandoc (Block(Plain), Pandoc(..), nullMeta, def)+import Text.Pandoc (Block(Plain), Pandoc(..), nullMeta) -- | Render the 'Formatted' into a plain text string. renderPlain :: Formatted -> String-renderPlain (Formatted ils) = writePlain def $ Pandoc nullMeta [Plain ils]+renderPlain (Formatted ils) = writePlain $ Pandoc nullMeta [Plain ils]
src/Text/CSL/Pandoc.hs view
@@ -369,7 +369,7 @@ locatorWords :: LocatorMap -> [Inline] -> (String, String, [Inline]) locatorWords locMap inp = case parse (pLocatorWords locMap) "suffix" $- splitStrWhen (\c -> isPunctuation c || isSpace c) inp of+ splitStrWhen (\c -> isLocatorPunct c || isSpace c) inp of Right r -> r Left _ -> ("","",inp) @@ -435,11 +435,13 @@ _ -> mzero pLocatorPunct :: Parsec [Inline] st Inline-pLocatorPunct = pMatch isLocatorPunct+pLocatorPunct = pMatch isLocatorPunct'+ where isLocatorPunct' (Str [c]) = isLocatorPunct c+ isLocatorPunct' _ = False -isLocatorPunct :: Inline -> Bool-isLocatorPunct (Str [c]) = isPunctuation c-isLocatorPunct _ = False+isLocatorPunct :: Char -> Bool+isLocatorPunct ':' = False+isLocatorPunct c = isPunctuation c type LocatorMap = M.Map String String
src/Text/CSL/Style.hs view
@@ -106,8 +106,7 @@ import Data.Yaml.Builder(ToYaml(..)) import qualified Data.Yaml.Builder as Y import Text.Pandoc.Definition hiding (Citation, Cite)-import Text.Pandoc (WriterOptions(..), ReaderOptions(..), WrapOption(..),- bottomUp, def)+import Text.Pandoc (bottomUp) import Text.CSL.Compat.Pandoc (readHtml, writeMarkdown) import qualified Text.Pandoc.Walk as Walk import qualified Text.Pandoc.Builder as B@@ -130,9 +129,7 @@ readCSLString :: String -> [Inline] readCSLString s = Walk.walk handleSmallCapsSpans- $ case readHtml def{ readerSmart = True- , readerParseRaw = True }- (adjustScTags s) of+ $ case readHtml (adjustScTags s) of Pandoc _ [Plain ils] -> ils Pandoc _ [Para ils] -> ils Pandoc _ x -> Walk.query (:[]) x@@ -157,13 +154,13 @@ writeYAMLString :: [Inline] -> String writeYAMLString ils =- trimr $ writeMarkdown def{writerWrapText = WrapNone}+ trimr $ writeMarkdown $ Pandoc nullMeta [Plain $ bottomUp (concatMap (adjustCSL False)) ils] writeCSLString :: [Inline] -> String writeCSLString ils =- trimr $ writeMarkdown def{writerWrapText = WrapNone}+ trimr $ writeMarkdown $ Pandoc nullMeta [Plain $ bottomUp (concatMap (adjustCSL True)) ils]
stack.yaml view
@@ -7,14 +7,10 @@ debug: false packages: - '.'-# - location:-# git: https://github.com/jgm/pandoc.git-# commit: 411434bf130a3116290c7ca54358678e03d0d92b-# extra-dep: true+- location:+ git: https://github.com/jgm/pandoc.git+ commit: cfdbe85e7178e2a82f141192736dc2e0d6daed8a+ extra-dep: true extra-deps:-- pandoc-1.19.1-- doctemplates-0.1.0.2-- pandoc-types-1.17.0.4-- texmath-0.9-# - skylighting-0.1.1.2-resolver: lts-7.14+- xml-conduit-1.5.0+resolver: lts-8.0
tests/test-citeproc.hs view
@@ -3,7 +3,8 @@ import Text.Printf import System.Exit import qualified Control.Exception as E-import Text.Pandoc hiding (writeHtmlString)+import Text.Pandoc (Block(..), Inline(..), Format(..), bottomUp,+ nullMeta, Pandoc(..)) import Text.CSL.Compat.Pandoc (writeHtmlString) import Data.Char (isSpace, toLower) import System.Environment (getArgs)@@ -137,7 +138,7 @@ -- this is designed to mimic the test suite's output: inlinesToString :: [Inline] -> String inlinesToString ils =- writeHtmlString def{ writerWrapText = WrapNone }+ writeHtmlString $ bottomUp (concatMap adjustSpans) $ Pandoc nullMeta [Plain ils]
tests/test-pandoc-citeproc.hs view
@@ -11,9 +11,7 @@ import qualified Data.Aeson as Aeson import Text.Pandoc.Definition import qualified Text.Pandoc.UTF8 as UTF8-import Text.Pandoc.Options (WriterOptions(..)) import Text.CSL.Compat.Pandoc (writeNative, pipeProcess)-import Text.Pandoc (def) import Data.List (isSuffixOf) import System.Environment import Control.Monad (when)@@ -72,13 +70,13 @@ then err "PASSED" >> return Passed else do err $ "FAILED"- showDiff (writeNative def expectedDoc) (writeNative def outDoc)+ showDiff (writeNative expectedDoc) (writeNative outDoc) when regenerate $ UTF8.writeFile ("tests/" ++ csl ++ ".expected.native") $ #if MIN_VERSION_pandoc(1,19,0)- writeNative def{ writerTemplate = Just "" } outDoc+ writeNative outDoc #else- writeNative def{ writerStandalone = True } outDoc+ writeNative outDoc #endif return Failed else do