pandoc-crossref 0.2.0.1 → 0.2.1.1
raw patch · 5 files changed
+22/−15 lines, 5 filesdep ~data-defaultPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: data-default
API changes (from Hackage documentation)
Files
- lib/Text/Pandoc/CrossRef/References/Blocks.hs +10/−9
- lib/Text/Pandoc/CrossRef/References/Refs.hs +5/−1
- lib/Text/Pandoc/CrossRef/Util/Options.hs +1/−0
- lib/Text/Pandoc/CrossRef/Util/Settings.hs +1/−0
- pandoc-crossref.cabal +5/−5
lib/Text/Pandoc/CrossRef/References/Blocks.hs view
@@ -24,13 +24,16 @@ replaceAll :: Data a => Options -> a -> WS a replaceAll opts =- everywhereMBut' (mkQ False isSubfig) (mkM (replaceBlocks opts) `extM` replaceInlines opts)+ everywhereMBut' (mkQ False isSubfig `extQ` isSubfig') (mkM (replaceBlocks opts) `extM` replaceInlines opts) . everywhere' (mkT divBlocks `extT` spanInlines) where isSubfig (Div (label,cls,_) _) | "fig:" `isPrefixOf` label = True | "crossref-stop" `elem` cls = True isSubfig _ = False+ isSubfig' (Span (_,cls,_) _)+ | "crossref-stop" `elem` cls = True+ isSubfig' _ = False replaceBlocks :: Options -> Block -> WS Block replaceBlocks opts (Header n (label, cls, attrs) text')@@ -52,7 +55,6 @@ -- subfigures replaceBlocks opts (Div (label,cls,attrs) images) | "fig:" `isPrefixOf` label- , all isImage (init images) , Para caption <- last images = do idxStr <- replaceAttr opts label (lookup "label" attrs) caption imgRefs@@ -91,13 +93,6 @@ , RawBlock (Format "tex") "\\end{figure}"] _ -> return $ Div (label, "subfigures":cls, attrs) $ cont ++ [Para capt] where- isImage (Para images') = all isImage' images'- isImage (Plain images') = all isImage' images'- isImage _ = False- isImage' (Image _ _ s) = "fig:" `isPrefixOf` snd s- isImage' Space = True- isImage' SoftBreak = True- isImage' _ = False opts' = opts { figureTemplate = subfigureChildTemplate opts , customLabel = \r i -> customLabel opts ("sub"++r) i@@ -165,6 +160,12 @@ Para caption' , CodeBlock ([], classes, attrs) code ]+replaceBlocks opts (Para [Span (label, _, attrs) [Math DisplayMath eq]])+ | not $ isFormat "latex" (outFormat opts)+ , tableEqns opts+ = do+ idxStr <- replaceAttr opts label (lookup "label" attrs) [] eqnRefs+ return $ Table [] [AlignCenter, AlignRight] [0.9, 0.1] [] [[[Plain [Math DisplayMath eq]], [Plain [Math DisplayMath $ "(" ++ stringify idxStr ++ ")"]]]] replaceBlocks _ x = return x replaceInlines :: Options -> Inline -> WS Inline
lib/Text/Pandoc/CrossRef/References/Refs.hs view
@@ -86,7 +86,7 @@ return $ p [texcit] where texcit =- RawInline (Format "tex") $+ RawInline (Format "tex") $ replace' '_' "ux5f" $ if cref opts then cref'++"{"++listLabels prefix "" "," "" cits++"}" else@@ -96,6 +96,10 @@ cap = maybe False isFirstUpper $ getLabelPrefix . citationId . head $ cits cref' | cap = "\\Cref" | otherwise = "\\cref"+ replace' old new | prefix == "sec:" = replace old new+ | otherwise = id+ replace old new = intercalate new . split old+ split a = filter (/=[a]) . groupBy ((&&) `on` (/= a)) listLabels :: String -> String -> String -> String -> [Citation] -> String listLabels prefix p sep s =
lib/Text/Pandoc/CrossRef/Util/Options.hs view
@@ -32,4 +32,5 @@ , customLabel :: String -> Int -> Maybe String , ccsDelim :: [Inline] , ccsLabelSep :: [Inline]+ , tableEqns :: Bool }
lib/Text/Pandoc/CrossRef/Util/Settings.hs view
@@ -59,4 +59,5 @@ <> ccsDelim (str "," <> space) <> ccsLabelSep (space <> str "—" <> space) <> ccsTemplate (var "i" <> var "ccsLabelSep" <> var "t")+ <> tableEqns (MetaBool False) where var = displayMath
pandoc-crossref.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: pandoc-crossref-version: 0.2.0.1+version: 0.2.1.1 synopsis: Pandoc filter for cross-references description: pandoc-crossref is a pandoc filter for numbering figures, equations, tables and cross-references to them. license: GPL-2@@ -25,7 +25,7 @@ source-repository this type: git location: https://github.com/lierdakil/pandoc-crossref- tag: v0.2.0.1+ tag: v0.2.1.1 library exposed-modules: Text.Pandoc.CrossRef@@ -51,7 +51,7 @@ , containers >= 0.1 && <0.6 , pandoc-types >= 1.12.4.1 && < 1.17 , yaml >= 0.8 && <0.9- , data-default >= 0.4 && <0.6+ , data-default >= 0.4 && <0.7 , bytestring >=0.9 && <0.11 , data-accessor >= 0.2.2.6 && < 0.3.0.0 , data-accessor-template >= 0.2.1.12 && < 0.3.0.0@@ -71,7 +71,7 @@ , containers >= 0.1 && <0.6 , pandoc-types >= 1.12.4.1 && < 1.17 , yaml >= 0.8 && <0.9- , data-default >= 0.4 && <0.6+ , data-default >= 0.4 && <0.7 , bytestring >=0.9 && <0.11 , pandoc-crossref hs-source-dirs: src@@ -88,7 +88,7 @@ , containers >= 0.1 && <0.6 , pandoc-types >= 1.12.4.1 && < 1.17 , yaml >= 0.8 && <0.9- , data-default >= 0.4 && <0.6+ , data-default >= 0.4 && <0.7 , bytestring >=0.9 && <0.11 , hspec , process >=1 && <1.5