packages feed

pandoc-crossref 0.3.4.0 → 0.3.4.1

raw patch · 9 files changed

+45/−38 lines, 9 files

Files

docs/demo/demo.md view
@@ -123,9 +123,9 @@ It's also possible to show lists of figures and tables, like this:  \listoffigures-[]: hack to split raw blocks+ \listoftables-[]: hack to split raw blocks+ \listoflistings  # Appendix A. Custom labels {label=AppA}
docs/index.md view
@@ -738,11 +738,11 @@     http://www.fileformat.info/info/unicode/block/basic\_latin/utf8test.htm     for general idea on letter progression. -   list of strings. You can define a YAML array for numbers. Mapping is-    1:1. For example, `yaml   figLabels: [α, β, γ, 1, 2, 3, I, II, III]`-    will give first figure label 'α', second -- 'β', etc.+    1:1. For example, `figLabels: [α, β, γ, δ, ε]`+    will give first object label 'α', second -- 'β', etc, up until the fifths.      Note that it will repeat last item in list indefinitely if there are-    more images than items in list.+    more references than items in list, i.e. in the example above, sixths object and all after that will also have label 'ε'.  ## Settings file 
lib/Text/Pandoc/CrossRef/Util/CustomLabels.hs view
@@ -34,12 +34,13 @@  mkLabel :: Int -> String -> MetaValue -> Maybe String mkLabel i n lt+  | MetaList _ <- lt+  , Just val <- toString n <$> getList (i-1) lt+  = Just val   | toString n lt == "arabic"   = Nothing   | toString n lt == "roman"   = Just $ toRoman i   | Just (startWith:_) <- stripPrefix "alpha " $ toString n lt   = Just [[startWith..] !! (i-1)]-  | Just val <- toString n <$> getList (i-1) lt-  = Just val   | otherwise = error $ "Unknown numeration type: " ++ show lt
lib/Text/Pandoc/CrossRef/Util/Template.hs view
@@ -44,7 +44,7 @@     | '[' `elem` var  && ']' == last var =       let (vn, idxBr) = span (/='[') var           idxVar = drop 1 $ takeWhile (/=']') idxBr-          idx = readMaybe . toString ("index variable " ++ idxVar) =<< (vf idxVar)+          idx = readMaybe . toString ("index variable " ++ idxVar) =<< vf idxVar           arr = do             i <- idx             v <- lookupMeta vn dtv
pandoc-crossref.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.0.+-- This file has been generated from package.yaml by hpack version 0.31.1. -- -- see: https://github.com/sol/hpack ----- hash: 2cd0206988abd6c996a007085e3e239d62131d1ab25f6075cf86d49407c2c5e9+-- hash: 39d61fdf8cc92a3c2c4fa382a9847aa07faa45ce3ea2081e99b89c46a711651f  name:           pandoc-crossref-version:        0.3.4.0+version:        0.3.4.1 synopsis:       Pandoc filter for cross-references description:    pandoc-crossref is a pandoc filter for numbering figures, equations, tables and cross-references to them. category:       Text@@ -104,7 +104,7 @@     , directory >=1 && <1.4     , filepath >=1.1 && <1.5     , mtl >=1.1 && <2.3-    , pandoc >=2.3 && <2.5+    , pandoc >=2.3 && <2.8     , pandoc-types >=1.17.5.1 && <1.18     , roman-numerals ==0.5.*     , syb >=0.4 && <0.8@@ -135,7 +135,7 @@     , mtl >=1.1 && <2.3     , open-browser >=0.2 && <0.3     , optparse-applicative >=0.13 && <0.15-    , pandoc >=2.3 && <2.5+    , pandoc >=2.3 && <2.8     , pandoc-crossref     , pandoc-types >=1.17.5.1 && <1.18     , roman-numerals ==0.5.*@@ -163,7 +163,7 @@     , filepath >=1.1 && <1.5     , hspec >=2.4.4 && <3     , mtl >=1.1 && <2.3-    , pandoc >=2.3 && <2.5+    , pandoc >=2.3 && <2.8     , pandoc-crossref     , pandoc-types >=1.17.5.1 && <1.18     , roman-numerals ==0.5.*@@ -212,7 +212,7 @@     , filepath >=1.1 && <1.5     , hspec >=2.4.4 && <3     , mtl >=1.1 && <2.3-    , pandoc >=2.3 && <2.5+    , pandoc >=2.3 && <2.8     , pandoc-types >=1.17.5.1 && <1.18     , roman-numerals ==0.5.*     , syb >=0.4 && <0.8
src/pandoc-crossref.hs view
@@ -18,7 +18,7 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -} -{-# LANGUAGE ApplicativeDo, TemplateHaskell, CPP #-}+{-# LANGUAGE ApplicativeDo, TemplateHaskell, CPP, OverloadedStrings #-} import Text.Pandoc import Text.Pandoc.JSON @@ -28,15 +28,19 @@ import Control.Monad import Web.Browser import System.IO.Temp-import System.IO+import System.IO hiding (putStrLn) import ManData import Control.Concurrent import Development.GitRev+import qualified Data.Text as T+import qualified Data.Text.IO as T -man, manHtml :: String-man = $(embedManualText)-manHtml = $(embedManualHtml)+import Prelude hiding (putStrLn) +man, manHtml :: T.Text+man = T.pack $(embedManualText)+manHtml = T.pack $(embedManualHtml)+ data Flag = NumericVersion | Version | Man | HtmlMan  run :: Parser (IO ())@@ -49,17 +53,18 @@   return $ go (numVers <|> vers <|> man' <|> hman) fmt   where     go :: Maybe Flag -> Maybe String -> IO ()-    go (Just Version) _ = putStrLn $+    go (Just Version) _ = T.putStrLn $          "pandoc-crossref v" <> VERSION_pandoc_crossref       <> " git commit " <> $gitHash       <> " (" <> $gitBranch <> ")"       <> " built with Pandoc v" <> VERSION_pandoc <> ","       <> " pandoc-types v" <> VERSION_pandoc_types       <> " and GHC " <> TOOL_VERSION_ghc-    go (Just NumericVersion) _ = putStrLn VERSION_pandoc_crossref-    go (Just Man    ) _ = putStrLn man+    go (Just NumericVersion) _ = T.putStrLn VERSION_pandoc_crossref+    go (Just Man    ) _ = T.putStrLn man     go (Just HtmlMan) _ = withSystemTempFile "pandoc-crossref-manual.html" $ \fp h -> do-      hPutStrLn h manHtml+      hSetEncoding h utf8+      T.hPutStrLn h manHtml       hClose h       void $ openBrowser $ "file:///" <> fp       threadDelay 5000000
test/demo-chapters.inc view
@@ -56,7 +56,7 @@    [Para [Str "Listing",Space,Str "4.3:",Space,Str "Listing",Space,Str "caption"]    ,CodeBlock ("",["haskell"],[]) "main :: IO ()\nmain = putStrLn \"Hello World!\""]   ,Header 1 ("sec:unnumbered-chapter.",["unnumbered"],[]) [Str "Unnumbered",Space,Str "chapter."]-  ,Para [Str "This",Space,Str "chapter",Space,Str "doesn\8217t",Space,Str "change",Space,Str "chapter",Space,Str "prefix",Space,Str "of",Space,Str "referenced",Space,Str "elements,",Space,Str "instead",Space,Str "keeping",Space,Str "number",Space,Str "of",Space,Str "previous",Space,Str "chapter,",SoftBreak,Str "e.g.\160",Span ("eq:eqn2",[],[]) [Math DisplayMath " S(x) = \\int_{x_1}^{x_2} a x+b \\  \\mathrm{d}x \\qquad(4.1)"]]+  ,Para [Str "This",Space,Str "chapter",Space,Str "doesn\8217t",Space,Str "change",Space,Str "chapter",Space,Str "prefix",Space,Str "of",Space,Str "referenced",Space,Str "elements,",Space,Str "instead",Space,Str "keeping",Space,Str "number",Space,Str "of",Space,Str "previous",Space,Str "chapter,",Space,Str "e.g.",SoftBreak,Span ("eq:eqn2",[],[]) [Math DisplayMath " S(x) = \\int_{x_1}^{x_2} a x+b \\  \\mathrm{d}x \\qquad(4.1)"]]   ,Header 1 ("sec:chapter-5.-reference-lists",[],[]) [Str "Chapter",Space,Str "5.",Space,Str "Reference",Space,Str "lists"]   ,Para [Str "It\8217s",Space,Str "also",Space,Str "possible",Space,Str "to",Space,Str "show",Space,Str "lists",Space,Str "of",Space,Str "figures",Space,Str "and",Space,Str "tables,",Space,Str "like",Space,Str "this:"]   ,Header 2 ("list-of-figures",[],[]) [Str "List",Space,Str "of",Space,Str "Figures"]
test/demo.inc view
@@ -56,7 +56,7 @@    [Para [Str "Listing",Space,Str "3:",Space,Str "Listing",Space,Str "caption"]    ,CodeBlock ("",["haskell"],[]) "main :: IO ()\nmain = putStrLn \"Hello World!\""]   ,Header 1 ("sec:unnumbered-chapter.",["unnumbered"],[]) [Str "Unnumbered",Space,Str "chapter."]-  ,Para [Str "This",Space,Str "chapter",Space,Str "doesn\8217t",Space,Str "change",Space,Str "chapter",Space,Str "prefix",Space,Str "of",Space,Str "referenced",Space,Str "elements,",Space,Str "instead",Space,Str "keeping",Space,Str "number",Space,Str "of",Space,Str "previous",Space,Str "chapter,",SoftBreak,Str "e.g.\160",Span ("eq:eqn2",[],[]) [Math DisplayMath " S(x) = \\int_{x_1}^{x_2} a x+b \\  \\mathrm{d}x \\qquad(3)"]]+  ,Para [Str "This",Space,Str "chapter",Space,Str "doesn\8217t",Space,Str "change",Space,Str "chapter",Space,Str "prefix",Space,Str "of",Space,Str "referenced",Space,Str "elements,",Space,Str "instead",Space,Str "keeping",Space,Str "number",Space,Str "of",Space,Str "previous",Space,Str "chapter,",Space,Str "e.g.",SoftBreak,Span ("eq:eqn2",[],[]) [Math DisplayMath " S(x) = \\int_{x_1}^{x_2} a x+b \\  \\mathrm{d}x \\qquad(3)"]]   ,Header 1 ("sec:chapter-5.-reference-lists",[],[]) [Str "Chapter",Space,Str "5.",Space,Str "Reference",Space,Str "lists"]   ,Para [Str "It\8217s",Space,Str "also",Space,Str "possible",Space,Str "to",Space,Str "show",Space,Str "lists",Space,Str "of",Space,Str "figures",Space,Str "and",Space,Str "tables,",Space,Str "like",Space,Str "this:"]   ,Header 2 ("list-of-figures",[],[]) [Str "List",Space,Str "of",Space,Str "Figures"]
test/m2m/listing-captions-ids/expect.tex view
@@ -9,7 +9,7 @@ \begin{Shaded} \begin{Highlighting}[] \OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}-\NormalTok{main }\FunctionTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}+\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"} \end{Highlighting} \end{Shaded} @@ -24,7 +24,7 @@ \begin{Shaded} \begin{Highlighting}[] \OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}-\NormalTok{main }\FunctionTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}+\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"} \end{Highlighting} \end{Shaded} @@ -39,7 +39,7 @@ \begin{Shaded} \begin{Highlighting}[] \OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}-\NormalTok{main }\FunctionTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}+\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"} \end{Highlighting} \end{Shaded} @@ -54,7 +54,7 @@ \begin{Shaded} \begin{Highlighting}[] \OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}-\NormalTok{main }\FunctionTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}+\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"} \end{Highlighting} \end{Shaded} @@ -63,7 +63,7 @@ \begin{Shaded} \begin{Highlighting}[] \OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}-\NormalTok{main }\FunctionTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}+\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"} \end{Highlighting} \end{Shaded} @@ -72,7 +72,7 @@ \begin{Shaded} \begin{Highlighting}[] \OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}-\NormalTok{main }\FunctionTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}+\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"} \end{Highlighting} \end{Shaded} @@ -89,7 +89,7 @@ \begin{Shaded} \begin{Highlighting}[] \OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}-\NormalTok{main }\FunctionTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}+\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"} \end{Highlighting} \end{Shaded} @@ -104,7 +104,7 @@ \begin{Shaded} \begin{Highlighting}[] \OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}-\NormalTok{main }\FunctionTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}+\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"} \end{Highlighting} \end{Shaded} @@ -119,7 +119,7 @@ \begin{Shaded} \begin{Highlighting}[] \OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}-\NormalTok{main }\FunctionTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}+\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"} \end{Highlighting} \end{Shaded} @@ -134,7 +134,7 @@ \begin{Shaded} \begin{Highlighting}[] \OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}-\NormalTok{main }\FunctionTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}+\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"} \end{Highlighting} \end{Shaded} @@ -147,7 +147,7 @@ \begin{Shaded} \begin{Highlighting}[] \OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}-\NormalTok{main }\FunctionTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}+\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"} \end{Highlighting} \end{Shaded} @@ -156,6 +156,7 @@ \begin{Shaded} \begin{Highlighting}[] \OtherTok{main ::} \DataTypeTok{IO}\NormalTok{ ()}-\NormalTok{main }\FunctionTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"}+\NormalTok{main }\OtherTok{=} \FunctionTok{putStrLn} \StringTok{"Hello World!"} \end{Highlighting} \end{Shaded}+