Created
May 15, 2015 01:46
-
-
Save elliottslaughter/50eddc705e2d49bb6786 to your computer and use it in GitHub Desktop.
Deindent
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
import Data.List | |
import Text.Pandoc.Definition | |
import Text.Pandoc.JSON | |
import Text.Pandoc.Walk | |
-- This pass implements <div class="noindent"> by adding \noindent to | |
-- the start of every paragraph. | |
deindentParas :: Block -> Block | |
deindentParas (Para lines) = | |
Para (RawInline (Format "tex") "\\noindent " : lines) | |
deindentParas x = x | |
deindentBlocks :: Block -> Block | |
deindentBlocks (Div (id, classes, other) blocks) = | |
if elem "noindent" classes | |
then Div (id, (delete "noindent" classes), other) (walk deindentParas blocks) | |
else Div (id, classes, other) blocks | |
deindentBlocks x = x | |
main :: IO () | |
main = toJSONFilter deindentBlocks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment