@@ -54,6 +54,8 @@ module Text.Pandoc.Shared (
54 QuoteContext (..),
54 QuoteContext (..),
55 ParserState (..),
55 ParserState (..),
56 defaultParserState,
56 defaultParserState,
57 -- * Native format prettyprinting
59 -- * Native format prettyprinting
58 prettyPandoc,
60 prettyPandoc,
59 -- * Pandoc block list processing
61 -- * Pandoc block list processing
@@ -68,10 +70,8 @@ module Text.Pandoc.Shared (
68 refsMatch,
70 refsMatch,
70import Text.Pandoc.Definition
72import Text.Pandoc.Definition
71−import Text.ParserCombinators.Parsec as Parsec
73+import Text.ParserCombinators.Parsec
72import Text.Pandoc.Entities ( decodeEntities, escapeStringForXML )
74import Text.Pandoc.Entities ( decodeEntities, escapeStringForXML )
73−import Text.PrettyPrint.HughesPJ as PP ( text, char, (<>),
74− ($$), nest, Doc, isEmpty )
75import Data.Char ( toLower, ord )
75import Data.Char ( toLower, ord )
76import Data.List ( find, groupBy, isPrefixOf )
76import Data.List ( find, groupBy, isPrefixOf )
@@ -172,6 +172,21 @@ defaultParserState =
172 stateColumns = 80,
172 stateColumns = 80,
173 stateHeaderTable = [] }
173 stateHeaderTable = [] }
175+-- | Parses a character and returns 'Null' (so that the parser can move on
176+-- if it gets stuck).
177+nullBlock :: GenParser Char st Block
182+-- | Parses backslash, then applies character parser.
183+escaped :: GenParser Char st Char -- ^ Parser for character to escape
184+ -> GenParser Char st Inline
185+escaped parser = try (do
188+ return (Str [result]))
175-- | Indent string as a block.
190-- | Indent string as a block.
176indentBy :: Int -- ^ Number of spaces to indent the block
191indentBy :: Int -- ^ Number of spaces to indent the block
177 -> Int -- ^ Number of spaces (rel to block) to indent first line
192 -> Int -- ^ Number of spaces (rel to block) to indent first line