-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
41 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,38 @@ | ||
{-# LANGUAGE PatternGuards, OverloadedStrings #-} | ||
module Main where | ||
|
||
import Text.Pandoc | ||
import Lib (transform) | ||
import Text.Pandoc.JSON | ||
import Text.Pandoc.Error (handleError) | ||
import Text.Pandoc.Walk (walk, query) | ||
import Text.Pandoc.Options (ReaderOptions(..)) | ||
import System.Environment (getArgs) | ||
import Data.Text (Text(..), unlines, pack) | ||
import qualified Data.Text.IO as T | ||
import qualified Data.Map as M | ||
import Data.Monoid ((<>)) | ||
import Control.Applicative ((<$>)) | ||
import Data.Maybe (maybeToList) | ||
import Data.Either (fromRight) | ||
import Options.Applicative | ||
import Control.Monad (when, unless) | ||
|
||
main :: IO () | ||
main = do | ||
|
||
|
||
interact' :: (Pandoc -> IO a) -> IO a | ||
interact' f = T.getContents >>= handleError . readJSON def >>= f | ||
|
||
data Options = Options { | ||
levelOption :: Maybe Int | ||
} | ||
|
||
toSphinx :: Options -> IO () | ||
toSphinx (Options levelOption) = interact' transform | ||
|
||
options :: Parser Options | ||
options = Options | ||
<$> option auto (long "level" | ||
<> short 'l' | ||
<> help "the section level to use for splitting the document" | ||
<> showDefault) | ||
|
||
main = execParser (info options fullDesc) >>= toSphinx |
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
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
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