Created
May 3, 2020 06:48
-
-
Save steshaw/98c479fa2ace9f3e4ce14f57cf4a0db6 to your computer and use it in GitHub Desktop.
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
module Docs where | |
import Prelude | |
import Text.Pandoc | |
import Text.Pandoc.Walk | |
import qualified Data.Text.IO as T | |
go = do | |
t <- T.readFile "../.local/j.html"; | |
pandoc1@(Pandoc meta1 blocks1) <- runIOorExplode $ readHtml def t; | |
putStrLn "\npandoc1 ---------------\n" | |
mapM_ print blocks1; | |
let pandoc_ = walk f pandoc1; | |
let pandoc2 = walk g pandoc_; | |
let (Pandoc _ blocks2) = pandoc2; | |
mapM_ print blocks2; | |
putStrLn "\npandoc2 ---------------\n" | |
t <- runIOorExplode $ writePlain def { writerTabStop = 2 } pandoc2; | |
putStrLn "\nplain ---------------\n" | |
T.putStrLn t | |
where | |
f :: Block -> Block | |
f (Para x) = Plain x | |
f a = a | |
g :: Inline -> Inline | |
g (Strong x) = Span def x | |
g (Emph x) = Span def x | |
g a = a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment