git.iko.soy/typeable/pandoc
on master help sign in
Major rewrite of markdown reader.

* Use Builder's Inlines/Blocks instead of lists. * Return values in the reader monad, which are then run (at the end of parsing) against the final parser state. This allows links, notes, and example numbers to be resolved without a second parser pass. * An effect of using Builder is that everything is normalized automatically. * New exports from Text.Pandoc.Parsing: widthsFromIndices, NoteTable', KeyTable', Key', toKey', withQuoteContext, singleQuoteStart, singleQuoteEnd, doubleQuoteStart, doubleQuoteEnd, ellipses, apostrophe, dash * Updated opendocument tests. * Don't derive Show for ParserState. * Benchmarks: markdown reader takes 82% of the time it took before. Markdown writer takes 92% of the time (here the speedup is probably due to the fact that everything is normalized by default).

commitfadc7b0d873cb021b69d06bd37313be84afeecca authorJohn MacFarlane <jgm@berkeley.edu> dateFri 27 Jul 2012, 21:04 (14 years ago) parent973c7ec
10 files changed+953−769
src/Text/Pandoc/Parsing.hs+43−14 src/Text/Pandoc/Readers/Markdown.hs+553−390 src/Text/Pandoc/Readers/RST.hs+2−2 tests/lhs-test.native+3−3 tests/markdown-reader-more.native+10−10 tests/pipe-tables.native+6−6 tests/tables.native+22−22 tests/testsuite.native+134−134 tests/writer.native+134−134 tests/writer.opendocument+46−54
src/Text/Pandoc/Parsing.hs+43−14
@@ -56,6 +56,7 @@ module Text.Pandoc.Parsing ( (>>~),
5656 orderedListMarker,
5757 charRef,
5858 tableWith,
59+ widthsFromIndices,
5960 gridTableWith,
6061 readWith,
6162 testStringWith,
@@ -68,12 +69,24 @@ module Text.Pandoc.Parsing ( (>>~),
6869 ParserContext (..),
6970 QuoteContext (..),
7071 NoteTable,
72+ NoteTable',
7173 KeyTable,
7274 Key,
7375 toKey,
7476 fromKey,
7577 lookupKeySrc,
78+ KeyTable',
79+ Key',
80+ toKey',
7681 smartPunctuation,
82+ withQuoteContext,
83+ singleQuoteStart,
84+ singleQuoteEnd,
85+ doubleQuoteStart,
86+ doubleQuoteEnd,
87+ ellipses,
88+ apostrophe,
89+ dash,
7790 macro,
7891 applyMacros',
7992 Parser,
@@ -133,19 +146,20 @@ where
133146import Text.Pandoc.Definition
134147import Text.Pandoc.Options
135148import Text.Pandoc.Generic
149+import Text.Pandoc.Builder (Blocks)
136150import qualified Text.Pandoc.UTF8 as UTF8 (putStrLn)
137151import Text.Parsec
138152import Text.Parsec.Pos (newPos)
139153import Data.Char ( toLower, toUpper, ord, isAscii, isAlphaNum, isDigit, isPunctuation )
140154import Data.List ( intercalate, transpose )
141155import Network.URI ( parseURI, URI (..), isAllowedInURI )
142−import Control.Monad ( join, liftM, guard, mzero )
143156import Text.Pandoc.Shared
144157import qualified Data.Map as M
145158import Text.TeXMath.Macros (applyMacros, Macro, parseMacroDefinitions)
146159import Text.HTML.TagSoup.Entity ( lookupEntity )
147160import Data.Default
148161import qualified Data.Set as Set
162+import Control.Monad.Reader
149163
150164type Parser t s = Parsec t s
151165
@@ -579,11 +593,12 @@ widthsFromIndices numColumns' indices =
579593-- (which may be grid), then the rows,
580594-- which may be grid, separated by blank lines, and
581595-- ending with a footer (dashed line followed by blank line).
582−gridTableWith :: Parser [Char] ParserState Block -- ^ Block parser
596+gridTableWith :: Parser [Char] ParserState [Block] -- ^ Block list parser
583597 -> Bool -- ^ Headerless table
584598 -> Parser [Char] ParserState Block
585−gridTableWith block headless =
586− tableWith (gridTableHeader headless block) (gridTableRow block) (gridTableSep '-') gridTableFooter
599+gridTableWith blocks headless =
600+ tableWith (gridTableHeader headless blocks) (gridTableRow blocks)
601+ (gridTableSep '-') gridTableFooter
587602
588603gridTableSplitLine :: [Int] -> String -> [String]
589604gridTableSplitLine indices line = map removeFinalBar $ tail $
@@ -608,9 +623,9 @@ gridTableSep ch = try $ gridDashedLines ch >> return '\n'
608623
609624-- | Parse header for a grid table.
610625gridTableHeader :: Bool -- ^ Headerless table
611− -> Parser [Char] ParserState Block
626+ -> Parser [Char] ParserState [Block]
612627 -> Parser [Char] ParserState ([[Block]], [Alignment], [Int])
613−gridTableHeader headless block = try $ do
628+gridTableHeader headless blocks = try $ do
614629 optional blanklines
615630 dashes <- gridDashedLines '-'
616631 rawContent <- if headless
@@ -629,7 +644,7 @@ gridTableHeader headless block = try $ do
629644 then replicate (length dashes) ""
630645 else map (intercalate " ") $ transpose
631646 $ map (gridTableSplitLine indices) rawContent
632− heads <- mapM (parseFromString $ many block) $
647+ heads <- mapM (parseFromString blocks) $
633648 map removeLeadingTrailingSpace rawHeads
634649 return (heads, aligns, indices)
635650
@@ -640,14 +655,14 @@ gridTableRawLine indices = do
640655 return (gridTableSplitLine indices line)
641656
642657-- | Parse row of grid table.
643−gridTableRow :: Parser [Char] ParserState Block
658+gridTableRow :: Parser [Char] ParserState [Block]
644659 -> [Int]
645660 -> Parser [Char] ParserState [[Block]]
646−gridTableRow block indices = do
661+gridTableRow blocks indices = do
647662 colLines <- many1 (gridTableRawLine indices)
648663 let cols = map ((++ "\n") . unlines . removeOneLeadingSpace) $
649664 transpose colLines
650− mapM (liftM compactifyCell . parseFromString (many block)) cols
665+ mapM (liftM compactifyCell . parseFromString blocks) cols
651666
652667removeOneLeadingSpace :: [String] -> [String]
653668removeOneLeadingSpace xs =
@@ -688,10 +703,13 @@ data ParserState = ParserState
688703 { stateOptions :: ReaderOptions, -- ^ User options
689704 stateParserContext :: ParserContext, -- ^ Inside list?
690705 stateQuoteContext :: QuoteContext, -- ^ Inside quoted environment?
706+ stateAllowLinks :: Bool, -- ^ Allow parsing of links
691707 stateMaxNestingLevel :: Int, -- ^ Max # of nested Strong/Emph
692708 stateLastStrPos :: Maybe SourcePos, -- ^ Position after last str parsed
693709 stateKeys :: KeyTable, -- ^ List of reference keys
694− stateNotes :: NoteTable, -- ^ List of notes
710+ stateKeys' :: KeyTable', -- ^ List of reference keys (with fallbacks)
711+ stateNotes :: NoteTable, -- ^ List of notes (raw bodies)
712+ stateNotes' :: NoteTable', -- ^ List of notes (parsed bodies)
695713 stateTitle :: [Inline], -- ^ Title of document
696714 stateAuthors :: [[Inline]], -- ^ Authors of document
697715 stateDate :: [Inline], -- ^ Date of document
@@ -702,7 +720,6 @@ data ParserState = ParserState
702720 stateMacros :: [Macro], -- ^ List of macros defined so far
703721 stateRstDefaultRole :: String -- ^ Current rST default interpreted text role
704722 }
705− deriving Show
706723
707724instance Default ParserState where
708725 def = defaultParserState
@@ -712,10 +729,13 @@ defaultParserState =
712729 ParserState { stateOptions = def,
713730 stateParserContext = NullState,
714731 stateQuoteContext = NoQuote,
732+ stateAllowLinks = True,
715733 stateMaxNestingLevel = 6,
716734 stateLastStrPos = Nothing,
717735 stateKeys = M.empty,
736+ stateKeys' = M.empty,
718737 stateNotes = [],
738+ stateNotes' = [],
719739 stateTitle = [],
720740 stateAuthors = [],
721741 stateDate = [],
@@ -755,6 +775,8 @@ data QuoteContext
755775
756776type NoteTable = [(String, String)]
757777
778+type NoteTable' = [(String, Reader ParserState Blocks)] -- used in markdown reader
779+
758780newtype Key = Key [Inline] deriving (Show, Read, Eq, Ord)
759781
760782toKey :: [Inline] -> Key
@@ -772,6 +794,13 @@ fromKey (Key xs) = xs
772794
773795type KeyTable = M.Map Key Target
774796
797+newtype Key' = Key' String deriving (Show, Read, Eq, Ord)
798+
799+toKey' :: String -> Key'
800+toKey' = Key' . map toLower . unwords . words
801+
802+type KeyTable' = M.Map Key' Target
803+
775804-- | Look up key in key table and return target object.
776805lookupKeySrc :: KeyTable -- ^ Key table
777806 -> Key -- ^ Key
@@ -798,8 +827,8 @@ quoted :: Parser [Char] ParserState Inline
798827quoted inlineParser = doubleQuoted inlineParser <|> singleQuoted inlineParser
799828
800829withQuoteContext :: QuoteContext
801− -> (Parser [Char] ParserState Inline)
802− -> Parser [Char] ParserState Inline
830+ -> Parser [Char] ParserState a
831+ -> Parser [Char] ParserState a
803832withQuoteContext context parser = do
804833 oldState <- getState
805834 let oldQuoteContext = stateQuoteContext oldState
src/Text/Pandoc/Readers/Markdown.hs+553−390
@@ -1,4 +1,5 @@
11{-# LANGUAGE RelaxedPolyRec #-} -- needed for inlinesBetween on GHC < 7
2+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
23{-
34Copyright (C) 2006-2010 John MacFarlane <jgm@berkeley.edu>
45
@@ -36,17 +37,21 @@ import Data.Ord ( comparing )
3637import Data.Char ( isAlphaNum )
3738import Data.Maybe
3839import Text.Pandoc.Definition
39−import Text.Pandoc.Generic
40+import qualified Text.Pandoc.Builder as B
41+import Text.Pandoc.Builder (Inlines(..), Blocks, trimInlines)
4042import Text.Pandoc.Options
41−import Text.Pandoc.Shared
42−import Text.Pandoc.Parsing
43+import Text.Pandoc.Shared hiding (compactify)
44+import Text.Pandoc.Parsing hiding (tableWith)
4345import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
4446import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockTag,
4547 isTextTag, isCommentTag )
4648import Text.Pandoc.XML ( fromEntities )
47−import Control.Monad (when, liftM, guard, mzero, unless )
49+import Data.Monoid
50+import qualified Data.Sequence as Seq -- TODO leaky abstraction, need better isNull in Builder
51+import Control.Applicative ((<$>), (<*), (*>), (<$))
4852import Text.HTML.TagSoup
4953import Text.HTML.TagSoup.Match (tagOpen)
54+import Control.Monad.Reader
5055
5156-- | Read markdown from an input string and return a Pandoc document.
5257readMarkdown :: ReaderOptions -- ^ Reader options
@@ -55,6 +60,16 @@ readMarkdown :: ReaderOptions -- ^ Reader options
5560readMarkdown opts s =
5661 (readWith parseMarkdown) def{ stateOptions = opts } (s ++ "\n\n")
5762
63+type F a = Reader ParserState a
64+
65+instance Monoid a => Monoid (Reader ParserState a) where
66+ mempty = return mempty
67+ mappend = liftM2 mappend
68+ mconcat = liftM mconcat . sequence
69+
70+trimInlinesF :: F Inlines -> F Inlines
71+trimInlinesF = liftM trimInlines
72+
5873--
5974-- Constants and data structure definitions
6075--
@@ -71,7 +86,7 @@ isHruleChar '-' = True
7186isHruleChar '_' = True
7287isHruleChar _ = False
7388
74−setextHChars :: [Char]
89+setextHChars :: String
7590setextHChars = "=-"
7691
7792isBlank :: Char -> Bool
@@ -84,13 +99,23 @@ isBlank _ = False
8499-- auxiliary functions
85100--
86101
87−indentSpaces :: Parser [Char] ParserState [Char]
102+isNull :: F Inlines -> Bool
103+isNull ils = Seq.null $ unInlines (runReader ils def)
104+
105+spnl :: Parser [Char] st ()
106+spnl = try $ do
107+ skipSpaces
108+ optional newline
109+ skipSpaces
110+ notFollowedBy (char '\n')
111+
112+indentSpaces :: Parser [Char] ParserState String
88113indentSpaces = try $ do
89114 tabStop <- getOption readerTabStop
90115 count tabStop (char ' ') <|>
91116 string "\t" <?> "indentation"
92117
93−nonindentSpaces :: Parser [Char] ParserState [Char]
118+nonindentSpaces :: Parser [Char] ParserState String
94119nonindentSpaces = do
95120 tabStop <- getOption readerTabStop
96121 sps <- many (char ' ')
@@ -114,32 +139,31 @@ litChar = escapedChar'
114139
115140-- | Parse a sequence of inline elements between square brackets,
116141-- including inlines between balanced pairs of square brackets.
117−inlinesInBalancedBrackets :: Parser [Char] ParserState Inline
118− -> Parser [Char] ParserState [Inline]
119−inlinesInBalancedBrackets parser = try $ do
142+inlinesInBalancedBrackets :: Parser [Char] ParserState (F Inlines)
143+inlinesInBalancedBrackets = try $ do
120144 char '['
121− result <- manyTill ( (do lookAhead $ try $ do (Str res) <- parser
122− guard (res == "[")
123− bal <- inlinesInBalancedBrackets parser
124− return $ [Str "["] ++ bal ++ [Str "]"])
125− <|> (count 1 parser))
145+ result <- manyTill ( (do lookAhead $ try $ do x <- inline
146+ guard (runReader x def == B.str "[")
147+ bal <- inlinesInBalancedBrackets
148+ return $ (\x -> B.str "[" <> x <> B.str "]") <$> bal)
149+ <|> inline)
126150 (char ']')
127− return $ concat result
151+ return $ mconcat result
128152
129153--
130154-- document structure
131155--
132156
133−titleLine :: Parser [Char] ParserState [Inline]
157+titleLine :: Parser [Char] ParserState (F Inlines)
134158titleLine = try $ do
135159 char '%'
136160 skipSpaces
137161 res <- many $ (notFollowedBy newline >> inline)
138162 <|> try (endline >> whitespace)
139163 newline
140− return $ normalizeSpaces res
164+ return $ trimInlinesF $ mconcat res
141165
142−authorsLine :: Parser [Char] ParserState [[Inline]]
166+authorsLine :: Parser [Char] ParserState (F [Inlines])
143167authorsLine = try $ do
144168 char '%'
145169 skipSpaces
@@ -148,21 +172,20 @@ authorsLine = try $ do
148172 (char ';' <|>
149173 try (newline >> notFollowedBy blankline >> spaceChar))
150174 newline
151− return $ filter (not . null) $ map normalizeSpaces authors
175+ return $ sequence $ filter (not . isNull) $ map (trimInlinesF . mconcat) authors
152176
153−dateLine :: Parser [Char] ParserState [Inline]
177+dateLine :: Parser [Char] ParserState (F Inlines)
154178dateLine = try $ do
155179 char '%'
156180 skipSpaces
157− date <- manyTill inline newline
158− return $ normalizeSpaces date
181+ trimInlinesF . mconcat <$> manyTill inline newline
159182
160−titleBlock :: Parser [Char] ParserState ([Inline], [[Inline]], [Inline])
183+titleBlock :: Parser [Char] ParserState (F Inlines, F [Inlines], F Inlines)
161184titleBlock = try $ do
162185 guardEnabled Ext_pandoc_title_blocks
163− title <- option [] titleLine
164− author <- option [] authorsLine
165− date <- option [] dateLine
186+ title <- option mempty titleLine
187+ author <- option (return []) authorsLine
188+ date <- option mempty dateLine
166189 optional blanklines
167190 return (title, author, date)
168191
@@ -172,45 +195,22 @@ parseMarkdown = do
172195 updateState $ \state -> state { stateOptions =
173196 let oldOpts = stateOptions state in
174197 oldOpts{ readerParseRaw = True } }
175− startPos <- getPosition
176− -- go through once just to get list of reference keys and notes
177− -- docMinusKeys is the raw document with blanks where the keys/notes were...
178− let firstPassParser = referenceKey
179− <|> (guardEnabled Ext_footnotes >> noteBlock)
180− <|> (guardEnabled Ext_delimited_code_blocks >>
181− liftM snd (withRaw codeBlockDelimited))
182− <|> lineClump
183− docMinusKeys <- liftM concat $ manyTill firstPassParser eof
184− setInput docMinusKeys
185− setPosition startPos
186− st' <- getState
187− let reversedNotes = stateNotes st'
188− updateState $ \s -> s { stateNotes = reverse reversedNotes }
189− -- now parse it for real...
190− (title, author, date) <- option ([],[],[]) titleBlock
198+ (title, authors, date) <- option (mempty,return [],mempty) titleBlock
191199 blocks <- parseBlocks
192− let doc = Pandoc (Meta title author date) $ filter (/= Null) blocks
193− -- if there are labeled examples, change references into numbers
194− examples <- liftM stateExamples getState
195− let handleExampleRef :: Inline -> Inline
196− handleExampleRef z@(Str ('@':xs)) =
197− case M.lookup xs examples of
198− Just n -> Str (show n)
199− Nothing -> z
200− handleExampleRef z = z
201− if M.null examples
202− then return doc
203− else return $ bottomUp handleExampleRef doc
200+ st <- getState
201+ return $ B.setTitle (runReader title st)
202+ $ B.setAuthors (runReader authors st)
203+ $ B.setDate (runReader date st)
204+ $ B.doc $ runReader blocks st
204205
205206--
206207-- initial pass for references and notes
207208--
208209
209−referenceKey :: Parser [Char] ParserState [Char]
210+referenceKey :: Parser [Char] ParserState (F Blocks)
210211referenceKey = try $ do
211− startPos <- getPosition
212212 skipNonindentSpaces
213− lab <- reference
213+ (_,raw) <- reference
214214 char ':'
215215 skipSpaces >> optional newline >> skipSpaces >> notFollowedBy (char '[')
216216 let sourceURL = liftM unwords $ many $ try $ do
@@ -218,20 +218,18 @@ referenceKey = try $ do
218218 skipMany spaceChar
219219 optional $ newline >> notFollowedBy blankline
220220 skipMany spaceChar
221− notFollowedBy' reference
221+ notFollowedBy' (() <$ reference)
222222 many1 $ escapedChar' <|> satisfy (not . isBlank)
223223 let betweenAngles = try $ char '<' >>
224224 manyTill (escapedChar' <|> litChar) (char '>')
225225 src <- try betweenAngles <|> sourceURL
226226 tit <- option "" referenceTitle
227227 blanklines
228− endPos <- getPosition
229228 let target = (escapeURI $ removeTrailingSpace src, tit)
230229 st <- getState
231− let oldkeys = stateKeys st
232− updateState $ \s -> s { stateKeys = M.insert (toKey lab) target oldkeys }
233− -- return blanks so line count isn't affected
234− return $ replicate (sourceLine endPos - sourceLine startPos) '\n'
230+ let oldkeys = stateKeys' st
231+ updateState $ \s -> s { stateKeys' = M.insert (toKey' raw) target oldkeys }
232+ return $ return mempty
235233
236234referenceTitle :: Parser [Char] ParserState String
237235referenceTitle = try $ do
@@ -242,25 +240,24 @@ referenceTitle = try $ do
242240 notFollowedBy (noneOf ")\n")))
243241 return $ fromEntities tit
244242
245−noteMarker :: Parser [Char] ParserState [Char]
243+noteMarker :: Parser [Char] ParserState String
246244noteMarker = string "[^" >> many1Till (satisfy $ not . isBlank) (char ']')
247245
248−rawLine :: Parser [Char] ParserState [Char]
246+rawLine :: Parser [Char] ParserState String
249247rawLine = try $ do
250248 notFollowedBy blankline
251249 notFollowedBy' $ try $ skipNonindentSpaces >> noteMarker
252250 optional indentSpaces
253251 anyLine
254252
255−rawLines :: Parser [Char] ParserState [Char]
253+rawLines :: Parser [Char] ParserState String
256254rawLines = do
257255 first <- anyLine
258256 rest <- many rawLine
259257 return $ unlines (first:rest)
260258
261−noteBlock :: Parser [Char] ParserState [Char]
259+noteBlock :: Parser [Char] ParserState (F Blocks)
262260noteBlock = try $ do
263− startPos <- getPosition
264261 skipNonindentSpaces
265262 ref <- noteMarker
266263 char ':'
@@ -270,24 +267,21 @@ noteBlock = try $ do
270267 (try (blankline >> indentSpaces >>
271268 notFollowedBy blankline))
272269 optional blanklines
273− endPos <- getPosition
274− let newnote = (ref, (intercalate "\n" raw) ++ "\n\n")
275− st <- getState
276− let oldnotes = stateNotes st
277− updateState $ \s -> s { stateNotes = newnote : oldnotes }
278− -- return blanks so line count isn't affected
279− return $ replicate (sourceLine endPos - sourceLine startPos) '\n'
270+ parsed <- parseFromString parseBlocks $ unlines raw ++ "\n"
271+ let newnote = (ref, parsed)
272+ updateState $ \s -> s { stateNotes' = newnote : stateNotes' s }
273+ return mempty
280274
281275--
282276-- parsing blocks
283277--
284278
285−parseBlocks :: Parser [Char] ParserState [Block]
286−parseBlocks = manyTill block eof
279+parseBlocks :: Parser [Char] ParserState (F Blocks)
280+parseBlocks = mconcat <$> manyTill block eof
287281
288−block :: Parser [Char] ParserState Block
282+block :: Parser [Char] ParserState (F Blocks)
289283block = choice [ codeBlockDelimited
290− , guardEnabled Ext_latex_macros >> macro
284+ , guardEnabled Ext_latex_macros *> (mempty <$ macro)
291285 , header
292286 , table
293287 , codeBlockIndented
@@ -298,46 +292,48 @@ block = choice [ codeBlockDelimited
298292 , orderedList
299293 , definitionList
300294 , rawTeXBlock
301− , para
302295 , htmlBlock
296+ , noteBlock
297+ , referenceKey
298+ , para
303299 , plain
304− , nullBlock ] <?> "block"
300+ ] <?> "block"
305301
306302--
307303-- header blocks
308304--
309305
310−header :: Parser [Char] ParserState Block
306+header :: Parser [Char] ParserState (F Blocks)
311307header = setextHeader <|> atxHeader <?> "header"
312308
313−atxHeader :: Parser [Char] ParserState Block
309+atxHeader :: Parser [Char] ParserState (F Blocks)
314310atxHeader = try $ do
315311 level <- many1 (char '#') >>= return . length
316312 notFollowedBy (char '.' <|> char ')') -- this would be a list
317313 skipSpaces
318− text <- manyTill inline atxClosing >>= return . normalizeSpaces
319− return $ Header level text
314+ text <- trimInlinesF . mconcat <$> manyTill inline atxClosing
315+ return $ B.header level <$> text
320316
321−atxClosing :: Parser [Char] st [Char]
317+atxClosing :: Parser [Char] st String
322318atxClosing = try $ skipMany (char '#') >> blanklines
323319
324−setextHeader :: Parser [Char] ParserState Block
320+setextHeader :: Parser [Char] ParserState (F Blocks)
325321setextHeader = try $ do
326322 -- This lookahead prevents us from wasting time parsing Inlines
327323 -- unless necessary -- it gives a significant performance boost.
328324 lookAhead $ anyLine >> many1 (oneOf setextHChars) >> blankline
329− text <- many1Till inline newline
325+ text <- trimInlinesF . mconcat <$> many1Till inline newline
330326 underlineChar <- oneOf setextHChars
331327 many (char underlineChar)
332328 blanklines
333329 let level = (fromMaybe 0 $ findIndex (== underlineChar) setextHChars) + 1
334− return $ Header level (normalizeSpaces text)
330+ return $ B.header level <$> text
335331
336332--
337333-- hrule block
338334--
339335
340−hrule :: Parser [Char] st Block
336+hrule :: Parser [Char] st (F Blocks)
341337hrule = try $ do
342338 skipSpaces
343339 start <- satisfy isHruleChar
@@ -345,13 +341,13 @@ hrule = try $ do
345341 skipMany (spaceChar <|> char start)
346342 newline
347343 optional blanklines
348− return HorizontalRule
344+ return $ return B.horizontalRule
349345
350346--
351347-- code blocks
352348--
353349
354−indentedLine :: Parser [Char] ParserState [Char]
350+indentedLine :: Parser [Char] ParserState String
355351indentedLine = indentSpaces >> manyTill anyChar newline >>= return . (++ "\n")
356352
357353blockDelimiter :: (Char -> Bool)
@@ -370,7 +366,7 @@ blockDelimiter f len = try $ do
370366 blankline
371367 return (size, attr, c)
372368
373−attributes :: Parser [Char] st ([Char], [[Char]], [([Char], [Char])])
369+attributes :: Parser [Char] st (String, [String], [(String, String)])
374370attributes = try $ do
375371 char '{'
376372 spnl
@@ -382,28 +378,28 @@ attributes = try $ do
382378 | otherwise = firstNonNull xs
383379 return (firstNonNull $ reverse ids, concat classes, concat keyvals)
384380
385−attribute :: Parser [Char] st ([Char], [[Char]], [([Char], [Char])])
381+attribute :: Parser [Char] st (String, [String], [(String, String)])
386382attribute = identifierAttr <|> classAttr <|> keyValAttr
387383
388−identifier :: Parser [Char] st [Char]
384+identifier :: Parser [Char] st String
389385identifier = do
390386 first <- letter
391387 rest <- many $ alphaNum <|> oneOf "-_:."
392388 return (first:rest)
393389
394−identifierAttr :: Parser [Char] st ([Char], [a], [a1])
390+identifierAttr :: Parser [Char] st (String, [a], [a1])
395391identifierAttr = try $ do
396392 char '#'
397393 result <- identifier
398394 return (result,[],[])
399395
400−classAttr :: Parser [Char] st ([Char], [[Char]], [a])
396+classAttr :: Parser [Char] st (String, [String], [a])
401397classAttr = try $ do
402398 char '.'
403399 result <- identifier
404400 return ("",[result],[])
405401
406−keyValAttr :: Parser [Char] st ([Char], [a], [([Char], [Char])])
402+keyValAttr :: Parser [Char] st (String, [a], [(String, String)])
407403keyValAttr = try $ do
408404 key <- identifier
409405 char '='
@@ -412,15 +408,15 @@ keyValAttr = try $ do
412408 <|> many nonspaceChar
413409 return ("",[],[(key,val)])
414410
415−codeBlockDelimited :: Parser [Char] ParserState Block
411+codeBlockDelimited :: Parser [Char] ParserState (F Blocks)
416412codeBlockDelimited = try $ do
417413 guardEnabled Ext_delimited_code_blocks
418414 (size, attr, c) <- blockDelimiter (\c -> c == '~' || c == '`') Nothing
419415 contents <- manyTill anyLine (blockDelimiter (== c) (Just size))
420416 blanklines
421− return $ CodeBlock attr $ intercalate "\n" contents
417+ return $ return $ B.codeBlockWith attr $ intercalate "\n" contents
422418
423−codeBlockIndented :: Parser [Char] ParserState Block
419+codeBlockIndented :: Parser [Char] ParserState (F Blocks)
424420codeBlockIndented = do
425421 contents <- many1 (indentedLine <|>
426422 try (do b <- blanklines
@@ -428,16 +424,16 @@ codeBlockIndented = do
428424 return $ b ++ l))
429425 optional blanklines
430426 classes <- getOption readerIndentedCodeClasses
431− return $ CodeBlock ("", classes, []) $
427+ return $ return $ B.codeBlockWith ("", classes, []) $
432428 stripTrailingNewlines $ concat contents
433429
434−lhsCodeBlock :: Parser [Char] ParserState Block
430+lhsCodeBlock :: Parser [Char] ParserState (F Blocks)
435431lhsCodeBlock = do
436432 failUnlessLHS
437− liftM (CodeBlock ("",["sourceCode","literate","haskell"],[]))
438− (lhsCodeBlockBird <|> lhsCodeBlockLaTeX)
439− <|> liftM (CodeBlock ("",["sourceCode","haskell"],[]))
440− lhsCodeBlockInverseBird
433+ (return . B.codeBlockWith ("",["sourceCode","literate","haskell"],[]) <$>
434+ (lhsCodeBlockBird <|> lhsCodeBlockLaTeX))
435+ <|> (return . B.codeBlockWith ("",["sourceCode","haskell"],[]) <$>
436+ lhsCodeBlockInverseBird)
441437
442438lhsCodeBlockLaTeX :: Parser [Char] ParserState String
443439lhsCodeBlockLaTeX = try $ do
@@ -465,14 +461,13 @@ lhsCodeBlockBirdWith c = try $ do
465461 blanklines
466462 return $ intercalate "\n" lns'
467463
468−birdTrackLine :: Char -> Parser [Char] st [Char]
464+birdTrackLine :: Char -> Parser [Char] st String
469465birdTrackLine c = try $ do
470466 char c
471467 -- allow html tags on left margin:
472468 when (c == '<') $ notFollowedBy letter
473469 manyTill anyChar newline
474470
475−
476471--
477472-- block quotes
478473--
@@ -480,7 +475,7 @@ birdTrackLine c = try $ do
480475emailBlockQuoteStart :: Parser [Char] ParserState Char
481476emailBlockQuoteStart = try $ skipNonindentSpaces >> char '>' >>~ optional (char ' ')
482477
483−emailBlockQuote :: Parser [Char] ParserState [[Char]]
478+emailBlockQuote :: Parser [Char] ParserState [String]
484479emailBlockQuote = try $ do
485480 emailBlockQuoteStart
486481 raw <- sepBy (many (nonEndline <|>
@@ -491,12 +486,12 @@ emailBlockQuote = try $ do
491486 optional blanklines
492487 return raw
493488
494−blockQuote :: Parser [Char] ParserState Block
489+blockQuote :: Parser [Char] ParserState (F Blocks)
495490blockQuote = do
496491 raw <- emailBlockQuote
497492 -- parse the extracted block, which may contain various block elements:
498493 contents <- parseFromString parseBlocks $ (intercalate "\n" raw) ++ "\n\n"
499− return $ BlockQuote contents
494+ return $ B.blockQuote <$> contents
500495
501496--
502497-- list blocks
@@ -506,7 +501,7 @@ bulletListStart :: Parser [Char] ParserState ()
506501bulletListStart = try $ do
507502 optional newline -- if preceded by a Plain block in a list context
508503 skipNonindentSpaces
509− notFollowedBy' hrule -- because hrules start out just like lists
504+ notFollowedBy' (() <$ hrule) -- because hrules start out just like lists
510505 satisfy isBulletListMarker
511506 spaceChar
512507 skipSpaces
@@ -516,26 +511,25 @@ anyOrderedListStart = try $ do
516511 optional newline -- if preceded by a Plain block in a list context
517512 skipNonindentSpaces
518513 notFollowedBy $ string "p." >> spaceChar >> digit -- page number
519− state <- getState
520− if readerStrict (stateOptions state)
521− then do many1 digit
522− char '.'
523− spaceChar
524− return (1, DefaultStyle, DefaultDelim)
525− else do (num, style, delim) <- anyOrderedListMarker
526− -- if it could be an abbreviated first name, insist on more than one space
527− if delim == Period && (style == UpperAlpha || (style == UpperRoman &&
528− num `elem` [1, 5, 10, 50, 100, 500, 1000]))
529− then char '\t' <|> (try $ char ' ' >> spaceChar)
530− else spaceChar
531− skipSpaces
532− return (num, style, delim)
514+ (guardDisabled Ext_fancy_lists >>
515+ do many1 digit
516+ char '.'
517+ spaceChar
518+ return (1, DefaultStyle, DefaultDelim))
519+ <|> do (num, style, delim) <- anyOrderedListMarker
520+ -- if it could be an abbreviated first name, insist on more than one space
521+ if delim == Period && (style == UpperAlpha || (style == UpperRoman &&
522+ num `elem` [1, 5, 10, 50, 100, 500, 1000]))
523+ then char '\t' <|> (try $ char ' ' >> spaceChar)
524+ else spaceChar
525+ skipSpaces
526+ return (num, style, delim)
533527
534528listStart :: Parser [Char] ParserState ()
535529listStart = bulletListStart <|> (anyOrderedListStart >> return ())
536530
537531-- parse a line of a list item (start = parser for beginning of list item)
538−listLine :: Parser [Char] ParserState [Char]
532+listLine :: Parser [Char] ParserState String
539533listLine = try $ do
540534 notFollowedBy blankline
541535 notFollowedBy' (do indentSpaces
@@ -546,7 +540,7 @@ listLine = try $ do
546540
547541-- parse raw text for one list item, excluding start marker and continuations
548542rawListItem :: Parser [Char] ParserState a
549− -> Parser [Char] ParserState [Char]
543+ -> Parser [Char] ParserState String
550544rawListItem start = try $ do
551545 start
552546 first <- listLine
@@ -557,14 +551,14 @@ rawListItem start = try $ do
557551-- continuation of a list item - indented and separated by blankline
558552-- or (in compact lists) endline.
559553-- note: nested lists are parsed as continuations
560−listContinuation :: Parser [Char] ParserState [Char]
554+listContinuation :: Parser [Char] ParserState String
561555listContinuation = try $ do
562556 lookAhead indentSpaces
563557 result <- many1 listContinuationLine
564558 blanks <- many blankline
565559 return $ concat result ++ blanks
566560
567−listContinuationLine :: Parser [Char] ParserState [Char]
561+listContinuationLine :: Parser [Char] ParserState String
568562listContinuationLine = try $ do
569563 notFollowedBy blankline
570564 notFollowedBy' listStart
@@ -573,7 +567,7 @@ listContinuationLine = try $ do
573567 return $ result ++ "\n"
574568
575569listItem :: Parser [Char] ParserState a
576− -> Parser [Char] ParserState [Block]
570+ -> Parser [Char] ParserState (F Blocks)
577571listItem start = try $ do
578572 first <- rawListItem start
579573 continuations <- many listContinuation
@@ -589,23 +583,39 @@ listItem start = try $ do
589583 updateState (\st -> st {stateParserContext = oldContext})
590584 return contents
591585
592−orderedList :: Parser [Char] ParserState Block
586+orderedList :: Parser [Char] ParserState (F Blocks)
593587orderedList = try $ do
594588 (start, style, delim) <- lookAhead anyOrderedListStart
595589 unless ((style == DefaultStyle || style == Decimal || style == Example) &&
596590 (delim == DefaultDelim || delim == Period)) $
597591 guardEnabled Ext_fancy_lists
598592 when (style == Example) $ guardEnabled Ext_example_lists
599− items <- many1 $ listItem $ try $
600− do optional newline -- if preceded by a Plain block in a list context
601− skipNonindentSpaces
602− orderedListMarker style delim
593+ items <- fmap sequence $ many1 $ listItem
594+ ( try $ do
595+ optional newline -- if preceded by Plain block in a list
596+ skipNonindentSpaces
597+ orderedListMarker style delim )
603598 start' <- option 1 $ guardEnabled Ext_startnum >> return start
604− return $ OrderedList (start', style, delim) $ compactify items
605−
606−bulletList :: Parser [Char] ParserState Block
607−bulletList =
608− many1 (listItem bulletListStart) >>= return . BulletList . compactify
599+ return $ B.orderedListWith (start', style, delim) <$> fmap compactify items
600+
601+-- | Change final list item from @Para@ to @Plain@ if the list contains
602+-- no other @Para@ blocks. (From Shared, modified for Blocks rather than [Block].)
603+compactify :: [Blocks] -- ^ List of list items (each a list of blocks)
604+ -> [Blocks]
605+compactify [] = []
606+compactify items =
607+ let (others, final) = (init items, last items)
608+ in case reverse (B.toList final) of
609+ (Para a:xs) -> case [Para x | Para x <- concatMap B.toList items] of
610+ -- if this is only Para, change to Plain
611+ [_] -> others ++ [B.fromList (reverse $ Plain a : xs)]
612+ _ -> items
613+ _ -> items
614+
615+bulletList :: Parser [Char] ParserState (F Blocks)
616+bulletList = do
617+ items <- fmap sequence $ many1 $ listItem bulletListStart
618+ return $ B.bulletList <$> fmap compactify items
609619
610620-- definition lists
611621
@@ -620,12 +630,12 @@ defListMarker = do
620630 else mzero
621631 return ()
622632
623−definitionListItem :: Parser [Char] ParserState ([Inline], [[Block]])
633+definitionListItem :: Parser [Char] ParserState (F (Inlines, [Blocks]))
624634definitionListItem = try $ do
625635 guardEnabled Ext_definition_lists
626636 -- first, see if this has any chance of being a definition list:
627637 lookAhead (anyLine >> optional blankline >> defListMarker)
628− term <- manyTill inline newline
638+ term <- trimInlinesF . mconcat <$> manyTill inline newline
629639 optional blankline
630640 raw <- many1 defRawBlock
631641 state <- getState
@@ -633,9 +643,9 @@ definitionListItem = try $ do
633643 -- parse the extracted block, which may contain various block elements:
634644 contents <- mapM (parseFromString parseBlocks) raw
635645 updateState (\st -> st {stateParserContext = oldContext})
636− return ((normalizeSpaces term), contents)
646+ return $ liftM2 (,) term (sequence contents)
637647
638−defRawBlock :: Parser [Char] ParserState [Char]
648+defRawBlock :: Parser [Char] ParserState String
639649defRawBlock = try $ do
640650 defListMarker
641651 firstline <- anyLine
@@ -647,58 +657,63 @@ defRawBlock = try $ do
647657 return $ unlines lns ++ trl
648658 return $ firstline ++ "\n" ++ unlines rawlines ++ trailing ++ cont
649659
650−definitionList :: Parser [Char] ParserState Block
660+definitionList :: Parser [Char] ParserState (F Blocks)
651661definitionList = do
652− items <- many1 definitionListItem
653− -- "compactify" the definition list:
654− let defs = map snd items
655− let defBlocks = reverse $ concat $ concat defs
656− let isPara (Para _) = True
662+ items <- fmap sequence $ many1 definitionListItem
663+ return $ B.definitionList <$> fmap compactifyDL items
664+
665+compactifyDL :: [(Inlines, [Blocks])] -> [(Inlines, [Blocks])]
666+compactifyDL items =
667+ let defs = concatMap snd items
668+ defBlocks = reverse $ concatMap B.toList defs
669+ isPara (Para _) = True
657670 isPara _ = False
658− let items' = case take 1 defBlocks of
659− [Para x] -> if not $ any isPara (drop 1 defBlocks)
660− then let (t,ds) = last items
661− lastDef = last ds
662− ds' = init ds ++
663− [init lastDef ++ [Plain x]]
664− in init items ++ [(t, ds')]
665− else items
666− _ -> items
667− return $ DefinitionList items'
671+ in case defBlocks of
672+ (Para x:_) -> if not $ any isPara (drop 1 defBlocks)
673+ then let (t,ds) = last items
674+ lastDef = B.toList $ last ds
675+ ds' = init ds ++
676+ [B.fromList $ init lastDef ++ [Plain x]]
677+ in init items ++ [(t, ds')]
678+ else items
679+ _ -> items
668680
669681--
670682-- paragraph block
671683--
672684
685+{-
673686isHtmlOrBlank :: Inline -> Bool
674687isHtmlOrBlank (RawInline "html" _) = True
675688isHtmlOrBlank (Space) = True
676689isHtmlOrBlank (LineBreak) = True
677690isHtmlOrBlank _ = False
691+-}
678692
679−para :: Parser [Char] ParserState Block
693+para :: Parser [Char] ParserState (F Blocks)
680694para = try $ do
681− result <- liftM normalizeSpaces $ many1 inline
682− guard $ not . all isHtmlOrBlank $ result
683− option (Plain result) $ try $ do
695+ result <- trimInlinesF . mconcat <$> many1 inline
696+ -- TODO remove this if not really needed? and remove isHtmlOrBlank
697+ -- guard $ not $ F.all isHtmlOrBlank result
698+ option (B.plain <$> result) $ try $ do
684699 newline
685− (blanklines >> return Null)
700+ (blanklines >> return mempty)
686701 <|> (guardDisabled Ext_blank_before_blockquote >> lookAhead blockQuote)
687702 <|> (guardDisabled Ext_blank_before_header >> lookAhead header)
688− return $ Para result
703+ return $ B.para <$> result
689704
690−plain :: Parser [Char] ParserState Block
691−plain = many1 inline >>~ spaces >>= return . Plain . normalizeSpaces
705+plain :: Parser [Char] ParserState (F Blocks)
706+plain = fmap B.plain . trimInlinesF . mconcat <$> many1 inline <* spaces
692707
693708--
694709-- raw html
695710--
696711
697−htmlElement :: Parser [Char] ParserState [Char]
712+htmlElement :: Parser [Char] ParserState String
698713htmlElement = strictHtmlBlock <|> liftM snd (htmlTag isBlockTag)
699714
700−htmlBlock :: Parser [Char] ParserState Block
701−htmlBlock = RawBlock "html" `fmap`
715+htmlBlock :: Parser [Char] ParserState (F Blocks)
716+htmlBlock = return . B.rawBlock "html" <$>
702717 ((guardEnabled Ext_markdown_in_html_blocks >> rawHtmlBlocks)
703718 <|> htmlBlock')
704719
@@ -709,7 +724,7 @@ htmlBlock' = try $ do
709724 finalNewlines <- many newline
710725 return $ first ++ finalSpace ++ finalNewlines
711726
712−strictHtmlBlock :: Parser [Char] ParserState [Char]
727+strictHtmlBlock :: Parser [Char] ParserState String
713728strictHtmlBlock = htmlInBalanced (not . isInlineTag)
714729
715730rawVerbatimBlock :: Parser [Char] ParserState String
@@ -720,13 +735,13 @@ rawVerbatimBlock = try $ do
720735 contents <- manyTill anyChar (htmlTag (~== TagClose tag))
721736 return $ open ++ contents ++ renderTags [TagClose tag]
722737
723−rawTeXBlock :: Parser [Char] ParserState Block
738+rawTeXBlock :: Parser [Char] ParserState (F Blocks)
724739rawTeXBlock = do
725740 guardEnabled Ext_raw_tex
726− result <- liftM (RawBlock "latex") rawLaTeXBlock
727− <|> liftM (RawBlock "context") rawConTeXtEnvironment
741+ result <- (B.rawBlock "latex" <$> rawLaTeXBlock)
742+ <|> (B.rawBlock "context" <$> rawConTeXtEnvironment)
728743 spaces
729− return result
744+ return $ return result
730745
731746rawHtmlBlocks :: Parser [Char] ParserState String
732747rawHtmlBlocks = do
@@ -760,7 +775,7 @@ dashedLine ch = do
760775-- Parse a table header with dashed lines of '-' preceded by
761776-- one (or zero) line of text.
762777simpleTableHeader :: Bool -- ^ Headerless table
763− -> Parser [Char] ParserState ([[Block]], [Alignment], [Int])
778+ -> Parser [Char] ParserState (F [Blocks], [Alignment], [Int])
764779simpleTableHeader headless = try $ do
765780 rawContent <- if headless
766781 then return ""
@@ -779,12 +794,32 @@ simpleTableHeader headless = try $ do
779794 let rawHeads' = if headless
780795 then replicate (length dashes) ""
781796 else rawHeads
782− heads <- mapM (parseFromString (many plain)) $
783− map removeLeadingTrailingSpace rawHeads'
797+ heads <- fmap sequence
798+ $ mapM (parseFromString (mconcat <$> many plain))
799+ $ map removeLeadingTrailingSpace rawHeads'
784800 return (heads, aligns, indices)
785801
802+-- Returns an alignment type for a table, based on a list of strings
803+-- (the rows of the column header) and a number (the length of the
804+-- dashed line under the rows.
805+alignType :: [String]
806+ -> Int
807+ -> Alignment
808+alignType [] _ = AlignDefault
809+alignType strLst len =
810+ let nonempties = filter (not . null) $ map removeTrailingSpace strLst
811+ (leftSpace, rightSpace) =
812+ case sortBy (comparing length) nonempties of
813+ (x:_) -> (head x `elem` " \t", length x < len)
814+ [] -> (False, False)
815+ in case (leftSpace, rightSpace) of
816+ (True, False) -> AlignRight
817+ (False, True) -> AlignLeft
818+ (True, True) -> AlignCenter
819+ (False, False) -> AlignDefault
820+
786821-- Parse a table footer - dashed lines followed by blank line.
787−tableFooter :: Parser [Char] ParserState [Char]
822+tableFooter :: Parser [Char] ParserState String
788823tableFooter = try $ skipNonindentSpaces >> many1 (dashedLine '-') >> blanklines
789824
790825-- Parse a table separator - dashed line.
@@ -802,49 +837,49 @@ rawTableLine indices = do
802837
803838-- Parse a table line and return a list of lists of blocks (columns).
804839tableLine :: [Int]
805− -> Parser [Char] ParserState [[Block]]
806−tableLine indices = rawTableLine indices >>= mapM (parseFromString (many plain))
840+ -> Parser [Char] ParserState (F [Blocks])
841+tableLine indices = rawTableLine indices >>=
842+ fmap sequence . mapM (parseFromString (mconcat <$> many plain))
807843
808844-- Parse a multiline table row and return a list of blocks (columns).
809845multilineRow :: [Int]
810− -> Parser [Char] ParserState [[Block]]
846+ -> Parser [Char] ParserState (F [Blocks])
811847multilineRow indices = do
812848 colLines <- many1 (rawTableLine indices)
813849 let cols = map unlines $ transpose colLines
814− mapM (parseFromString (many plain)) cols
850+ fmap sequence $ mapM (parseFromString (mconcat <$> many plain)) cols
815851
816852-- Parses a table caption: inlines beginning with 'Table:'
817853-- and followed by blank lines.
818−tableCaption :: Parser [Char] ParserState [Inline]
854+tableCaption :: Parser [Char] ParserState (F Inlines)
819855tableCaption = try $ do
820856 guardEnabled Ext_table_captions
821857 skipNonindentSpaces
822858 string ":" <|> string "Table:"
823− result <- many1 inline
824− blanklines
825− return $ normalizeSpaces result
859+ trimInlinesF . mconcat <$> many1 inline <* blanklines
826860
827861-- Parse a simple table with '---' header and one line per row.
828862simpleTable :: Bool -- ^ Headerless table
829− -> Parser [Char] ParserState Block
863+ -> Parser [Char] ParserState ([Alignment], [Double], F [Blocks], F [[Blocks]])
830864simpleTable headless = do
831− Table c a _w h l <- tableWith (simpleTableHeader headless) tableLine
865+ (aligns, _widths, heads', lines') <-
866+ tableWith (simpleTableHeader headless) tableLine
832867 (return ())
833868 (if headless then tableFooter else tableFooter <|> blanklines)
834869 -- Simple tables get 0s for relative column widths (i.e., use default)
835− return $ Table c a (replicate (length a) 0) h l
870+ return (aligns, replicate (length aligns) 0, heads', lines')
836871
837872-- Parse a multiline table: starts with row of '-' on top, then header
838873-- (which may be multiline), then the rows,
839874-- which may be multiline, separated by blank lines, and
840875-- ending with a footer (dashed line followed by blank line).
841876multilineTable :: Bool -- ^ Headerless table
842− -> Parser [Char] ParserState Block
877+ -> Parser [Char] ParserState ([Alignment], [Double], F [Blocks], F [[Blocks]])
843878multilineTable headless =
844879 tableWith (multilineTableHeader headless) multilineRow blanklines tableFooter
845880
846881multilineTableHeader :: Bool -- ^ Headerless table
847− -> Parser [Char] ParserState ([[Block]], [Alignment], [Int])
882+ -> Parser [Char] ParserState (F [Blocks], [Alignment], [Int])
848883multilineTableHeader headless = try $ do
849884 if headless
850885 then return '\n'
@@ -868,70 +903,142 @@ multilineTableHeader headless = try $ do
868903 let rawHeads = if headless
869904 then replicate (length dashes) ""
870905 else map (intercalate " ") rawHeadsList
871− heads <- mapM (parseFromString (many plain)) $
906+ heads <- fmap sequence $
907+ mapM (parseFromString (mconcat <$> many plain)) $
872908 map removeLeadingTrailingSpace rawHeads
873909 return (heads, aligns, indices)
874910
875−-- Returns an alignment type for a table, based on a list of strings
876−-- (the rows of the column header) and a number (the length of the
877−-- dashed line under the rows.
878−alignType :: [String]
879− -> Int
880− -> Alignment
881−alignType [] _ = AlignDefault
882−alignType strLst len =
883− let nonempties = filter (not . null) $ map removeTrailingSpace strLst
884− (leftSpace, rightSpace) =
885− case sortBy (comparing length) nonempties of
886− (x:_) -> (head x `elem` " \t", length x < len)
887− [] -> (False, False)
888− in case (leftSpace, rightSpace) of
889− (True, False) -> AlignRight
890− (False, True) -> AlignLeft
891− (True, True) -> AlignCenter
892− (False, False) -> AlignDefault
893−
911+-- Parse a grid table: starts with row of '-' on top, then header
912+-- (which may be grid), then the rows,
913+-- which may be grid, separated by blank lines, and
914+-- ending with a footer (dashed line followed by blank line).
894915gridTable :: Bool -- ^ Headerless table
895− -> Parser [Char] ParserState Block
896−gridTable = gridTableWith block
916+ -> Parser [Char] ParserState ([Alignment], [Double], F [Blocks], F [[Blocks]])
917+gridTable headless =
918+ tableWith (gridTableHeader headless) gridTableRow
919+ (gridTableSep '-') gridTableFooter
920+
921+gridTableSplitLine :: [Int] -> String -> [String]
922+gridTableSplitLine indices line = map removeFinalBar $ tail $
923+ splitStringByIndices (init indices) $ removeTrailingSpace line
924+
925+gridPart :: Char -> Parser [Char] st (Int, Int)
926+gridPart ch = do
927+ dashes <- many1 (char ch)
928+ char '+'
929+ return (length dashes, length dashes + 1)
930+
931+gridDashedLines :: Char -> Parser [Char] st [(Int,Int)]
932+gridDashedLines ch = try $ char '+' >> many1 (gridPart ch) >>~ blankline
933+
934+removeFinalBar :: String -> String
935+removeFinalBar =
936+ reverse . dropWhile (`elem` " \t") . dropWhile (=='|') . reverse
937+
938+-- | Separator between rows of grid table.
939+gridTableSep :: Char -> Parser [Char] ParserState Char
940+gridTableSep ch = try $ gridDashedLines ch >> return '\n'
941+
942+-- | Parse header for a grid table.
943+gridTableHeader :: Bool -- ^ Headerless table
944+ -> Parser [Char] ParserState (F [Blocks], [Alignment], [Int])
945+gridTableHeader headless = try $ do
946+ optional blanklines
947+ dashes <- gridDashedLines '-'
948+ rawContent <- if headless
949+ then return $ repeat ""
950+ else many1
951+ (notFollowedBy (gridTableSep '=') >> char '|' >>
952+ many1Till anyChar newline)
953+ if headless
954+ then return ()
955+ else gridTableSep '=' >> return ()
956+ let lines' = map snd dashes
957+ let indices = scanl (+) 0 lines'
958+ let aligns = replicate (length lines') AlignDefault
959+ -- RST does not have a notion of alignments
960+ let rawHeads = if headless
961+ then replicate (length dashes) ""
962+ else map (intercalate " ") $ transpose
963+ $ map (gridTableSplitLine indices) rawContent
964+ heads <- fmap sequence $ mapM (parseFromString block) $
965+ map removeLeadingTrailingSpace rawHeads
966+ return (heads, aligns, indices)
967+
968+gridTableRawLine :: [Int] -> Parser [Char] ParserState [String]
969+gridTableRawLine indices = do
970+ char '|'
971+ line <- many1Till anyChar newline
972+ return (gridTableSplitLine indices line)
973+
974+-- | Parse row of grid table.
975+gridTableRow :: [Int]
976+ -> Parser [Char] ParserState (F [Blocks])
977+gridTableRow indices = do
978+ colLines <- many1 (gridTableRawLine indices)
979+ let cols = map ((++ "\n") . unlines . removeOneLeadingSpace) $
980+ transpose colLines
981+ fmap compactify <$> fmap sequence (mapM (parseFromString block) cols)
982+
983+removeOneLeadingSpace :: [String] -> [String]
984+removeOneLeadingSpace xs =
985+ if all startsWithSpace xs
986+ then map (drop 1) xs
987+ else xs
988+ where startsWithSpace "" = True
989+ startsWithSpace (y:_) = y == ' '
990+
991+-- | Parse footer for a grid table.
992+gridTableFooter :: Parser [Char] ParserState [Char]
993+gridTableFooter = blanklines
897994
898995pipeTable :: Bool -- ^ Headerless table
899− -> Parser [Char] ParserState Block
900−pipeTable headless = tableWith (pipeTableHeader headless)
901− (\_ -> pipeTableRow) (return ()) blanklines
996+ -> Parser [Char] ParserState ([Alignment], [Double], F [Blocks], F [[Blocks]])
997+pipeTable headless =
998+ tableWith (pipeTableHeader headless)
999+ (\_ -> pipeTableRow) (return ()) blanklines
9021000
9031001-- | Parse header for an pipe table.
9041002pipeTableHeader :: Bool -- ^ Headerless table
905− -> Parser [Char] ParserState ([[Block]], [Alignment], [Int])
1003+ -> Parser [Char] ParserState (F [Blocks], [Alignment], [Int])
9061004pipeTableHeader headless = do
9071005 try $ do
9081006 heads <- if headless
909− then return $ repeat []
1007+ then return $ return $ repeat mempty
9101008 else pipeTableRow
9111009 aligns <- nonindentSpaces >> optional (char '|') >>
9121010 pipeTableHeaderPart `sepBy1` sepPipe
9131011 optional (char '|')
9141012 newline
9151013 let cols = length aligns
916− return (take cols heads, aligns, [])
1014+ let heads' = if headless
1015+ then return (replicate cols mempty)
1016+ else heads
1017+ return (heads', aligns, [])
9171018
9181019sepPipe :: Parser [Char] ParserState ()
9191020sepPipe = try $ char '|' >> notFollowedBy blankline
9201021
921−pipeTableRow :: Parser [Char] ParserState [[Block]]
1022+pipeTableRow :: Parser [Char] ParserState (F [Blocks])
9221023pipeTableRow = do
9231024 nonindentSpaces
9241025 optional (char '|')
925− let cell = many (notFollowedBy (blankline <|> char '|') >> inline)
1026+ let cell = mconcat <$>
1027+ many (notFollowedBy (blankline <|> char '|') >> inline)
9261028 first <- cell
9271029 sepPipe
9281030 rest <- cell `sepBy1` sepPipe
9291031 optional (char '|')
9301032 blankline
931− return $ map (\ils ->
932− if null ils
933− then []
934− else [Plain $ normalizeSpaces ils]) (first:rest)
1033+ let cells = sequence (first:rest)
1034+ return $ do
1035+ cells' <- cells
1036+ return $ map
1037+ (\ils ->
1038+ case trimInlines ils of
1039+ -- TODO leaky abstraction:
1040+ ils' | Seq.null (unInlines ils') -> mempty
1041+ | otherwise -> B.plain $ ils') cells'
9351042
9361043pipeTableHeaderPart :: Parser [Char] st Alignment
9371044pipeTableHeaderPart = do
@@ -949,33 +1056,54 @@ pipeTableHeaderPart = do
9491056scanForPipe :: Parser [Char] st ()
9501057scanForPipe = lookAhead (manyTill (satisfy (/='\n')) (char '|')) >> return ()
9511058
952−table :: Parser [Char] ParserState Block
1059+-- | Parse a table using 'headerParser', 'rowParser',
1060+-- 'lineParser', and 'footerParser'. Variant of the version in
1061+-- Text.Pandoc.Parsing.
1062+tableWith :: Parser [Char] ParserState (F [Blocks], [Alignment], [Int])
1063+ -> ([Int] -> Parser [Char] ParserState (F [Blocks]))
1064+ -> Parser [Char] ParserState sep
1065+ -> Parser [Char] ParserState end
1066+ -> Parser [Char] ParserState ([Alignment], [Double], F [Blocks], F [[Blocks]])
1067+tableWith headerParser rowParser lineParser footerParser = try $ do
1068+ (heads, aligns, indices) <- headerParser
1069+ lines' <- fmap sequence $ rowParser indices `sepEndBy1` lineParser
1070+ footerParser
1071+ numColumns <- getOption readerColumns
1072+ let widths = if (indices == [])
1073+ then replicate (length aligns) 0.0
1074+ else widthsFromIndices numColumns indices
1075+ return $ (aligns, widths, heads, lines')
1076+
1077+table :: Parser [Char] ParserState (F Blocks)
9531078table = try $ do
954− frontCaption <- option [] tableCaption
955− Table _ aligns widths heads lines' <-
956− try (guardEnabled Ext_pipe_tables >> scanForPipe >>
957− (pipeTable True <|> pipeTable False)) <|>
958− try (guardEnabled Ext_multiline_tables >>
959− (multilineTable False <|> simpleTable True)) <|>
960− try (guardEnabled Ext_simple_tables >>
961− (simpleTable False <|> multilineTable True)) <|>
962− try (guardEnabled Ext_grid_tables >>
1079+ frontCaption <- option Nothing (Just <$> tableCaption)
1080+ (aligns, widths, heads, lns) <-
1081+ try (guardEnabled Ext_pipe_tables >> scanForPipe >>
1082+ (pipeTable True <|> pipeTable False)) <|>
1083+ try (guardEnabled Ext_multiline_tables >>
1084+ multilineTable False) <|>
1085+ try (guardEnabled Ext_simple_tables >>
1086+ (simpleTable True <|> simpleTable False)) <|>
1087+ try (guardEnabled Ext_multiline_tables >>
1088+ multilineTable True) <|>
1089+ try (guardEnabled Ext_grid_tables >>
9631090 (gridTable False <|> gridTable True)) <?> "table"
9641091 optional blanklines
965− caption <- if null frontCaption
966− then option [] tableCaption
967− else return frontCaption
968− return $ Table caption aligns widths heads lines'
1092+ caption <- case frontCaption of
1093+ Nothing -> option (return mempty) tableCaption
1094+ Just c -> return c
1095+ return $ do
1096+ caption' <- caption
1097+ heads' <- heads
1098+ lns' <- lns
1099+ return $ B.table caption' (zip aligns widths) heads' lns'
9691100
9701101--
9711102-- inline
9721103--
9731104
974−inline :: Parser [Char] ParserState Inline
975−inline = choice inlineParsers <?> "inline"
976−
977−inlineParsers :: [Parser [Char] ParserState Inline]
978−inlineParsers = [ whitespace
1105+inline :: Parser [Char] ParserState (F Inlines)
1106+inline = choice [ whitespace
9791107 , str
9801108 , endline
9811109 , code
@@ -983,8 +1111,8 @@ inlineParsers = [ whitespace
9831111 , strong
9841112 , emph
9851113 , note
986− , link
9871114 , cite
1115+ , link
9881116 , image
9891117 , math
9901118 , strikeout
@@ -996,10 +1124,11 @@ inlineParsers = [ whitespace
9961124 , escapedChar
9971125 , rawLaTeXInline'
9981126 , exampleRef
999− , smartPunctuation inline
1000− , charRef
1127+ , smart
1128+ , return . B.singleton <$> charRef
10011129 , symbol
1002− , ltSign ]
1130+ , ltSign
1131+ ] <?> "inline"
10031132
10041133escapedChar' :: Parser [Char] ParserState Char
10051134escapedChar' = try $ do
@@ -1007,41 +1136,43 @@ escapedChar' = try $ do
10071136 (guardEnabled Ext_all_symbols_escapable >> satisfy (not . isAlphaNum))
10081137 <|> oneOf "\\`*_{}[]()>#+-.!~"
10091138
1010−escapedChar :: Parser [Char] ParserState Inline
1139+escapedChar :: Parser [Char] ParserState (F Inlines)
10111140escapedChar = do
10121141 result <- escapedChar'
10131142 case result of
1014− ' ' -> return $ Str "\160" -- "\ " is a nonbreaking space
1143+ ' ' -> return $ return $ B.str "\160" -- "\ " is a nonbreaking space
10151144 '\n' -> guardEnabled Ext_escaped_line_breaks >>
1016− return LineBreak -- "\[newline]" is a linebreak
1017− _ -> return $ Str [result]
1145+ return (return B.linebreak) -- "\[newline]" is a linebreak
1146+ _ -> return $ return $ B.str [result]
10181147
1019−ltSign :: Parser [Char] ParserState Inline
1148+ltSign :: Parser [Char] ParserState (F Inlines)
10201149ltSign = do
10211150 guardDisabled Ext_markdown_in_html_blocks
10221151 <|> (notFollowedBy' rawHtmlBlocks >> return ())
10231152 char '<'
1024− return $ Str ['<']
1153+ return $ return $ B.str "<"
10251154
1026−exampleRef :: Parser [Char] ParserState Inline
1155+exampleRef :: Parser [Char] ParserState (F Inlines)
10271156exampleRef = try $ do
10281157 guardEnabled Ext_example_lists
10291158 char '@'
10301159 lab <- many1 (alphaNum <|> oneOf "-_")
1031− -- We just return a Str. These are replaced with numbers
1032− -- later. See the end of parseMarkdown.
1033− return $ Str $ '@' : lab
1160+ return $ do
1161+ st <- ask
1162+ return $ case M.lookup lab (stateExamples st) of
1163+ Just n -> B.str (show n)
1164+ Nothing -> B.str ('@':lab)
10341165
1035−symbol :: Parser [Char] ParserState Inline
1166+symbol :: Parser [Char] ParserState (F Inlines)
10361167symbol = do
10371168 result <- noneOf "<\\\n\t "
10381169 <|> try (do lookAhead $ char '\\'
1039− notFollowedBy' rawTeXBlock
1170+ notFollowedBy' (() <$ rawTeXBlock)
10401171 char '\\')
1041− return $ Str [result]
1172+ return $ return $ B.str [result]
10421173
10431174-- parses inline code, between n `s and n `s
1044−code :: Parser [Char] ParserState Inline
1175+code :: Parser [Char] ParserState (F Inlines)
10451176code = try $ do
10461177 starts <- many1 (char '`')
10471178 skipSpaces
@@ -1051,20 +1182,20 @@ code = try $ do
10511182 notFollowedBy (char '`')))
10521183 attr <- option ([],[],[]) (try $ guardEnabled Ext_inline_code_attributes >>
10531184 optional whitespace >> attributes)
1054− return $ Code attr $ removeLeadingTrailingSpace $ concat result
1185+ return $ return $ B.codeWith attr $ removeLeadingTrailingSpace $ concat result
10551186
1056−mathWord :: Parser [Char] st [Char]
1187+mathWord :: Parser [Char] st String
10571188mathWord = liftM concat $ many1 mathChunk
10581189
1059−mathChunk :: Parser [Char] st [Char]
1190+mathChunk :: Parser [Char] st String
10601191mathChunk = do char '\\'
10611192 c <- anyChar
10621193 return ['\\',c]
10631194 <|> many1 (satisfy $ \c -> not (isBlank c || c == '\\' || c == '$'))
10641195
1065−math :: Parser [Char] ParserState Inline
1066−math = (mathDisplay >>= applyMacros' >>= return . Math DisplayMath)
1067− <|> (mathInline >>= applyMacros' >>= return . Math InlineMath)
1196+math :: Parser [Char] ParserState (F Inlines)
1197+math = (return . B.displayMath <$> (mathDisplay >>= applyMacros'))
1198+ <|> (return . B.math <$> (mathInline >>= applyMacros'))
10681199
10691200mathDisplay :: Parser [Char] ParserState String
10701201mathDisplay = try $ do
@@ -1084,21 +1215,21 @@ mathInline = try $ do
10841215
10851216-- to avoid performance problems, treat 4 or more _ or * or ~ or ^ in a row
10861217-- as a literal rather than attempting to parse for emph/strong/strikeout/super/sub
1087−fours :: Parser [Char] st Inline
1218+fours :: Parser [Char] st (F Inlines)
10881219fours = try $ do
10891220 x <- char '*' <|> char '_' <|> char '~' <|> char '^'
10901221 count 2 $ satisfy (==x)
10911222 rest <- many1 (satisfy (==x))
1092− return $ Str (x:x:x:rest)
1223+ return $ return $ B.str (x:x:x:rest)
10931224
10941225-- | Parses a list of inlines between start and end delimiters.
10951226inlinesBetween :: (Show b)
10961227 => Parser [Char] ParserState a
10971228 -> Parser [Char] ParserState b
1098− -> Parser [Char] ParserState [Inline]
1229+ -> Parser [Char] ParserState (F Inlines)
10991230inlinesBetween start end =
1100− normalizeSpaces `liftM` try (start >> many1Till inner end)
1101− where inner = innerSpace <|> (notFollowedBy' whitespace >> inline)
1231+ (trimInlinesF . mconcat) <$> try (start >> many1Till inner end)
1232+ where inner = innerSpace <|> (notFollowedBy' (() <$ whitespace) >> inline)
11021233 innerSpace = try $ whitespace >>~ notFollowedBy' end
11031234
11041235-- This is used to prevent exponential blowups for things like:
@@ -1113,55 +1244,57 @@ nested p = do
11131244 updateState $ \st -> st{ stateMaxNestingLevel = nestlevel }
11141245 return res
11151246
1116−emph :: Parser [Char] ParserState Inline
1117−emph = Emph `fmap` nested
1247+emph :: Parser [Char] ParserState (F Inlines)
1248+emph = fmap B.emph <$> nested
11181249 (inlinesBetween starStart starEnd <|> inlinesBetween ulStart ulEnd)
11191250 where starStart = char '*' >> lookAhead nonspaceChar
1120− starEnd = notFollowedBy' strong >> char '*'
1251+ starEnd = notFollowedBy' (() <$ strong) >> char '*'
11211252 ulStart = char '_' >> lookAhead nonspaceChar
1122− ulEnd = notFollowedBy' strong >> char '_'
1253+ ulEnd = notFollowedBy' (() <$ strong) >> char '_'
11231254
1124−strong :: Parser [Char] ParserState Inline
1125−strong = Strong `liftM` nested
1255+strong :: Parser [Char] ParserState (F Inlines)
1256+strong = fmap B.strong <$> nested
11261257 (inlinesBetween starStart starEnd <|> inlinesBetween ulStart ulEnd)
11271258 where starStart = string "**" >> lookAhead nonspaceChar
11281259 starEnd = try $ string "**"
11291260 ulStart = string "__" >> lookAhead nonspaceChar
11301261 ulEnd = try $ string "__"
11311262
1132−strikeout :: Parser [Char] ParserState Inline
1133−strikeout = Strikeout `liftM`
1263+strikeout :: Parser [Char] ParserState (F Inlines)
1264+strikeout = fmap B.strikeout <$>
11341265 (guardEnabled Ext_strikeout >> inlinesBetween strikeStart strikeEnd)
11351266 where strikeStart = string "~~" >> lookAhead nonspaceChar
11361267 >> notFollowedBy (char '~')
11371268 strikeEnd = try $ string "~~"
11381269
1139−superscript :: Parser [Char] ParserState Inline
1140−superscript = guardEnabled Ext_superscript >> enclosed (char '^') (char '^')
1141− (notFollowedBy spaceChar >> inline) >>= -- may not contain Space
1142− return . Superscript
1270+superscript :: Parser [Char] ParserState (F Inlines)
1271+superscript = fmap B.superscript <$> try (do
1272+ guardEnabled Ext_superscript
1273+ char '^'
1274+ mconcat <$> many1Till (notFollowedBy spaceChar >> inline) (char '^'))
11431275
1144−subscript :: Parser [Char] ParserState Inline
1145−subscript = guardEnabled Ext_subscript >> enclosed (char '~') (char '~')
1146− (notFollowedBy spaceChar >> inline) >>= -- may not contain Space
1147− return . Subscript
1276+subscript :: Parser [Char] ParserState (F Inlines)
1277+subscript = fmap B.subscript <$> try (do
1278+ guardEnabled Ext_subscript
1279+ char '~'
1280+ mconcat <$> many1Till (notFollowedBy spaceChar >> inline) (char '~'))
11481281
1149−whitespace :: Parser [Char] ParserState Inline
1150−whitespace = spaceChar >>
1151− ( (spaceChar >> skipMany spaceChar >> option Space (endline >> return LineBreak))
1152− <|> (skipMany spaceChar >> return Space) ) <?> "whitespace"
1282+whitespace :: Parser [Char] ParserState (F Inlines)
1283+whitespace = spaceChar >> return <$> (lb <|> regsp) <?> "whitespace"
1284+ where lb = spaceChar >> skipMany spaceChar >> option B.space (endline >> return B.linebreak)
1285+ regsp = skipMany spaceChar >> return B.space
11531286
11541287nonEndline :: Parser [Char] st Char
11551288nonEndline = satisfy (/='\n')
11561289
1157−str :: Parser [Char] ParserState Inline
1290+str :: Parser [Char] ParserState (F Inlines)
11581291str = do
1159− smart <- (readerSmart . stateOptions) `fmap` getState
1292+ isSmart <- readerSmart . stateOptions <$> getState
11601293 a <- alphaNum
11611294 as <- many $ alphaNum
11621295 <|> (guardEnabled Ext_intraword_underscores >>
11631296 try (char '_' >>~ lookAhead alphaNum))
1164− <|> if smart
1297+ <|> if isSmart
11651298 then (try $ satisfy (\c -> c == '\'' || c == '\x2019') >>
11661299 lookAhead alphaNum >> return '\x2019')
11671300 -- for things like l'aide
@@ -1170,15 +1303,16 @@ str = do
11701303 updateState $ \s -> s{ stateLastStrPos = Just pos }
11711304 let result = a:as
11721305 let spacesToNbr = map (\c -> if c == ' ' then '\160' else c)
1173− if smart
1306+ if isSmart
11741307 then case likelyAbbrev result of
1175− [] -> return $ Str result
1308+ [] -> return $ return $ B.str result
11761309 xs -> choice (map (\x ->
11771310 try (string x >> oneOf " \n" >>
11781311 lookAhead alphaNum >>
1179− return (Str $ result ++ spacesToNbr x ++ "\160"))) xs)
1180− <|> (return $ Str result)
1181− else return $ Str result
1312+ return (return $ B.str
1313+ $ result ++ spacesToNbr x ++ "\160"))) xs)
1314+ <|> (return $ return $ B.str result)
1315+ else return $ return $ B.str result
11821316
11831317-- | if the string matches the beginning of an abbreviation (before
11841318-- the first period, return strings that would finish the abbreviation.
@@ -1193,7 +1327,7 @@ likelyAbbrev x =
11931327 in map snd $ filter (\(y,_) -> y == x) abbrPairs
11941328
11951329-- an endline character that can be treated as a space, not a structural break
1196−endline :: Parser [Char] ParserState Inline
1330+endline :: Parser [Char] ParserState (F Inlines)
11971331endline = try $ do
11981332 newline
11991333 notFollowedBy blankline
@@ -1204,27 +1338,26 @@ endline = try $ do
12041338 when (stateParserContext st == ListItemState) $ do
12051339 notFollowedBy' bulletListStart
12061340 notFollowedBy' anyOrderedListStart
1207− return Space
1341+ return $ return B.space
12081342
12091343--
12101344-- links
12111345--
12121346
12131347-- a reference label for a link
1214−reference :: Parser [Char] ParserState [Inline]
1348+reference :: Parser [Char] ParserState (F Inlines, String)
12151349reference = do notFollowedBy' (string "[^") -- footnote reference
1216− result <- inlinesInBalancedBrackets inline
1217− return $ normalizeSpaces result
1350+ withRaw $ trimInlinesF <$> inlinesInBalancedBrackets
12181351
12191352-- source for a link, with optional title
1220−source :: Parser [Char] ParserState (String, [Char])
1353+source :: Parser [Char] ParserState (String, String)
12211354source =
12221355 (try $ charsInBalanced '(' ')' litChar >>= parseFromString source') <|>
12231356 -- the following is needed for cases like: [ref](/url(a).
12241357 (enclosed (char '(') (char ')') litChar >>= parseFromString source')
12251358
12261359-- auxiliary function for source
1227−source' :: Parser [Char] ParserState (String, [Char])
1360+source' :: Parser [Char] ParserState (String, String)
12281361source' = do
12291362 skipSpaces
12301363 let nl = char '\n' >>~ notFollowedBy blankline
@@ -1250,75 +1383,86 @@ linkTitle = try $ do
12501383 tit <- manyTill litChar (try (char delim >> skipSpaces >> eof))
12511384 return $ fromEntities tit
12521385
1253−link :: Parser [Char] ParserState Inline
1386+link :: Parser [Char] ParserState (F Inlines)
12541387link = try $ do
1255− lab <- reference
1256− (src, tit) <- source <|> referenceLink lab
1257− return $ Link (delinkify lab) (src, tit)
1258−
1259−delinkify :: [Inline] -> [Inline]
1260−delinkify = bottomUp $ concatMap go
1261− where go (Link lab _) = lab
1262− go x = [x]
1388+ st <- getState
1389+ guard $ stateAllowLinks st
1390+ setState $ st{ stateAllowLinks = False }
1391+ (lab,raw) <- reference
1392+ setState $ st{ stateAllowLinks = True }
1393+ regLink B.link lab <|> referenceLink B.link (lab,raw)
1394+
1395+regLink :: (String -> String -> Inlines -> Inlines)
1396+ -> F Inlines -> Parser [Char] ParserState (F Inlines)
1397+regLink constructor lab = try $ do
1398+ (src, tit) <- source
1399+ return $ constructor src tit <$> lab
12631400
12641401-- a link like [this][ref] or [this][] or [this]
1265−referenceLink :: [Inline]
1266− -> Parser [Char] ParserState (String, [Char])
1267−referenceLink lab = do
1268− ref <- option [] (try (optional (char ' ') >>
1269− optional (newline >> skipSpaces) >> reference))
1270− let ref' = if null ref then lab else ref
1271− state <- getState
1272− case lookupKeySrc (stateKeys state) (toKey ref') of
1273− Nothing -> fail "no corresponding key"
1274− Just target -> return target
1275−
1276−autoLink :: Parser [Char] ParserState Inline
1402+referenceLink :: (String -> String -> Inlines -> Inlines)
1403+ -> (F Inlines, String) -> Parser [Char] ParserState (F Inlines)
1404+referenceLink constructor (lab, raw) = do
1405+ raw' <- try (optional (char ' ') >>
1406+ optional (newline >> skipSpaces) >>
1407+ (snd <$> reference)) <|> return ""
1408+ let key = toKey' $ if raw' == "[]" || raw' == "" then raw else raw'
1409+ let dropRB (']':xs) = xs
1410+ dropRB xs = xs
1411+ let dropLB ('[':xs) = xs
1412+ dropLB xs = xs
1413+ let dropBrackets = reverse . dropRB . reverse . dropLB
1414+ fallback <- parseFromString (mconcat <$> many inline) $ dropBrackets raw
1415+ return $ do
1416+ keys <- asks stateKeys'
1417+ case M.lookup key keys of
1418+ Nothing -> (\x -> B.str "[" <> x <> B.str "]" <> B.str raw') <$> fallback
1419+ Just (src,tit) -> constructor src tit <$> lab
1420+
1421+autoLink :: Parser [Char] ParserState (F Inlines)
12771422autoLink = try $ do
12781423 char '<'
12791424 (orig, src) <- uri <|> emailAddress
12801425 char '>'
12811426 (guardEnabled Ext_autolink_code_spans >>
1282− return (Link [Code ("",["url"],[]) orig] (src, "")))
1283− <|> return (Link [Str orig] (src, ""))
1427+ return (return $ B.link src "" (B.codeWith ("",["url"],[]) orig)))
1428+ <|> return (return $ B.link src "" (B.str orig))
12841429
1285−image :: Parser [Char] ParserState Inline
1430+image :: Parser [Char] ParserState (F Inlines)
12861431image = try $ do
12871432 char '!'
1288− lab <- reference
1289− (src, tit) <- source <|> referenceLink lab
1290− return $ Image lab (src,tit)
1433+ (lab,raw) <- reference
1434+ regLink B.image lab <|> referenceLink B.image (lab,raw)
12911435
1292−note :: Parser [Char] ParserState Inline
1436+note :: Parser [Char] ParserState (F Inlines)
12931437note = try $ do
12941438 guardEnabled Ext_footnotes
12951439 ref <- noteMarker
1296− state <- getState
1297− let notes = stateNotes state
1298− case lookup ref notes of
1299− Nothing -> fail "note not found"
1300− Just raw -> do
1301− -- We temporarily empty the note list while parsing the note,
1302− -- so that we don't get infinite loops with notes inside notes...
1303− -- Note references inside other notes do not work.
1304− updateState $ \st -> st{ stateNotes = [] }
1305− contents <- parseFromString parseBlocks raw
1306− updateState $ \st -> st{ stateNotes = notes }
1307− return $ Note contents
1308−
1309−inlineNote :: Parser [Char] ParserState Inline
1440+ return $ do
1441+ notes <- asks stateNotes'
1442+ case lookup ref notes of
1443+ Nothing -> return $ B.str $ "[^" ++ ref ++ "]"
1444+ Just contents -> do
1445+ st <- ask
1446+ -- process the note in a context that doesn't resolve
1447+ -- notes, to avoid infinite looping with notes inside
1448+ -- notes:
1449+ let contents' = runReader contents st{ stateNotes' = [] }
1450+ return $ B.note contents'
1451+
1452+inlineNote :: Parser [Char] ParserState (F Inlines)
13101453inlineNote = try $ do
13111454 guardEnabled Ext_inline_notes
13121455 char '^'
1313− contents <- inlinesInBalancedBrackets inline
1314− return $ Note [Para contents]
1456+ contents <- inlinesInBalancedBrackets
1457+ return $ B.note . B.para <$> contents
13151458
1316−rawLaTeXInline' :: Parser [Char] ParserState Inline
1459+rawLaTeXInline' :: Parser [Char] ParserState (F Inlines)
13171460rawLaTeXInline' = try $ do
13181461 guardEnabled Ext_raw_tex
13191462 lookAhead $ char '\\' >> notFollowedBy' (string "start") -- context env
13201463 RawInline _ s <- rawLaTeXInline
1321− return $ RawInline "tex" s -- "tex" because it might be context or latex
1464+ return $ return $ B.rawInline "tex" s
1465+ -- "tex" because it might be context or latex
13221466
13231467rawConTeXtEnvironment :: Parser [Char] st String
13241468rawConTeXtEnvironment = try $ do
@@ -1336,31 +1480,25 @@ inBrackets parser = do
13361480 char ']'
13371481 return $ "[" ++ contents ++ "]"
13381482
1339−rawHtmlInline :: Parser [Char] ParserState Inline
1483+rawHtmlInline :: Parser [Char] ParserState (F Inlines)
13401484rawHtmlInline = do
13411485 mdInHtml <- option False $
13421486 guardEnabled Ext_markdown_in_html_blocks >> return True
13431487 (_,result) <- if mdInHtml
13441488 then htmlTag isInlineTag
13451489 else htmlTag (not . isTextTag)
1346− return $ RawInline "html" result
1490+ return $ return $ B.rawInline "html" result
13471491
13481492-- Citations
13491493
1350−cite :: Parser [Char] ParserState Inline
1494+cite :: Parser [Char] ParserState (F Inlines)
13511495cite = do
13521496 guardEnabled Ext_citations
1497+ getOption readerCitations >>= guard . not . null
13531498 citations <- textualCite <|> normalCite
1354− return $ Cite citations []
1355−
1356−spnl :: Parser [Char] st ()
1357−spnl = try $ do
1358− skipSpaces
1359− optional newline
1360− skipSpaces
1361− notFollowedBy (char '\n')
1499+ return $ flip B.cite mempty <$> citations
13621500
1363−textualCite :: Parser [Char] ParserState [Citation]
1501+textualCite :: Parser [Char] ParserState (F [Citation])
13641502textualCite = try $ do
13651503 (_, key) <- citeKey
13661504 let first = Citation{ citationId = key
@@ -1370,22 +1508,25 @@ textualCite = try $ do
13701508 , citationNoteNum = 0
13711509 , citationHash = 0
13721510 }
1373− rest <- option [] $ try $ spnl >> normalCite
1374− if null rest
1375− then option [first] $ bareloc first
1376− else return $ first : rest
1511+ mbrest <- option Nothing $ try $ spnl >> Just <$> normalCite
1512+ case mbrest of
1513+ Just rest -> return $ (first:) <$> rest
1514+ Nothing -> option (return [first]) $ bareloc first
13771515
1378−bareloc :: Citation -> Parser [Char] ParserState [Citation]
1516+bareloc :: Citation -> Parser [Char] ParserState (F [Citation])
13791517bareloc c = try $ do
13801518 spnl
13811519 char '['
13821520 suff <- suffix
1383− rest <- option [] $ try $ char ';' >> citeList
1521+ rest <- option (return []) $ try $ char ';' >> citeList
13841522 spnl
13851523 char ']'
1386− return $ c{ citationSuffix = suff } : rest
1524+ return $ do
1525+ suff' <- suff
1526+ rest' <- rest
1527+ return $ c{ citationSuffix = B.toList suff' } : rest'
13871528
1388−normalCite :: Parser [Char] ParserState [Citation]
1529+normalCite :: Parser [Char] ParserState (F [Citation])
13891530normalCite = try $ do
13901531 char '['
13911532 spnl
@@ -1406,30 +1547,33 @@ citeKey = try $ do
14061547 guard $ key `elem` citations'
14071548 return (suppress_author, key)
14081549
1409−suffix :: Parser [Char] ParserState [Inline]
1550+suffix :: Parser [Char] ParserState (F Inlines)
14101551suffix = try $ do
14111552 hasSpace <- option False (notFollowedBy nonspaceChar >> return True)
14121553 spnl
1413− rest <- liftM normalizeSpaces $ many $ notFollowedBy (oneOf ";]") >> inline
1554+ rest <- trimInlinesF . mconcat <$> many (notFollowedBy (oneOf ";]") >> inline)
14141555 return $ if hasSpace
1415− then Space : rest
1556+ then (B.space <>) <$> rest
14161557 else rest
14171558
1418−prefix :: Parser [Char] ParserState [Inline]
1419−prefix = liftM normalizeSpaces $
1559+prefix :: Parser [Char] ParserState (F Inlines)
1560+prefix = trimInlinesF . mconcat <$>
14201561 manyTill inline (char ']' <|> liftM (const ']') (lookAhead citeKey))
14211562
1422−citeList :: Parser [Char] ParserState [Citation]
1423−citeList = sepBy1 citation (try $ char ';' >> spnl)
1563+citeList :: Parser [Char] ParserState (F [Citation])
1564+citeList = fmap sequence $ sepBy1 citation (try $ char ';' >> spnl)
14241565
1425−citation :: Parser [Char] ParserState Citation
1566+citation :: Parser [Char] ParserState (F Citation)
14261567citation = try $ do
14271568 pref <- prefix
14281569 (suppress_author, key) <- citeKey
14291570 suff <- suffix
1430− return $ Citation{ citationId = key
1431− , citationPrefix = pref
1432− , citationSuffix = suff
1571+ return $ do
1572+ x <- pref
1573+ y <- suff
1574+ return $ Citation{ citationId = key
1575+ , citationPrefix = B.toList x
1576+ , citationSuffix = B.toList y
14331577 , citationMode = if suppress_author
14341578 then SuppressAuthor
14351579 else NormalCitation
@@ -1437,3 +1581,22 @@ citation = try $ do
14371581 , citationHash = 0
14381582 }
14391583
1584+smart :: Parser [Char] ParserState (F Inlines)
1585+smart = do
1586+ getOption readerSmart >>= guard
1587+ doubleQuoted <|> singleQuoted <|>
1588+ choice (map (return . B.singleton <$>) [apostrophe, dash, ellipses])
1589+
1590+singleQuoted :: Parser [Char] ParserState (F Inlines)
1591+singleQuoted = try $ do
1592+ singleQuoteStart
1593+ withQuoteContext InSingleQuote $
1594+ fmap B.singleQuoted . trimInlinesF . mconcat <$>
1595+ many1Till inline singleQuoteEnd
1596+
1597+doubleQuoted :: Parser [Char] ParserState (F Inlines)
1598+doubleQuoted = try $ do
1599+ doubleQuoteStart
1600+ withQuoteContext InDoubleQuote $
1601+ fmap B.doubleQuoted . trimInlinesF . mconcat <$>
1602+ many1Till inline doubleQuoteEnd
src/Text/Pandoc/Readers/RST.hs+2−2
@@ -407,7 +407,7 @@ mathBlockMultiline = try $ do
407407
408408lhsCodeBlock :: Parser [Char] ParserState Block
409409lhsCodeBlock = try $ do
410− failUnlessLHS
410+ getOption readerLiterateHaskell >>= guard
411411 optional codeBlockStart
412412 pos <- getPosition
413413 when (sourceColumn pos /= 1) $ fail "Not in first column"
@@ -776,7 +776,7 @@ simpleTable headless = do
776776
777777gridTable :: Bool -- ^ Headerless table
778778 -> Parser [Char] ParserState Block
779−gridTable = gridTableWith block
779+gridTable = gridTableWith parseBlocks
780780
781781table :: Parser [Char] ParserState Block
782782table = gridTable False <|> simpleTable False <|>
tests/lhs-test.native+3−3
@@ -1,8 +1,8 @@
11[Header 1 [Str "lhs",Space,Str "test"]
2−,Para [Code ("",[],[]) "unsplit",Space,Str "is",Space,Str "an",Space,Str "arrow",Space,Str "that",Space,Str "takes",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "and",Space,Str "combines",Space,Str "them",Space,Str "to",Space,Str "return",Space,Str "a",Space,Str "single",Space,Str "value",Str ":"]
2+,Para [Code ("",[],[]) "unsplit",Space,Str "is",Space,Str "an",Space,Str "arrow",Space,Str "that",Space,Str "takes",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "and",Space,Str "combines",Space,Str "them",Space,Str "to",Space,Str "return",Space,Str "a",Space,Str "single",Space,Str "value:"]
33,CodeBlock ("",["sourceCode","literate","haskell"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry \n -- arr (\\op (x,y) -> x `op` y) "
4−,Para [Code ("",[],[]) "(***)",Space,Str "combines",Space,Str "two",Space,Str "arrows",Space,Str "into",Space,Str "a",Space,Str "new",Space,Str "arrow",Space,Str "by",Space,Str "running",Space,Str "the",Space,Str "two",Space,Str "arrows",Space,Str "on",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "(one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "first",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair",Space,Str "and",Space,Str "one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "second",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair)",Str "."]
4+,Para [Code ("",[],[]) "(***)",Space,Str "combines",Space,Str "two",Space,Str "arrows",Space,Str "into",Space,Str "a",Space,Str "new",Space,Str "arrow",Space,Str "by",Space,Str "running",Space,Str "the",Space,Str "two",Space,Str "arrows",Space,Str "on",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "(one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "first",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair",Space,Str "and",Space,Str "one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "second",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair)."]
55,CodeBlock ("",[],[]) "f *** g = first f >>> second g"
6−,Para [Str "Block",Space,Str "quote",Str ":"]
6+,Para [Str "Block",Space,Str "quote:"]
77,BlockQuote
88 [Para [Str "foo",Space,Str "bar"]]]
tests/markdown-reader-more.native+10−10
@@ -12,11 +12,11 @@
1212,HorizontalRule
1313,HorizontalRule
1414,Header 2 [Str "Raw",Space,Str "HTML",Space,Str "before",Space,Str "header"]
15−,Plain [RawInline "html" "<a>",RawInline "html" "</a>"]
15+,Para [RawInline "html" "<a>",RawInline "html" "</a>"]
1616,Header 3 [Str "my",Space,Str "header"]
1717,Header 2 [Str "$",Space,Str "in",Space,Str "math"]
1818,Para [Math InlineMath "\\$2 + \\$3"]
19−,Header 2 [Str "Commented",Str "-",Str "out",Space,Str "list",Space,Str "item"]
19+,Header 2 [Str "Commented-out",Space,Str "list",Space,Str "item"]
2020,BulletList
2121 [[Plain [Str "one",Space,RawInline "html" "<!--\n- two\n-->"]]
2222 ,[Plain [Str "three"]]]
@@ -26,22 +26,22 @@
2626,Para [Code ("",[],[]) "hi\\"]
2727,Para [Code ("",[],[]) "hi there"]
2828,Para [Code ("",[],[]) "hi````there"]
29−,Para [Str "`",Str "hi"]
30−,Para [Str "there",Str "`"]
29+,Para [Str "`hi"]
30+,Para [Str "there`"]
3131,Header 2 [Str "Multilingual",Space,Str "URLs"]
32−,Plain [RawInline "html" "<http://\27979.com?\27979=\27979>"]
32+,Para [RawInline "html" "<http://\27979.com?\27979=\27979>"]
3333,Para [Link [Str "foo"] ("/bar/\27979?x=\27979","title")]
3434,Para [Link [Code ("",["url"],[]) "\27979@foo.\27979.baz"] ("mailto:\27979@foo.\27979.baz","")]
3535,Header 2 [Str "Numbered",Space,Str "examples"]
3636,OrderedList (1,Example,TwoParens)
37− [[Plain [Str "First",Space,Str "example",Str "."]]
38− ,[Plain [Str "Second",Space,Str "example",Str "."]]]
39−,Para [Str "Explanation",Space,Str "of",Space,Str "examples",Space,Str "(",Str "2",Str ")",Space,Str "and",Space,Str "(",Str "3",Str ")",Str "."]
37+ [[Plain [Str "First",Space,Str "example."]]
38+ ,[Plain [Str "Second",Space,Str "example."]]]
39+,Para [Str "Explanation",Space,Str "of",Space,Str "examples",Space,Str "(2)",Space,Str "and",Space,Str "(3)."]
4040,OrderedList (3,Example,TwoParens)
41− [[Plain [Str "Third",Space,Str "example",Str "."]]]
41+ [[Plain [Str "Third",Space,Str "example."]]]
4242,Header 2 [Str "Macros"]
4343,Para [Math InlineMath "\\langle x,y \\rangle"]
44−,Header 2 [Str "Case",Str "-",Str "insensitive",Space,Str "references"]
44+,Header 2 [Str "Case-insensitive",Space,Str "references"]
4545,Para [Link [Str "Fum"] ("/fum","")]
4646,Para [Link [Str "FUM"] ("/fum","")]
4747,Para [Link [Str "bat"] ("/bat","")]
tests/pipe-tables.native+6−6
@@ -1,4 +1,4 @@
1−[Para [Str "Simplest",Space,Str "table",Space,Str "without",Space,Str "caption",Str ":"]
1+[Para [Str "Simplest",Space,Str "table",Space,Str "without",Space,Str "caption:"]
22,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
33 [[Plain [Str "Default1"]]
44 ,[Plain [Str "Default2"]]
@@ -12,8 +12,8 @@
1212 ,[[Plain [Str "1"]]
1313 ,[Plain [Str "1"]]
1414 ,[Plain [Str "1"]]]]
15−,Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption",Str ":"]
16−,Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."] [AlignRight,AlignLeft,AlignDefault,AlignCenter] [0.0,0.0,0.0,0.0]
15+,Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption:"]
16+,Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."] [AlignRight,AlignLeft,AlignDefault,AlignCenter] [0.0,0.0,0.0,0.0]
1717 [[Plain [Str "Right"]]
1818 ,[Plain [Str "Left"]]
1919 ,[Plain [Str "Default"]]
@@ -30,7 +30,7 @@
3030 ,[Plain [Str "1"]]
3131 ,[Plain [Str "1"]]
3232 ,[Plain [Str "1"]]]]
33−,Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption",Str ":"]
33+,Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption:"]
3434,Table [] [AlignRight,AlignLeft,AlignCenter] [0.0,0.0,0.0]
3535 [[Plain [Str "Right"]]
3636 ,[Plain [Str "Left"]]
@@ -44,7 +44,7 @@
4444 ,[[Plain [Str "1"]]
4545 ,[Plain [Str "1"]]
4646 ,[Plain [Str "1"]]]]
47−,Para [Str "Headerless",Space,Str "table",Space,Str "without",Space,Str "caption",Str ":"]
47+,Para [Str "Headerless",Space,Str "table",Space,Str "without",Space,Str "caption:"]
4848,Table [] [AlignRight,AlignLeft,AlignCenter] [0.0,0.0,0.0]
4949 [[]
5050 ,[]
@@ -58,7 +58,7 @@
5858 ,[[Plain [Str "1"]]
5959 ,[Plain [Str "1"]]
6060 ,[Plain [Str "1"]]]]
61−,Para [Str "Table",Space,Str "without",Space,Str "sides",Str ":"]
61+,Para [Str "Table",Space,Str "without",Space,Str "sides:"]
6262,Table [] [AlignDefault,AlignRight] [0.0,0.0]
6363 [[Plain [Str "Fruit"]]
6464 ,[Plain [Str "Quantity"]]]
tests/tables.native+22−22
@@ -1,5 +1,5 @@
1−[Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption",Str ":"]
2−,Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.0,0.0,0.0,0.0]
1+[Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption:"]
2+,Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.0,0.0,0.0,0.0]
33 [[Plain [Str "Right"]]
44 ,[Plain [Str "Left"]]
55 ,[Plain [Str "Center"]]
@@ -16,7 +16,7 @@
1616 ,[Plain [Str "1"]]
1717 ,[Plain [Str "1"]]
1818 ,[Plain [Str "1"]]]]
19−,Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption",Str ":"]
19+,Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption:"]
2020,Table [] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.0,0.0,0.0,0.0]
2121 [[Plain [Str "Right"]]
2222 ,[Plain [Str "Left"]]
@@ -34,8 +34,8 @@
3434 ,[Plain [Str "1"]]
3535 ,[Plain [Str "1"]]
3636 ,[Plain [Str "1"]]]]
37−,Para [Str "Simple",Space,Str "table",Space,Str "indented",Space,Str "two",Space,Str "spaces",Str ":"]
38−,Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.0,0.0,0.0,0.0]
37+,Para [Str "Simple",Space,Str "table",Space,Str "indented",Space,Str "two",Space,Str "spaces:"]
38+,Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax."] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.0,0.0,0.0,0.0]
3939 [[Plain [Str "Right"]]
4040 ,[Plain [Str "Left"]]
4141 ,[Plain [Str "Center"]]
@@ -52,21 +52,21 @@
5252 ,[Plain [Str "1"]]
5353 ,[Plain [Str "1"]]
5454 ,[Plain [Str "1"]]]]
55−,Para [Str "Multiline",Space,Str "table",Space,Str "with",Space,Str "caption",Str ":"]
56−,Table [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 "."] [AlignCenter,AlignLeft,AlignRight,AlignLeft] [0.15,0.1375,0.1625,0.3375]
55+,Para [Str "Multiline",Space,Str "table",Space,Str "with",Space,Str "caption:"]
56+,Table [Str "Here's",Space,Str "the",Space,Str "caption.",Space,Str "It",Space,Str "may",Space,Str "span",Space,Str "multiple",Space,Str "lines."] [AlignCenter,AlignLeft,AlignRight,AlignLeft] [0.15,0.1375,0.1625,0.3375]
5757 [[Plain [Str "Centered",Space,Str "Header"]]
5858 ,[Plain [Str "Left",Space,Str "Aligned"]]
5959 ,[Plain [Str "Right",Space,Str "Aligned"]]
6060 ,[Plain [Str "Default",Space,Str "aligned"]]]
6161 [[[Plain [Str "First"]]
6262 ,[Plain [Str "row"]]
63− ,[Plain [Str "12",Str ".",Str "0"]]
64− ,[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 "."]]]
63+ ,[Plain [Str "12.0"]]
64+ ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
6565 ,[[Plain [Str "Second"]]
6666 ,[Plain [Str "row"]]
67− ,[Plain [Str "5",Str ".",Str "0"]]
68− ,[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 "."]]]]
69−,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "caption",Str ":"]
67+ ,[Plain [Str "5.0"]]
68+ ,[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."]]]]
69+,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "caption:"]
7070,Table [] [AlignCenter,AlignLeft,AlignRight,AlignLeft] [0.15,0.1375,0.1625,0.3375]
7171 [[Plain [Str "Centered",Space,Str "Header"]]
7272 ,[Plain [Str "Left",Space,Str "Aligned"]]
@@ -74,13 +74,13 @@
7474 ,[Plain [Str "Default",Space,Str "aligned"]]]
7575 [[[Plain [Str "First"]]
7676 ,[Plain [Str "row"]]
77− ,[Plain [Str "12",Str ".",Str "0"]]
78− ,[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 "."]]]
77+ ,[Plain [Str "12.0"]]
78+ ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
7979 ,[[Plain [Str "Second"]]
8080 ,[Plain [Str "row"]]
81− ,[Plain [Str "5",Str ".",Str "0"]]
82− ,[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 "."]]]]
83−,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers",Str ":"]
81+ ,[Plain [Str "5.0"]]
82+ ,[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."]]]]
83+,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
8484,Table [] [AlignRight,AlignLeft,AlignCenter,AlignRight] [0.0,0.0,0.0,0.0]
8585 [[]
8686 ,[]
@@ -98,7 +98,7 @@
9898 ,[Plain [Str "1"]]
9999 ,[Plain [Str "1"]]
100100 ,[Plain [Str "1"]]]]
101−,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "column",Space,Str "headers",Str ":"]
101+,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
102102,Table [] [AlignCenter,AlignLeft,AlignRight,AlignDefault] [0.15,0.1375,0.1625,0.3375]
103103 [[]
104104 ,[]
@@ -106,9 +106,9 @@
106106 ,[]]
107107 [[[Plain [Str "First"]]
108108 ,[Plain [Str "row"]]
109− ,[Plain [Str "12",Str ".",Str "0"]]
110− ,[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 "."]]]
109+ ,[Plain [Str "12.0"]]
110+ ,[Plain [Str "Example",Space,Str "of",Space,Str "a",Space,Str "row",Space,Str "that",Space,Str "spans",Space,Str "multiple",Space,Str "lines."]]]
111111 ,[[Plain [Str "Second"]]
112112 ,[Plain [Str "row"]]
113− ,[Plain [Str "5",Str ".",Str "0"]]
114− ,[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 "."]]]]]
113+ ,[Plain [Str "5.0"]]
114+ ,[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."]]]]]
tests/testsuite.native+134−134
@@ -1,5 +1,5 @@
1−Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docAuthors = [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]], docDate = [Str "July",Space,Str "17",Str ",",Space,Str "2006"]})
2−[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\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."]
1+Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docAuthors = [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]], docDate = [Str "July",Space,Str "17,",Space,Str "2006"]})
2+[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."]
33,HorizontalRule
44,Header 1 [Str "Headers"]
55,Header 2 [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embedded",Space,Str "link"] ("/url","")]
@@ -14,95 +14,95 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
1414,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
1515,HorizontalRule
1616,Header 1 [Str "Paragraphs"]
17−,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph",Str "."]
18−,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 "."]
19−,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet",Str ".",Space,Str "*",Space,Str "criminey",Str "."]
20−,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here",Str "."]
17+,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
18+,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."]
19+,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
20+,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here."]
2121,HorizontalRule
2222,Header 1 [Str "Block",Space,Str "Quotes"]
23−,Para [Str "E",Str "-",Str "mail",Space,Str "style",Str ":"]
23+,Para [Str "E-mail",Space,Str "style:"]
2424,BlockQuote
25− [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 "."]]
25+ [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."]]
2626,BlockQuote
27− [Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"]
27+ [Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
2828 ,CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}"
29− ,Para [Str "A",Space,Str "list",Str ":"]
29+ ,Para [Str "A",Space,Str "list:"]
3030 ,OrderedList (1,Decimal,Period)
3131 [[Plain [Str "item",Space,Str "one"]]
3232 ,[Plain [Str "item",Space,Str "two"]]]
33− ,Para [Str "Nested",Space,Str "block",Space,Str "quotes",Str ":"]
33+ ,Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
3434 ,BlockQuote
3535 [Para [Str "nested"]]
3636 ,BlockQuote
3737 [Para [Str "nested"]]]
38−,Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":",Space,Str "2",Space,Str ">",Space,Str "1",Str "."]
39−,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph",Str "."]
38+,Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "block",Space,Str "quote:",Space,Str "2",Space,Str ">",Space,Str "1."]
39+,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
4040,HorizontalRule
4141,Header 1 [Str "Code",Space,Str "Blocks"]
42−,Para [Str "Code",Str ":"]
42+,Para [Str "Code:"]
4343,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab"
44−,Para [Str "And",Str ":"]
44+,Para [Str "And:"]
4545,CodeBlock ("",[],[]) " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{"
4646,HorizontalRule
4747,Header 1 [Str "Lists"]
4848,Header 2 [Str "Unordered"]
49−,Para [Str "Asterisks",Space,Str "tight",Str ":"]
49+,Para [Str "Asterisks",Space,Str "tight:"]
5050,BulletList
5151 [[Plain [Str "asterisk",Space,Str "1"]]
5252 ,[Plain [Str "asterisk",Space,Str "2"]]
5353 ,[Plain [Str "asterisk",Space,Str "3"]]]
54−,Para [Str "Asterisks",Space,Str "loose",Str ":"]
54+,Para [Str "Asterisks",Space,Str "loose:"]
5555,BulletList
5656 [[Para [Str "asterisk",Space,Str "1"]]
5757 ,[Para [Str "asterisk",Space,Str "2"]]
5858 ,[Para [Str "asterisk",Space,Str "3"]]]
59−,Para [Str "Pluses",Space,Str "tight",Str ":"]
59+,Para [Str "Pluses",Space,Str "tight:"]
6060,BulletList
6161 [[Plain [Str "Plus",Space,Str "1"]]
6262 ,[Plain [Str "Plus",Space,Str "2"]]
6363 ,[Plain [Str "Plus",Space,Str "3"]]]
64−,Para [Str "Pluses",Space,Str "loose",Str ":"]
64+,Para [Str "Pluses",Space,Str "loose:"]
6565,BulletList
6666 [[Para [Str "Plus",Space,Str "1"]]
6767 ,[Para [Str "Plus",Space,Str "2"]]
6868 ,[Para [Str "Plus",Space,Str "3"]]]
69−,Para [Str "Minuses",Space,Str "tight",Str ":"]
69+,Para [Str "Minuses",Space,Str "tight:"]
7070,BulletList
7171 [[Plain [Str "Minus",Space,Str "1"]]
7272 ,[Plain [Str "Minus",Space,Str "2"]]
7373 ,[Plain [Str "Minus",Space,Str "3"]]]
74−,Para [Str "Minuses",Space,Str "loose",Str ":"]
74+,Para [Str "Minuses",Space,Str "loose:"]
7575,BulletList
7676 [[Para [Str "Minus",Space,Str "1"]]
7777 ,[Para [Str "Minus",Space,Str "2"]]
7878 ,[Para [Str "Minus",Space,Str "3"]]]
7979,Header 2 [Str "Ordered"]
80−,Para [Str "Tight",Str ":"]
80+,Para [Str "Tight:"]
8181,OrderedList (1,Decimal,Period)
8282 [[Plain [Str "First"]]
8383 ,[Plain [Str "Second"]]
8484 ,[Plain [Str "Third"]]]
85−,Para [Str "and",Str ":"]
85+,Para [Str "and:"]
8686,OrderedList (1,Decimal,Period)
8787 [[Plain [Str "One"]]
8888 ,[Plain [Str "Two"]]
8989 ,[Plain [Str "Three"]]]
90−,Para [Str "Loose",Space,Str "using",Space,Str "tabs",Str ":"]
90+,Para [Str "Loose",Space,Str "using",Space,Str "tabs:"]
9191,OrderedList (1,Decimal,Period)
9292 [[Para [Str "First"]]
9393 ,[Para [Str "Second"]]
9494 ,[Para [Str "Third"]]]
95−,Para [Str "and",Space,Str "using",Space,Str "spaces",Str ":"]
95+,Para [Str "and",Space,Str "using",Space,Str "spaces:"]
9696,OrderedList (1,Decimal,Period)
9797 [[Para [Str "One"]]
9898 ,[Para [Str "Two"]]
9999 ,[Para [Str "Three"]]]
100−,Para [Str "Multiple",Space,Str "paragraphs",Str ":"]
100+,Para [Str "Multiple",Space,Str "paragraphs:"]
101101,OrderedList (1,Decimal,Period)
102− [[Para [Str "Item",Space,Str "1",Str ",",Space,Str "graf",Space,Str "one",Str "."]
103− ,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\8217s",Space,Str "back",Str "."]]
104− ,[Para [Str "Item",Space,Str "2",Str "."]]
105− ,[Para [Str "Item",Space,Str "3",Str "."]]]
102+ [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
103+ ,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."]]
104+ ,[Para [Str "Item",Space,Str "2."]]
105+ ,[Para [Str "Item",Space,Str "3."]]]
106106,Header 2 [Str "Nested"]
107107,BulletList
108108 [[Plain [Str "Tab"]
@@ -110,19 +110,19 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
110110 [[Plain [Str "Tab"]
111111 ,BulletList
112112 [[Plain [Str "Tab"]]]]]]]
113−,Para [Str "Here\8217s",Space,Str "another",Str ":"]
113+,Para [Str "Here\8217s",Space,Str "another:"]
114114,OrderedList (1,Decimal,Period)
115115 [[Plain [Str "First"]]
116− ,[Plain [Str "Second",Str ":"]
116+ ,[Plain [Str "Second:"]
117117 ,BulletList
118118 [[Plain [Str "Fee"]]
119119 ,[Plain [Str "Fie"]]
120120 ,[Plain [Str "Foe"]]]]
121121 ,[Plain [Str "Third"]]]
122−,Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs",Str ":"]
122+,Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs:"]
123123,OrderedList (1,Decimal,Period)
124124 [[Para [Str "First"]]
125− ,[Para [Str "Second",Str ":"]
125+ ,[Para [Str "Second:"]
126126 ,BulletList
127127 [[Plain [Str "Fee"]]
128128 ,[Plain [Str "Fie"]]
@@ -141,32 +141,32 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
141141 ,[Para [Str "and",Space,Str "now",Space,Str "3"]
142142 ,Para [Str "with",Space,Str "a",Space,Str "continuation"]
143143 ,OrderedList (4,LowerRoman,Period)
144− [[Plain [Str "sublist",Space,Str "with",Space,Str "roman",Space,Str "numerals",Str ",",Space,Str "starting",Space,Str "with",Space,Str "4"]]
144+ [[Plain [Str "sublist",Space,Str "with",Space,Str "roman",Space,Str "numerals,",Space,Str "starting",Space,Str "with",Space,Str "4"]]
145145 ,[Plain [Str "more",Space,Str "items"]
146146 ,OrderedList (1,UpperAlpha,TwoParens)
147147 [[Plain [Str "a",Space,Str "subsublist"]]
148148 ,[Plain [Str "a",Space,Str "subsublist"]]]]]]]
149−,Para [Str "Nesting",Str ":"]
149+,Para [Str "Nesting:"]
150150,OrderedList (1,UpperAlpha,Period)
151151 [[Plain [Str "Upper",Space,Str "Alpha"]
152152 ,OrderedList (1,UpperRoman,Period)
153− [[Plain [Str "Upper",Space,Str "Roman",Str "."]
153+ [[Plain [Str "Upper",Space,Str "Roman."]
154154 ,OrderedList (6,Decimal,TwoParens)
155155 [[Plain [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
156156 ,OrderedList (3,LowerAlpha,OneParen)
157157 [[Plain [Str "Lower",Space,Str "alpha",Space,Str "with",Space,Str "paren"]]]]]]]]]
158−,Para [Str "Autonumbering",Str ":"]
158+,Para [Str "Autonumbering:"]
159159,OrderedList (1,DefaultStyle,DefaultDelim)
160− [[Plain [Str "Autonumber",Str "."]]
161− ,[Plain [Str "More",Str "."]
160+ [[Plain [Str "Autonumber."]]
161+ ,[Plain [Str "More."]
162162 ,OrderedList (1,DefaultStyle,DefaultDelim)
163− [[Plain [Str "Nested",Str "."]]]]]
164−,Para [Str "Should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "list",Space,Str "item",Str ":"]
165−,Para [Str "M.A.\160",Str "2007"]
166−,Para [Str "B",Str ".",Space,Str "Williams"]
163+ [[Plain [Str "Nested."]]]]]
164+,Para [Str "Should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "list",Space,Str "item:"]
165+,Para [Str "M.A.\160\&2007"]
166+,Para [Str "B.",Space,Str "Williams"]
167167,HorizontalRule
168168,Header 1 [Str "Definition",Space,Str "Lists"]
169−,Para [Str "Tight",Space,Str "using",Space,Str "spaces",Str ":"]
169+,Para [Str "Tight",Space,Str "using",Space,Str "spaces:"]
170170,DefinitionList
171171 [([Str "apple"],
172172 [[Plain [Str "red",Space,Str "fruit"]]])
@@ -174,7 +174,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
174174 [[Plain [Str "orange",Space,Str "fruit"]]])
175175 ,([Str "banana"],
176176 [[Plain [Str "yellow",Space,Str "fruit"]]])]
177−,Para [Str "Tight",Space,Str "using",Space,Str "tabs",Str ":"]
177+,Para [Str "Tight",Space,Str "using",Space,Str "tabs:"]
178178,DefinitionList
179179 [([Str "apple"],
180180 [[Plain [Str "red",Space,Str "fruit"]]])
@@ -182,7 +182,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
182182 [[Plain [Str "orange",Space,Str "fruit"]]])
183183 ,([Str "banana"],
184184 [[Plain [Str "yellow",Space,Str "fruit"]]])]
185−,Para [Str "Loose",Str ":"]
185+,Para [Str "Loose:"]
186186,DefinitionList
187187 [([Str "apple"],
188188 [[Para [Str "red",Space,Str "fruit"]]])
@@ -190,17 +190,17 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
190190 [[Para [Str "orange",Space,Str "fruit"]]])
191191 ,([Str "banana"],
192192 [[Para [Str "yellow",Space,Str "fruit"]]])]
193−,Para [Str "Multiple",Space,Str "blocks",Space,Str "with",Space,Str "italics",Str ":"]
193+,Para [Str "Multiple",Space,Str "blocks",Space,Str "with",Space,Str "italics:"]
194194,DefinitionList
195195 [([Emph [Str "apple"]],
196196 [[Para [Str "red",Space,Str "fruit"]
197− ,Para [Str "contains",Space,Str "seeds",Str ",",Space,Str "crisp",Str ",",Space,Str "pleasant",Space,Str "to",Space,Str "taste"]]])
197+ ,Para [Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"]]])
198198 ,([Emph [Str "orange"]],
199199 [[Para [Str "orange",Space,Str "fruit"]
200200 ,CodeBlock ("",[],[]) "{ orange code block }"
201201 ,BlockQuote
202202 [Para [Str "orange",Space,Str "block",Space,Str "quote"]]]])]
203−,Para [Str "Multiple",Space,Str "definitions",Str ",",Space,Str "tight",Str ":"]
203+,Para [Str "Multiple",Space,Str "definitions,",Space,Str "tight:"]
204204,DefinitionList
205205 [([Str "apple"],
206206 [[Plain [Str "red",Space,Str "fruit"]]
@@ -208,7 +208,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
208208 ,([Str "orange"],
209209 [[Plain [Str "orange",Space,Str "fruit"]]
210210 ,[Plain [Str "bank"]]])]
211−,Para [Str "Multiple",Space,Str "definitions",Str ",",Space,Str "loose",Str ":"]
211+,Para [Str "Multiple",Space,Str "definitions,",Space,Str "loose:"]
212212,DefinitionList
213213 [([Str "apple"],
214214 [[Para [Str "red",Space,Str "fruit"]]
@@ -216,7 +216,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
216216 ,([Str "orange"],
217217 [[Para [Str "orange",Space,Str "fruit"]]
218218 ,[Para [Str "bank"]]])]
219−,Para [Str "Blank",Space,Str "line",Space,Str "after",Space,Str "term",Str ",",Space,Str "indented",Space,Str "marker",Str ",",Space,Str "alternate",Space,Str "markers",Str ":"]
219+,Para [Str "Blank",Space,Str "line",Space,Str "after",Space,Str "term,",Space,Str "indented",Space,Str "marker,",Space,Str "alternate",Space,Str "markers:"]
220220,DefinitionList
221221 [([Str "apple"],
222222 [[Para [Str "red",Space,Str "fruit"]]
@@ -227,70 +227,70 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
227227 [[Plain [Str "sublist"]]
228228 ,[Plain [Str "sublist"]]]]])]
229229,Header 1 [Str "HTML",Space,Str "Blocks"]
230−,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line",Str ":"]
230+,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
231231,RawBlock "html" "<div>"
232232,Plain [Str "foo"]
233233,RawBlock "html" "</div>\n"
234−,Para [Str "And",Space,Str "nested",Space,Str "without",Space,Str "indentation",Str ":"]
234+,Para [Str "And",Space,Str "nested",Space,Str "without",Space,Str "indentation:"]
235235,RawBlock "html" "<div>\n<div>\n<div>"
236236,Plain [Str "foo"]
237237,RawBlock "html" "</div>\n</div>\n<div>"
238238,Plain [Str "bar"]
239239,RawBlock "html" "</div>\n</div>\n"
240−,Para [Str "Interpreted",Space,Str "markdown",Space,Str "in",Space,Str "a",Space,Str "table",Str ":"]
240+,Para [Str "Interpreted",Space,Str "markdown",Space,Str "in",Space,Str "a",Space,Str "table:"]
241241,RawBlock "html" "<table>\n<tr>\n<td>"
242242,Plain [Str "This",Space,Str "is",Space,Emph [Str "emphasized"]]
243243,RawBlock "html" "</td>\n<td>"
244244,Plain [Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"]]
245245,RawBlock "html" "</td>\n</tr>\n</table>\n\n<script type=\"text/javascript\">document.write('This *should not* be interpreted as markdown');</script>\n"
246−,Para [Str "Here\8217s",Space,Str "a",Space,Str "simple",Space,Str "block",Str ":"]
246+,Para [Str "Here\8217s",Space,Str "a",Space,Str "simple",Space,Str "block:"]
247247,RawBlock "html" "<div>\n "
248248,Plain [Str "foo"]
249249,RawBlock "html" "</div>\n"
250−,Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block",Str ",",Space,Str "though",Str ":"]
250+,Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]
251251,CodeBlock ("",[],[]) "<div>\n foo\n</div>"
252−,Para [Str "As",Space,Str "should",Space,Str "this",Str ":"]
252+,Para [Str "As",Space,Str "should",Space,Str "this:"]
253253,CodeBlock ("",[],[]) "<div>foo</div>"
254−,Para [Str "Now",Str ",",Space,Str "nested",Str ":"]
254+,Para [Str "Now,",Space,Str "nested:"]
255255,RawBlock "html" "<div>\n <div>\n <div>\n "
256256,Plain [Str "foo"]
257257,RawBlock "html" "</div>\n </div>\n</div>\n"
258−,Para [Str "This",Space,Str "should",Space,Str "just",Space,Str "be",Space,Str "an",Space,Str "HTML",Space,Str "comment",Str ":"]
258+,Para [Str "This",Space,Str "should",Space,Str "just",Space,Str "be",Space,Str "an",Space,Str "HTML",Space,Str "comment:"]
259259,RawBlock "html" "<!-- Comment -->\n"
260−,Para [Str "Multiline",Str ":"]
260+,Para [Str "Multiline:"]
261261,RawBlock "html" "<!--\nBlah\nBlah\n-->\n\n<!--\n This is another comment.\n-->\n"
262−,Para [Str "Code",Space,Str "block",Str ":"]
262+,Para [Str "Code",Space,Str "block:"]
263263,CodeBlock ("",[],[]) "<!-- Comment -->"
264−,Para [Str "Just",Space,Str "plain",Space,Str "comment",Str ",",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line",Str ":"]
264+,Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"]
265265,RawBlock "html" "<!-- foo --> \n"
266−,Para [Str "Code",Str ":"]
266+,Para [Str "Code:"]
267267,CodeBlock ("",[],[]) "<hr />"
268−,Para [Str "Hr\8217s",Str ":"]
268+,Para [Str "Hr\8217s:"]
269269,RawBlock "html" "<hr>\n\n<hr />\n\n<hr />\n\n<hr> \n\n<hr /> \n\n<hr /> \n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\">\n"
270270,HorizontalRule
271271,Header 1 [Str "Inline",Space,Str "Markup"]
272272,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str "."]
273273,Para [Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str "."]
274274,Para [Str "An",Space,Emph [Link [Str "emphasized",Space,Str "link"] ("/url","")],Str "."]
275−,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em",Str "."]]]
276−,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word",Str "."]
277−,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em",Str "."]]]
278−,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word",Str "."]
279−,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 "."]
275+,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
276+,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
277+,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
278+,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
279+,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 "."]
280280,Para [Strikeout [Str "This",Space,Str "is",Space,Emph [Str "strikeout"],Str "."]]
281−,Para [Str "Superscripts",Str ":",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Superscript [Emph [Str "hello"]],Space,Str "a",Superscript [Str "hello",Str "\160",Str "there"],Str "."]
282−,Para [Str "Subscripts",Str ":",Space,Str "H",Subscript [Str "2"],Str "O",Str ",",Space,Str "H",Subscript [Str "23"],Str "O",Str ",",Space,Str "H",Subscript [Str "many",Str "\160",Str "of",Str "\160",Str "them"],Str "O",Str "."]
283−,Para [Str "These",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "superscripts",Space,Str "or",Space,Str "subscripts",Str ",",Space,Str "because",Space,Str "of",Space,Str "the",Space,Str "unescaped",Space,Str "spaces",Str ":",Space,Str "a",Str "^",Str "b",Space,Str "c",Str "^",Str "d",Str ",",Space,Str "a",Str "~",Str "b",Space,Str "c",Str "~",Str "d",Str "."]
281+,Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Superscript [Emph [Str "hello"]],Space,Str "a",Superscript [Str "hello\160there"],Str "."]
282+,Para [Str "Subscripts:",Space,Str "H",Subscript [Str "2"],Str "O,",Space,Str "H",Subscript [Str "23"],Str "O,",Space,Str "H",Subscript [Str "many\160of\160them"],Str "O."]
283+,Para [Str "These",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "superscripts",Space,Str "or",Space,Str "subscripts,",Space,Str "because",Space,Str "of",Space,Str "the",Space,Str "unescaped",Space,Str "spaces:",Space,Str "a^b",Space,Str "c^d,",Space,Str "a~b",Space,Str "c~d."]
284284,HorizontalRule
285−,Header 1 [Str "Smart",Space,Str "quotes",Str ",",Space,Str "ellipses",Str ",",Space,Str "dashes"]
286−,Para [Quoted DoubleQuote [Str "Hello",Str ","],Space,Str "said",Space,Str "the",Space,Str "spider",Str ".",Space,Quoted DoubleQuote [Quoted SingleQuote [Str "Shelob"],Space,Str "is",Space,Str "my",Space,Str "name",Str "."]]
287−,Para [Quoted SingleQuote [Str "A"],Str ",",Space,Quoted SingleQuote [Str "B"],Str ",",Space,Str "and",Space,Quoted SingleQuote [Str "C"],Space,Str "are",Space,Str "letters",Str "."]
288−,Para [Quoted SingleQuote [Str "Oak",Str ","],Space,Quoted SingleQuote [Str "elm",Str ","],Space,Str "and",Space,Quoted SingleQuote [Str "beech"],Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees",Str ".",Space,Str "So",Space,Str "is",Space,Quoted SingleQuote [Str "pine",Str "."]]
289−,Para [Quoted SingleQuote [Str "He",Space,Str "said",Str ",",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go",Str "."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70\8217s",Str "?"]
285+,Header 1 [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
286+,Para [Quoted DoubleQuote [Str "Hello,"],Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Quoted DoubleQuote [Quoted SingleQuote [Str "Shelob"],Space,Str "is",Space,Str "my",Space,Str "name."]]
287+,Para [Quoted SingleQuote [Str "A"],Str ",",Space,Quoted SingleQuote [Str "B"],Str ",",Space,Str "and",Space,Quoted SingleQuote [Str "C"],Space,Str "are",Space,Str "letters."]
288+,Para [Quoted SingleQuote [Str "Oak,"],Space,Quoted SingleQuote [Str "elm,"],Space,Str "and",Space,Quoted SingleQuote [Str "beech"],Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees.",Space,Str "So",Space,Str "is",Space,Quoted SingleQuote [Str "pine."]]
289+,Para [Quoted SingleQuote [Str "He",Space,Str "said,",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70\8217s?"]
290290,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Quoted SingleQuote [Code ("",[],[]) "code"],Space,Str "and",Space,Str "a",Space,Quoted DoubleQuote [Link [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2","")],Str "."]
291−,Para [Str "Some",Space,Str "dashes",Str ":",Space,Str "one",Str "\8212",Str "two",Space,Str "\8212",Space,Str "three",Str "\8212",Str "four",Space,Str "\8212",Space,Str "five",Str "."]
292−,Para [Str "Dashes",Space,Str "between",Space,Str "numbers",Str ":",Space,Str "5",Str "\8211",Str "7",Str ",",Space,Str "255",Str "\8211",Str "66",Str ",",Space,Str "1987",Str "\8211",Str "1999",Str "."]
293−,Para [Str "Ellipses",Str "\8230",Str "and",Str "\8230",Str "and",Str "\8230",Str "."]
291+,Para [Str "Some",Space,Str "dashes:",Space,Str "one\8212two",Space,Str "\8212",Space,Str "three\8212four",Space,Str "\8212",Space,Str "five."]
292+,Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5\8211\&7,",Space,Str "255\8211\&66,",Space,Str "1987\8211\&1999."]
293+,Para [Str "Ellipses\8230and\8230and\8230."]
294294,HorizontalRule
295295,Header 1 [Str "LaTeX"]
296296,BulletList
@@ -299,47 +299,47 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
299299 ,[Plain [Math InlineMath "x \\in y"]]
300300 ,[Plain [Math InlineMath "\\alpha \\wedge \\omega"]]
301301 ,[Plain [Math InlineMath "223"]]
302− ,[Plain [Math InlineMath "p",Str "-",Str "Tree"]]
303− ,[Plain [Str "Here\8217s",Space,Str "some",Space,Str "display",Space,Str "math",Str ":",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]]
304− ,[Plain [Str "Here\8217s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it",Str ":",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]]
305−,Para [Str "These",Space,Str "shouldn\8217t",Space,Str "be",Space,Str "math",Str ":"]
302+ ,[Plain [Math InlineMath "p",Str "-Tree"]]
303+ ,[Plain [Str "Here\8217s",Space,Str "some",Space,Str "display",Space,Str "math:",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]]
304+ ,[Plain [Str "Here\8217s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]]
305+,Para [Str "These",Space,Str "shouldn\8217t",Space,Str "be",Space,Str "math:"]
306306,BulletList
307− [[Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation",Str ",",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]]
308− ,[Plain [Str "$",Str "22",Str ",",Str "000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money",Str ".",Space,Str "So",Space,Str "is",Space,Str "$",Str "34",Str ",",Str "000",Str ".",Space,Str "(",Str "It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized",Str ".",Str ")"]]
309− ,[Plain [Str "Shoes",Space,Str "(",Str "$",Str "20",Str ")",Space,Str "and",Space,Str "socks",Space,Str "(",Str "$",Str "5",Str ")",Str "."]]
310− ,[Plain [Str "Escaped",Space,Code ("",[],[]) "$",Str ":",Space,Str "$",Str "73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23",Str "$",Str "."]]]
311−,Para [Str "Here\8217s",Space,Str "a",Space,Str "LaTeX",Space,Str "table",Str ":"]
307+ [[Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]]
308+ ,[Plain [Str "$22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money.",Space,Str "So",Space,Str "is",Space,Str "$34,000.",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized.)"]]
309+ ,[Plain [Str "Shoes",Space,Str "($20)",Space,Str "and",Space,Str "socks",Space,Str "($5)."]]
310+ ,[Plain [Str "Escaped",Space,Code ("",[],[]) "$",Str ":",Space,Str "$73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23$."]]]
311+,Para [Str "Here\8217s",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
312312,RawBlock "latex" "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}"
313313,HorizontalRule
314314,Header 1 [Str "Special",Space,Str "Characters"]
315−,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode",Str ":"]
315+,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
316316,BulletList
317− [[Plain [Str "I",Space,Str "hat",Str ":",Space,Str "\206"]]
318− ,[Plain [Str "o",Space,Str "umlaut",Str ":",Space,Str "\246"]]
319− ,[Plain [Str "section",Str ":",Space,Str "\167"]]
320− ,[Plain [Str "set",Space,Str "membership",Str ":",Space,Str "\8712"]]
321− ,[Plain [Str "copyright",Str ":",Space,Str "\169"]]]
322−,Para [Str "AT",Str "&",Str "T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name",Str "."]
323−,Para [Str "AT",Str "&",Str "T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it",Str "."]
324−,Para [Str "This",Space,Str "&",Space,Str "that",Str "."]
325−,Para [Str "4",Space,Str "<",Space,Str "5",Str "."]
326−,Para [Str "6",Space,Str ">",Space,Str "5",Str "."]
327−,Para [Str "Backslash",Str ":",Space,Str "\\"]
328−,Para [Str "Backtick",Str ":",Space,Str "`"]
329−,Para [Str "Asterisk",Str ":",Space,Str "*"]
330−,Para [Str "Underscore",Str ":",Space,Str "_"]
331−,Para [Str "Left",Space,Str "brace",Str ":",Space,Str "{"]
332−,Para [Str "Right",Space,Str "brace",Str ":",Space,Str "}"]
333−,Para [Str "Left",Space,Str "bracket",Str ":",Space,Str "["]
334−,Para [Str "Right",Space,Str "bracket",Str ":",Space,Str "]"]
335−,Para [Str "Left",Space,Str "paren",Str ":",Space,Str "("]
336−,Para [Str "Right",Space,Str "paren",Str ":",Space,Str ")"]
337−,Para [Str "Greater",Str "-",Str "than",Str ":",Space,Str ">"]
338−,Para [Str "Hash",Str ":",Space,Str "#"]
339−,Para [Str "Period",Str ":",Space,Str "."]
340−,Para [Str "Bang",Str ":",Space,Str "!"]
341−,Para [Str "Plus",Str ":",Space,Str "+"]
342−,Para [Str "Minus",Str ":",Space,Str "-"]
317+ [[Plain [Str "I",Space,Str "hat:",Space,Str "\206"]]
318+ ,[Plain [Str "o",Space,Str "umlaut:",Space,Str "\246"]]
319+ ,[Plain [Str "section:",Space,Str "\167"]]
320+ ,[Plain [Str "set",Space,Str "membership:",Space,Str "\8712"]]
321+ ,[Plain [Str "copyright:",Space,Str "\169"]]]
322+,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
323+,Para [Str "AT&T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it."]
324+,Para [Str "This",Space,Str "&",Space,Str "that."]
325+,Para [Str "4",Space,Str "<",Space,Str "5."]
326+,Para [Str "6",Space,Str ">",Space,Str "5."]
327+,Para [Str "Backslash:",Space,Str "\\"]
328+,Para [Str "Backtick:",Space,Str "`"]
329+,Para [Str "Asterisk:",Space,Str "*"]
330+,Para [Str "Underscore:",Space,Str "_"]
331+,Para [Str "Left",Space,Str "brace:",Space,Str "{"]
332+,Para [Str "Right",Space,Str "brace:",Space,Str "}"]
333+,Para [Str "Left",Space,Str "bracket:",Space,Str "["]
334+,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
335+,Para [Str "Left",Space,Str "paren:",Space,Str "("]
336+,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
337+,Para [Str "Greater-than:",Space,Str ">"]
338+,Para [Str "Hash:",Space,Str "#"]
339+,Para [Str "Period:",Space,Str "."]
340+,Para [Str "Bang:",Space,Str "!"]
341+,Para [Str "Plus:",Space,Str "+"]
342+,Para [Str "Minus:",Space,Str "-"]
343343,HorizontalRule
344344,Header 1 [Str "Links"]
345345,Header 2 [Str "Explicit"]
@@ -349,48 +349,48 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
349349,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title preceded by a tab"),Str "."]
350350,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with \"quotes\" in it")]
351351,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with single quotes")]
352−,Para [Link [Str "with",Str "_",Str "underscore"] ("/url/with_underscore","")]
352+,Para [Link [Str "with_underscore"] ("/url/with_underscore","")]
353353,Para [Link [Str "Email",Space,Str "link"] ("mailto:nobody@nowhere.net","")]
354354,Para [Link [Str "Empty"] ("",""),Str "."]
355355,Header 2 [Str "Reference"]
356356,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
357357,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
358358,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
359−,Para [Str "With",Space,Link [Str "embedded",Space,Str "[",Str "brackets",Str "]"] ("/url/",""),Str "."]
360−,Para [Link [Str "b"] ("/url/",""),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link",Str "."]
359+,Para [Str "With",Space,Link [Str "embedded",Space,Str "[brackets]"] ("/url/",""),Str "."]
360+,Para [Link [Str "b"] ("/url/",""),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link."]
361361,Para [Str "Indented",Space,Link [Str "once"] ("/url",""),Str "."]
362362,Para [Str "Indented",Space,Link [Str "twice"] ("/url",""),Str "."]
363363,Para [Str "Indented",Space,Link [Str "thrice"] ("/url",""),Str "."]
364−,Para [Str "This",Space,Str "should",Space,Str "[",Str "not",Str "]",Str "[",Str "]",Space,Str "be",Space,Str "a",Space,Str "link",Str "."]
364+,Para [Str "This",Space,Str "should",Space,Str "[not][]",Space,Str "be",Space,Str "a",Space,Str "link."]
365365,CodeBlock ("",[],[]) "[not]: /url"
366366,Para [Str "Foo",Space,Link [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."]
367367,Para [Str "Foo",Space,Link [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."]
368368,Header 2 [Str "With",Space,Str "ampersands"]
369369,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 "."]
370−,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",Str ":",Space,Link [Str "AT",Str "&",Str "T"] ("http://att.com/","AT&T"),Str "."]
370+,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"] ("http://att.com/","AT&T"),Str "."]
371371,Para [Str "Here\8217s",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."]
372372,Para [Str "Here\8217s",Space,Str "an",Space,Link [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."]
373373,Header 2 [Str "Autolinks"]
374−,Para [Str "With",Space,Str "an",Space,Str "ampersand",Str ":",Space,Link [Code ("",["url"],[]) "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
374+,Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link [Code ("",["url"],[]) "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
375375,BulletList
376− [[Plain [Str "In",Space,Str "a",Space,Str "list",Str "?"]]
376+ [[Plain [Str "In",Space,Str "a",Space,Str "list?"]]
377377 ,[Plain [Link [Code ("",["url"],[]) "http://example.com/"] ("http://example.com/","")]]
378− ,[Plain [Str "It",Space,Str "should",Str "."]]]
379−,Para [Str "An",Space,Str "e",Str "-",Str "mail",Space,Str "address",Str ":",Space,Link [Code ("",["url"],[]) "nobody@nowhere.net"] ("mailto:nobody@nowhere.net","")]
378+ ,[Plain [Str "It",Space,Str "should."]]]
379+,Para [Str "An",Space,Str "e-mail",Space,Str "address:",Space,Link [Code ("",["url"],[]) "nobody@nowhere.net"] ("mailto:nobody@nowhere.net","")]
380380,BlockQuote
381− [Para [Str "Blockquoted",Str ":",Space,Link [Code ("",["url"],[]) "http://example.com/"] ("http://example.com/","")]]
382−,Para [Str "Auto",Str "-",Str "links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here",Str ":",Space,Code ("",[],[]) "<http://example.com/>"]
381+ [Para [Str "Blockquoted:",Space,Link [Code ("",["url"],[]) "http://example.com/"] ("http://example.com/","")]]
382+,Para [Str "Auto-links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code ("",[],[]) "<http://example.com/>"]
383383,CodeBlock ("",[],[]) "or here: <http://example.com/>"
384384,HorizontalRule
385385,Header 1 [Str "Images"]
386−,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 ":"]
386+,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):"]
387387,Para [Image [Str "lalune"] ("lalune.jpg","Voyage dans la Lune")]
388−,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon",Str "."]
388+,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
389389,HorizontalRule
390390,Header 1 [Str "Footnotes"]
391−,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",Str ",",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote",Str ".",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference",Str ".",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document",Str "."]],Space,Str "and",Space,Str "another",Str ".",Note [Para [Str "Here\8217s",Space,Str "the",Space,Str "long",Space,Str "note",Str ".",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks",Str "."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(",Str "as",Space,Str "with",Space,Str "list",Space,Str "items",Str ")",Str "."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want",Str ",",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line",Str ",",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block",Str "."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference",Str ",",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space",Str ".",Str "[",Str "^",Str "my",Space,Str "note",Str "]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note",Str ".",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type",Str ".",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters",Str ",",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[",Str "bracketed",Space,Str "text",Str "]",Str "."]]]
391+,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference.",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document."]],Space,Str "and",Space,Str "another.",Note [Para [Str "Here\8217s",Space,Str "the",Space,Str "long",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space.[^my",Space,Str "note]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note.",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type.",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[bracketed",Space,Str "text]."]]]
392392,BlockQuote
393− [Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes",Str ".",Note [Para [Str "In",Space,Str "quote",Str "."]]]]
393+ [Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes.",Note [Para [Str "In",Space,Str "quote."]]]]
394394,OrderedList (1,Decimal,Period)
395− [[Plain [Str "And",Space,Str "in",Space,Str "list",Space,Str "items",Str ".",Note [Para [Str "In",Space,Str "list",Str "."]]]]]
396−,Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note",Str ",",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",Space,Str "indented",Str "."]]
395+ [[Plain [Str "And",Space,Str "in",Space,Str "list",Space,Str "items.",Note [Para [Str "In",Space,Str "list."]]]]]
396+,Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note,",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",Space,Str "indented."]]
tests/writer.native+134−134
@@ -1,5 +1,5 @@
1−Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docAuthors = [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]], docDate = [Str "July",Space,Str "17",Str ",",Space,Str "2006"]})
2−[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\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."]
1+Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docAuthors = [[Str "John",Space,Str "MacFarlane"],[Str "Anonymous"]], docDate = [Str "July",Space,Str "17,",Space,Str "2006"]})
2+[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."]
33,HorizontalRule
44,Header 1 [Str "Headers"]
55,Header 2 [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embedded",Space,Str "link"] ("/url","")]
@@ -14,95 +14,95 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
1414,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
1515,HorizontalRule
1616,Header 1 [Str "Paragraphs"]
17−,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph",Str "."]
18−,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 "."]
19−,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet",Str ".",Space,Str "*",Space,Str "criminey",Str "."]
20−,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here",Str "."]
17+,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
18+,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."]
19+,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet.",Space,Str "*",Space,Str "criminey."]
20+,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Str "here."]
2121,HorizontalRule
2222,Header 1 [Str "Block",Space,Str "Quotes"]
23−,Para [Str "E",Str "-",Str "mail",Space,Str "style",Str ":"]
23+,Para [Str "E-mail",Space,Str "style:"]
2424,BlockQuote
25− [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 "."]]
25+ [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."]]
2626,BlockQuote
27− [Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":"]
27+ [Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
2828 ,CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}"
29− ,Para [Str "A",Space,Str "list",Str ":"]
29+ ,Para [Str "A",Space,Str "list:"]
3030 ,OrderedList (1,Decimal,Period)
3131 [[Plain [Str "item",Space,Str "one"]]
3232 ,[Plain [Str "item",Space,Str "two"]]]
33− ,Para [Str "Nested",Space,Str "block",Space,Str "quotes",Str ":"]
33+ ,Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
3434 ,BlockQuote
3535 [Para [Str "nested"]]
3636 ,BlockQuote
3737 [Para [Str "nested"]]]
38−,Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "block",Space,Str "quote",Str ":",Space,Str "2",Space,Str ">",Space,Str "1",Str "."]
39−,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph",Str "."]
38+,Para [Str "This",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "block",Space,Str "quote:",Space,Str "2",Space,Str ">",Space,Str "1."]
39+,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
4040,HorizontalRule
4141,Header 1 [Str "Code",Space,Str "Blocks"]
42−,Para [Str "Code",Str ":"]
42+,Para [Str "Code:"]
4343,CodeBlock ("",[],[]) "---- (should be four hyphens)\n\nsub status {\n print \"working\";\n}\n\nthis code block is indented by one tab"
44−,Para [Str "And",Str ":"]
44+,Para [Str "And:"]
4545,CodeBlock ("",[],[]) " this code block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{"
4646,HorizontalRule
4747,Header 1 [Str "Lists"]
4848,Header 2 [Str "Unordered"]
49−,Para [Str "Asterisks",Space,Str "tight",Str ":"]
49+,Para [Str "Asterisks",Space,Str "tight:"]
5050,BulletList
5151 [[Plain [Str "asterisk",Space,Str "1"]]
5252 ,[Plain [Str "asterisk",Space,Str "2"]]
5353 ,[Plain [Str "asterisk",Space,Str "3"]]]
54−,Para [Str "Asterisks",Space,Str "loose",Str ":"]
54+,Para [Str "Asterisks",Space,Str "loose:"]
5555,BulletList
5656 [[Para [Str "asterisk",Space,Str "1"]]
5757 ,[Para [Str "asterisk",Space,Str "2"]]
5858 ,[Para [Str "asterisk",Space,Str "3"]]]
59−,Para [Str "Pluses",Space,Str "tight",Str ":"]
59+,Para [Str "Pluses",Space,Str "tight:"]
6060,BulletList
6161 [[Plain [Str "Plus",Space,Str "1"]]
6262 ,[Plain [Str "Plus",Space,Str "2"]]
6363 ,[Plain [Str "Plus",Space,Str "3"]]]
64−,Para [Str "Pluses",Space,Str "loose",Str ":"]
64+,Para [Str "Pluses",Space,Str "loose:"]
6565,BulletList
6666 [[Para [Str "Plus",Space,Str "1"]]
6767 ,[Para [Str "Plus",Space,Str "2"]]
6868 ,[Para [Str "Plus",Space,Str "3"]]]
69−,Para [Str "Minuses",Space,Str "tight",Str ":"]
69+,Para [Str "Minuses",Space,Str "tight:"]
7070,BulletList
7171 [[Plain [Str "Minus",Space,Str "1"]]
7272 ,[Plain [Str "Minus",Space,Str "2"]]
7373 ,[Plain [Str "Minus",Space,Str "3"]]]
74−,Para [Str "Minuses",Space,Str "loose",Str ":"]
74+,Para [Str "Minuses",Space,Str "loose:"]
7575,BulletList
7676 [[Para [Str "Minus",Space,Str "1"]]
7777 ,[Para [Str "Minus",Space,Str "2"]]
7878 ,[Para [Str "Minus",Space,Str "3"]]]
7979,Header 2 [Str "Ordered"]
80−,Para [Str "Tight",Str ":"]
80+,Para [Str "Tight:"]
8181,OrderedList (1,Decimal,Period)
8282 [[Plain [Str "First"]]
8383 ,[Plain [Str "Second"]]
8484 ,[Plain [Str "Third"]]]
85−,Para [Str "and",Str ":"]
85+,Para [Str "and:"]
8686,OrderedList (1,Decimal,Period)
8787 [[Plain [Str "One"]]
8888 ,[Plain [Str "Two"]]
8989 ,[Plain [Str "Three"]]]
90−,Para [Str "Loose",Space,Str "using",Space,Str "tabs",Str ":"]
90+,Para [Str "Loose",Space,Str "using",Space,Str "tabs:"]
9191,OrderedList (1,Decimal,Period)
9292 [[Para [Str "First"]]
9393 ,[Para [Str "Second"]]
9494 ,[Para [Str "Third"]]]
95−,Para [Str "and",Space,Str "using",Space,Str "spaces",Str ":"]
95+,Para [Str "and",Space,Str "using",Space,Str "spaces:"]
9696,OrderedList (1,Decimal,Period)
9797 [[Para [Str "One"]]
9898 ,[Para [Str "Two"]]
9999 ,[Para [Str "Three"]]]
100−,Para [Str "Multiple",Space,Str "paragraphs",Str ":"]
100+,Para [Str "Multiple",Space,Str "paragraphs:"]
101101,OrderedList (1,Decimal,Period)
102− [[Para [Str "Item",Space,Str "1",Str ",",Space,Str "graf",Space,Str "one",Str "."]
103− ,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\8217s",Space,Str "back",Str "."]]
104− ,[Para [Str "Item",Space,Str "2",Str "."]]
105− ,[Para [Str "Item",Space,Str "3",Str "."]]]
102+ [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
103+ ,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."]]
104+ ,[Para [Str "Item",Space,Str "2."]]
105+ ,[Para [Str "Item",Space,Str "3."]]]
106106,Header 2 [Str "Nested"]
107107,BulletList
108108 [[Plain [Str "Tab"]
@@ -110,19 +110,19 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
110110 [[Plain [Str "Tab"]
111111 ,BulletList
112112 [[Plain [Str "Tab"]]]]]]]
113−,Para [Str "Here\8217s",Space,Str "another",Str ":"]
113+,Para [Str "Here\8217s",Space,Str "another:"]
114114,OrderedList (1,Decimal,Period)
115115 [[Plain [Str "First"]]
116− ,[Plain [Str "Second",Str ":"]
116+ ,[Plain [Str "Second:"]
117117 ,BulletList
118118 [[Plain [Str "Fee"]]
119119 ,[Plain [Str "Fie"]]
120120 ,[Plain [Str "Foe"]]]]
121121 ,[Plain [Str "Third"]]]
122−,Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs",Str ":"]
122+,Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs:"]
123123,OrderedList (1,Decimal,Period)
124124 [[Para [Str "First"]]
125− ,[Para [Str "Second",Str ":"]
125+ ,[Para [Str "Second:"]
126126 ,BulletList
127127 [[Plain [Str "Fee"]]
128128 ,[Plain [Str "Fie"]]
@@ -141,32 +141,32 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
141141 ,[Para [Str "and",Space,Str "now",Space,Str "3"]
142142 ,Para [Str "with",Space,Str "a",Space,Str "continuation"]
143143 ,OrderedList (4,LowerRoman,Period)
144− [[Plain [Str "sublist",Space,Str "with",Space,Str "roman",Space,Str "numerals",Str ",",Space,Str "starting",Space,Str "with",Space,Str "4"]]
144+ [[Plain [Str "sublist",Space,Str "with",Space,Str "roman",Space,Str "numerals,",Space,Str "starting",Space,Str "with",Space,Str "4"]]
145145 ,[Plain [Str "more",Space,Str "items"]
146146 ,OrderedList (1,UpperAlpha,TwoParens)
147147 [[Plain [Str "a",Space,Str "subsublist"]]
148148 ,[Plain [Str "a",Space,Str "subsublist"]]]]]]]
149−,Para [Str "Nesting",Str ":"]
149+,Para [Str "Nesting:"]
150150,OrderedList (1,UpperAlpha,Period)
151151 [[Plain [Str "Upper",Space,Str "Alpha"]
152152 ,OrderedList (1,UpperRoman,Period)
153− [[Plain [Str "Upper",Space,Str "Roman",Str "."]
153+ [[Plain [Str "Upper",Space,Str "Roman."]
154154 ,OrderedList (6,Decimal,TwoParens)
155155 [[Plain [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
156156 ,OrderedList (3,LowerAlpha,OneParen)
157157 [[Plain [Str "Lower",Space,Str "alpha",Space,Str "with",Space,Str "paren"]]]]]]]]]
158−,Para [Str "Autonumbering",Str ":"]
158+,Para [Str "Autonumbering:"]
159159,OrderedList (1,DefaultStyle,DefaultDelim)
160− [[Plain [Str "Autonumber",Str "."]]
161− ,[Plain [Str "More",Str "."]
160+ [[Plain [Str "Autonumber."]]
161+ ,[Plain [Str "More."]
162162 ,OrderedList (1,DefaultStyle,DefaultDelim)
163− [[Plain [Str "Nested",Str "."]]]]]
164−,Para [Str "Should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "list",Space,Str "item",Str ":"]
165−,Para [Str "M.A.\160",Str "2007"]
166−,Para [Str "B",Str ".",Space,Str "Williams"]
163+ [[Plain [Str "Nested."]]]]]
164+,Para [Str "Should",Space,Str "not",Space,Str "be",Space,Str "a",Space,Str "list",Space,Str "item:"]
165+,Para [Str "M.A.\160\&2007"]
166+,Para [Str "B.",Space,Str "Williams"]
167167,HorizontalRule
168168,Header 1 [Str "Definition",Space,Str "Lists"]
169−,Para [Str "Tight",Space,Str "using",Space,Str "spaces",Str ":"]
169+,Para [Str "Tight",Space,Str "using",Space,Str "spaces:"]
170170,DefinitionList
171171 [([Str "apple"],
172172 [[Plain [Str "red",Space,Str "fruit"]]])
@@ -174,7 +174,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
174174 [[Plain [Str "orange",Space,Str "fruit"]]])
175175 ,([Str "banana"],
176176 [[Plain [Str "yellow",Space,Str "fruit"]]])]
177−,Para [Str "Tight",Space,Str "using",Space,Str "tabs",Str ":"]
177+,Para [Str "Tight",Space,Str "using",Space,Str "tabs:"]
178178,DefinitionList
179179 [([Str "apple"],
180180 [[Plain [Str "red",Space,Str "fruit"]]])
@@ -182,7 +182,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
182182 [[Plain [Str "orange",Space,Str "fruit"]]])
183183 ,([Str "banana"],
184184 [[Plain [Str "yellow",Space,Str "fruit"]]])]
185−,Para [Str "Loose",Str ":"]
185+,Para [Str "Loose:"]
186186,DefinitionList
187187 [([Str "apple"],
188188 [[Para [Str "red",Space,Str "fruit"]]])
@@ -190,17 +190,17 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
190190 [[Para [Str "orange",Space,Str "fruit"]]])
191191 ,([Str "banana"],
192192 [[Para [Str "yellow",Space,Str "fruit"]]])]
193−,Para [Str "Multiple",Space,Str "blocks",Space,Str "with",Space,Str "italics",Str ":"]
193+,Para [Str "Multiple",Space,Str "blocks",Space,Str "with",Space,Str "italics:"]
194194,DefinitionList
195195 [([Emph [Str "apple"]],
196196 [[Para [Str "red",Space,Str "fruit"]
197− ,Para [Str "contains",Space,Str "seeds",Str ",",Space,Str "crisp",Str ",",Space,Str "pleasant",Space,Str "to",Space,Str "taste"]]])
197+ ,Para [Str "contains",Space,Str "seeds,",Space,Str "crisp,",Space,Str "pleasant",Space,Str "to",Space,Str "taste"]]])
198198 ,([Emph [Str "orange"]],
199199 [[Para [Str "orange",Space,Str "fruit"]
200200 ,CodeBlock ("",[],[]) "{ orange code block }"
201201 ,BlockQuote
202202 [Para [Str "orange",Space,Str "block",Space,Str "quote"]]]])]
203−,Para [Str "Multiple",Space,Str "definitions",Str ",",Space,Str "tight",Str ":"]
203+,Para [Str "Multiple",Space,Str "definitions,",Space,Str "tight:"]
204204,DefinitionList
205205 [([Str "apple"],
206206 [[Plain [Str "red",Space,Str "fruit"]]
@@ -208,7 +208,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
208208 ,([Str "orange"],
209209 [[Plain [Str "orange",Space,Str "fruit"]]
210210 ,[Plain [Str "bank"]]])]
211−,Para [Str "Multiple",Space,Str "definitions",Str ",",Space,Str "loose",Str ":"]
211+,Para [Str "Multiple",Space,Str "definitions,",Space,Str "loose:"]
212212,DefinitionList
213213 [([Str "apple"],
214214 [[Para [Str "red",Space,Str "fruit"]]
@@ -216,7 +216,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
216216 ,([Str "orange"],
217217 [[Para [Str "orange",Space,Str "fruit"]]
218218 ,[Para [Str "bank"]]])]
219−,Para [Str "Blank",Space,Str "line",Space,Str "after",Space,Str "term",Str ",",Space,Str "indented",Space,Str "marker",Str ",",Space,Str "alternate",Space,Str "markers",Str ":"]
219+,Para [Str "Blank",Space,Str "line",Space,Str "after",Space,Str "term,",Space,Str "indented",Space,Str "marker,",Space,Str "alternate",Space,Str "markers:"]
220220,DefinitionList
221221 [([Str "apple"],
222222 [[Para [Str "red",Space,Str "fruit"]]
@@ -227,70 +227,70 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
227227 [[Plain [Str "sublist"]]
228228 ,[Plain [Str "sublist"]]]]])]
229229,Header 1 [Str "HTML",Space,Str "Blocks"]
230−,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line",Str ":"]
230+,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
231231,RawBlock "html" "<div>"
232232,Plain [Str "foo"]
233233,RawBlock "html" "</div>\n"
234−,Para [Str "And",Space,Str "nested",Space,Str "without",Space,Str "indentation",Str ":"]
234+,Para [Str "And",Space,Str "nested",Space,Str "without",Space,Str "indentation:"]
235235,RawBlock "html" "<div>\n<div>\n<div>"
236236,Plain [Str "foo"]
237237,RawBlock "html" "</div>\n</div>\n<div>"
238238,Plain [Str "bar"]
239239,RawBlock "html" "</div>\n</div>\n"
240−,Para [Str "Interpreted",Space,Str "markdown",Space,Str "in",Space,Str "a",Space,Str "table",Str ":"]
240+,Para [Str "Interpreted",Space,Str "markdown",Space,Str "in",Space,Str "a",Space,Str "table:"]
241241,RawBlock "html" "<table>\n<tr>\n<td>"
242242,Plain [Str "This",Space,Str "is",Space,Emph [Str "emphasized"]]
243243,RawBlock "html" "</td>\n<td>"
244244,Plain [Str "And",Space,Str "this",Space,Str "is",Space,Strong [Str "strong"]]
245245,RawBlock "html" "</td>\n</tr>\n</table>\n\n<script type=\"text/javascript\">document.write('This *should not* be interpreted as markdown');</script>\n"
246−,Para [Str "Here\8217s",Space,Str "a",Space,Str "simple",Space,Str "block",Str ":"]
246+,Para [Str "Here\8217s",Space,Str "a",Space,Str "simple",Space,Str "block:"]
247247,RawBlock "html" "<div>\n "
248248,Plain [Str "foo"]
249249,RawBlock "html" "</div>\n"
250−,Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block",Str ",",Space,Str "though",Str ":"]
250+,Para [Str "This",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "code",Space,Str "block,",Space,Str "though:"]
251251,CodeBlock ("",[],[]) "<div>\n foo\n</div>"
252−,Para [Str "As",Space,Str "should",Space,Str "this",Str ":"]
252+,Para [Str "As",Space,Str "should",Space,Str "this:"]
253253,CodeBlock ("",[],[]) "<div>foo</div>"
254−,Para [Str "Now",Str ",",Space,Str "nested",Str ":"]
254+,Para [Str "Now,",Space,Str "nested:"]
255255,RawBlock "html" "<div>\n <div>\n <div>\n "
256256,Plain [Str "foo"]
257257,RawBlock "html" "</div>\n </div>\n</div>\n"
258−,Para [Str "This",Space,Str "should",Space,Str "just",Space,Str "be",Space,Str "an",Space,Str "HTML",Space,Str "comment",Str ":"]
258+,Para [Str "This",Space,Str "should",Space,Str "just",Space,Str "be",Space,Str "an",Space,Str "HTML",Space,Str "comment:"]
259259,RawBlock "html" "<!-- Comment -->\n"
260−,Para [Str "Multiline",Str ":"]
260+,Para [Str "Multiline:"]
261261,RawBlock "html" "<!--\nBlah\nBlah\n-->\n\n<!--\n This is another comment.\n-->\n"
262−,Para [Str "Code",Space,Str "block",Str ":"]
262+,Para [Str "Code",Space,Str "block:"]
263263,CodeBlock ("",[],[]) "<!-- Comment -->"
264−,Para [Str "Just",Space,Str "plain",Space,Str "comment",Str ",",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line",Str ":"]
264+,Para [Str "Just",Space,Str "plain",Space,Str "comment,",Space,Str "with",Space,Str "trailing",Space,Str "spaces",Space,Str "on",Space,Str "the",Space,Str "line:"]
265265,RawBlock "html" "<!-- foo --> \n"
266−,Para [Str "Code",Str ":"]
266+,Para [Str "Code:"]
267267,CodeBlock ("",[],[]) "<hr />"
268−,Para [Str "Hr\8217s",Str ":"]
268+,Para [Str "Hr\8217s:"]
269269,RawBlock "html" "<hr>\n\n<hr />\n\n<hr />\n\n<hr> \n\n<hr /> \n\n<hr /> \n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\" />\n\n<hr class=\"foo\" id=\"bar\">\n"
270270,HorizontalRule
271271,Header 1 [Str "Inline",Space,Str "Markup"]
272272,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ",",Space,Str "and",Space,Str "so",Space,Emph [Str "is",Space,Str "this"],Str "."]
273273,Para [Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str "."]
274274,Para [Str "An",Space,Emph [Link [Str "emphasized",Space,Str "link"] ("/url","")],Str "."]
275−,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em",Str "."]]]
276−,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word",Str "."]
277−,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em",Str "."]]]
278−,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word",Str "."]
279−,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 "."]
275+,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
276+,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
277+,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
278+,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
279+,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 "."]
280280,Para [Strikeout [Str "This",Space,Str "is",Space,Emph [Str "strikeout"],Str "."]]
281−,Para [Str "Superscripts",Str ":",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Superscript [Emph [Str "hello"]],Space,Str "a",Superscript [Str "hello",Str "\160",Str "there"],Str "."]
282−,Para [Str "Subscripts",Str ":",Space,Str "H",Subscript [Str "2"],Str "O",Str ",",Space,Str "H",Subscript [Str "23"],Str "O",Str ",",Space,Str "H",Subscript [Str "many",Str "\160",Str "of",Str "\160",Str "them"],Str "O",Str "."]
283−,Para [Str "These",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "superscripts",Space,Str "or",Space,Str "subscripts",Str ",",Space,Str "because",Space,Str "of",Space,Str "the",Space,Str "unescaped",Space,Str "spaces",Str ":",Space,Str "a",Str "^",Str "b",Space,Str "c",Str "^",Str "d",Str ",",Space,Str "a",Str "~",Str "b",Space,Str "c",Str "~",Str "d",Str "."]
281+,Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Superscript [Emph [Str "hello"]],Space,Str "a",Superscript [Str "hello\160there"],Str "."]
282+,Para [Str "Subscripts:",Space,Str "H",Subscript [Str "2"],Str "O,",Space,Str "H",Subscript [Str "23"],Str "O,",Space,Str "H",Subscript [Str "many\160of\160them"],Str "O."]
283+,Para [Str "These",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "superscripts",Space,Str "or",Space,Str "subscripts,",Space,Str "because",Space,Str "of",Space,Str "the",Space,Str "unescaped",Space,Str "spaces:",Space,Str "a^b",Space,Str "c^d,",Space,Str "a~b",Space,Str "c~d."]
284284,HorizontalRule
285−,Header 1 [Str "Smart",Space,Str "quotes",Str ",",Space,Str "ellipses",Str ",",Space,Str "dashes"]
286−,Para [Quoted DoubleQuote [Str "Hello",Str ","],Space,Str "said",Space,Str "the",Space,Str "spider",Str ".",Space,Quoted DoubleQuote [Quoted SingleQuote [Str "Shelob"],Space,Str "is",Space,Str "my",Space,Str "name",Str "."]]
287−,Para [Quoted SingleQuote [Str "A"],Str ",",Space,Quoted SingleQuote [Str "B"],Str ",",Space,Str "and",Space,Quoted SingleQuote [Str "C"],Space,Str "are",Space,Str "letters",Str "."]
288−,Para [Quoted SingleQuote [Str "Oak",Str ","],Space,Quoted SingleQuote [Str "elm",Str ","],Space,Str "and",Space,Quoted SingleQuote [Str "beech"],Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees",Str ".",Space,Str "So",Space,Str "is",Space,Quoted SingleQuote [Str "pine",Str "."]]
289−,Para [Quoted SingleQuote [Str "He",Space,Str "said",Str ",",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go",Str "."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70\8217s",Str "?"]
285+,Header 1 [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
286+,Para [Quoted DoubleQuote [Str "Hello,"],Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Quoted DoubleQuote [Quoted SingleQuote [Str "Shelob"],Space,Str "is",Space,Str "my",Space,Str "name."]]
287+,Para [Quoted SingleQuote [Str "A"],Str ",",Space,Quoted SingleQuote [Str "B"],Str ",",Space,Str "and",Space,Quoted SingleQuote [Str "C"],Space,Str "are",Space,Str "letters."]
288+,Para [Quoted SingleQuote [Str "Oak,"],Space,Quoted SingleQuote [Str "elm,"],Space,Str "and",Space,Quoted SingleQuote [Str "beech"],Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees.",Space,Str "So",Space,Str "is",Space,Quoted SingleQuote [Str "pine."]]
289+,Para [Quoted SingleQuote [Str "He",Space,Str "said,",Space,Quoted DoubleQuote [Str "I",Space,Str "want",Space,Str "to",Space,Str "go."]],Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70\8217s?"]
290290,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Quoted SingleQuote [Code ("",[],[]) "code"],Space,Str "and",Space,Str "a",Space,Quoted DoubleQuote [Link [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2","")],Str "."]
291−,Para [Str "Some",Space,Str "dashes",Str ":",Space,Str "one",Str "\8212",Str "two",Space,Str "\8212",Space,Str "three",Str "\8212",Str "four",Space,Str "\8212",Space,Str "five",Str "."]
292−,Para [Str "Dashes",Space,Str "between",Space,Str "numbers",Str ":",Space,Str "5",Str "\8211",Str "7",Str ",",Space,Str "255",Str "\8211",Str "66",Str ",",Space,Str "1987",Str "\8211",Str "1999",Str "."]
293−,Para [Str "Ellipses",Str "\8230",Str "and",Str "\8230",Str "and",Str "\8230",Str "."]
291+,Para [Str "Some",Space,Str "dashes:",Space,Str "one\8212two",Space,Str "\8212",Space,Str "three\8212four",Space,Str "\8212",Space,Str "five."]
292+,Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5\8211\&7,",Space,Str "255\8211\&66,",Space,Str "1987\8211\&1999."]
293+,Para [Str "Ellipses\8230and\8230and\8230."]
294294,HorizontalRule
295295,Header 1 [Str "LaTeX"]
296296,BulletList
@@ -299,47 +299,47 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
299299 ,[Plain [Math InlineMath "x \\in y"]]
300300 ,[Plain [Math InlineMath "\\alpha \\wedge \\omega"]]
301301 ,[Plain [Math InlineMath "223"]]
302− ,[Plain [Math InlineMath "p",Str "-",Str "Tree"]]
303− ,[Plain [Str "Here\8217s",Space,Str "some",Space,Str "display",Space,Str "math",Str ":",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]]
304− ,[Plain [Str "Here\8217s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it",Str ":",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]]
305−,Para [Str "These",Space,Str "shouldn\8217t",Space,Str "be",Space,Str "math",Str ":"]
302+ ,[Plain [Math InlineMath "p",Str "-Tree"]]
303+ ,[Plain [Str "Here\8217s",Space,Str "some",Space,Str "display",Space,Str "math:",Space,Math DisplayMath "\\frac{d}{dx}f(x)=\\lim_{h\\to 0}\\frac{f(x+h)-f(x)}{h}"]]
304+ ,[Plain [Str "Here\8217s",Space,Str "one",Space,Str "that",Space,Str "has",Space,Str "a",Space,Str "line",Space,Str "break",Space,Str "in",Space,Str "it:",Space,Math InlineMath "\\alpha + \\omega \\times x^2",Str "."]]]
305+,Para [Str "These",Space,Str "shouldn\8217t",Space,Str "be",Space,Str "math:"]
306306,BulletList
307− [[Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation",Str ",",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]]
308− ,[Plain [Str "$",Str "22",Str ",",Str "000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money",Str ".",Space,Str "So",Space,Str "is",Space,Str "$",Str "34",Str ",",Str "000",Str ".",Space,Str "(",Str "It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized",Str ".",Str ")"]]
309− ,[Plain [Str "Shoes",Space,Str "(",Str "$",Str "20",Str ")",Space,Str "and",Space,Str "socks",Space,Str "(",Str "$",Str "5",Str ")",Str "."]]
310− ,[Plain [Str "Escaped",Space,Code ("",[],[]) "$",Str ":",Space,Str "$",Str "73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23",Str "$",Str "."]]]
311−,Para [Str "Here\8217s",Space,Str "a",Space,Str "LaTeX",Space,Str "table",Str ":"]
307+ [[Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]]
308+ ,[Plain [Str "$22,000",Space,Str "is",Space,Str "a",Space,Emph [Str "lot"],Space,Str "of",Space,Str "money.",Space,Str "So",Space,Str "is",Space,Str "$34,000.",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Quoted DoubleQuote [Str "lot"],Space,Str "is",Space,Str "emphasized.)"]]
309+ ,[Plain [Str "Shoes",Space,Str "($20)",Space,Str "and",Space,Str "socks",Space,Str "($5)."]]
310+ ,[Plain [Str "Escaped",Space,Code ("",[],[]) "$",Str ":",Space,Str "$73",Space,Emph [Str "this",Space,Str "should",Space,Str "be",Space,Str "emphasized"],Space,Str "23$."]]]
311+,Para [Str "Here\8217s",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
312312,RawBlock "latex" "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}"
313313,HorizontalRule
314314,Header 1 [Str "Special",Space,Str "Characters"]
315−,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode",Str ":"]
315+,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "unicode:"]
316316,BulletList
317− [[Plain [Str "I",Space,Str "hat",Str ":",Space,Str "\206"]]
318− ,[Plain [Str "o",Space,Str "umlaut",Str ":",Space,Str "\246"]]
319− ,[Plain [Str "section",Str ":",Space,Str "\167"]]
320− ,[Plain [Str "set",Space,Str "membership",Str ":",Space,Str "\8712"]]
321− ,[Plain [Str "copyright",Str ":",Space,Str "\169"]]]
322−,Para [Str "AT",Str "&",Str "T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name",Str "."]
323−,Para [Str "AT",Str "&",Str "T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it",Str "."]
324−,Para [Str "This",Space,Str "&",Space,Str "that",Str "."]
325−,Para [Str "4",Space,Str "<",Space,Str "5",Str "."]
326−,Para [Str "6",Space,Str ">",Space,Str "5",Str "."]
327−,Para [Str "Backslash",Str ":",Space,Str "\\"]
328−,Para [Str "Backtick",Str ":",Space,Str "`"]
329−,Para [Str "Asterisk",Str ":",Space,Str "*"]
330−,Para [Str "Underscore",Str ":",Space,Str "_"]
331−,Para [Str "Left",Space,Str "brace",Str ":",Space,Str "{"]
332−,Para [Str "Right",Space,Str "brace",Str ":",Space,Str "}"]
333−,Para [Str "Left",Space,Str "bracket",Str ":",Space,Str "["]
334−,Para [Str "Right",Space,Str "bracket",Str ":",Space,Str "]"]
335−,Para [Str "Left",Space,Str "paren",Str ":",Space,Str "("]
336−,Para [Str "Right",Space,Str "paren",Str ":",Space,Str ")"]
337−,Para [Str "Greater",Str "-",Str "than",Str ":",Space,Str ">"]
338−,Para [Str "Hash",Str ":",Space,Str "#"]
339−,Para [Str "Period",Str ":",Space,Str "."]
340−,Para [Str "Bang",Str ":",Space,Str "!"]
341−,Para [Str "Plus",Str ":",Space,Str "+"]
342−,Para [Str "Minus",Str ":",Space,Str "-"]
317+ [[Plain [Str "I",Space,Str "hat:",Space,Str "\206"]]
318+ ,[Plain [Str "o",Space,Str "umlaut:",Space,Str "\246"]]
319+ ,[Plain [Str "section:",Space,Str "\167"]]
320+ ,[Plain [Str "set",Space,Str "membership:",Space,Str "\8712"]]
321+ ,[Plain [Str "copyright:",Space,Str "\169"]]]
322+,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
323+,Para [Str "AT&T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it."]
324+,Para [Str "This",Space,Str "&",Space,Str "that."]
325+,Para [Str "4",Space,Str "<",Space,Str "5."]
326+,Para [Str "6",Space,Str ">",Space,Str "5."]
327+,Para [Str "Backslash:",Space,Str "\\"]
328+,Para [Str "Backtick:",Space,Str "`"]
329+,Para [Str "Asterisk:",Space,Str "*"]
330+,Para [Str "Underscore:",Space,Str "_"]
331+,Para [Str "Left",Space,Str "brace:",Space,Str "{"]
332+,Para [Str "Right",Space,Str "brace:",Space,Str "}"]
333+,Para [Str "Left",Space,Str "bracket:",Space,Str "["]
334+,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
335+,Para [Str "Left",Space,Str "paren:",Space,Str "("]
336+,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
337+,Para [Str "Greater-than:",Space,Str ">"]
338+,Para [Str "Hash:",Space,Str "#"]
339+,Para [Str "Period:",Space,Str "."]
340+,Para [Str "Bang:",Space,Str "!"]
341+,Para [Str "Plus:",Space,Str "+"]
342+,Para [Str "Minus:",Space,Str "-"]
343343,HorizontalRule
344344,Header 1 [Str "Links"]
345345,Header 2 [Str "Explicit"]
@@ -349,48 +349,48 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
349349,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title preceded by a tab"),Str "."]
350350,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with \"quotes\" in it")]
351351,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with single quotes")]
352−,Para [Link [Str "with",Str "_",Str "underscore"] ("/url/with_underscore","")]
352+,Para [Link [Str "with_underscore"] ("/url/with_underscore","")]
353353,Para [Link [Str "Email",Space,Str "link"] ("mailto:nobody@nowhere.net","")]
354354,Para [Link [Str "Empty"] ("",""),Str "."]
355355,Header 2 [Str "Reference"]
356356,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
357357,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
358358,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
359−,Para [Str "With",Space,Link [Str "embedded",Space,Str "[",Str "brackets",Str "]"] ("/url/",""),Str "."]
360−,Para [Link [Str "b"] ("/url/",""),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link",Str "."]
359+,Para [Str "With",Space,Link [Str "embedded",Space,Str "[brackets]"] ("/url/",""),Str "."]
360+,Para [Link [Str "b"] ("/url/",""),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link."]
361361,Para [Str "Indented",Space,Link [Str "once"] ("/url",""),Str "."]
362362,Para [Str "Indented",Space,Link [Str "twice"] ("/url",""),Str "."]
363363,Para [Str "Indented",Space,Link [Str "thrice"] ("/url",""),Str "."]
364−,Para [Str "This",Space,Str "should",Space,Str "[",Str "not",Str "]",Str "[",Str "]",Space,Str "be",Space,Str "a",Space,Str "link",Str "."]
364+,Para [Str "This",Space,Str "should",Space,Str "[not][]",Space,Str "be",Space,Str "a",Space,Str "link."]
365365,CodeBlock ("",[],[]) "[not]: /url"
366366,Para [Str "Foo",Space,Link [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."]
367367,Para [Str "Foo",Space,Link [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."]
368368,Header 2 [Str "With",Space,Str "ampersands"]
369369,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 "."]
370−,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",Str ":",Space,Link [Str "AT",Str "&",Str "T"] ("http://att.com/","AT&T"),Str "."]
370+,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"] ("http://att.com/","AT&T"),Str "."]
371371,Para [Str "Here\8217s",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."]
372372,Para [Str "Here\8217s",Space,Str "an",Space,Link [Str "inline",Space,Str "link",Space,Str "in",Space,Str "pointy",Space,Str "braces"] ("/script?foo=1&bar=2",""),Str "."]
373373,Header 2 [Str "Autolinks"]
374−,Para [Str "With",Space,Str "an",Space,Str "ampersand",Str ":",Space,Link [Code ("",["url"],[]) "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
374+,Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link [Code ("",["url"],[]) "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
375375,BulletList
376− [[Plain [Str "In",Space,Str "a",Space,Str "list",Str "?"]]
376+ [[Plain [Str "In",Space,Str "a",Space,Str "list?"]]
377377 ,[Plain [Link [Code ("",["url"],[]) "http://example.com/"] ("http://example.com/","")]]
378− ,[Plain [Str "It",Space,Str "should",Str "."]]]
379−,Para [Str "An",Space,Str "e",Str "-",Str "mail",Space,Str "address",Str ":",Space,Link [Code ("",["url"],[]) "nobody@nowhere.net"] ("mailto:nobody@nowhere.net","")]
378+ ,[Plain [Str "It",Space,Str "should."]]]
379+,Para [Str "An",Space,Str "e-mail",Space,Str "address:",Space,Link [Code ("",["url"],[]) "nobody@nowhere.net"] ("mailto:nobody@nowhere.net","")]
380380,BlockQuote
381− [Para [Str "Blockquoted",Str ":",Space,Link [Code ("",["url"],[]) "http://example.com/"] ("http://example.com/","")]]
382−,Para [Str "Auto",Str "-",Str "links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here",Str ":",Space,Code ("",[],[]) "<http://example.com/>"]
381+ [Para [Str "Blockquoted:",Space,Link [Code ("",["url"],[]) "http://example.com/"] ("http://example.com/","")]]
382+,Para [Str "Auto-links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code ("",[],[]) "<http://example.com/>"]
383383,CodeBlock ("",[],[]) "or here: <http://example.com/>"
384384,HorizontalRule
385385,Header 1 [Str "Images"]
386−,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 ":"]
386+,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):"]
387387,Para [Image [Str "lalune"] ("lalune.jpg","Voyage dans la Lune")]
388−,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon",Str "."]
388+,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
389389,HorizontalRule
390390,Header 1 [Str "Footnotes"]
391−,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",Str ",",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote",Str ".",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference",Str ".",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document",Str "."]],Space,Str "and",Space,Str "another",Str ".",Note [Para [Str "Here\8217s",Space,Str "the",Space,Str "long",Space,Str "note",Str ".",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks",Str "."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(",Str "as",Space,Str "with",Space,Str "list",Space,Str "items",Str ")",Str "."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want",Str ",",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line",Str ",",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block",Str "."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference",Str ",",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space",Str ".",Str "[",Str "^",Str "my",Space,Str "note",Str "]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note",Str ".",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type",Str ".",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters",Str ",",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[",Str "bracketed",Space,Str "text",Str "]",Str "."]]]
391+,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference.",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document."]],Space,Str "and",Space,Str "another.",Note [Para [Str "Here\8217s",Space,Str "the",Space,Str "long",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space.[^my",Space,Str "note]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note.",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type.",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[bracketed",Space,Str "text]."]]]
392392,BlockQuote
393− [Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes",Str ".",Note [Para [Str "In",Space,Str "quote",Str "."]]]]
393+ [Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes.",Note [Para [Str "In",Space,Str "quote."]]]]
394394,OrderedList (1,Decimal,Period)
395− [[Plain [Str "And",Space,Str "in",Space,Str "list",Space,Str "items",Str ".",Note [Para [Str "In",Space,Str "list",Str "."]]]]]
396−,Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note",Str ",",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",Space,Str "indented",Str "."]]
395+ [[Plain [Str "And",Space,Str "in",Space,Str "list",Space,Str "items.",Note [Para [Str "In",Space,Str "list."]]]]]
396+,Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note,",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",Space,Str "indented."]]
tests/writer.opendocument+46−54
@@ -665,27 +665,27 @@
665665 <style:style style:name="T35" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>
666666 <style:style style:name="T36" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>
667667 <style:style style:name="T37" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>
668− <style:style style:name="T38" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>
669− <style:style style:name="T39" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold" /></style:style>
668+ <style:style style:name="T38" style:family="text"><style:text-properties style:text-line-through-style="solid" /></style:style>
669+ <style:style style:name="T39" style:family="text"><style:text-properties style:text-line-through-style="solid" /></style:style>
670670 <style:style style:name="T40" style:family="text"><style:text-properties style:text-line-through-style="solid" /></style:style>
671671 <style:style style:name="T41" style:family="text"><style:text-properties style:text-line-through-style="solid" /></style:style>
672− <style:style style:name="T42" style:family="text"><style:text-properties style:text-line-through-style="solid" /></style:style>
672+ <style:style style:name="T42" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" style:text-line-through-style="solid" /></style:style>
673673 <style:style style:name="T43" style:family="text"><style:text-properties style:text-line-through-style="solid" /></style:style>
674− <style:style style:name="T44" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" style:text-line-through-style="solid" /></style:style>
675− <style:style style:name="T45" style:family="text"><style:text-properties style:text-line-through-style="solid" /></style:style>
674+ <style:style style:name="T44" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>
675+ <style:style style:name="T45" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" style:text-position="super 58%" /></style:style>
676676 <style:style style:name="T46" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>
677− <style:style style:name="T47" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" style:text-position="super 58%" /></style:style>
678− <style:style style:name="T48" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>
679− <style:style style:name="T49" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>
680− <style:style style:name="T50" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>
681− <style:style style:name="T51" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>
682− <style:style style:name="T52" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>
683− <style:style style:name="T53" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>
684− <style:style style:name="T54" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>
685− <style:style style:name="T55" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>
686− <style:style style:name="T56" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>
687− <style:style style:name="T57" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>
688− <style:style style:name="T58" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
677+ <style:style style:name="T47" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>
678+ <style:style style:name="T48" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>
679+ <style:style style:name="T49" style:family="text"><style:text-properties style:text-position="sub 58%" /></style:style>
680+ <style:style style:name="T50" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
681+ <style:style style:name="T51" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
682+ <style:style style:name="T52" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
683+ <style:style style:name="T53" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
684+ <style:style style:name="T54" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
685+ <style:style style:name="T55" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
686+ <style:style style:name="T56" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
687+ <style:style style:name="T57" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
688+ <style:style style:name="T58" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>
689689 <style:style style:name="T59" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
690690 <style:style style:name="T60" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
691691 <style:style style:name="T61" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
@@ -693,17 +693,9 @@
693693 <style:style style:name="T63" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
694694 <style:style style:name="T64" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
695695 <style:style style:name="T65" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
696− <style:style style:name="T66" style:family="text"><style:text-properties style:text-position="super 58%" /></style:style>
696+ <style:style style:name="T66" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
697697 <style:style style:name="T67" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
698698 <style:style style:name="T68" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
699− <style:style style:name="T69" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
700− <style:style style:name="T70" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
701− <style:style style:name="T71" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
702− <style:style style:name="T72" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
703− <style:style style:name="T73" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
704− <style:style style:name="T74" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
705− <style:style style:name="T75" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
706− <style:style style:name="T76" style:family="text"><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic" /></style:style>
707699 <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Quotations">
708700 <style:paragraph-properties fo:margin-left="0.5in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" />
709701 </style:style>
@@ -1342,33 +1334,33 @@ Markup</text:h>
13421334</text:span><text:span text:style-name="T20">is</text:span><text:span text:style-name="T21">
13431335</text:span><text:span text:style-name="T22">strong</text:span><text:span text:style-name="T23">
13441336</text:span><text:span text:style-name="T24">and</text:span><text:span text:style-name="T25">
1345−</text:span><text:span text:style-name="T26">em</text:span><text:span text:style-name="T27">.</text:span></text:p>
1337+</text:span><text:span text:style-name="T26">em.</text:span></text:p>
13461338<text:p text:style-name="Text_20_body">So is
1347−<text:span text:style-name="T28">this</text:span> word.</text:p>
1348−<text:p text:style-name="Text_20_body"><text:span text:style-name="T29">This</text:span><text:span text:style-name="T30">
1349−</text:span><text:span text:style-name="T31">is</text:span><text:span text:style-name="T32">
1350−</text:span><text:span text:style-name="T33">strong</text:span><text:span text:style-name="T34">
1351−</text:span><text:span text:style-name="T35">and</text:span><text:span text:style-name="T36">
1352−</text:span><text:span text:style-name="T37">em</text:span><text:span text:style-name="T38">.</text:span></text:p>
1339+<text:span text:style-name="T27">this</text:span> word.</text:p>
1340+<text:p text:style-name="Text_20_body"><text:span text:style-name="T28">This</text:span><text:span text:style-name="T29">
1341+</text:span><text:span text:style-name="T30">is</text:span><text:span text:style-name="T31">
1342+</text:span><text:span text:style-name="T32">strong</text:span><text:span text:style-name="T33">
1343+</text:span><text:span text:style-name="T34">and</text:span><text:span text:style-name="T35">
1344+</text:span><text:span text:style-name="T36">em.</text:span></text:p>
13531345<text:p text:style-name="Text_20_body">So is
1354−<text:span text:style-name="T39">this</text:span> word.</text:p>
1346+<text:span text:style-name="T37">this</text:span> word.</text:p>
13551347<text:p text:style-name="Text_20_body">This is code:
13561348<text:span text:style-name="Teletype">&gt;</text:span>,
13571349<text:span text:style-name="Teletype">$</text:span>,
13581350<text:span text:style-name="Teletype">\</text:span>,
13591351<text:span text:style-name="Teletype">\$</text:span>,
13601352<text:span text:style-name="Teletype">&lt;html&gt;</text:span>.</text:p>
1361−<text:p text:style-name="Text_20_body"><text:span text:style-name="T40">This</text:span><text:span text:style-name="T41">
1362−</text:span><text:span text:style-name="T42">is</text:span><text:span text:style-name="T43">
1363−</text:span><text:span text:style-name="T44">strikeout</text:span><text:span text:style-name="T45">.</text:span></text:p>
1353+<text:p text:style-name="Text_20_body"><text:span text:style-name="T38">This</text:span><text:span text:style-name="T39">
1354+</text:span><text:span text:style-name="T40">is</text:span><text:span text:style-name="T41">
1355+</text:span><text:span text:style-name="T42">strikeout</text:span><text:span text:style-name="T43">.</text:span></text:p>
13641356<text:p text:style-name="Text_20_body">Superscripts:
1365−a<text:span text:style-name="T46">bc</text:span>d
1366−a<text:span text:style-name="T47">hello</text:span>
1367−a<text:span text:style-name="T48">hello</text:span><text:span text:style-name="T49"> </text:span><text:span text:style-name="T50">there</text:span>.</text:p>
1357+a<text:span text:style-name="T44">bc</text:span>d
1358+a<text:span text:style-name="T45">hello</text:span>
1359+a<text:span text:style-name="T46">hello there</text:span>.</text:p>
13681360<text:p text:style-name="Text_20_body">Subscripts:
1369−H<text:span text:style-name="T51">2</text:span>O,
1370−H<text:span text:style-name="T52">23</text:span>O,
1371−H<text:span text:style-name="T53">many</text:span><text:span text:style-name="T54"> </text:span><text:span text:style-name="T55">of</text:span><text:span text:style-name="T56"> </text:span><text:span text:style-name="T57">them</text:span>O.</text:p>
1361+H<text:span text:style-name="T47">2</text:span>O,
1362+H<text:span text:style-name="T48">23</text:span>O,
1363+H<text:span text:style-name="T49">many of them</text:span>O.</text:p>
13721364<text:p text:style-name="Text_20_body">These should not be superscripts or
13731365subscripts, because of the unescaped spaces: a^b c^d, a~b c~d.</text:p>
13741366<text:p text:style-name="Horizontal_20_Line" />
@@ -1400,16 +1392,16 @@ five.</text:p>
14001392 <text:p text:style-name="P51">2 + 2 = 4</text:p>
14011393 </text:list-item>
14021394 <text:list-item>
1403− <text:p text:style-name="P51"><text:span text:style-name="T58">x</text:span> ∈ <text:span text:style-name="T59">y</text:span></text:p>
1395+ <text:p text:style-name="P51"><text:span text:style-name="T50">x</text:span> ∈ <text:span text:style-name="T51">y</text:span></text:p>
14041396 </text:list-item>
14051397 <text:list-item>
1406− <text:p text:style-name="P51"><text:span text:style-name="T60">α</text:span> ∧ <text:span text:style-name="T61">ω</text:span></text:p>
1398+ <text:p text:style-name="P51"><text:span text:style-name="T52">α</text:span> ∧ <text:span text:style-name="T53">ω</text:span></text:p>
14071399 </text:list-item>
14081400 <text:list-item>
14091401 <text:p text:style-name="P51">223</text:p>
14101402 </text:list-item>
14111403 <text:list-item>
1412− <text:p text:style-name="P51"><text:span text:style-name="T62">p</text:span>-Tree</text:p>
1404+ <text:p text:style-name="P51"><text:span text:style-name="T54">p</text:span>-Tree</text:p>
14131405 </text:list-item>
14141406 <text:list-item>
14151407 <text:p text:style-name="P51">Here’s some display math:
@@ -1417,7 +1409,7 @@ five.</text:p>
14171409 </text:list-item>
14181410 <text:list-item>
14191411 <text:p text:style-name="P51">Here’s one that has a line break in it:
1420− <text:span text:style-name="T63">α</text:span> + <text:span text:style-name="T64">ω</text:span> × <text:span text:style-name="T65">x</text:span><text:span text:style-name="T66">2</text:span>.</text:p>
1412+ <text:span text:style-name="T55">α</text:span> + <text:span text:style-name="T56">ω</text:span> × <text:span text:style-name="T57">x</text:span><text:span text:style-name="T58">2</text:span>.</text:p>
14211413 </text:list-item>
14221414</text:list>
14231415<text:p text:style-name="First_20_paragraph">These shouldn’t be math:</text:p>
@@ -1428,7 +1420,7 @@ five.</text:p>
14281420 </text:list-item>
14291421 <text:list-item>
14301422 <text:p text:style-name="P52">$22,000 is a
1431− <text:span text:style-name="T67">lot</text:span> of money. So is $34,000.
1423+ <text:span text:style-name="T59">lot</text:span> of money. So is $34,000.
14321424 (It worked if “lot” is emphasized.)</text:p>
14331425 </text:list-item>
14341426 <text:list-item>
@@ -1437,10 +1429,10 @@ five.</text:p>
14371429 <text:list-item>
14381430 <text:p text:style-name="P52">Escaped
14391431 <text:span text:style-name="Teletype">$</text:span>: $73
1440− <text:span text:style-name="T68">this</text:span><text:span text:style-name="T69">
1441− </text:span><text:span text:style-name="T70">should</text:span><text:span text:style-name="T71">
1442− </text:span><text:span text:style-name="T72">be</text:span><text:span text:style-name="T73">
1443− </text:span><text:span text:style-name="T74">emphasized</text:span>
1432+ <text:span text:style-name="T60">this</text:span><text:span text:style-name="T61">
1433+ </text:span><text:span text:style-name="T62">should</text:span><text:span text:style-name="T63">
1434+ </text:span><text:span text:style-name="T64">be</text:span><text:span text:style-name="T65">
1435+ </text:span><text:span text:style-name="T66">emphasized</text:span>
14441436 23$.</text:p>
14451437 </text:list-item>
14461438</text:list>
@@ -1589,10 +1581,10 @@ indented to show that they belong to the footnote (as with list
15891581items).</text:p><text:p text:style-name="P58"><text:s text:c="2" />{ &lt;code&gt; }</text:p><text:p text:style-name="Footnote">If
15901582you want, you can indent every line, but you can also be lazy and just indent
15911583the first line of each block.</text:p></text:note-body></text:note> This
1592−should <text:span text:style-name="T75">not</text:span> be a footnote
1584+should <text:span text:style-name="T67">not</text:span> be a footnote
15931585reference, because it contains a space.[^my note] Here is an inline
15941586note.<text:note text:id="ftn2" text:note-class="footnote"><text:note-citation>3</text:note-citation><text:note-body><text:p text:style-name="Footnote">This
1595−is <text:span text:style-name="T76">easier</text:span> to type. Inline notes
1587+is <text:span text:style-name="T68">easier</text:span> to type. Inline notes
15961588may contain
15971589<text:a xlink:type="simple" xlink:href="http://google.com" office:name=""><text:span text:style-name="Definition">links</text:span></text:a>
15981590and <text:span text:style-name="Teletype">]</text:span> verbatim characters,