Created
October 2, 2016 07:37
-
-
Save edwtjo/b32b2394fba7257b62d4ba5223807b94 to your computer and use it in GitHub Desktop.
A Pandoc Filter for Comments (install nix and chmod to use)
This file contains 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
#! /usr/bin/env nix-shell | |
#! nix-shell -i runghc -p "haskellPackages.ghcWithPackages (p: with p; [pandoc])" | |
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/7465bcd67a2177c63adeec66398b1b581260b31e.tar.gz | |
import Text.Pandoc.JSON | |
removeComments :: Block -> IO Block | |
removeComments cb@(CodeBlock (id, classes, namevals) contents) = | |
if "comment" `elem` classes then | |
return $ Para [] | |
else return cb | |
removeComments x = return x | |
main :: IO () | |
main = toJSONFilter removeComments |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment