RST reader: Use Text.Pandoc.Builder.
This will give us more flexibility in the future. It also gives built-in normalization. Performance slightly better.
This commit is contained in:
parent
5c06322ab2
commit
ab17faf497
3 changed files with 305 additions and 299 deletions
|
@ -35,11 +35,14 @@ import Text.Pandoc.Shared
|
||||||
import Text.Pandoc.Parsing
|
import Text.Pandoc.Parsing
|
||||||
import Text.Pandoc.Options
|
import Text.Pandoc.Options
|
||||||
import Control.Monad ( when, liftM, guard, mzero )
|
import Control.Monad ( when, liftM, guard, mzero )
|
||||||
import Data.List ( findIndex, intercalate, transpose, sort, deleteFirstsBy )
|
import Data.List ( findIndex, intersperse, intercalate, transpose, sort, deleteFirstsBy )
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Text.Printf ( printf )
|
import Text.Printf ( printf )
|
||||||
import Data.Maybe ( catMaybes )
|
import Data.Maybe ( catMaybes )
|
||||||
import Control.Applicative ((<$>))
|
import Control.Applicative ((<$>), (<$), (<*), (*>))
|
||||||
|
import Text.Pandoc.Builder (Inlines, Blocks, trimInlines, (<>))
|
||||||
|
import qualified Text.Pandoc.Builder as B
|
||||||
|
import Data.Monoid (mconcat, mempty)
|
||||||
|
|
||||||
-- | Parse reStructuredText string and return Pandoc document.
|
-- | Parse reStructuredText string and return Pandoc document.
|
||||||
readRST :: ReaderOptions -- ^ Reader options
|
readRST :: ReaderOptions -- ^ Reader options
|
||||||
|
@ -104,26 +107,25 @@ parseRST = do
|
||||||
let reversedNotes = stateNotes st'
|
let reversedNotes = stateNotes st'
|
||||||
updateState $ \s -> s { stateNotes = reverse reversedNotes }
|
updateState $ \s -> s { stateNotes = reverse reversedNotes }
|
||||||
-- now parse it for real...
|
-- now parse it for real...
|
||||||
blocks <- parseBlocks
|
blocks <- B.toList <$> parseBlocks
|
||||||
let blocks' = filter (/= Null) blocks
|
|
||||||
standalone <- getOption readerStandalone
|
standalone <- getOption readerStandalone
|
||||||
let (blocks'', title) = if standalone
|
let (blocks', title) = if standalone
|
||||||
then titleTransform blocks'
|
then titleTransform blocks
|
||||||
else (blocks', [])
|
else (blocks, [])
|
||||||
state <- getState
|
state <- getState
|
||||||
let authors = stateAuthors state
|
let authors = stateAuthors state
|
||||||
let date = stateDate state
|
let date = stateDate state
|
||||||
let title' = if (null title) then (stateTitle state) else title
|
let title' = if null title then stateTitle state else title
|
||||||
return $ Pandoc (Meta title' authors date) blocks''
|
return $ Pandoc (Meta title' authors date) blocks'
|
||||||
|
|
||||||
--
|
--
|
||||||
-- parsing blocks
|
-- parsing blocks
|
||||||
--
|
--
|
||||||
|
|
||||||
parseBlocks :: Parser [Char] ParserState [Block]
|
parseBlocks :: Parser [Char] ParserState Blocks
|
||||||
parseBlocks = manyTill block eof
|
parseBlocks = mconcat <$> manyTill block eof
|
||||||
|
|
||||||
block :: Parser [Char] ParserState Block
|
block :: Parser [Char] ParserState Blocks
|
||||||
block = choice [ codeBlock
|
block = choice [ codeBlock
|
||||||
, rawBlock
|
, rawBlock
|
||||||
, blockQuote
|
, blockQuote
|
||||||
|
@ -142,7 +144,7 @@ block = choice [ codeBlock
|
||||||
, lhsCodeBlock
|
, lhsCodeBlock
|
||||||
, para
|
, para
|
||||||
, plain
|
, plain
|
||||||
, nullBlock ] <?> "block"
|
] <?> "block"
|
||||||
|
|
||||||
--
|
--
|
||||||
-- field list
|
-- field list
|
||||||
|
@ -161,13 +163,13 @@ rawFieldListItem indent = try $ do
|
||||||
return (name, raw)
|
return (name, raw)
|
||||||
|
|
||||||
fieldListItem :: String
|
fieldListItem :: String
|
||||||
-> Parser [Char] ParserState (Maybe ([Inline], [[Block]]))
|
-> Parser [Char] ParserState (Maybe (Inlines, [Blocks]))
|
||||||
fieldListItem indent = try $ do
|
fieldListItem indent = try $ do
|
||||||
(name, raw) <- rawFieldListItem indent
|
(name, raw) <- rawFieldListItem indent
|
||||||
let term = [Str name]
|
let term = B.str name
|
||||||
contents <- parseFromString (many block) raw
|
contents <- parseFromString parseBlocks raw
|
||||||
optional blanklines
|
optional blanklines
|
||||||
case (name, contents) of
|
case (name, B.toList contents) of
|
||||||
("Author", x) -> do
|
("Author", x) -> do
|
||||||
updateState $ \st ->
|
updateState $ \st ->
|
||||||
st{ stateAuthors = stateAuthors st ++ [extractContents x] }
|
st{ stateAuthors = stateAuthors st ++ [extractContents x] }
|
||||||
|
@ -188,19 +190,19 @@ extractContents [Plain auth] = auth
|
||||||
extractContents [Para auth] = auth
|
extractContents [Para auth] = auth
|
||||||
extractContents _ = []
|
extractContents _ = []
|
||||||
|
|
||||||
fieldList :: Parser [Char] ParserState Block
|
fieldList :: Parser [Char] ParserState Blocks
|
||||||
fieldList = try $ do
|
fieldList = try $ do
|
||||||
indent <- lookAhead $ many spaceChar
|
indent <- lookAhead $ many spaceChar
|
||||||
items <- many1 $ fieldListItem indent
|
items <- many1 $ fieldListItem indent
|
||||||
if null items
|
if null items
|
||||||
then return Null
|
then return mempty
|
||||||
else return $ DefinitionList $ catMaybes items
|
else return $ B.definitionList $ catMaybes items
|
||||||
|
|
||||||
--
|
--
|
||||||
-- line block
|
-- line block
|
||||||
--
|
--
|
||||||
|
|
||||||
lineBlockLine :: Parser [Char] ParserState [Inline]
|
lineBlockLine :: Parser [Char] ParserState Inlines
|
||||||
lineBlockLine = try $ do
|
lineBlockLine = try $ do
|
||||||
char '|'
|
char '|'
|
||||||
char ' ' <|> lookAhead (char '\n')
|
char ' ' <|> lookAhead (char '\n')
|
||||||
|
@ -208,87 +210,74 @@ lineBlockLine = try $ do
|
||||||
line <- many $ (notFollowedBy newline >> inline) <|> (try $ endline >>~ char ' ')
|
line <- many $ (notFollowedBy newline >> inline) <|> (try $ endline >>~ char ' ')
|
||||||
optional endline
|
optional endline
|
||||||
return $ if null white
|
return $ if null white
|
||||||
then normalizeSpaces line
|
then mconcat line
|
||||||
else Str white : normalizeSpaces line
|
else B.str white <> mconcat line
|
||||||
|
|
||||||
lineBlock :: Parser [Char] ParserState Block
|
lineBlock :: Parser [Char] ParserState Blocks
|
||||||
lineBlock = try $ do
|
lineBlock = try $ do
|
||||||
lines' <- many1 lineBlockLine
|
lines' <- many1 lineBlockLine
|
||||||
blanklines
|
blanklines
|
||||||
return $ Para (intercalate [LineBreak] lines')
|
return $ B.para (mconcat $ intersperse B.linebreak lines')
|
||||||
|
|
||||||
--
|
--
|
||||||
-- paragraph block
|
-- paragraph block
|
||||||
--
|
--
|
||||||
|
|
||||||
para :: Parser [Char] ParserState Block
|
|
||||||
para = paraBeforeCodeBlock <|> paraNormal <?> "paragraph"
|
|
||||||
|
|
||||||
codeBlockStart :: Parser [Char] st Char
|
codeBlockStart :: Parser [Char] st Char
|
||||||
codeBlockStart = string "::" >> blankline >> blankline
|
codeBlockStart = string "::" >> blankline >> blankline
|
||||||
|
|
||||||
-- paragraph that ends in a :: starting a code block
|
-- note: paragraph can end in a :: starting a code block
|
||||||
paraBeforeCodeBlock :: Parser [Char] ParserState Block
|
para :: Parser [Char] ParserState Blocks
|
||||||
paraBeforeCodeBlock = try $ do
|
para = try $ do
|
||||||
result <- many1 (notFollowedBy' codeBlockStart >> inline)
|
result <- trimInlines . mconcat <$>
|
||||||
lookAhead (string "::")
|
many1 (notFollowedBy' codeBlockStart >> inline)
|
||||||
return $ Para $ if last result == Space
|
(lookAhead codeBlockStart >> return (B.para $ result <> B.str ":"))
|
||||||
then normalizeSpaces result
|
<|> (newline >> blanklines >> return (B.para result))
|
||||||
else (normalizeSpaces result) ++ [Str ":"]
|
|
||||||
|
|
||||||
-- regular paragraph
|
plain :: Parser [Char] ParserState Blocks
|
||||||
paraNormal :: Parser [Char] ParserState Block
|
plain = B.plain . trimInlines . mconcat <$> many1 inline
|
||||||
paraNormal = try $ do
|
|
||||||
result <- many1 inline
|
|
||||||
newline
|
|
||||||
blanklines
|
|
||||||
return $ Para $ normalizeSpaces result
|
|
||||||
|
|
||||||
plain :: Parser [Char] ParserState Block
|
|
||||||
plain = many1 inline >>= return . Plain . normalizeSpaces
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- image block
|
-- image block
|
||||||
--
|
--
|
||||||
|
|
||||||
imageBlock :: Parser [Char] ParserState Block
|
imageBlock :: Parser [Char] ParserState Blocks
|
||||||
imageBlock = try $ do
|
imageBlock = try $ do
|
||||||
string ".. "
|
string ".. "
|
||||||
res <- imageDef [Str "image"]
|
res <- imageDef (B.str "image")
|
||||||
return $ Para [res]
|
return $ B.para res
|
||||||
|
|
||||||
imageDef :: [Inline] -> Parser [Char] ParserState Inline
|
imageDef :: Inlines -> Parser [Char] ParserState Inlines
|
||||||
imageDef defaultAlt = try $ do
|
imageDef defaultAlt = try $ do
|
||||||
string "image:: "
|
string "image:: "
|
||||||
src <- escapeURI . removeLeadingTrailingSpace <$> manyTill anyChar newline
|
src <- escapeURI . removeLeadingTrailingSpace <$> manyTill anyChar newline
|
||||||
fields <- try $ do indent <- lookAhead $ many (oneOf " /t")
|
fields <- try $ do indent <- lookAhead $ many (oneOf " /t")
|
||||||
many $ rawFieldListItem indent
|
many $ rawFieldListItem indent
|
||||||
optional blanklines
|
optional blanklines
|
||||||
let alt = maybe defaultAlt (\x -> [Str $ removeTrailingSpace x])
|
let alt = maybe defaultAlt (\x -> B.str $ removeTrailingSpace x)
|
||||||
$ lookup "alt" fields
|
$ lookup "alt" fields
|
||||||
let img = Image alt (src,"")
|
let img = B.image src "" alt
|
||||||
return $ case lookup "target" fields of
|
return $ case lookup "target" fields of
|
||||||
Just t -> Link [img]
|
Just t -> B.link (escapeURI $ removeLeadingTrailingSpace t)
|
||||||
(escapeURI $ removeLeadingTrailingSpace t,"")
|
"" img
|
||||||
Nothing -> img
|
Nothing -> img
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- header blocks
|
-- header blocks
|
||||||
--
|
--
|
||||||
|
|
||||||
header :: Parser [Char] ParserState Block
|
header :: Parser [Char] ParserState Blocks
|
||||||
header = doubleHeader <|> singleHeader <?> "header"
|
header = doubleHeader <|> singleHeader <?> "header"
|
||||||
|
|
||||||
-- a header with lines on top and bottom
|
-- a header with lines on top and bottom
|
||||||
doubleHeader :: Parser [Char] ParserState Block
|
doubleHeader :: Parser [Char] ParserState Blocks
|
||||||
doubleHeader = try $ do
|
doubleHeader = try $ do
|
||||||
c <- oneOf underlineChars
|
c <- oneOf underlineChars
|
||||||
rest <- many (char c) -- the top line
|
rest <- many (char c) -- the top line
|
||||||
let lenTop = length (c:rest)
|
let lenTop = length (c:rest)
|
||||||
skipSpaces
|
skipSpaces
|
||||||
newline
|
newline
|
||||||
txt <- many1 (notFollowedBy blankline >> inline)
|
txt <- trimInlines . mconcat <$> many1 (notFollowedBy blankline >> inline)
|
||||||
pos <- getPosition
|
pos <- getPosition
|
||||||
let len = (sourceColumn pos) - 1
|
let len = (sourceColumn pos) - 1
|
||||||
if (len > lenTop) then fail "title longer than border" else return ()
|
if (len > lenTop) then fail "title longer than border" else return ()
|
||||||
|
@ -303,13 +292,13 @@ doubleHeader = try $ do
|
||||||
Just ind -> (headerTable, ind + 1)
|
Just ind -> (headerTable, ind + 1)
|
||||||
Nothing -> (headerTable ++ [DoubleHeader c], (length headerTable) + 1)
|
Nothing -> (headerTable ++ [DoubleHeader c], (length headerTable) + 1)
|
||||||
setState (state { stateHeaderTable = headerTable' })
|
setState (state { stateHeaderTable = headerTable' })
|
||||||
return $ Header level (normalizeSpaces txt)
|
return $ B.header level txt
|
||||||
|
|
||||||
-- a header with line on the bottom only
|
-- a header with line on the bottom only
|
||||||
singleHeader :: Parser [Char] ParserState Block
|
singleHeader :: Parser [Char] ParserState Blocks
|
||||||
singleHeader = try $ do
|
singleHeader = try $ do
|
||||||
notFollowedBy' whitespace
|
notFollowedBy' whitespace
|
||||||
txt <- many1 (do {notFollowedBy blankline; inline})
|
txt <- trimInlines . mconcat <$> many1 (do {notFollowedBy blankline; inline})
|
||||||
pos <- getPosition
|
pos <- getPosition
|
||||||
let len = (sourceColumn pos) - 1
|
let len = (sourceColumn pos) - 1
|
||||||
blankline
|
blankline
|
||||||
|
@ -323,20 +312,20 @@ singleHeader = try $ do
|
||||||
Just ind -> (headerTable, ind + 1)
|
Just ind -> (headerTable, ind + 1)
|
||||||
Nothing -> (headerTable ++ [SingleHeader c], (length headerTable) + 1)
|
Nothing -> (headerTable ++ [SingleHeader c], (length headerTable) + 1)
|
||||||
setState (state { stateHeaderTable = headerTable' })
|
setState (state { stateHeaderTable = headerTable' })
|
||||||
return $ Header level (normalizeSpaces txt)
|
return $ B.header level txt
|
||||||
|
|
||||||
--
|
--
|
||||||
-- hrule block
|
-- hrule block
|
||||||
--
|
--
|
||||||
|
|
||||||
hrule :: Parser [Char] st Block
|
hrule :: Parser [Char] st Blocks
|
||||||
hrule = try $ do
|
hrule = try $ do
|
||||||
chr <- oneOf underlineChars
|
chr <- oneOf underlineChars
|
||||||
count 3 (char chr)
|
count 3 (char chr)
|
||||||
skipMany (char chr)
|
skipMany (char chr)
|
||||||
blankline
|
blankline
|
||||||
blanklines
|
blanklines
|
||||||
return HorizontalRule
|
return B.horizontalRule
|
||||||
|
|
||||||
--
|
--
|
||||||
-- code blocks
|
-- code blocks
|
||||||
|
@ -359,49 +348,49 @@ indentedBlock = try $ do
|
||||||
optional blanklines
|
optional blanklines
|
||||||
return $ unlines lns
|
return $ unlines lns
|
||||||
|
|
||||||
codeBlock :: Parser [Char] st Block
|
codeBlock :: Parser [Char] st Blocks
|
||||||
codeBlock = try $ do
|
codeBlock = try $ do
|
||||||
codeBlockStart
|
codeBlockStart
|
||||||
result <- indentedBlock
|
result <- indentedBlock
|
||||||
return $ CodeBlock ("",[],[]) $ stripTrailingNewlines result
|
return $ B.codeBlock $ stripTrailingNewlines result
|
||||||
|
|
||||||
-- | The 'code-block' directive (from Sphinx) that allows a language to be
|
-- | The 'code-block' directive (from Sphinx) that allows a language to be
|
||||||
-- specified.
|
-- specified.
|
||||||
customCodeBlock :: Parser [Char] st Block
|
customCodeBlock :: Parser [Char] st Blocks
|
||||||
customCodeBlock = try $ do
|
customCodeBlock = try $ do
|
||||||
string ".. code-block:: "
|
string ".. code-block:: "
|
||||||
language <- manyTill anyChar newline
|
language <- manyTill anyChar newline
|
||||||
blanklines
|
blanklines
|
||||||
result <- indentedBlock
|
result <- indentedBlock
|
||||||
return $ CodeBlock ("", ["sourceCode", language], []) $ stripTrailingNewlines result
|
return $ B.codeBlockWith ("", ["sourceCode", language], [])
|
||||||
|
$ stripTrailingNewlines result
|
||||||
|
|
||||||
|
figureBlock :: Parser [Char] ParserState Blocks
|
||||||
figureBlock :: Parser [Char] ParserState Block
|
|
||||||
figureBlock = try $ do
|
figureBlock = try $ do
|
||||||
string ".. figure::"
|
string ".. figure::"
|
||||||
src <- removeLeadingTrailingSpace `fmap` manyTill anyChar newline
|
src <- escapeURI . removeLeadingTrailingSpace <$> manyTill anyChar newline
|
||||||
body <- indentedBlock
|
body <- indentedBlock
|
||||||
caption <- parseFromString extractCaption body
|
caption <- parseFromString extractCaption body
|
||||||
return $ Para [Image caption (src,"")]
|
return $ B.para $ B.image src "" caption
|
||||||
|
|
||||||
extractCaption :: Parser [Char] ParserState [Inline]
|
extractCaption :: Parser [Char] ParserState Inlines
|
||||||
extractCaption = try $ do
|
extractCaption = try $ do
|
||||||
manyTill anyLine blanklines
|
manyTill anyLine blanklines
|
||||||
many inline
|
trimInlines . mconcat <$> many inline
|
||||||
|
|
||||||
-- | The 'math' directive (from Sphinx) for display math.
|
-- | The 'math' directive (from Sphinx) for display math.
|
||||||
mathBlock :: Parser [Char] st Block
|
mathBlock :: Parser [Char] st Blocks
|
||||||
mathBlock = try $ do
|
mathBlock = try $ do
|
||||||
string ".. math::"
|
string ".. math::"
|
||||||
mathBlockMultiline <|> mathBlockOneLine
|
mathBlockMultiline <|> mathBlockOneLine
|
||||||
|
|
||||||
mathBlockOneLine :: Parser [Char] st Block
|
mathBlockOneLine :: Parser [Char] st Blocks
|
||||||
mathBlockOneLine = try $ do
|
mathBlockOneLine = try $ do
|
||||||
result <- manyTill anyChar newline
|
result <- manyTill anyChar newline
|
||||||
blanklines
|
blanklines
|
||||||
return $ Para [Math DisplayMath $ removeLeadingTrailingSpace result]
|
return $ B.para $ B.displayMath $ removeLeadingTrailingSpace result
|
||||||
|
|
||||||
mathBlockMultiline :: Parser [Char] st Block
|
mathBlockMultiline :: Parser [Char] st Blocks
|
||||||
mathBlockMultiline = try $ do
|
mathBlockMultiline = try $ do
|
||||||
blanklines
|
blanklines
|
||||||
result <- indentedBlock
|
result <- indentedBlock
|
||||||
|
@ -414,9 +403,9 @@ mathBlockMultiline = try $ do
|
||||||
let lns' = dropWhile startsWithColon lns
|
let lns' = dropWhile startsWithColon lns
|
||||||
let eqs = map (removeLeadingTrailingSpace . unlines)
|
let eqs = map (removeLeadingTrailingSpace . unlines)
|
||||||
$ filter (not . null) $ splitBy null lns'
|
$ filter (not . null) $ splitBy null lns'
|
||||||
return $ Para $ map (Math DisplayMath) eqs
|
return $ B.para $ mconcat $ map B.displayMath eqs
|
||||||
|
|
||||||
lhsCodeBlock :: Parser [Char] ParserState Block
|
lhsCodeBlock :: Parser [Char] ParserState Blocks
|
||||||
lhsCodeBlock = try $ do
|
lhsCodeBlock = try $ do
|
||||||
guardEnabled Ext_literate_haskell
|
guardEnabled Ext_literate_haskell
|
||||||
optional codeBlockStart
|
optional codeBlockStart
|
||||||
|
@ -428,55 +417,54 @@ lhsCodeBlock = try $ do
|
||||||
then map (drop 1) lns
|
then map (drop 1) lns
|
||||||
else lns
|
else lns
|
||||||
blanklines
|
blanklines
|
||||||
return $ CodeBlock ("", ["sourceCode", "literate", "haskell"], []) $ intercalate "\n" lns'
|
return $ B.codeBlockWith ("", ["sourceCode", "literate", "haskell"], [])
|
||||||
|
$ intercalate "\n" lns'
|
||||||
|
|
||||||
birdTrackLine :: Parser [Char] st [Char]
|
birdTrackLine :: Parser [Char] st [Char]
|
||||||
birdTrackLine = do
|
birdTrackLine = char '>' >> manyTill anyChar newline
|
||||||
char '>'
|
|
||||||
manyTill anyChar newline
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- raw html/latex/etc
|
-- raw html/latex/etc
|
||||||
--
|
--
|
||||||
|
|
||||||
rawBlock :: Parser [Char] st Block
|
rawBlock :: Parser [Char] st Blocks
|
||||||
rawBlock = try $ do
|
rawBlock = try $ do
|
||||||
string ".. raw:: "
|
string ".. raw:: "
|
||||||
lang <- many1 (letter <|> digit)
|
lang <- many1 (letter <|> digit)
|
||||||
blanklines
|
blanklines
|
||||||
result <- indentedBlock
|
result <- indentedBlock
|
||||||
return $ RawBlock lang result
|
return $ B.rawBlock lang result
|
||||||
|
|
||||||
--
|
--
|
||||||
-- block quotes
|
-- block quotes
|
||||||
--
|
--
|
||||||
|
|
||||||
blockQuote :: Parser [Char] ParserState Block
|
blockQuote :: Parser [Char] ParserState Blocks
|
||||||
blockQuote = do
|
blockQuote = do
|
||||||
raw <- indentedBlock
|
raw <- indentedBlock
|
||||||
-- parse the extracted block, which may contain various block elements:
|
-- parse the extracted block, which may contain various block elements:
|
||||||
contents <- parseFromString parseBlocks $ raw ++ "\n\n"
|
contents <- parseFromString parseBlocks $ raw ++ "\n\n"
|
||||||
return $ BlockQuote contents
|
return $ B.blockQuote contents
|
||||||
|
|
||||||
--
|
--
|
||||||
-- list blocks
|
-- list blocks
|
||||||
--
|
--
|
||||||
|
|
||||||
list :: Parser [Char] ParserState Block
|
list :: Parser [Char] ParserState Blocks
|
||||||
list = choice [ bulletList, orderedList, definitionList ] <?> "list"
|
list = choice [ bulletList, orderedList, definitionList ] <?> "list"
|
||||||
|
|
||||||
definitionListItem :: Parser [Char] ParserState ([Inline], [[Block]])
|
definitionListItem :: Parser [Char] ParserState (Inlines, [Blocks])
|
||||||
definitionListItem = try $ do
|
definitionListItem = try $ do
|
||||||
-- avoid capturing a directive or comment
|
-- avoid capturing a directive or comment
|
||||||
notFollowedBy (try $ char '.' >> char '.')
|
notFollowedBy (try $ char '.' >> char '.')
|
||||||
term <- many1Till inline endline
|
term <- trimInlines . mconcat <$> many1Till inline endline
|
||||||
raw <- indentedBlock
|
raw <- indentedBlock
|
||||||
-- parse the extracted block, which may contain various block elements:
|
-- parse the extracted block, which may contain various block elements:
|
||||||
contents <- parseFromString parseBlocks $ raw ++ "\n"
|
contents <- parseFromString parseBlocks $ raw ++ "\n"
|
||||||
return (normalizeSpaces term, [contents])
|
return (term, [contents])
|
||||||
|
|
||||||
definitionList :: Parser [Char] ParserState Block
|
definitionList :: Parser [Char] ParserState Blocks
|
||||||
definitionList = many1 definitionListItem >>= return . DefinitionList
|
definitionList = B.definitionList <$> many1 definitionListItem
|
||||||
|
|
||||||
-- parses bullet list start and returns its length (inc. following whitespace)
|
-- parses bullet list start and returns its length (inc. following whitespace)
|
||||||
bulletListStart :: Parser [Char] st Int
|
bulletListStart :: Parser [Char] st Int
|
||||||
|
@ -531,7 +519,7 @@ listContinuation markerLength = try $ do
|
||||||
return $ blanks ++ concat result
|
return $ blanks ++ concat result
|
||||||
|
|
||||||
listItem :: Parser [Char] ParserState Int
|
listItem :: Parser [Char] ParserState Int
|
||||||
-> Parser [Char] ParserState [Block]
|
-> Parser [Char] ParserState Blocks
|
||||||
listItem start = try $ do
|
listItem start = try $ do
|
||||||
(markerLength, first) <- rawListItem start
|
(markerLength, first) <- rawListItem start
|
||||||
rest <- many (listContinuation markerLength)
|
rest <- many (listContinuation markerLength)
|
||||||
|
@ -548,22 +536,21 @@ listItem start = try $ do
|
||||||
updateState (\st -> st {stateParserContext = oldContext})
|
updateState (\st -> st {stateParserContext = oldContext})
|
||||||
return parsed
|
return parsed
|
||||||
|
|
||||||
orderedList :: Parser [Char] ParserState Block
|
orderedList :: Parser [Char] ParserState Blocks
|
||||||
orderedList = try $ do
|
orderedList = try $ do
|
||||||
(start, style, delim) <- lookAhead (anyOrderedListMarker >>~ spaceChar)
|
(start, style, delim) <- lookAhead (anyOrderedListMarker >>~ spaceChar)
|
||||||
items <- many1 (listItem (orderedListStart style delim))
|
items <- many1 (listItem (orderedListStart style delim))
|
||||||
let items' = compactify items
|
let items' = compactify' items
|
||||||
return $ OrderedList (start, style, delim) items'
|
return $ B.orderedListWith (start, style, delim) items'
|
||||||
|
|
||||||
bulletList :: Parser [Char] ParserState Block
|
bulletList :: Parser [Char] ParserState Blocks
|
||||||
bulletList = many1 (listItem bulletListStart) >>=
|
bulletList = B.bulletList . compactify' <$> many1 (listItem bulletListStart)
|
||||||
return . BulletList . compactify
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- default-role block
|
-- default-role block
|
||||||
--
|
--
|
||||||
|
|
||||||
defaultRoleBlock :: Parser [Char] ParserState Block
|
defaultRoleBlock :: Parser [Char] ParserState Blocks
|
||||||
defaultRoleBlock = try $ do
|
defaultRoleBlock = try $ do
|
||||||
string ".. default-role::"
|
string ".. default-role::"
|
||||||
-- doesn't enforce any restrictions on the role name; embedded spaces shouldn't be allowed, for one
|
-- doesn't enforce any restrictions on the role name; embedded spaces shouldn't be allowed, for one
|
||||||
|
@ -574,20 +561,20 @@ defaultRoleBlock = try $ do
|
||||||
else role
|
else role
|
||||||
}
|
}
|
||||||
-- skip body of the directive if it exists
|
-- skip body of the directive if it exists
|
||||||
many $ blanklines <|> (spaceChar >> manyTill anyChar newline)
|
skipMany $ blanklines <|> (spaceChar >> manyTill anyChar newline)
|
||||||
return Null
|
return mempty
|
||||||
|
|
||||||
--
|
--
|
||||||
-- unknown directive (e.g. comment)
|
-- unknown directive (e.g. comment)
|
||||||
--
|
--
|
||||||
|
|
||||||
unknownDirective :: Parser [Char] st Block
|
unknownDirective :: Parser [Char] st Blocks
|
||||||
unknownDirective = try $ do
|
unknownDirective = try $ do
|
||||||
string ".."
|
string ".."
|
||||||
notFollowedBy (noneOf " \t\n")
|
notFollowedBy (noneOf " \t\n")
|
||||||
manyTill anyChar newline
|
manyTill anyChar newline
|
||||||
many $ blanklines <|> (spaceChar >> manyTill anyChar newline)
|
many $ blanklines <|> (spaceChar >> manyTill anyChar newline)
|
||||||
return Null
|
return mempty
|
||||||
|
|
||||||
---
|
---
|
||||||
--- note block
|
--- note block
|
||||||
|
@ -625,15 +612,15 @@ noteMarker = do
|
||||||
-- reference key
|
-- reference key
|
||||||
--
|
--
|
||||||
|
|
||||||
quotedReferenceName :: Parser [Char] ParserState [Inline]
|
quotedReferenceName :: Parser [Char] ParserState Inlines
|
||||||
quotedReferenceName = try $ do
|
quotedReferenceName = try $ do
|
||||||
char '`' >> notFollowedBy (char '`') -- `` means inline code!
|
char '`' >> notFollowedBy (char '`') -- `` means inline code!
|
||||||
label' <- many1Till inline (char '`')
|
label' <- trimInlines . mconcat <$> many1Till inline (char '`')
|
||||||
return label'
|
return label'
|
||||||
|
|
||||||
unquotedReferenceName :: Parser [Char] ParserState [Inline]
|
unquotedReferenceName :: Parser [Char] ParserState Inlines
|
||||||
unquotedReferenceName = try $ do
|
unquotedReferenceName = try $ do
|
||||||
label' <- many1Till inline (lookAhead $ char ':')
|
label' <- trimInlines . mconcat <$> many1Till inline (lookAhead $ char ':')
|
||||||
return label'
|
return label'
|
||||||
|
|
||||||
-- Simple reference names are single words consisting of alphanumerics
|
-- Simple reference names are single words consisting of alphanumerics
|
||||||
|
@ -647,12 +634,12 @@ simpleReferenceName' = do
|
||||||
<|> (try $ oneOf "-_:+." >> lookAhead alphaNum)
|
<|> (try $ oneOf "-_:+." >> lookAhead alphaNum)
|
||||||
return (x:xs)
|
return (x:xs)
|
||||||
|
|
||||||
simpleReferenceName :: Parser [Char] st [Inline]
|
simpleReferenceName :: Parser [Char] st Inlines
|
||||||
simpleReferenceName = do
|
simpleReferenceName = do
|
||||||
raw <- simpleReferenceName'
|
raw <- simpleReferenceName'
|
||||||
return [Str raw]
|
return $ B.str raw
|
||||||
|
|
||||||
referenceName :: Parser [Char] ParserState [Inline]
|
referenceName :: Parser [Char] ParserState Inlines
|
||||||
referenceName = quotedReferenceName <|>
|
referenceName = quotedReferenceName <|>
|
||||||
(try $ simpleReferenceName >>~ lookAhead (char ':')) <|>
|
(try $ simpleReferenceName >>~ lookAhead (char ':')) <|>
|
||||||
unquotedReferenceName
|
unquotedReferenceName
|
||||||
|
@ -678,7 +665,7 @@ targetURI = do
|
||||||
imageKey :: Parser [Char] ParserState ()
|
imageKey :: Parser [Char] ParserState ()
|
||||||
imageKey = try $ do
|
imageKey = try $ do
|
||||||
string ".. |"
|
string ".. |"
|
||||||
(alt,ref) <- withRaw (manyTill inline (char '|'))
|
(alt,ref) <- withRaw (trimInlines . mconcat <$> manyTill inline (char '|'))
|
||||||
skipSpaces
|
skipSpaces
|
||||||
img <- imageDef alt
|
img <- imageDef alt
|
||||||
let key = toKey $ init ref
|
let key = toKey $ init ref
|
||||||
|
@ -753,7 +740,7 @@ simpleTableRow indices = do
|
||||||
firstLine <- simpleTableRawLine indices
|
firstLine <- simpleTableRawLine indices
|
||||||
colLines <- return [] -- TODO
|
colLines <- return [] -- TODO
|
||||||
let cols = map unlines . transpose $ firstLine : colLines
|
let cols = map unlines . transpose $ firstLine : colLines
|
||||||
mapM (parseFromString (many plain)) cols
|
mapM (parseFromString (B.toList . mconcat <$> many plain)) cols
|
||||||
|
|
||||||
simpleTableSplitLine :: [Int] -> String -> [String]
|
simpleTableSplitLine :: [Int] -> String -> [String]
|
||||||
simpleTableSplitLine indices line =
|
simpleTableSplitLine indices line =
|
||||||
|
@ -775,34 +762,34 @@ simpleTableHeader headless = try $ do
|
||||||
let rawHeads = if headless
|
let rawHeads = if headless
|
||||||
then replicate (length dashes) ""
|
then replicate (length dashes) ""
|
||||||
else simpleTableSplitLine indices rawContent
|
else simpleTableSplitLine indices rawContent
|
||||||
heads <- mapM (parseFromString (many plain)) $
|
heads <- mapM (parseFromString (B.toList . mconcat <$> many plain)) $
|
||||||
map removeLeadingTrailingSpace rawHeads
|
map removeLeadingTrailingSpace rawHeads
|
||||||
return (heads, aligns, indices)
|
return (heads, aligns, indices)
|
||||||
|
|
||||||
-- Parse a simple table.
|
-- Parse a simple table.
|
||||||
simpleTable :: Bool -- ^ Headerless table
|
simpleTable :: Bool -- ^ Headerless table
|
||||||
-> Parser [Char] ParserState Block
|
-> Parser [Char] ParserState Blocks
|
||||||
simpleTable headless = do
|
simpleTable headless = do
|
||||||
Table c a _w h l <- tableWith (simpleTableHeader headless) simpleTableRow sep simpleTableFooter
|
Table c a _w h l <- tableWith (simpleTableHeader headless) simpleTableRow sep simpleTableFooter
|
||||||
-- Simple tables get 0s for relative column widths (i.e., use default)
|
-- Simple tables get 0s for relative column widths (i.e., use default)
|
||||||
return $ Table c a (replicate (length a) 0) h l
|
return $ B.singleton $ Table c a (replicate (length a) 0) h l
|
||||||
where
|
where
|
||||||
sep = return () -- optional (simpleTableSep '-')
|
sep = return () -- optional (simpleTableSep '-')
|
||||||
|
|
||||||
gridTable :: Bool -- ^ Headerless table
|
gridTable :: Bool -- ^ Headerless table
|
||||||
-> Parser [Char] ParserState Block
|
-> Parser [Char] ParserState Blocks
|
||||||
gridTable = gridTableWith parseBlocks
|
gridTable headerless = B.singleton
|
||||||
|
<$> gridTableWith (B.toList <$> parseBlocks) headerless
|
||||||
|
|
||||||
table :: Parser [Char] ParserState Block
|
table :: Parser [Char] ParserState Blocks
|
||||||
table = gridTable False <|> simpleTable False <|>
|
table = gridTable False <|> simpleTable False <|>
|
||||||
gridTable True <|> simpleTable True <?> "table"
|
gridTable True <|> simpleTable True <?> "table"
|
||||||
|
|
||||||
|
--
|
||||||
|
-- inline
|
||||||
|
--
|
||||||
|
|
||||||
--
|
inline :: Parser [Char] ParserState Inlines
|
||||||
-- inline
|
|
||||||
--
|
|
||||||
|
|
||||||
inline :: Parser [Char] ParserState Inline
|
|
||||||
inline = choice [ whitespace
|
inline = choice [ whitespace
|
||||||
, link
|
, link
|
||||||
, str
|
, str
|
||||||
|
@ -815,36 +802,36 @@ inline = choice [ whitespace
|
||||||
, subscript
|
, subscript
|
||||||
, math
|
, math
|
||||||
, note
|
, note
|
||||||
, smartPunctuation inline
|
, smart
|
||||||
, hyphens
|
, hyphens
|
||||||
, escapedChar
|
, escapedChar
|
||||||
, symbol ] <?> "inline"
|
, symbol ] <?> "inline"
|
||||||
|
|
||||||
hyphens :: Parser [Char] ParserState Inline
|
hyphens :: Parser [Char] ParserState Inlines
|
||||||
hyphens = do
|
hyphens = do
|
||||||
result <- many1 (char '-')
|
result <- many1 (char '-')
|
||||||
option Space endline
|
optional endline
|
||||||
-- don't want to treat endline after hyphen or dash as a space
|
-- don't want to treat endline after hyphen or dash as a space
|
||||||
return $ Str result
|
return $ B.str result
|
||||||
|
|
||||||
escapedChar :: Parser [Char] st Inline
|
escapedChar :: Parser [Char] st Inlines
|
||||||
escapedChar = do c <- escaped anyChar
|
escapedChar = do c <- escaped anyChar
|
||||||
return $ if c == ' ' -- '\ ' is null in RST
|
return $ if c == ' ' -- '\ ' is null in RST
|
||||||
then Str ""
|
then mempty
|
||||||
else Str [c]
|
else B.str [c]
|
||||||
|
|
||||||
symbol :: Parser [Char] ParserState Inline
|
symbol :: Parser [Char] ParserState Inlines
|
||||||
symbol = do
|
symbol = do
|
||||||
result <- oneOf specialChars
|
result <- oneOf specialChars
|
||||||
return $ Str [result]
|
return $ B.str [result]
|
||||||
|
|
||||||
-- parses inline code, between codeStart and codeEnd
|
-- parses inline code, between codeStart and codeEnd
|
||||||
code :: Parser [Char] ParserState Inline
|
code :: Parser [Char] ParserState Inlines
|
||||||
code = try $ do
|
code = try $ do
|
||||||
string "``"
|
string "``"
|
||||||
result <- manyTill anyChar (try (string "``"))
|
result <- manyTill anyChar (try (string "``"))
|
||||||
return $ Code nullAttr
|
return $ B.code
|
||||||
$ removeLeadingTrailingSpace $ intercalate " " $ lines result
|
$ removeLeadingTrailingSpace $ unwords $ lines result
|
||||||
|
|
||||||
-- succeeds only if we're not right after a str (ie. in middle of word)
|
-- succeeds only if we're not right after a str (ie. in middle of word)
|
||||||
atStart :: Parser [Char] ParserState a -> Parser [Char] ParserState a
|
atStart :: Parser [Char] ParserState a -> Parser [Char] ParserState a
|
||||||
|
@ -855,13 +842,13 @@ atStart p = do
|
||||||
guard $ stateLastStrPos st /= Just pos
|
guard $ stateLastStrPos st /= Just pos
|
||||||
p
|
p
|
||||||
|
|
||||||
emph :: Parser [Char] ParserState Inline
|
emph :: Parser [Char] ParserState Inlines
|
||||||
emph = enclosed (atStart $ char '*') (char '*') inline >>=
|
emph = B.emph . trimInlines . mconcat <$>
|
||||||
return . Emph . normalizeSpaces
|
enclosed (atStart $ char '*') (char '*') inline
|
||||||
|
|
||||||
strong :: Parser [Char] ParserState Inline
|
strong :: Parser [Char] ParserState Inlines
|
||||||
strong = enclosed (atStart $ string "**") (try $ string "**") inline >>=
|
strong = B.strong . trimInlines . mconcat <$>
|
||||||
return . Strong . normalizeSpaces
|
enclosed (atStart $ string "**") (try $ string "**") inline
|
||||||
|
|
||||||
-- Parses inline interpreted text which is required to have the given role.
|
-- Parses inline interpreted text which is required to have the given role.
|
||||||
-- This decision is based on the role marker (if present),
|
-- This decision is based on the role marker (if present),
|
||||||
|
@ -873,8 +860,8 @@ interpreted role = try $ do
|
||||||
then try markedInterpretedText <|> unmarkedInterpretedText
|
then try markedInterpretedText <|> unmarkedInterpretedText
|
||||||
else markedInterpretedText
|
else markedInterpretedText
|
||||||
where
|
where
|
||||||
markedInterpretedText = try (roleMarker >> unmarkedInterpretedText)
|
markedInterpretedText = try (roleMarker *> unmarkedInterpretedText)
|
||||||
<|> (unmarkedInterpretedText >>= (\txt -> roleMarker >> return txt))
|
<|> (unmarkedInterpretedText <* roleMarker)
|
||||||
roleMarker = string $ ":" ++ role ++ ":"
|
roleMarker = string $ ":" ++ role ++ ":"
|
||||||
-- Note, this doesn't precisely implement the complex rule in
|
-- Note, this doesn't precisely implement the complex rule in
|
||||||
-- http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#inline-markup-recognition-rules
|
-- http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#inline-markup-recognition-rules
|
||||||
|
@ -883,27 +870,27 @@ interpreted role = try $ do
|
||||||
result <- enclosed (atStart $ char '`') (char '`') anyChar
|
result <- enclosed (atStart $ char '`') (char '`') anyChar
|
||||||
return result
|
return result
|
||||||
|
|
||||||
superscript :: Parser [Char] ParserState Inline
|
superscript :: Parser [Char] ParserState Inlines
|
||||||
superscript = interpreted "sup" >>= \x -> return (Superscript [Str x])
|
superscript = B.superscript . B.str <$> interpreted "sup"
|
||||||
|
|
||||||
subscript :: Parser [Char] ParserState Inline
|
subscript :: Parser [Char] ParserState Inlines
|
||||||
subscript = interpreted "sub" >>= \x -> return (Subscript [Str x])
|
subscript = B.subscript . B.str <$> interpreted "sub"
|
||||||
|
|
||||||
math :: Parser [Char] ParserState Inline
|
math :: Parser [Char] ParserState Inlines
|
||||||
math = interpreted "math" >>= \x -> return (Math InlineMath x)
|
math = B.math <$> interpreted "math"
|
||||||
|
|
||||||
whitespace :: Parser [Char] ParserState Inline
|
whitespace :: Parser [Char] ParserState Inlines
|
||||||
whitespace = many1 spaceChar >> return Space <?> "whitespace"
|
whitespace = B.space <$ skipMany1 spaceChar <?> "whitespace"
|
||||||
|
|
||||||
str :: Parser [Char] ParserState Inline
|
str :: Parser [Char] ParserState Inlines
|
||||||
str = do
|
str = do
|
||||||
let strChar = noneOf ("\t\n " ++ specialChars)
|
let strChar = noneOf ("\t\n " ++ specialChars)
|
||||||
result <- many1 strChar
|
result <- many1 strChar
|
||||||
updateLastStrPos
|
updateLastStrPos
|
||||||
return $ Str result
|
return $ B.str result
|
||||||
|
|
||||||
-- an endline character that can be treated as a space, not a structural break
|
-- an endline character that can be treated as a space, not a structural break
|
||||||
endline :: Parser [Char] ParserState Inline
|
endline :: Parser [Char] ParserState Inlines
|
||||||
endline = try $ do
|
endline = try $ do
|
||||||
newline
|
newline
|
||||||
notFollowedBy blankline
|
notFollowedBy blankline
|
||||||
|
@ -913,28 +900,27 @@ endline = try $ do
|
||||||
then notFollowedBy (anyOrderedListMarker >> spaceChar) >>
|
then notFollowedBy (anyOrderedListMarker >> spaceChar) >>
|
||||||
notFollowedBy' bulletListStart
|
notFollowedBy' bulletListStart
|
||||||
else return ()
|
else return ()
|
||||||
return Space
|
return B.space
|
||||||
|
|
||||||
--
|
--
|
||||||
-- links
|
-- links
|
||||||
--
|
--
|
||||||
|
|
||||||
link :: Parser [Char] ParserState Inline
|
link :: Parser [Char] ParserState Inlines
|
||||||
link = choice [explicitLink, referenceLink, autoLink] <?> "link"
|
link = choice [explicitLink, referenceLink, autoLink] <?> "link"
|
||||||
|
|
||||||
explicitLink :: Parser [Char] ParserState Inline
|
explicitLink :: Parser [Char] ParserState Inlines
|
||||||
explicitLink = try $ do
|
explicitLink = try $ do
|
||||||
char '`'
|
char '`'
|
||||||
notFollowedBy (char '`') -- `` marks start of inline code
|
notFollowedBy (char '`') -- `` marks start of inline code
|
||||||
label' <- manyTill (notFollowedBy (char '`') >> inline)
|
label' <- trimInlines . mconcat <$>
|
||||||
(try (spaces >> char '<'))
|
manyTill (notFollowedBy (char '`') >> inline) (char '<')
|
||||||
src <- manyTill (noneOf ">\n") (char '>')
|
src <- manyTill (noneOf ">\n") (char '>')
|
||||||
skipSpaces
|
skipSpaces
|
||||||
string "`_"
|
string "`_"
|
||||||
return $ Link (normalizeSpaces label')
|
return $ B.link (escapeURI $ removeLeadingTrailingSpace src) "" label'
|
||||||
(escapeURI $ removeLeadingTrailingSpace src, "")
|
|
||||||
|
|
||||||
referenceLink :: Parser [Char] ParserState Inline
|
referenceLink :: Parser [Char] ParserState Inlines
|
||||||
referenceLink = try $ do
|
referenceLink = try $ do
|
||||||
(label',ref) <- withRaw (quotedReferenceName <|> simpleReferenceName) >>~
|
(label',ref) <- withRaw (quotedReferenceName <|> simpleReferenceName) >>~
|
||||||
char '_'
|
char '_'
|
||||||
|
@ -953,23 +939,23 @@ referenceLink = try $ do
|
||||||
Just target -> return target
|
Just target -> return target
|
||||||
-- if anonymous link, remove key so it won't be used again
|
-- if anonymous link, remove key so it won't be used again
|
||||||
when (isAnonKey key) $ updateState $ \s -> s{ stateKeys = M.delete key keyTable }
|
when (isAnonKey key) $ updateState $ \s -> s{ stateKeys = M.delete key keyTable }
|
||||||
return $ Link (normalizeSpaces label') (src, tit)
|
return $ B.link src tit label'
|
||||||
|
|
||||||
autoURI :: Parser [Char] ParserState Inline
|
autoURI :: Parser [Char] ParserState Inlines
|
||||||
autoURI = do
|
autoURI = do
|
||||||
(orig, src) <- uri
|
(orig, src) <- uri
|
||||||
return $ Link [Str orig] (src, "")
|
return $ B.link src "" $ B.str orig
|
||||||
|
|
||||||
autoEmail :: Parser [Char] ParserState Inline
|
autoEmail :: Parser [Char] ParserState Inlines
|
||||||
autoEmail = do
|
autoEmail = do
|
||||||
(orig, src) <- emailAddress
|
(orig, src) <- emailAddress
|
||||||
return $ Link [Str orig] (src, "")
|
return $ B.link src "" $ B.str orig
|
||||||
|
|
||||||
autoLink :: Parser [Char] ParserState Inline
|
autoLink :: Parser [Char] ParserState Inlines
|
||||||
autoLink = autoURI <|> autoEmail
|
autoLink = autoURI <|> autoEmail
|
||||||
|
|
||||||
-- For now, we assume that all substitution references are for images.
|
-- For now, we assume that all substitution references are for images.
|
||||||
image :: Parser [Char] ParserState Inline
|
image :: Parser [Char] ParserState Inlines
|
||||||
image = try $ do
|
image = try $ do
|
||||||
char '|'
|
char '|'
|
||||||
(_,ref) <- withRaw (manyTill inline (char '|'))
|
(_,ref) <- withRaw (manyTill inline (char '|'))
|
||||||
|
@ -979,7 +965,7 @@ image = try $ do
|
||||||
Nothing -> fail "no corresponding key"
|
Nothing -> fail "no corresponding key"
|
||||||
Just target -> return target
|
Just target -> return target
|
||||||
|
|
||||||
note :: Parser [Char] ParserState Inline
|
note :: Parser [Char] ParserState Inlines
|
||||||
note = try $ do
|
note = try $ do
|
||||||
ref <- noteMarker
|
ref <- noteMarker
|
||||||
char '_'
|
char '_'
|
||||||
|
@ -1000,4 +986,24 @@ note = try $ do
|
||||||
then deleteFirstsBy (==) notes [(ref,raw)]
|
then deleteFirstsBy (==) notes [(ref,raw)]
|
||||||
else notes
|
else notes
|
||||||
updateState $ \st -> st{ stateNotes = newnotes }
|
updateState $ \st -> st{ stateNotes = newnotes }
|
||||||
return $ Note contents
|
return $ B.note contents
|
||||||
|
|
||||||
|
smart :: Parser [Char] ParserState Inlines
|
||||||
|
smart = do
|
||||||
|
getOption readerSmart >>= guard
|
||||||
|
doubleQuoted <|> singleQuoted <|>
|
||||||
|
choice (map (B.singleton <$>) [apostrophe, dash, ellipses])
|
||||||
|
|
||||||
|
singleQuoted :: Parser [Char] ParserState Inlines
|
||||||
|
singleQuoted = try $ do
|
||||||
|
singleQuoteStart
|
||||||
|
withQuoteContext InSingleQuote $
|
||||||
|
B.singleQuoted . trimInlines . mconcat <$>
|
||||||
|
many1Till inline singleQuoteEnd
|
||||||
|
|
||||||
|
doubleQuoted :: Parser [Char] ParserState Inlines
|
||||||
|
doubleQuoted = try $ do
|
||||||
|
doubleQuoteStart
|
||||||
|
withQuoteContext InDoubleQuote $
|
||||||
|
B.doubleQuoted . trimInlines . mconcat <$>
|
||||||
|
many1Till inline doubleQuoteEnd
|
||||||
|
|
|
@ -3,115 +3,115 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":
|
||||||
[([Str "Revision"],
|
[([Str "Revision"],
|
||||||
[[Para [Str "3"]]])]
|
[[Para [Str "3"]]])]
|
||||||
,Header 1 [Str "Level",Space,Str "one",Space,Str "header"]
|
,Header 1 [Str "Level",Space,Str "one",Space,Str "header"]
|
||||||
,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc",Str ".",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber",Str "\8217",Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."]
|
,Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "set",Space,Str "of",Space,Str "tests",Space,Str "for",Space,Str "pandoc.",Space,Str "Most",Space,Str "of",Space,Str "them",Space,Str "are",Space,Str "adapted",Space,Str "from",Space,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
|
||||||
,Header 2 [Str "Level",Space,Str "two",Space,Str "header"]
|
,Header 2 [Str "Level",Space,Str "two",Space,Str "header"]
|
||||||
,Header 3 [Str "Level",Space,Str "three"]
|
,Header 3 [Str "Level",Space,Str "three"]
|
||||||
,Header 4 [Str "Level",Space,Str "four",Space,Str "with",Space,Emph [Str "emphasis"]]
|
,Header 4 [Str "Level",Space,Str "four",Space,Str "with",Space,Emph [Str "emphasis"]]
|
||||||
,Header 5 [Str "Level",Space,Str "five"]
|
,Header 5 [Str "Level",Space,Str "five"]
|
||||||
,Header 1 [Str "Paragraphs"]
|
,Header 1 [Str "Paragraphs"]
|
||||||
,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Str "regular",Space,Str "paragraph",Str "."]
|
,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
|
||||||
,Para [Str "In",Space,Str "Markdown",Space,Str "1",Str ".",Str "0",Str ".",Str "0",Space,Str "and",Space,Str "earlier",Str ".",Space,Str "Version",Space,Str "8",Str ".",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item",Str ".",Space,Str "Because",Space,Str "a",Space,Str "hard",Str "-",Str "wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item",Str "."]
|
,Para [Str "In",Space,Str "Markdown",Space,Str "1.0.0",Space,Str "and",Space,Str "earlier.",Space,Str "Version",Space,Str "8.",Space,Str "This",Space,Str "line",Space,Str "turns",Space,Str "into",Space,Str "a",Space,Str "list",Space,Str "item.",Space,Str "Because",Space,Str "a",Space,Str "hard-wrapped",Space,Str "line",Space,Str "in",Space,Str "the",Space,Str "middle",Space,Str "of",Space,Str "a",Space,Str "paragraph",Space,Str "looked",Space,Str "like",Space,Str "a",Space,Str "list",Space,Str "item."]
|
||||||
,Para [Str "Here",Str "\8217",Str "s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet",Str ".",Space,Str "*",Space,Str "criminey",Str "."]
|
,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
|
||||||
,Para [Str "Horizontal",Space,Str "rule",Str ":"]
|
,Para [Str "Horizontal",Space,Str "rule:"]
|
||||||
,HorizontalRule
|
,HorizontalRule
|
||||||
,Para [Str "Another",Str ":"]
|
,Para [Str "Another:"]
|
||||||
,HorizontalRule
|
,HorizontalRule
|
||||||
,Header 1 [Str "Block",Space,Str "Quotes"]
|
,Header 1 [Str "Block",Space,Str "Quotes"]
|
||||||
,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"]
|
,Para [Str "Here\8217s",Space,Str "a",Space,Str "block",Space,Str "quote:"]
|
||||||
,BlockQuote
|
,BlockQuote
|
||||||
[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote",Str ".",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short",Str "."]]
|
[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It",Space,Str "is",Space,Str "pretty",Space,Str "short."]]
|
||||||
,Para [Str "Here",Str "\8217",Str "s",Space,Str "another,",Space,Str "differently",Space,Str "indented",Str ":"]
|
,Para [Str "Here\8217s",Space,Str "another,",Space,Str "differently",Space,Str "indented:"]
|
||||||
,BlockQuote
|
,BlockQuote
|
||||||
[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote",Str ".",Space,Str "It",Str "\8217",Str "s",Space,Str "indented",Space,Str "with",Space,Str "a",Space,Str "tab",Str "."]
|
[Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote.",Space,Str "It\8217s",Space,Str "indented",Space,Str "with",Space,Str "a",Space,Str "tab."]
|
||||||
,Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"]
|
,Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
|
||||||
,CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}"
|
,CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}"
|
||||||
,Para [Str "List",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"]
|
,Para [Str "List",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
|
||||||
,OrderedList (1,Decimal,Period)
|
,OrderedList (1,Decimal,Period)
|
||||||
[[Plain [Str "item",Space,Str "one"]]
|
[[Plain [Str "item",Space,Str "one"]]
|
||||||
,[Plain [Str "item",Space,Str "two"]]]
|
,[Plain [Str "item",Space,Str "two"]]]
|
||||||
,Para [Str "Nested",Space,Str "block",Space,Str "quotes",Str ":"]
|
,Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
|
||||||
,BlockQuote
|
,BlockQuote
|
||||||
[Para [Str "nested"]
|
[Para [Str "nested"]
|
||||||
,BlockQuote
|
,BlockQuote
|
||||||
[Para [Str "nested"]]]]
|
[Para [Str "nested"]]]]
|
||||||
,Header 1 [Str "Code",Space,Str "Blocks"]
|
,Header 1 [Str "Code",Space,Str "Blocks"]
|
||||||
,Para [Str "Code",Str ":"]
|
,Para [Str "Code:"]
|
||||||
,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}"
|
,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}"
|
||||||
,CodeBlock ("",[],[]) "this code block is indented by one tab"
|
,CodeBlock ("",[],[]) "this code block is indented by one tab"
|
||||||
,Para [Str "And",Str ":"]
|
,Para [Str "And:"]
|
||||||
,CodeBlock ("",[],[]) "this block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{"
|
,CodeBlock ("",[],[]) "this block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{"
|
||||||
,Para [Str "And",Str ":"]
|
,Para [Str "And:"]
|
||||||
,CodeBlock ("",["sourceCode","python"],[]) "def my_function(x):\n return x + 1"
|
,CodeBlock ("",["sourceCode","python"],[]) "def my_function(x):\n return x + 1"
|
||||||
,Header 1 [Str "Lists"]
|
,Header 1 [Str "Lists"]
|
||||||
,Header 2 [Str "Unordered"]
|
,Header 2 [Str "Unordered"]
|
||||||
,Para [Str "Asterisks",Space,Str "tight",Str ":"]
|
,Para [Str "Asterisks",Space,Str "tight:"]
|
||||||
,BulletList
|
,BulletList
|
||||||
[[Plain [Str "asterisk",Space,Str "1"]]
|
[[Plain [Str "asterisk",Space,Str "1"]]
|
||||||
,[Plain [Str "asterisk",Space,Str "2"]]
|
,[Plain [Str "asterisk",Space,Str "2"]]
|
||||||
,[Plain [Str "asterisk",Space,Str "3"]]]
|
,[Plain [Str "asterisk",Space,Str "3"]]]
|
||||||
,Para [Str "Asterisks",Space,Str "loose",Str ":"]
|
,Para [Str "Asterisks",Space,Str "loose:"]
|
||||||
,BulletList
|
,BulletList
|
||||||
[[Para [Str "asterisk",Space,Str "1"]]
|
[[Para [Str "asterisk",Space,Str "1"]]
|
||||||
,[Para [Str "asterisk",Space,Str "2"]]
|
,[Para [Str "asterisk",Space,Str "2"]]
|
||||||
,[Para [Str "asterisk",Space,Str "3"]]]
|
,[Para [Str "asterisk",Space,Str "3"]]]
|
||||||
,Para [Str "Pluses",Space,Str "tight",Str ":"]
|
,Para [Str "Pluses",Space,Str "tight:"]
|
||||||
,BulletList
|
,BulletList
|
||||||
[[Plain [Str "Plus",Space,Str "1"]]
|
[[Plain [Str "Plus",Space,Str "1"]]
|
||||||
,[Plain [Str "Plus",Space,Str "2"]]
|
,[Plain [Str "Plus",Space,Str "2"]]
|
||||||
,[Plain [Str "Plus",Space,Str "3"]]]
|
,[Plain [Str "Plus",Space,Str "3"]]]
|
||||||
,Para [Str "Pluses",Space,Str "loose",Str ":"]
|
,Para [Str "Pluses",Space,Str "loose:"]
|
||||||
,BulletList
|
,BulletList
|
||||||
[[Para [Str "Plus",Space,Str "1"]]
|
[[Para [Str "Plus",Space,Str "1"]]
|
||||||
,[Para [Str "Plus",Space,Str "2"]]
|
,[Para [Str "Plus",Space,Str "2"]]
|
||||||
,[Para [Str "Plus",Space,Str "3"]]]
|
,[Para [Str "Plus",Space,Str "3"]]]
|
||||||
,Para [Str "Minuses",Space,Str "tight",Str ":"]
|
,Para [Str "Minuses",Space,Str "tight:"]
|
||||||
,BulletList
|
,BulletList
|
||||||
[[Plain [Str "Minus",Space,Str "1"]]
|
[[Plain [Str "Minus",Space,Str "1"]]
|
||||||
,[Plain [Str "Minus",Space,Str "2"]]
|
,[Plain [Str "Minus",Space,Str "2"]]
|
||||||
,[Plain [Str "Minus",Space,Str "3"]]]
|
,[Plain [Str "Minus",Space,Str "3"]]]
|
||||||
,Para [Str "Minuses",Space,Str "loose",Str ":"]
|
,Para [Str "Minuses",Space,Str "loose:"]
|
||||||
,BulletList
|
,BulletList
|
||||||
[[Para [Str "Minus",Space,Str "1"]]
|
[[Para [Str "Minus",Space,Str "1"]]
|
||||||
,[Para [Str "Minus",Space,Str "2"]]
|
,[Para [Str "Minus",Space,Str "2"]]
|
||||||
,[Para [Str "Minus",Space,Str "3"]]]
|
,[Para [Str "Minus",Space,Str "3"]]]
|
||||||
,Header 2 [Str "Ordered"]
|
,Header 2 [Str "Ordered"]
|
||||||
,Para [Str "Tight",Str ":"]
|
,Para [Str "Tight:"]
|
||||||
,OrderedList (1,Decimal,Period)
|
,OrderedList (1,Decimal,Period)
|
||||||
[[Plain [Str "First"]]
|
[[Plain [Str "First"]]
|
||||||
,[Plain [Str "Second"]]
|
,[Plain [Str "Second"]]
|
||||||
,[Plain [Str "Third"]]]
|
,[Plain [Str "Third"]]]
|
||||||
,Para [Str "and",Str ":"]
|
,Para [Str "and:"]
|
||||||
,OrderedList (1,Decimal,Period)
|
,OrderedList (1,Decimal,Period)
|
||||||
[[Plain [Str "One"]]
|
[[Plain [Str "One"]]
|
||||||
,[Plain [Str "Two"]]
|
,[Plain [Str "Two"]]
|
||||||
,[Plain [Str "Three"]]]
|
,[Plain [Str "Three"]]]
|
||||||
,Para [Str "Loose",Space,Str "using",Space,Str "tabs",Str ":"]
|
,Para [Str "Loose",Space,Str "using",Space,Str "tabs:"]
|
||||||
,OrderedList (1,Decimal,Period)
|
,OrderedList (1,Decimal,Period)
|
||||||
[[Para [Str "First"]]
|
[[Para [Str "First"]]
|
||||||
,[Para [Str "Second"]]
|
,[Para [Str "Second"]]
|
||||||
,[Para [Str "Third"]]]
|
,[Para [Str "Third"]]]
|
||||||
,Para [Str "and",Space,Str "using",Space,Str "spaces",Str ":"]
|
,Para [Str "and",Space,Str "using",Space,Str "spaces:"]
|
||||||
,OrderedList (1,Decimal,Period)
|
,OrderedList (1,Decimal,Period)
|
||||||
[[Para [Str "One"]]
|
[[Para [Str "One"]]
|
||||||
,[Para [Str "Two"]]
|
,[Para [Str "Two"]]
|
||||||
,[Para [Str "Three"]]]
|
,[Para [Str "Three"]]]
|
||||||
,Para [Str "Multiple",Space,Str "paragraphs",Str ":"]
|
,Para [Str "Multiple",Space,Str "paragraphs:"]
|
||||||
,OrderedList (1,Decimal,Period)
|
,OrderedList (1,Decimal,Period)
|
||||||
[[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one",Str "."]
|
[[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
|
||||||
,Para [Str "Item",Space,Str "1",Str ".",Space,Str "graf",Space,Str "two",Str ".",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog",Str "\8217",Str "s",Space,Str "back",Str "."]]
|
,Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog\8217s",Space,Str "back."]]
|
||||||
,[Para [Str "Item",Space,Str "2",Str "."]]
|
,[Para [Str "Item",Space,Str "2."]]
|
||||||
,[Para [Str "Item",Space,Str "3",Str "."]]]
|
,[Para [Str "Item",Space,Str "3."]]]
|
||||||
,Para [Str "Nested",Str ":"]
|
,Para [Str "Nested:"]
|
||||||
,BulletList
|
,BulletList
|
||||||
[[Para [Str "Tab"]
|
[[Para [Str "Tab"]
|
||||||
,BulletList
|
,BulletList
|
||||||
[[Para [Str "Tab"]
|
[[Para [Str "Tab"]
|
||||||
,BulletList
|
,BulletList
|
||||||
[[Plain [Str "Tab"]]]]]]]
|
[[Plain [Str "Tab"]]]]]]]
|
||||||
,Para [Str "Here",Str "\8217",Str "s",Space,Str "another",Str ":"]
|
,Para [Str "Here\8217s",Space,Str "another:"]
|
||||||
,OrderedList (1,Decimal,Period)
|
,OrderedList (1,Decimal,Period)
|
||||||
[[Para [Str "First"]]
|
[[Para [Str "First"]]
|
||||||
,[Para [Str "Second",Str ":"]
|
,[Para [Str "Second:"]
|
||||||
,BlockQuote
|
,BlockQuote
|
||||||
[BulletList
|
[BulletList
|
||||||
[[Plain [Str "Fee"]]
|
[[Plain [Str "Fee"]]
|
||||||
|
@ -129,111 +129,111 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":
|
||||||
,OrderedList (1,UpperAlpha,TwoParens)
|
,OrderedList (1,UpperAlpha,TwoParens)
|
||||||
[[Plain [Str "a",Space,Str "subsublist"]]
|
[[Plain [Str "a",Space,Str "subsublist"]]
|
||||||
,[Plain [Str "a",Space,Str "subsublist"]]]]]]]
|
,[Plain [Str "a",Space,Str "subsublist"]]]]]]]
|
||||||
,Para [Str "Nesting",Str ":"]
|
,Para [Str "Nesting:"]
|
||||||
,OrderedList (1,UpperAlpha,Period)
|
,OrderedList (1,UpperAlpha,Period)
|
||||||
[[Para [Str "Upper",Space,Str "Alpha"]
|
[[Para [Str "Upper",Space,Str "Alpha"]
|
||||||
,OrderedList (1,UpperRoman,Period)
|
,OrderedList (1,UpperRoman,Period)
|
||||||
[[Para [Str "Upper",Space,Str "Roman",Str "."]
|
[[Para [Str "Upper",Space,Str "Roman."]
|
||||||
,OrderedList (6,Decimal,TwoParens)
|
,OrderedList (6,Decimal,TwoParens)
|
||||||
[[Para [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
|
[[Para [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
|
||||||
,OrderedList (3,LowerAlpha,OneParen)
|
,OrderedList (3,LowerAlpha,OneParen)
|
||||||
[[Plain [Str "Lower",Space,Str "alpha",Space,Str "with",Space,Str "paren"]]]]]]]]]
|
[[Plain [Str "Lower",Space,Str "alpha",Space,Str "with",Space,Str "paren"]]]]]]]]]
|
||||||
,Para [Str "Autonumbering",Str ":"]
|
,Para [Str "Autonumbering:"]
|
||||||
,OrderedList (1,DefaultStyle,DefaultDelim)
|
,OrderedList (1,DefaultStyle,DefaultDelim)
|
||||||
[[Plain [Str "Autonumber",Str "."]]
|
[[Plain [Str "Autonumber."]]
|
||||||
,[Para [Str "More",Str "."]
|
,[Para [Str "More."]
|
||||||
,OrderedList (1,DefaultStyle,DefaultDelim)
|
,OrderedList (1,DefaultStyle,DefaultDelim)
|
||||||
[[Plain [Str "Nested",Str "."]]]]]
|
[[Plain [Str "Nested."]]]]]
|
||||||
,Para [Str "Autonumbering",Space,Str "with",Space,Str "explicit",Space,Str "start",Str ":"]
|
,Para [Str "Autonumbering",Space,Str "with",Space,Str "explicit",Space,Str "start:"]
|
||||||
,OrderedList (4,LowerAlpha,TwoParens)
|
,OrderedList (4,LowerAlpha,TwoParens)
|
||||||
[[Plain [Str "item",Space,Str "1"]]
|
[[Plain [Str "item",Space,Str "1"]]
|
||||||
,[Plain [Str "item",Space,Str "2"]]]
|
,[Plain [Str "item",Space,Str "2"]]]
|
||||||
,Header 2 [Str "Definition"]
|
,Header 2 [Str "Definition"]
|
||||||
,DefinitionList
|
,DefinitionList
|
||||||
[([Str "term",Space,Str "1"],
|
[([Str "term",Space,Str "1"],
|
||||||
[[Para [Str "Definition",Space,Str "1",Str "."]]])
|
[[Para [Str "Definition",Space,Str "1."]]])
|
||||||
,([Str "term",Space,Str "2"],
|
,([Str "term",Space,Str "2"],
|
||||||
[[Para [Str "Definition",Space,Str "2,",Space,Str "paragraph",Space,Str "1",Str "."]
|
[[Para [Str "Definition",Space,Str "2,",Space,Str "paragraph",Space,Str "1."]
|
||||||
,Para [Str "Definition",Space,Str "2,",Space,Str "paragraph",Space,Str "2",Str "."]]])
|
,Para [Str "Definition",Space,Str "2,",Space,Str "paragraph",Space,Str "2."]]])
|
||||||
,([Str "term",Space,Str "with",Space,Emph [Str "emphasis"]],
|
,([Str "term",Space,Str "with",Space,Emph [Str "emphasis"]],
|
||||||
[[Para [Str "Definition",Space,Str "3",Str "."]]])]
|
[[Para [Str "Definition",Space,Str "3."]]])]
|
||||||
,Header 1 [Str "Field",Space,Str "Lists"]
|
,Header 1 [Str "Field",Space,Str "Lists"]
|
||||||
,BlockQuote
|
,BlockQuote
|
||||||
[DefinitionList
|
[DefinitionList
|
||||||
[([Str "address"],
|
[([Str "address"],
|
||||||
[[Para [Str "61",Space,Str "Main",Space,Str "St",Str "."]]])
|
[[Para [Str "61",Space,Str "Main",Space,Str "St."]]])
|
||||||
,([Str "city"],
|
,([Str "city"],
|
||||||
[[Para [Emph [Str "Nowhere"],Str ",",Space,Str "MA,",Space,Str "USA"]]])
|
[[Para [Emph [Str "Nowhere"],Str ",",Space,Str "MA,",Space,Str "USA"]]])
|
||||||
,([Str "phone"],
|
,([Str "phone"],
|
||||||
[[Para [Str "123",Str "-",Str "4567"]]])]]
|
[[Para [Str "123-4567"]]])]]
|
||||||
,DefinitionList
|
,DefinitionList
|
||||||
[([Str "address"],
|
[([Str "address"],
|
||||||
[[Para [Str "61",Space,Str "Main",Space,Str "St",Str "."]]])
|
[[Para [Str "61",Space,Str "Main",Space,Str "St."]]])
|
||||||
,([Str "city"],
|
,([Str "city"],
|
||||||
[[Para [Emph [Str "Nowhere"],Str ",",Space,Str "MA,",Space,Str "USA"]]])
|
[[Para [Emph [Str "Nowhere"],Str ",",Space,Str "MA,",Space,Str "USA"]]])
|
||||||
,([Str "phone"],
|
,([Str "phone"],
|
||||||
[[Para [Str "123",Str "-",Str "4567"]]])]
|
[[Para [Str "123-4567"]]])]
|
||||||
,Header 1 [Str "HTML",Space,Str "Blocks"]
|
,Header 1 [Str "HTML",Space,Str "Blocks"]
|
||||||
,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line",Str ":"]
|
,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
|
||||||
,RawBlock "html" "<div>foo</div>\n"
|
,RawBlock "html" "<div>foo</div>\n"
|
||||||
,Para [Str "Now,",Space,Str "nested",Str ":"]
|
,Para [Str "Now,",Space,Str "nested:"]
|
||||||
,RawBlock "html" "<div>\n <div>\n <div>\n foo\n </div>\n </div>\n</div>\n"
|
,RawBlock "html" "<div>\n <div>\n <div>\n foo\n </div>\n </div>\n</div>\n"
|
||||||
,Header 1 [Str "LaTeX",Space,Str "Block"]
|
,Header 1 [Str "LaTeX",Space,Str "Block"]
|
||||||
,RawBlock "latex" "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}\n"
|
,RawBlock "latex" "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}\n"
|
||||||
,Header 1 [Str "Inline",Space,Str "Markup"]
|
,Header 1 [Str "Inline",Space,Str "Markup"]
|
||||||
,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ".",Space,Str "This",Space,Str "is",Space,Strong [Str "strong"],Str "."]
|
,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ".",Space,Str "This",Space,Str "is",Space,Strong [Str "strong"],Str "."]
|
||||||
,Para [Str "This",Space,Str "is",Space,Str "code",Str ":",Space,Code ("",[],[]) ">",Str ",",Space,Code ("",[],[]) "$",Str ",",Space,Code ("",[],[]) "\\",Str ",",Space,Code ("",[],[]) "\\$",Str ",",Space,Code ("",[],[]) "<html>",Str "."]
|
,Para [Str "This",Space,Str "is",Space,Str "code:",Space,Code ("",[],[]) ">",Str ",",Space,Code ("",[],[]) "$",Str ",",Space,Code ("",[],[]) "\\",Str ",",Space,Code ("",[],[]) "\\$",Str ",",Space,Code ("",[],[]) "<html>",Str "."]
|
||||||
,Para [Str "This",Space,Str "is",Subscript [Str "subscripted"],Space,Str "and",Space,Str "this",Space,Str "is",Space,Superscript [Str "superscripted"],Str "."]
|
,Para [Str "This",Space,Str "is",Subscript [Str "subscripted"],Space,Str "and",Space,Str "this",Space,Str "is",Space,Superscript [Str "superscripted"],Str "."]
|
||||||
,Header 1 [Str "Special",Space,Str "Characters"]
|
,Header 1 [Str "Special",Space,Str "Characters"]
|
||||||
,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode",Str ":"]
|
,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
|
||||||
,BulletList
|
,BulletList
|
||||||
[[Plain [Str "I",Space,Str "hat",Str ":",Space,Str "\206"]]
|
[[Plain [Str "I",Space,Str "hat:",Space,Str "\206"]]
|
||||||
,[Plain [Str "o",Space,Str "umlaut",Str ":",Space,Str "\246"]]
|
,[Plain [Str "o",Space,Str "umlaut:",Space,Str "\246"]]
|
||||||
,[Plain [Str "section",Str ":",Space,Str "\167"]]
|
,[Plain [Str "section:",Space,Str "\167"]]
|
||||||
,[Plain [Str "set",Space,Str "membership",Str ":",Space,Str "\8712"]]
|
,[Plain [Str "set",Space,Str "membership:",Space,Str "\8712"]]
|
||||||
,[Plain [Str "copyright",Str ":",Space,Str "\169"]]]
|
,[Plain [Str "copyright:",Space,Str "\169"]]]
|
||||||
,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name",Str "."]
|
,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
|
||||||
,Para [Str "This",Space,Str "&",Space,Str "that",Str "."]
|
,Para [Str "This",Space,Str "&",Space,Str "that."]
|
||||||
,Para [Str "4",Space,Str "<",Space,Str "5",Str "."]
|
,Para [Str "4",Space,Str "<",Space,Str "5."]
|
||||||
,Para [Str "6",Space,Str ">",Space,Str "5",Str "."]
|
,Para [Str "6",Space,Str ">",Space,Str "5."]
|
||||||
,Para [Str "Backslash",Str ":",Space,Str "\\"]
|
,Para [Str "Backslash:",Space,Str "\\"]
|
||||||
,Para [Str "Backtick",Str ":",Space,Str "`"]
|
,Para [Str "Backtick:",Space,Str "`"]
|
||||||
,Para [Str "Asterisk",Str ":",Space,Str "*"]
|
,Para [Str "Asterisk:",Space,Str "*"]
|
||||||
,Para [Str "Underscore",Str ":",Space,Str "_"]
|
,Para [Str "Underscore:",Space,Str "_"]
|
||||||
,Para [Str "Left",Space,Str "brace",Str ":",Space,Str "{"]
|
,Para [Str "Left",Space,Str "brace:",Space,Str "{"]
|
||||||
,Para [Str "Right",Space,Str "brace",Str ":",Space,Str "}"]
|
,Para [Str "Right",Space,Str "brace:",Space,Str "}"]
|
||||||
,Para [Str "Left",Space,Str "bracket",Str ":",Space,Str "["]
|
,Para [Str "Left",Space,Str "bracket:",Space,Str "["]
|
||||||
,Para [Str "Right",Space,Str "bracket",Str ":",Space,Str "]"]
|
,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
|
||||||
,Para [Str "Left",Space,Str "paren",Str ":",Space,Str "("]
|
,Para [Str "Left",Space,Str "paren:",Space,Str "("]
|
||||||
,Para [Str "Right",Space,Str "paren",Str ":",Space,Str ")"]
|
,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
|
||||||
,Para [Str "Greater",Str "-",Str "than",Str ":",Space,Str ">"]
|
,Para [Str "Greater-than:",Space,Str ">"]
|
||||||
,Para [Str "Hash",Str ":",Space,Str "#"]
|
,Para [Str "Hash:",Space,Str "#"]
|
||||||
,Para [Str "Period",Str ":",Space,Str "."]
|
,Para [Str "Period:",Space,Str "."]
|
||||||
,Para [Str "Bang",Str ":",Space,Str "!"]
|
,Para [Str "Bang:",Space,Str "!"]
|
||||||
,Para [Str "Plus",Str ":",Space,Str "+"]
|
,Para [Str "Plus:",Space,Str "+"]
|
||||||
,Para [Str "Minus",Str ":",Space,Str "-"]
|
,Para [Str "Minus:",Space,Str "-"]
|
||||||
,Header 1 [Str "Links"]
|
,Header 1 [Str "Links"]
|
||||||
,Para [Str "Explicit",Str ":",Space,Str "a",Space,Link [Str "URL"] ("/url/",""),Str "."]
|
,Para [Str "Explicit:",Space,Str "a",Space,Link [Str "URL"] ("/url/",""),Str "."]
|
||||||
,Para [Str "Two",Space,Str "anonymous",Space,Str "links",Str ":",Space,Link [Str "the",Space,Str "first"] ("/url1/",""),Space,Str "and",Space,Link [Str "the",Space,Str "second"] ("/url2/","")]
|
,Para [Str "Two",Space,Str "anonymous",Space,Str "links:",Space,Link [Str "the",Space,Str "first"] ("/url1/",""),Space,Str "and",Space,Link [Str "the",Space,Str "second"] ("/url2/","")]
|
||||||
,Para [Str "Reference",Space,Str "links",Str ":",Space,Link [Str "link1"] ("/url1/",""),Space,Str "and",Space,Link [Str "link2"] ("/url2/",""),Space,Str "and",Space,Link [Str "link1"] ("/url1/",""),Space,Str "again",Str "."]
|
,Para [Str "Reference",Space,Str "links:",Space,Link [Str "link1"] ("/url1/",""),Space,Str "and",Space,Link [Str "link2"] ("/url2/",""),Space,Str "and",Space,Link [Str "link1"] ("/url1/",""),Space,Str "again."]
|
||||||
,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."]
|
,Para [Str "Here\8217s",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."]
|
||||||
,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text",Str ":",Space,Link [Str "AT&T"] ("/url/",""),Str "."]
|
,Para [Str "Here\8217s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link [Str "AT&T"] ("/url/",""),Str "."]
|
||||||
,Para [Str "Autolinks",Str ":",Space,Link [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2",""),Space,Str "and",Space,Link [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net",""),Str "."]
|
,Para [Str "Autolinks:",Space,Link [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2",""),Space,Str "and",Space,Link [Str "nobody@nowhere.net"] ("mailto:nobody@nowhere.net",""),Str "."]
|
||||||
,Para [Str "But",Space,Str "not",Space,Str "here",Str ":"]
|
,Para [Str "But",Space,Str "not",Space,Str "here:"]
|
||||||
,CodeBlock ("",[],[]) "http://example.com/"
|
,CodeBlock ("",[],[]) "http://example.com/"
|
||||||
,Header 1 [Str "Images"]
|
,Header 1 [Str "Images"]
|
||||||
,Para [Str "From",Space,Quoted DoubleQuote [Str "Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune"],Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(",Str "1902",Str ")",Str ":"]
|
,Para [Str "From",Space,Quoted DoubleQuote [Str "Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune"],Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
|
||||||
,Para [Image [Str "image"] ("lalune.jpg","")]
|
,Para [Image [Str "image"] ("lalune.jpg","")]
|
||||||
,Para [Image [Str "Voyage dans la Lune"] ("lalune.jpg","")]
|
,Para [Image [Str "Voyage dans la Lune"] ("lalune.jpg","")]
|
||||||
,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon",Str "."]
|
,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
|
||||||
,Para [Str "And",Space,Str "an",Space,Link [Image [Str "A movie"] ("movie.jpg","")] ("/url",""),Str "."]
|
,Para [Str "And",Space,Str "an",Space,Link [Image [Str "A movie"] ("movie.jpg","")] ("/url",""),Str "."]
|
||||||
,Header 1 [Str "Comments"]
|
,Header 1 [Str "Comments"]
|
||||||
,Para [Str "First",Space,Str "paragraph"]
|
,Para [Str "First",Space,Str "paragraph"]
|
||||||
,Para [Str "Another",Space,Str "paragraph"]
|
,Para [Str "Another",Space,Str "paragraph"]
|
||||||
,Para [Str "A",Space,Str "third",Space,Str "paragraph"]
|
,Para [Str "A",Space,Str "third",Space,Str "paragraph"]
|
||||||
,Header 1 [Str "Line",Space,Str "blocks"]
|
,Header 1 [Str "Line",Space,Str "blocks"]
|
||||||
,Para [Str "But",Space,Str "can",Space,Str "a",Space,Str "bee",Space,Str "be",Space,Str "said",Space,Str "to",Space,Str "be",LineBreak,Str " ",Str "or",Space,Str "not",Space,Str "to",Space,Str "be",Space,Str "an",Space,Str "entire",Space,Str "bee,",LineBreak,Str " ",Str "when",Space,Str "half",Space,Str "the",Space,Str "bee",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "bee,",LineBreak,Str " ",Str "due",Space,Str "to",Space,Str "some",Space,Str "ancient",Space,Str "injury?"]
|
,Para [Str "But",Space,Str "can",Space,Str "a",Space,Str "bee",Space,Str "be",Space,Str "said",Space,Str "to",Space,Str "be",LineBreak,Str " or",Space,Str "not",Space,Str "to",Space,Str "be",Space,Str "an",Space,Str "entire",Space,Str "bee,",LineBreak,Str " when",Space,Str "half",Space,Str "the",Space,Str "bee",Space,Str "is",Space,Str "not",Space,Str "a",Space,Str "bee,",LineBreak,Str " due",Space,Str "to",Space,Str "some",Space,Str "ancient",Space,Str "injury?"]
|
||||||
,Para [Str "Continuation",Space,Str "line",LineBreak,Str " ",Str "and",Space,Str "another"]
|
,Para [Str "Continuation",Space,Str "line",LineBreak,Str " and",Space,Str "another"]
|
||||||
,Header 1 [Str "Simple",Space,Str "Tables"]
|
,Header 1 [Str "Simple",Space,Str "Tables"]
|
||||||
,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
|
,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
|
||||||
[[Plain [Str "col",Space,Str "1"]]
|
[[Plain [Str "col",Space,Str "1"]]
|
||||||
|
@ -302,25 +302,25 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":
|
||||||
,[Plain [Str "b",Space,Str "2"]]]]
|
,[Plain [Str "b",Space,Str "2"]]]]
|
||||||
,[Plain [Str "c",Space,Str "c",Space,Str "2",Space,Str "c",Space,Str "2"]]]]
|
,[Plain [Str "c",Space,Str "c",Space,Str "2",Space,Str "c",Space,Str "2"]]]]
|
||||||
,Header 1 [Str "Footnotes"]
|
,Header 1 [Str "Footnotes"]
|
||||||
,Para [Note [Para [Str "Note",Space,Str "with",Space,Str "one",Space,Str "line",Str "."]]]
|
,Para [Note [Para [Str "Note",Space,Str "with",Space,Str "one",Space,Str "line."]]]
|
||||||
,Para [Note [Para [Str "Note",Space,Str "with",Space,Str "continuation",Space,Str "line",Str "."]]]
|
,Para [Note [Para [Str "Note",Space,Str "with",Space,Str "continuation",Space,Str "line."]]]
|
||||||
,Para [Note [Para [Str "Note",Space,Str "with"],Para [Str "continuation",Space,Str "block",Str "."]]]
|
,Para [Note [Para [Str "Note",Space,Str "with"],Para [Str "continuation",Space,Str "block."]]]
|
||||||
,Para [Note [Para [Str "Note",Space,Str "with",Space,Str "continuation",Space,Str "line"],Para [Str "and",Space,Str "a",Space,Str "second",Space,Str "para",Str "."]]]
|
,Para [Note [Para [Str "Note",Space,Str "with",Space,Str "continuation",Space,Str "line"],Para [Str "and",Space,Str "a",Space,Str "second",Space,Str "para."]]]
|
||||||
,Para [Str "Not",Space,Str "in",Space,Str "note",Str "."]
|
,Para [Str "Not",Space,Str "in",Space,Str "note."]
|
||||||
,Header 1 [Str "Math"]
|
,Header 1 [Str "Math"]
|
||||||
,Para [Str "Some",Space,Str "inline",Space,Str "math",Space,Math InlineMath "E=mc^2",Str ".",Space,Str "Now",Space,Str "some",Space,Str "display",Space,Str "math",Str ":"]
|
,Para [Str "Some",Space,Str "inline",Space,Str "math",Space,Math InlineMath "E=mc^2",Str ".",Space,Str "Now",Space,Str "some",Space,Str "display",Space,Str "math:"]
|
||||||
,Para [Math DisplayMath "E=mc^2"]
|
,Para [Math DisplayMath "E=mc^2"]
|
||||||
,Para [Math DisplayMath "E = mc^2"]
|
,Para [Math DisplayMath "E = mc^2"]
|
||||||
,Para [Math DisplayMath "E = mc^2",Math DisplayMath "\\alpha = \\beta"]
|
,Para [Math DisplayMath "E = mc^2",Math DisplayMath "\\alpha = \\beta"]
|
||||||
,Para [Math DisplayMath "E &= mc^2\\\\\nF &= \\pi E",Math DisplayMath "F &= \\gamma \\alpha^2"]
|
,Para [Math DisplayMath "E &= mc^2\\\\\nF &= \\pi E",Math DisplayMath "F &= \\gamma \\alpha^2"]
|
||||||
,Para [Str "All",Space,Str "done",Str "."]
|
,Para [Str "All",Space,Str "done."]
|
||||||
,Header 1 [Str "Default",Str "-",Str "Role"]
|
,Header 1 [Str "Default-Role"]
|
||||||
,Para [Str "Try",Space,Str "changing",Space,Str "the",Space,Str "default",Space,Str "role",Space,Str "to",Space,Str "a",Space,Str "few",Space,Str "different",Space,Str "things",Str "."]
|
,Para [Str "Try",Space,Str "changing",Space,Str "the",Space,Str "default",Space,Str "role",Space,Str "to",Space,Str "a",Space,Str "few",Space,Str "different",Space,Str "things."]
|
||||||
,Header 2 [Str "Doesn",Str "\8217",Str "t",Space,Str "Break",Space,Str "Title",Space,Str "Parsing"]
|
,Header 2 [Str "Doesn\8217t",Space,Str "Break",Space,Str "Title",Space,Str "Parsing"]
|
||||||
,Para [Str "Inline",Space,Str "math",Str ":",Space,Math InlineMath "E=mc^2",Space,Str "or",Space,Math InlineMath "E=mc^2",Space,Str "or",Space,Math InlineMath "E=mc^2",Str ".",Space,Str "Other",Space,Str "roles",Str ":",Space,Superscript [Str "super"],Str ",",Space,Subscript [Str "sub"],Str "."]
|
,Para [Str "Inline",Space,Str "math:",Space,Math InlineMath "E=mc^2",Space,Str "or",Space,Math InlineMath "E=mc^2",Space,Str "or",Space,Math InlineMath "E=mc^2",Str ".",Space,Str "Other",Space,Str "roles:",Space,Superscript [Str "super"],Str ",",Space,Subscript [Str "sub"],Str "."]
|
||||||
,Para [Math DisplayMath "\\alpha = beta",Math DisplayMath "E = mc^2"]
|
,Para [Math DisplayMath "\\alpha = beta",Math DisplayMath "E = mc^2"]
|
||||||
,Para [Str "Some",Space,Superscript [Str "of"],Space,Str "these",Space,Superscript [Str "words"],Space,Str "are",Space,Str "in",Space,Superscript [Str "superscript"],Str "."]
|
,Para [Str "Some",Space,Superscript [Str "of"],Space,Str "these",Space,Superscript [Str "words"],Space,Str "are",Space,Str "in",Space,Superscript [Str "superscript"],Str "."]
|
||||||
,Para [Str "Reset",Space,Str "default",Str "-",Str "role",Space,Str "to",Space,Str "the",Space,Str "default",Space,Str "default",Str "."]
|
,Para [Str "Reset",Space,Str "default-role",Space,Str "to",Space,Str "the",Space,Str "default",Space,Str "default."]
|
||||||
,Para [Str "And",Space,Str "now",Space,Str "`",Str "some",Str "-",Str "invalid",Str "-",Str "string",Str "-",Str "3231231",Str "`",Space,Str "is",Space,Str "nonsense",Str "."]
|
,Para [Str "And",Space,Str "now",Space,Str "`some-invalid-string-3231231`",Space,Str "is",Space,Str "nonsense."]
|
||||||
,Header 2 [Str "Literal",Space,Str "symbols"]
|
,Header 2 [Str "Literal",Space,Str "symbols"]
|
||||||
,Para [Str "2",Str "*",Str "2",Space,Str "=",Space,Str "4",Str "*",Str "1"]]
|
,Para [Str "2*2",Space,Str "=",Space,Str "4*1"]]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption",Str ":"]
|
[Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption:"]
|
||||||
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.125,0.1125,0.1375,0.15]
|
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.125,0.1125,0.1375,0.15]
|
||||||
[[Plain [Str "Right"]]
|
[[Plain [Str "Right"]]
|
||||||
,[Plain [Str "Left"]]
|
,[Plain [Str "Left"]]
|
||||||
|
@ -16,8 +16,8 @@
|
||||||
,[Plain [Str "1"]]
|
,[Plain [Str "1"]]
|
||||||
,[Plain [Str "1"]]
|
,[Plain [Str "1"]]
|
||||||
,[Plain [Str "1"]]]]
|
,[Plain [Str "1"]]]]
|
||||||
,Para [Str "Table",Str ":",Space,Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."]
|
,Para [Str "Table:",Space,Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."]
|
||||||
,Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption",Str ":"]
|
,Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption:"]
|
||||||
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.125,0.1125,0.1375,0.15]
|
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.125,0.1125,0.1375,0.15]
|
||||||
[[Plain [Str "Right"]]
|
[[Plain [Str "Right"]]
|
||||||
,[Plain [Str "Left"]]
|
,[Plain [Str "Left"]]
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
,[Plain [Str "1"]]
|
,[Plain [Str "1"]]
|
||||||
,[Plain [Str "1"]]
|
,[Plain [Str "1"]]
|
||||||
,[Plain [Str "1"]]]]
|
,[Plain [Str "1"]]]]
|
||||||
,Para [Str "Simple",Space,Str "table",Space,Str "indented",Space,Str "two",Space,Str "spaces",Str ":"]
|
,Para [Str "Simple",Space,Str "table",Space,Str "indented",Space,Str "two",Space,Str "spaces:"]
|
||||||
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.125,0.1125,0.1375,0.15]
|
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.125,0.1125,0.1375,0.15]
|
||||||
[[Plain [Str "Right"]]
|
[[Plain [Str "Right"]]
|
||||||
,[Plain [Str "Left"]]
|
,[Plain [Str "Left"]]
|
||||||
|
@ -53,8 +53,8 @@
|
||||||
,[Plain [Str "1"]]
|
,[Plain [Str "1"]]
|
||||||
,[Plain [Str "1"]]
|
,[Plain [Str "1"]]
|
||||||
,[Plain [Str "1"]]]]
|
,[Plain [Str "1"]]]]
|
||||||
,Para [Str "Table",Str ":",Space,Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."]
|
,Para [Str "Table:",Space,Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."]
|
||||||
,Para [Str "Multiline",Space,Str "table",Space,Str "with",Space,Str "caption",Str ":"]
|
,Para [Str "Multiline",Space,Str "table",Space,Str "with",Space,Str "caption:"]
|
||||||
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.175,0.1625,0.1875,0.3625]
|
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.175,0.1625,0.1875,0.3625]
|
||||||
[[Plain [Str "Centered",Space,Str "Header"]]
|
[[Plain [Str "Centered",Space,Str "Header"]]
|
||||||
,[Plain [Str "Left",Space,Str "Aligned"]]
|
,[Plain [Str "Left",Space,Str "Aligned"]]
|
||||||
|
@ -62,14 +62,14 @@
|
||||||
,[Plain [Str "Default",Space,Str "aligned"]]]
|
,[Plain [Str "Default",Space,Str "aligned"]]]
|
||||||
[[[Plain [Str "First"]]
|
[[[Plain [Str "First"]]
|
||||||
,[Plain [Str "row"]]
|
,[Plain [Str "row"]]
|
||||||
,[Plain [Str "12",Str ".",Str "0"]]
|
,[Plain [Str "12.0"]]
|
||||||
,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines",Str "."]]]
|
,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
|
||||||
,[[Plain [Str "Second"]]
|
,[[Plain [Str "Second"]]
|
||||||
,[Plain [Str "row"]]
|
,[Plain [Str "row"]]
|
||||||
,[Plain [Str "5",Str ".",Str "0"]]
|
,[Plain [Str "5.0"]]
|
||||||
,[Plain [Str "Here",Str "'",Str "s",Space,Str "another",Space,Str "one",Str ".",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows",Str "."]]]]
|
,[Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]]
|
||||||
,Para [Str "Table",Str ":",Space,Str "Here",Str "'",Str "s",Space,Str "the",Space,Str "caption",Str ".",Space,Str "It",Space,Str "may",Space,Str "span",Space,Str "multiple",Space,Str "lines",Str "."]
|
,Para [Str "Table:",Space,Str "Here's",Space,Str "the",Space,Str "caption.",Space,Str "It",Space,Str "may",Space,Str "span",Space,Str "multiple",Space,Str "lines."]
|
||||||
,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "caption",Str ":"]
|
,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "caption:"]
|
||||||
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.175,0.1625,0.1875,0.3625]
|
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.175,0.1625,0.1875,0.3625]
|
||||||
[[Plain [Str "Centered",Space,Str "Header"]]
|
[[Plain [Str "Centered",Space,Str "Header"]]
|
||||||
,[Plain [Str "Left",Space,Str "Aligned"]]
|
,[Plain [Str "Left",Space,Str "Aligned"]]
|
||||||
|
@ -77,13 +77,13 @@
|
||||||
,[Plain [Str "Default",Space,Str "aligned"]]]
|
,[Plain [Str "Default",Space,Str "aligned"]]]
|
||||||
[[[Plain [Str "First"]]
|
[[[Plain [Str "First"]]
|
||||||
,[Plain [Str "row"]]
|
,[Plain [Str "row"]]
|
||||||
,[Plain [Str "12",Str ".",Str "0"]]
|
,[Plain [Str "12.0"]]
|
||||||
,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines",Str "."]]]
|
,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
|
||||||
,[[Plain [Str "Second"]]
|
,[[Plain [Str "Second"]]
|
||||||
,[Plain [Str "row"]]
|
,[Plain [Str "row"]]
|
||||||
,[Plain [Str "5",Str ".",Str "0"]]
|
,[Plain [Str "5.0"]]
|
||||||
,[Plain [Str "Here",Str "'",Str "s",Space,Str "another",Space,Str "one",Str ".",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows",Str "."]]]]
|
,[Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]]
|
||||||
,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers",Str ":"]
|
,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
|
||||||
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1,0.1,0.1,0.1]
|
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1,0.1,0.1,0.1]
|
||||||
[[]
|
[[]
|
||||||
,[]
|
,[]
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
,[Plain [Str "1"]]
|
,[Plain [Str "1"]]
|
||||||
,[Plain [Str "1"]]
|
,[Plain [Str "1"]]
|
||||||
,[Plain [Str "1"]]]]
|
,[Plain [Str "1"]]]]
|
||||||
,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "column",Space,Str "headers",Str ":"]
|
,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
|
||||||
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.175,0.1625,0.1875,0.3625]
|
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.175,0.1625,0.1875,0.3625]
|
||||||
[[]
|
[[]
|
||||||
,[]
|
,[]
|
||||||
|
@ -109,9 +109,9 @@
|
||||||
,[]]
|
,[]]
|
||||||
[[[Plain [Str "First"]]
|
[[[Plain [Str "First"]]
|
||||||
,[Plain [Str "row"]]
|
,[Plain [Str "row"]]
|
||||||
,[Plain [Str "12",Str ".",Str "0"]]
|
,[Plain [Str "12.0"]]
|
||||||
,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines",Str "."]]]
|
,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
|
||||||
,[[Plain [Str "Second"]]
|
,[[Plain [Str "Second"]]
|
||||||
,[Plain [Str "row"]]
|
,[Plain [Str "row"]]
|
||||||
,[Plain [Str "5",Str ".",Str "0"]]
|
,[Plain [Str "5.0"]]
|
||||||
,[Plain [Str "Here",Str "'",Str "s",Space,Str "another",Space,Str "one",Str ".",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows",Str "."]]]]]
|
,[Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]]]
|
||||||
|
|
Loading…
Reference in a new issue