diff --git a/Makefile b/Makefile index be5f167..f369c0e 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ ASCIIMATH=filters/asciimath/pandoc-asciimath HS_FILTERS_NAMES = PY_FILTERS_NAMES = pandoc-svg.py -EXT_FILTERS = $(ASCIIMATH) +EXT_FILTERS = pandoc-crossref $(ASCIIMATH) HS_FILTERS = $(addprefix filters/, $(HS_FILTERS_NAMES)) PY_FILTERS = $(addprefix filters/, $(PY_FILTERS_NAMES)) @@ -21,7 +21,7 @@ $(HS_FILTERS): ghc --make $@.hs -o $@ $(ASCIIMATH): - (cd filters/asciimath; make) + (cd filters/asciimath; make filter-only) clean: rm -f $(OUT) diff --git a/filters/asciimath b/filters/asciimath index d68cf88..1848358 160000 --- a/filters/asciimath +++ b/filters/asciimath @@ -1 +1 @@ -Subproject commit d68cf88317451fc4ae04244802a0992afe91b6b7 +Subproject commit 18483581cecdbffe97810eb0e7292c030fcbf4d9 diff --git a/filters/nice-frac.hs b/filters/nice-frac.hs deleted file mode 100644 index a4732a4..0000000 --- a/filters/nice-frac.hs +++ /dev/null @@ -1,26 +0,0 @@ --- nice-frac.hs - -import Text.Pandoc.JSON -import Text.Regex - --- Usefull regex elements -space :: String -space = "[ \\t\\n\\r]*" -num :: String -num = "([0-9]+)" - --- Replace fractions like "(42 / 1)" by "\frac{42}{1}" -fracReg :: Regex -fracReg = mkRegex $ - "\\(" ++ space ++ num ++ space ++ "/" ++ space ++ num ++ space ++ "\\)" -frac :: String -> String -frac s = subRegex fracReg s "\\\\frac{\\1}{\\2}" - --- Apply the substitution to all Latex parts on the AST -niceFrac :: Inline -> Inline -niceFrac (Math t s) = Math t (frac s) -niceFrac x = x - -main :: IO () -main = toJSONFilter niceFrac - diff --git a/filters/usual-fun.hs b/filters/usual-fun.hs deleted file mode 100644 index 00fb098..0000000 --- a/filters/usual-fun.hs +++ /dev/null @@ -1,33 +0,0 @@ --- usual-fun.hs - -import Text.Pandoc.JSON -import Text.Regex -import Data.List (intercalate) - --- Association list for usual functions -usual :: String -usual = intercalate "|" [ - "cos", "sin", "tan", "cotan", - "arccos", "arcsin", "arctan", - "exp", "log"] - --- Remove the '\' before usual functions' names if present -rmBSReg :: Regex -rmBSReg = mkRegex $ "(\\\\)(" ++ usual ++ ")\\>" -rmBS :: String -> String -rmBS s = subRegex rmBSReg s "\\2" - --- Add a '\' before usual functions' names -addBSReg :: Regex -addBSReg = mkRegex $ "\\<(" ++ usual ++ ")\\>" -addBS :: String -> String -addBS s = subRegex addBSReg s "\\\\\\0" - --- Apply the substitution to all Latex parts on the AST -niceFrac :: Inline -> Inline -niceFrac (Math t s) = Math t (addBS . rmBS $ s) -niceFrac x = x - -main :: IO () -main = toJSONFilter niceFrac - diff --git a/notes.md b/notes.md index 0953d9d..6f87ad4 100644 --- a/notes.md +++ b/notes.md @@ -1,7 +1,7 @@ --- # Metadata title: Example -author: Martin Pépin +author: Kerl13 & Phyks date: \today # Pandoc-crossref options cref: True @@ -12,5 +12,10 @@ chapters: True # AsciiMath example -Soit $n in NN$, alors on a +The following asciimath code + + sum_(k=1)^n k^3 = ((n(n+1))/2)^2 + +will be rendered the following way + $$ sum_(k=1)^n k^3 = ((n(n+1))/2)^2 $$