Created
August 27, 2015 19:42
-
-
Save csrhodes/cb77a15aa968e6cd0886 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Char ( isAlphaNum ) | |
import Text.Pandoc.JSON | |
main = toJSONFilter relink | |
depunct :: String -> String | |
depunct x = map frob x | |
where frob c = if isAlphaNum c then c else if c == '_' then c else '-' | |
relink :: Inline -> Inline | |
relink (Link txt (src, "wikilink")) = Link txt ("#" ++ depunct src, "") | |
relink x = x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment