Vimwiki reader: parse Text without converting to [Char]
This commit is contained in:
parent
5686bdfc97
commit
9a004b86c9
1 changed files with 3 additions and 4 deletions
|
@ -71,7 +71,7 @@ import Control.Monad.Except (throwError)
|
||||||
import Data.Default
|
import Data.Default
|
||||||
import Data.List (isInfixOf, isPrefixOf)
|
import Data.List (isInfixOf, isPrefixOf)
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.Text (Text, unpack)
|
import Data.Text (Text)
|
||||||
import Text.Pandoc.Builder (Blocks, Inlines, fromList, toList, trimInlines)
|
import Text.Pandoc.Builder (Blocks, Inlines, fromList, toList, trimInlines)
|
||||||
import qualified Text.Pandoc.Builder as B (blockQuote, bulletList, code,
|
import qualified Text.Pandoc.Builder as B (blockQuote, bulletList, code,
|
||||||
codeBlockWith, definitionList,
|
codeBlockWith, definitionList,
|
||||||
|
@ -101,13 +101,12 @@ import Text.Parsec.Prim (getState, many, try, updateState, (<|>))
|
||||||
|
|
||||||
readVimwiki :: PandocMonad m => ReaderOptions -> Text -> m Pandoc
|
readVimwiki :: PandocMonad m => ReaderOptions -> Text -> m Pandoc
|
||||||
readVimwiki opts s = do
|
readVimwiki opts s = do
|
||||||
res <- readWithM parseVimwiki def{ stateOptions = opts }
|
res <- readWithM parseVimwiki def{ stateOptions = opts } $ crFilter s
|
||||||
(unpack (crFilter s))
|
|
||||||
case res of
|
case res of
|
||||||
Left e -> throwError e
|
Left e -> throwError e
|
||||||
Right result -> return result
|
Right result -> return result
|
||||||
|
|
||||||
type VwParser = ParserT [Char] ParserState
|
type VwParser = ParserT Text ParserState
|
||||||
|
|
||||||
|
|
||||||
-- constants
|
-- constants
|
||||||
|
|
Loading…
Reference in a new issue