packages feed

pandoc-crossref 0.2.5.0 → 0.2.6.0

raw patch · 15 files changed

+218/−279 lines, 15 filesdep ~basedep ~pandocdep ~pandoc-typesPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, pandoc, pandoc-types

API changes (from Hackage documentation)

Files

README.md view
@@ -289,7 +289,7 @@  Reference syntax heavily relies on citation syntax. Basic reference is created by writing `@`, then basically desired label with prefix. It is also possible to reference a group of objects, by putting them into brackets with `;` as separator. Similar objects will be grouped in order of them appearing in citation brackets, and sequential reference numbers will be shortened, e.g. `1,2,3` will be shortened to `1-3`. -You can capitalize first reference character to get capitalized prefix, e.g. `[@Fig:label1]` will produce `Fig. ...` by default. Capitalized prefixes are derived automatically by capitalizing first letter of every word in non-capitalized prefix, unless overriden with metadata settings. See [Customization](#customization) for more information.+You can capitalize first reference character to get capitalized prefix, e.g. `[@Fig:label1]` will produce `Fig. ...` by default. Capitalized prefixes are derived automatically by capitalizing first letter of every word in non-capitalized prefix, unless overridden with metadata settings. See [Customization](#customization) for more information.  #### Linking references @@ -398,7 +398,12 @@ * `secPrefix`, default `sec.`, `secs.`: Prefix for references to sections, e.g. `secs. 2,5` * `chapDelim`, default `.`: Delimiter between chapter number and item number. * `rangeDelim`, default `-`: Delimiter between reference ranges, e.g. `eq. 2-5`+* `pairDelim`, default `, `: Delimiter between pair of reference ranges, e.g. `eq. 2-5 <and> 7-9`, or `eq. 2 <and> 7`, but `eq. 2, 4, 6`+* `lastDelim`, default `, `: Delimiter between second-to-last and last reference ranges, e.g. `eq. 2-5, 6-8 <and> 10`. `pairDelim` overrides this for cases of exactly two references/ranges.+* `refDelim`, default `, `: Delimiter between references, e.g. `eq. 2, 5, 7` or `eq. 2-4, 6-8` * `linkReferences`, default `false`: Make references hyperlinks to the referenced element++Note that none of the `*Delim` options are honored with cleveref output. Use cleveref's customization options instead.  `figPrefix`, `eqnPrefix`, `tblPrefix`, `lstPrefix` can be YAML arrays. That way, value at index corresponds to total number of references in group, f.ex. 
− ghc-7/Text/Pandoc/CrossRef/Util/Settings/Template.hs
@@ -1,74 +0,0 @@-{-# LANGUAGE TemplateHaskell, RankNTypes, ViewPatterns, MultiWayIf #-}-module Text.Pandoc.CrossRef.Util.Settings.Template where--import Text.Pandoc.Definition-import Text.Pandoc.Builder-import Text.Pandoc.CrossRef.Util.Meta-import qualified Data.Map as M-import Language.Haskell.TH hiding (Inline)-import Language.Haskell.TH.Syntax hiding (Inline)-import Data.List-import Text.Pandoc.CrossRef.Util.Template-import Text.Pandoc.CrossRef.Util.CustomLabels (customLabel)--namedFields :: Con -> [VarStrictType]-namedFields (RecC _ fs) = fs-namedFields (ForallC _ _ c) = namedFields c-namedFields _ = []--fromRecDef :: forall t a r. Name -> t -> (Name -> Name -> Q [a]) -> (t -> [a] -> r) -> Q r-fromRecDef t cname f c = do-  info <- reify t-  reified <- case info of-                  TyConI dec -> return dec-                  _ -> fail "No cons"-  (_, cons) <- case reified of-               DataD _ _ params cons' _ -> return (params, cons')-               NewtypeD _ _ params con' _ -> return (params, [con'])-               _ -> fail "No cons"-  decs <- fmap concat . mapM (\ (name,_,_) -> f t name) . nub $ concatMap namedFields cons-  return $ c cname decs--nameDeriveSetters :: Name -> Q [Dec]-nameDeriveSetters t = fromRecDef t undefined (const makeAcc) (const id)--dropQualifiers :: Name -> Name-dropQualifiers (Name occ _) = mkName (occString occ)--makeAcc :: Name -> Q [Dec]-makeAcc (dropQualifiers -> accName) = do-    body <- [| Meta . M.singleton $(liftString $ show accName) . toMetaValue |]-    sig <- [t|forall a. ToMetaValue a => a -> Meta|]-    return-      [ SigD accName sig-      , ValD (VarP accName) (NormalB body) []-      ]--makeCon :: Name -> Name -> Q Exp-makeCon t cname = fromRecDef t cname makeCon' RecConE--makeCon' :: Name -> Name -> Q [(Name, Exp)]-makeCon' t accName = do-    VarI _ t' _ _ <- reify accName-    funT <- [t|$(conT t) -> Bool -> Int -> [Inline]|]-    inlT <- [t|$(conT t) -> [Inline]|]-    blkT <- [t|$(conT t) -> [Block]|]-    fmtT <- [t|$(conT t) -> Maybe Format|]-    boolT <- [t|$(conT t) -> Bool|]-    intT <- [t|$(conT t) -> Int|]-    tmplT <- [t|$(conT t) -> Template|]-    clT <- [t|$(conT t) -> String -> Int -> Maybe String|]-    let varName | Name (OccName n) _ <- accName = liftString n-    let dtv = return $ VarE $ mkName "dtv"-    body <--      if-      | t' == boolT -> [|getMetaBool $(varName) $(dtv)|]-      | t' == intT -> [|read $ getMetaString $(varName) $(dtv)|]-      | t' == funT -> [|tryCapitalizeM (flip (getMetaList toInlines) $(dtv)) $(varName)|]-      | t' == inlT -> [|getMetaInlines $(varName) $(dtv)|]-      | t' == blkT -> [|getMetaBlock $(varName) $(dtv)|]-      | t' == tmplT -> [|makeTemplate $(dtv) $ getMetaInlines $(varName) $(dtv)|]-      | t' == clT -> [|customLabel $(dtv)|]-      | t' == fmtT -> return $ VarE $ mkName "fmt"-      | otherwise -> fail $ show t'-    return [(accName, body)]
− ghc-8/Text/Pandoc/CrossRef/Util/Settings/Template.hs
@@ -1,74 +0,0 @@-{-# LANGUAGE TemplateHaskell, RankNTypes, ViewPatterns, MultiWayIf #-}-module Text.Pandoc.CrossRef.Util.Settings.Template where--import Text.Pandoc.Definition-import Text.Pandoc.Builder-import Text.Pandoc.CrossRef.Util.Meta-import qualified Data.Map as M-import Language.Haskell.TH hiding (Inline)-import Language.Haskell.TH.Syntax hiding (Inline)-import Data.List-import Text.Pandoc.CrossRef.Util.Template-import Text.Pandoc.CrossRef.Util.CustomLabels (customLabel)--namedFields :: Con -> [VarStrictType]-namedFields (RecC _ fs) = fs-namedFields (ForallC _ _ c) = namedFields c-namedFields _ = []--fromRecDef :: forall t a r. Name -> t -> (Name -> Name -> Q [a]) -> (t -> [a] -> r) -> Q r-fromRecDef t cname f c = do-  info <- reify t-  reified <- case info of-                  TyConI dec -> return dec-                  _ -> fail "No cons"-  (_, cons) <- case reified of-               DataD _ _ params _ cons' _ -> return (params, cons')-               NewtypeD _ _ params _ con' _ -> return (params, [con'])-               _ -> fail "No cons"-  decs <- fmap concat . mapM (\ (name,_,_) -> f t name) . nub $ concatMap namedFields cons-  return $ c cname decs--nameDeriveSetters :: Name -> Q [Dec]-nameDeriveSetters t = fromRecDef t undefined (const makeAcc) (const id)--dropQualifiers :: Name -> Name-dropQualifiers (Name occ _) = mkName (occString occ)--makeAcc :: Name -> Q [Dec]-makeAcc (dropQualifiers -> accName) = do-    body <- [| Meta . M.singleton $(liftString $ show accName) . toMetaValue |]-    sig <- [t|forall a. ToMetaValue a => a -> Meta|]-    return-      [ SigD accName sig-      , ValD (VarP accName) (NormalB body) []-      ]--makeCon :: Name -> Name -> Q Exp-makeCon t cname = fromRecDef t cname makeCon' RecConE--makeCon' :: Name -> Name -> Q [(Name, Exp)]-makeCon' t accName = do-    VarI _ t' _ <- reify accName-    funT <- [t|$(conT t) -> Bool -> Int -> [Inline]|]-    inlT <- [t|$(conT t) -> [Inline]|]-    blkT <- [t|$(conT t) -> [Block]|]-    fmtT <- [t|$(conT t) -> Maybe Format|]-    boolT <- [t|$(conT t) -> Bool|]-    intT <- [t|$(conT t) -> Int|]-    tmplT <- [t|$(conT t) -> Template|]-    clT <- [t|$(conT t) -> String -> Int -> Maybe String|]-    let varName | Name (OccName n) _ <- accName = liftString n-    let dtv = return $ VarE $ mkName "dtv"-    body <--      if-      | t' == boolT -> [|getMetaBool $(varName) $(dtv)|]-      | t' == intT -> [|read $ getMetaString $(varName) $(dtv)|]-      | t' == funT -> [|tryCapitalizeM (flip (getMetaList toInlines) $(dtv)) $(varName)|]-      | t' == inlT -> [|getMetaInlines $(varName) $(dtv)|]-      | t' == blkT -> [|getMetaBlock $(varName) $(dtv)|]-      | t' == tmplT -> [|makeTemplate $(dtv) $ getMetaInlines $(varName) $(dtv)|]-      | t' == clT -> [|customLabel $(dtv)|]-      | t' == fmtT -> return $ VarE $ mkName "fmt"-      | otherwise -> fail $ show t'-    return [(accName, body)]
lib/Text/Pandoc/CrossRef/References/Refs.hs view
@@ -18,6 +18,7 @@ import Text.Pandoc.CrossRef.Util.Util import Text.Pandoc.CrossRef.Util.Options import Control.Applicative+import Debug.Trace import Prelude  replaceRefs :: Options -> [Inline] -> WS [Inline]@@ -142,9 +143,12 @@     writePrefix | all (==SuppressAuthor) $ map citationMode cits                 = id                 | all null $ map citationPrefix cits-                = getRefPrefix opts prefix cap (length cits - 1)+                = cmap $ getRefPrefix opts prefix cap (length cits - 1)                 | otherwise-                = ((citationPrefix (head cits) ++ [Space]) ++)+                = cmap ((citationPrefix (head cits) ++ [Space]) ++)+    cmap f [Link attr t w]+      | nameInLink opts = [Link attr (f t) w]+    cmap f x = f x   return $ normalizeInlines $ writePrefix (makeIndices opts indices)  data RefData = RefData { rdLabel :: String@@ -172,8 +176,10 @@   prop = lookupUnsafe prefix accMap   lab = prefix ++ getLabelWithoutPrefix cid +data RefItem = RefRange RefData RefData | RefSingle RefData+ makeIndices :: Options -> [RefData] -> [Inline]-makeIndices o s = intercalate sep $ map f $ HT.groupBy g $ sort $ nub s+makeIndices o s = format $ concatMap f $ HT.groupBy g $ sort $ nub s   where   g :: RefData -> RefData -> Bool   g a b = all (null . rdSuffix) [a, b] && (@@ -188,12 +194,23 @@     , Just (bi, bl) <- HT.viewR b     = ai == bi && A.first (+1) bl == al   follows _ _ = False-  f :: [RefData] -> [Inline]+  f :: [RefData] -> [RefItem]   f []  = []                          -- drop empty lists-  f [w] = show' w                    -- single value-  f [w1,w2] = show' w1 ++ sep ++ show' w2 -- two values-  f (x:xs) = show' x ++ rangeDelim o ++ show' (last xs) -- shorten more than two values-  sep = [Str ",", Space]+  f [w] = [RefSingle w]                   -- single value+  f [w1,w2] = [RefSingle w1, RefSingle w2] -- two values+  f (x:xs) = [RefRange x (last xs)] -- shorten more than two values+  format :: [RefItem] -> [Inline]+  format [] = []+  format [x] = show'' x+  format [x, y] = show'' x ++ pairDelim o ++ show'' y+  format xs = intercalate (refDelim o) init' ++ lastDelim o ++ last'+    where initlast []     = error "emtpy list in initlast"+          initlast [y]    = ([], y)+          initlast (y:ys) = first (y:) $ initlast ys+          (init', last') = initlast $ map show'' xs+  show'' :: RefItem -> [Inline]+  show'' (RefSingle x) = show' x+  show'' (RefRange x y) = show' x ++ rangeDelim o ++ show' y   show' :: RefData -> [Inline]   show' RefData{rdLabel=l, rdIdx=Just i, rdSubfig = sub, rdSuffix = suf}     | linkReferences o = [Link nullAttr txt ('#':l,[])]@@ -213,4 +230,6 @@                       , ("suf", suf)                       ]           in applyTemplate' vars $ refIndexTemplate o-  show' RefData{rdLabel=l, rdIdx=Nothing, rdSuffix = suf} = Strong [Str $ "¿" ++ l ++ "?"] : suf+  show' RefData{rdLabel=l, rdIdx=Nothing, rdSuffix = suf} =+    trace ("Undefined cross-reference: " ++ l)+          (Strong [Str $ "¿" ++ l ++ "?"] : suf)
lib/Text/Pandoc/CrossRef/Util/ModifyMeta.hs view
@@ -63,7 +63,7 @@             ]           | otherwise = ["\\newcommand*\\listoflistings{\\listof{codelisting}{"++metaString' "lolTitle"++"}}"]         cleveref = [-            "\\usepackage{cleveref}"+            "\\usepackage" ++ cleverefOpts ++ "{cleveref}"           , "\\crefname{figure}" ++ prefix figPrefix False           , "\\crefname{table}" ++ prefix tblPrefix False           , "\\crefname{equation}" ++ prefix eqnPrefix False@@ -81,6 +81,8 @@           , "\\Crefname{codelisting}{\\Cref@listing@name}{\\Cref@listing@name@plural}"           , "\\makeatother"           ]+        cleverefOpts | nameInLink opts = "[nameinlink]"+                     | otherwise = ""         toLatex = writeLaTeX def . Pandoc nullMeta . return . Plain         metaString s = toLatex $ getMetaInlines s meta         metaString' s = toLatex [Str $ getMetaString s meta]
lib/Text/Pandoc/CrossRef/Util/Options.hs view
@@ -23,6 +23,9 @@                        , subfigureRefIndexTemplate :: Template                        , chapDelim   :: [Inline]                        , rangeDelim  :: [Inline]+                       , pairDelim  :: [Inline]+                       , lastDelim  :: [Inline]+                       , refDelim  :: [Inline]                        , lofTitle    :: [Block]                        , lotTitle    :: [Block]                        , lolTitle    :: [Block]@@ -40,4 +43,5 @@                        , autoEqnLabels :: Bool                        , subfigGrid :: Bool                        , linkReferences :: Bool+                       , nameInLink :: Bool                        }
lib/Text/Pandoc/CrossRef/Util/Settings.hs view
@@ -10,6 +10,7 @@ import Text.Pandoc.CrossRef.Util.PandocOrphans() import System.Directory import System.FilePath+import System.IO  getSettings :: Maybe Format -> Meta -> IO Meta getSettings fmt meta = do@@ -21,7 +22,9 @@   where     readConfig path =       handle handler $ do-        yaml <- readFile path+        h <- openFile path ReadMode+        hSetEncoding h utf8+        yaml <- hGetContents h         let Pandoc meta' _ = readMarkdown def ("---\n" ++ yaml ++ "\n---")         return meta'     readFmtConfig home fmt' = readConfig (home </> ".pandoc-crossref" </> "config-" ++ fmtStr fmt' ++ ".yaml")@@ -51,6 +54,9 @@   <> titleDelim (str ":")   <> chapDelim (str ".")   <> rangeDelim (str "-")+  <> pairDelim (str "," <> space)+  <> lastDelim (str "," <> space)+  <> refDelim (str "," <> space)   <> figPrefix [str "fig.", str "figs."]   <> eqnPrefix [str "eq." , str "eqns."]   <> tblPrefix [str "tbl.", str "tbls."]@@ -81,4 +87,5 @@   <> autoEqnLabels False   <> subfigGrid False   <> linkReferences False+  <> nameInLink False   where var = displayMath
+ lib/Text/Pandoc/CrossRef/Util/Settings/Template.hs view
@@ -0,0 +1,74 @@+{-# LANGUAGE TemplateHaskell, RankNTypes, ViewPatterns, MultiWayIf #-}+module Text.Pandoc.CrossRef.Util.Settings.Template where++import Text.Pandoc.Definition+import Text.Pandoc.Builder+import Text.Pandoc.CrossRef.Util.Meta+import qualified Data.Map as M+import Language.Haskell.TH hiding (Inline)+import Language.Haskell.TH.Syntax hiding (Inline)+import Data.List+import Text.Pandoc.CrossRef.Util.Template+import Text.Pandoc.CrossRef.Util.CustomLabels (customLabel)++namedFields :: Con -> [VarStrictType]+namedFields (RecC _ fs) = fs+namedFields (ForallC _ _ c) = namedFields c+namedFields _ = []++fromRecDef :: forall t a r. Name -> t -> (Name -> Name -> Q [a]) -> (t -> [a] -> r) -> Q r+fromRecDef t cname f c = do+  info <- reify t+  reified <- case info of+                  TyConI dec -> return dec+                  _ -> fail "No cons"+  (_, cons) <- case reified of+               DataD _ _ params _ cons' _ -> return (params, cons')+               NewtypeD _ _ params _ con' _ -> return (params, [con'])+               _ -> fail "No cons"+  decs <- fmap concat . mapM (\ (name,_,_) -> f t name) . nub $ concatMap namedFields cons+  return $ c cname decs++nameDeriveSetters :: Name -> Q [Dec]+nameDeriveSetters t = fromRecDef t undefined (const makeAcc) (const id)++dropQualifiers :: Name -> Name+dropQualifiers (Name occ _) = mkName (occString occ)++makeAcc :: Name -> Q [Dec]+makeAcc (dropQualifiers -> accName) = do+    body <- [| Meta . M.singleton $(liftString $ show accName) . toMetaValue |]+    sig <- [t|forall a. ToMetaValue a => a -> Meta|]+    return+      [ SigD accName sig+      , ValD (VarP accName) (NormalB body) []+      ]++makeCon :: Name -> Name -> Q Exp+makeCon t cname = fromRecDef t cname makeCon' RecConE++makeCon' :: Name -> Name -> Q [(Name, Exp)]+makeCon' t accName = do+    VarI _ t' _ <- reify accName+    funT <- [t|$(conT t) -> Bool -> Int -> [Inline]|]+    inlT <- [t|$(conT t) -> [Inline]|]+    blkT <- [t|$(conT t) -> [Block]|]+    fmtT <- [t|$(conT t) -> Maybe Format|]+    boolT <- [t|$(conT t) -> Bool|]+    intT <- [t|$(conT t) -> Int|]+    tmplT <- [t|$(conT t) -> Template|]+    clT <- [t|$(conT t) -> String -> Int -> Maybe String|]+    let varName | Name (OccName n) _ <- accName = liftString n+    let dtv = return $ VarE $ mkName "dtv"+    body <-+      if+      | t' == boolT -> [|getMetaBool $(varName) $(dtv)|]+      | t' == intT -> [|read $ getMetaString $(varName) $(dtv)|]+      | t' == funT -> [|tryCapitalizeM (flip (getMetaList toInlines) $(dtv)) $(varName)|]+      | t' == inlT -> [|getMetaInlines $(varName) $(dtv)|]+      | t' == blkT -> [|getMetaBlock $(varName) $(dtv)|]+      | t' == tmplT -> [|makeTemplate $(dtv) $ getMetaInlines $(varName) $(dtv)|]+      | t' == clT -> [|customLabel $(dtv)|]+      | t' == fmtT -> return $ VarE $ mkName "fmt"+      | otherwise -> fail $ show t'+    return [(accName, body)]
pandoc-crossref.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                pandoc-crossref-version:             0.2.5.0+version:             0.2.6.0 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@@ -14,7 +14,7 @@ build-type:          Simple extra-doc-files:     README.md                      BSD3.md-cabal-version:       >=1.10+cabal-version:       >=1.18 data-files:          demo.md extra-source-files:  test/*.inc                      test/m2m/equations/*.md@@ -40,7 +40,7 @@ source-repository this   type: git   location: https://github.com/lierdakil/pandoc-crossref-  tag: v0.2.5.0+  tag: v0.2.6.0  library   exposed-modules:     Text.Pandoc.CrossRef@@ -61,9 +61,9 @@                        Text.Pandoc.CrossRef.Util.Settings.Template                        Text.Pandoc.CrossRef.Util.Gap                        Text.Pandoc.CrossRef.Util.PandocOrphans-  build-depends:       base >=4.8 && <5-                     , pandoc >= 1.17.1 && <1.20-                     , pandoc-types >= 1.16 && < 1.18+  build-depends:       base >=4.9 && <5+                     , pandoc == 1.19.*+                     , pandoc-types == 1.17.*                      , mtl >= 1.1 && <2.3                      , containers >= 0.1 && <0.6                      , data-default >= 0.4 && <0.8@@ -72,21 +72,17 @@                      , data-accessor-transformers >= 0.2.1.6 && < 0.3.0.0                      , template-haskell >= 2.7.0.0 && < 3.0.0.0                      , roman-numerals == 0.5.*-                     , syb >= 0.4 && < 0.7+                     , syb >= 0.4 && < 0.8                      , utility-ht >= 0.0.11 && < 0.1.0                      , directory >= 1 && < 1.4                      , filepath >= 1.1 && < 1.5   hs-source-dirs:      lib-  if impl(ghc >= 8.0.1)-    hs-source-dirs:      ghc-8-  else-    hs-source-dirs:      ghc-7   Ghc-Options:         -Wall   default-language:    Haskell2010  executable pandoc-crossref   main-is:             pandoc-crossref.hs-  build-depends:       base >=4.8 && <5+  build-depends:       base                      , pandoc-crossref                      , pandoc                      , pandoc-types@@ -98,11 +94,7 @@   Type:           exitcode-stdio-1.0   Main-Is:        test-pandoc-crossref.hs   hs-source-dirs: test, lib-  if impl(ghc >= 8.0.1)-    hs-source-dirs:      ghc-8-  else-    hs-source-dirs:      ghc-7-  Build-Depends:   base >=4.8 && <5+  Build-Depends:   base                  , pandoc-crossref                  , hspec                  , pandoc@@ -147,7 +139,7 @@   Type:           exitcode-stdio-1.0   Main-Is:        test-integrative.hs   hs-source-dirs: test-  Build-Depends:   base >=4.8 && <5+  Build-Depends:   base                  , hspec                  , pandoc                  , filepath
test/m2m/equations-auto/expect.md view
@@ -1,32 +1,32 @@ This is a test file with some referenced equations, line-<span>$$ this \qquad(1)$$</span>+[$$ this \qquad(1)$$]{} -Some equations might be inside of text,-<span>$$ for example \qquad(2)$$</span> this one.+Some equations might be inside of text, [$$ for example \qquad(2)$$]{}+this one.  Some equations might be on start of paragraphs: -<span>$$ start \qquad(3)$$</span> of paragraph.+[$$ start \qquad(3)$$]{} of paragraph.  Other might be on separate paragraphs of their own: -<span>$$ separate \qquad(4)$$</span>+[$$ separate \qquad(4)$$]{}  Some of those can be labelled: -This is a test file with some referenced equations, line <span-id="eq:0">$$ this \qquad(5)$$</span>+This is a test file with some referenced equations, line+[$$ this \qquad(5)$$]{#eq:0} -Some equations might be inside of text, <span-id="eq:1">$$ for example \qquad(6)$$</span> this one.+Some equations might be inside of text,+[$$ for example \qquad(6)$$]{#eq:1} this one.  Some equations might be on start of paragraphs: -<span id="eq:2">$$ start \qquad(7)$$</span> of paragraph.+[$$ start \qquad(7)$$]{#eq:2} of paragraph.  Other might be on separate paragraphs of their own: -<span id="eq:3">$$ separate \qquad(8)$$</span>+[$$ separate \qquad(8)$$]{#eq:3}  Then they can be referenced: 
test/m2m/equations-tables-auto/expect.md view
@@ -2,10 +2,9 @@  <div> -  ---------------------------------------------------------------- -------                             $$ this $$                            $$(1)$-                                                                        $-  ---------------------------------------------------------------- ------+  ------------------------------------------------------------------------------------------------------------------------ ------------+                                                         $$ this $$                                                             $$(1)$$+  ------------------------------------------------------------------------------------------------------------------------ ------------  </div> @@ -13,10 +12,9 @@  <div> -  ---------------------------------------------------------------- -------                         $$ for example $$                         $$(2)$-                                                                        $-  ---------------------------------------------------------------- ------+  ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------+                                                                                        $$ for example $$                                                                                                    $$(2)$$+  ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------  </div> @@ -26,10 +24,9 @@  <div> -  ---------------------------------------------------------------- -------                            $$ start $$                            $$(3)$-                                                                        $-  ---------------------------------------------------------------- ------+  ---------------------------------------------------------------------------------------------------------------------------------- -------------+                                                             $$ start $$                                                                   $$(3)$$+  ---------------------------------------------------------------------------------------------------------------------------------- -------------  </div> @@ -39,10 +36,9 @@  <div> -  ---------------------------------------------------------------- -------                           $$ separate $$                          $$(4)$-                                                                        $-  ---------------------------------------------------------------- ------+  ---------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------+                                                                           $$ separate $$                                                                                   $$(4)$$+  ---------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------  </div> @@ -52,10 +48,9 @@  <div id="eq:0"> -  ---------------------------------------------------------------- -------                             $$ this $$                            $$(5)$-                                                                        $-  ---------------------------------------------------------------- ------+  ------------------------------------------------------------------------------------------------------------------------ ------------+                                                         $$ this $$                                                             $$(5)$$+  ------------------------------------------------------------------------------------------------------------------------ ------------  </div> @@ -63,10 +58,9 @@  <div id="eq:1"> -  ---------------------------------------------------------------- -------                         $$ for example $$                         $$(6)$-                                                                        $-  ---------------------------------------------------------------- ------+  ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------+                                                                                        $$ for example $$                                                                                                    $$(6)$$+  ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------  </div> @@ -76,10 +70,9 @@  <div id="eq:2"> -  ---------------------------------------------------------------- -------                            $$ start $$                            $$(7)$-                                                                        $-  ---------------------------------------------------------------- ------+  ---------------------------------------------------------------------------------------------------------------------------------- -------------+                                                             $$ start $$                                                                   $$(7)$$+  ---------------------------------------------------------------------------------------------------------------------------------- -------------  </div> @@ -89,10 +82,9 @@  <div id="eq:3"> -  ---------------------------------------------------------------- -------                           $$ separate $$                          $$(8)$-                                                                        $-  ---------------------------------------------------------------- ------+  ---------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------+                                                                           $$ separate $$                                                                                   $$(8)$$+  ---------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------  </div> 
test/m2m/equations-tables/expect.md view
@@ -16,10 +16,9 @@  <div id="eq:0"> -  ---------------------------------------------------------------- -------                             $$ this $$                            $$(1)$-                                                                        $-  ---------------------------------------------------------------- ------+  ------------------------------------------------------------------------------------------------------------------------ ------------+                                                         $$ this $$                                                             $$(1)$$+  ------------------------------------------------------------------------------------------------------------------------ ------------  </div> @@ -27,10 +26,9 @@  <div id="eq:1"> -  ---------------------------------------------------------------- -------                         $$ for example $$                         $$(2)$-                                                                        $-  ---------------------------------------------------------------- ------+  ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------+                                                                                        $$ for example $$                                                                                                    $$(2)$$+  ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------  </div> @@ -40,10 +38,9 @@  <div id="eq:2"> -  ---------------------------------------------------------------- -------                            $$ start $$                            $$(3)$-                                                                        $-  ---------------------------------------------------------------- ------+  ---------------------------------------------------------------------------------------------------------------------------------- -------------+                                                             $$ start $$                                                                   $$(3)$$+  ---------------------------------------------------------------------------------------------------------------------------------- -------------  </div> @@ -53,10 +50,9 @@  <div id="eq:3"> -  ---------------------------------------------------------------- -------                           $$ separate $$                          $$(4)$-                                                                        $-  ---------------------------------------------------------------- ------+  ---------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------+                                                                           $$ separate $$                                                                                   $$(4)$$+  ---------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------  </div> 
test/m2m/equations/expect.md view
@@ -12,19 +12,19 @@  Some of those can be labelled: -This is a test file with some referenced equations, line <span-id="eq:0">$$ this \qquad(1)$$</span>+This is a test file with some referenced equations, line+[$$ this \qquad(1)$$]{#eq:0} -Some equations might be inside of text, <span-id="eq:1">$$ for example \qquad(2)$$</span> this one.+Some equations might be inside of text,+[$$ for example \qquad(2)$$]{#eq:1} this one.  Some equations might be on start of paragraphs: -<span id="eq:2">$$ start \qquad(3)$$</span> of paragraph.+[$$ start \qquad(3)$$]{#eq:2} of paragraph.  Other might be on separate paragraphs of their own: -<span id="eq:3">$$ separate \qquad(4)$$</span>+[$$ separate \qquad(4)$$]{#eq:3}  Then they can be referenced: 
test/m2m/subfigures-grid/expect.md view
@@ -2,19 +2,19 @@  <div id="fig:subfigures" class="subfigures"> -+-----------------------+-----------------------+-----------------------+-| ![a](fig1.png){#fig:s | ![b](fig2.png){#fig:s | ![c](fig3.png){width= |-| ubfig1                | ubfig2                | "100%"}               |-| width="100%"}         | width="100%"}         |                       |-+-----------------------+-----------------------+-----------------------+-| ![d](fig4.png){#fig:s | ![e](fig5.png){width= | ![f](fig6.png){#fig:s |-| ubfig4                | "100%"}               | ubfig6                |-| width="100%"}         |                       | width="100%"}         |-+-----------------------+-----------------------+-----------------------+-| ![g](fig7.png){#fig:s | ![h](fig8.png){width= | ![i](fig9.png){#fig:s |-| ubfig7                | "100%"}               | ubfig9                |-| width="100%"}         |                       | width="100%"}         |-+-----------------------+-----------------------+-----------------------+++:------------------:+:------------------:+:------------------:++| ![a](fig1.png){#fi | ![b](fig2.png){#fi | ![c](fig3.png){wid |+| g:subfig1          | g:subfig2          | th="100%"}         |+| width="100%"}      | width="100%"}      |                    |++--------------------+--------------------+--------------------++| ![d](fig4.png){#fi | ![e](fig5.png){wid | ![f](fig6.png){#fi |+| g:subfig4          | th="100%"}         | g:subfig6          |+| width="100%"}      |                    | width="100%"}      |++--------------------+--------------------+--------------------++| ![g](fig7.png){#fi | ![h](fig8.png){wid | ![i](fig9.png){#fi |+| g:subfig7          | th="100%"}         | g:subfig9          |+| width="100%"}      |                    | width="100%"}      |++--------------------+--------------------+--------------------+  Figure 1: Caption. a — 1, b — 2, c — 3, d — 4, e — 5, f — 6, g — 7, h — 8, i — 9@@ -23,25 +23,25 @@  <div id="fig:subfigures2" class="subfigures"> -+-------------------------------------------------------------------------+-| ![a](fig1.png){#fig:subfig21 width="100%"}                              |-+-------------------------------------------------------------------------+-| ![b](fig2.png){#fig:subfig22 width="100%"}                              |-+-------------------------------------------------------------------------+-| ![c](fig3.png){width="100%"}                                            |-+-------------------------------------------------------------------------+-| ![d](fig4.png){#fig:subfig24 width="100%"}                              |-+-------------------------------------------------------------------------+-| ![e](fig5.png){width="100%"}                                            |-+-------------------------------------------------------------------------+-| ![f](fig6.png){#fig:subfig26 width="100%"}                              |-+-------------------------------------------------------------------------+-| ![g](fig7.png){#fig:subfig27 width="100%"}                              |-+-------------------------------------------------------------------------+-| ![h](fig8.png){width="100%"}                                            |-+-------------------------------------------------------------------------+-| ![i](fig9.png){#fig:subfig29 width="100%"}                              |-+-------------------------------------------------------------------------+++:--------------------------------------------------------------------:++| ![a](fig1.png){#fig:subfig21 width="100%"}                           |++----------------------------------------------------------------------++| ![b](fig2.png){#fig:subfig22 width="100%"}                           |++----------------------------------------------------------------------++| ![c](fig3.png){width="100%"}                                         |++----------------------------------------------------------------------++| ![d](fig4.png){#fig:subfig24 width="100%"}                           |++----------------------------------------------------------------------++| ![e](fig5.png){width="100%"}                                         |++----------------------------------------------------------------------++| ![f](fig6.png){#fig:subfig26 width="100%"}                           |++----------------------------------------------------------------------++| ![g](fig7.png){#fig:subfig27 width="100%"}                           |++----------------------------------------------------------------------++| ![h](fig8.png){width="100%"}                                         |++----------------------------------------------------------------------++| ![i](fig9.png){#fig:subfig29 width="100%"}                           |++----------------------------------------------------------------------+  Figure 2: Caption. a — 1, b — 2, c — 3, d — 4, e — 5, f — 6, g — 7, h — 8, i — 9
test/test-integrative.hs view
@@ -17,11 +17,7 @@   | otherwise =   describe dir $ do     input <- runIO $ readFile ("test" </> "m2m" </> dir </> "input.md")-#if MIN_VERSION_pandoc(1,19,0)-    expect_md <- runIO $ readFile ("test" </> "m2m" </> dir </> "expect-1.19.md")-#else     expect_md <- runIO $ readFile ("test" </> "m2m" </> dir </> "expect.md")-#endif     expect_tex <- runIO $ readFile ("test" </> "m2m" </> dir </> "expect.tex")     p@(Pandoc meta _) <- either (fail . show) return $ readMarkdown def input     let actual_md = writeMarkdown def $ runCrossRef meta (Just $ Format "markdown") defaultCrossRefAction p