git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1207 from mpickering/htmlinlines
ced8be1John MacFarlane
src/Text/Pandoc/Parsing.hs+21−22
@@ -997,17 +997,17 @@ registerHeader (ident,classes,kvs) header' = do
997failUnlessSmart :: HasReaderOptions st => Parser s st ()
997failUnlessSmart :: HasReaderOptions st => Parser s st ()
998failUnlessSmart = getOption readerSmart >>= guard
998failUnlessSmart = getOption readerSmart >>= guard
999
999
1000−smartPunctuation :: Parser [Char] ParserState Inline
1000+smartPunctuation :: Parser [Char] ParserState Inlines
1001− -> Parser [Char] ParserState Inline
1001+ -> Parser [Char] ParserState Inlines
1002smartPunctuation inlineParser = do
1002smartPunctuation inlineParser = do
1003 failUnlessSmart
1003 failUnlessSmart
1004 choice [ quoted inlineParser, apostrophe, dash, ellipses ]
1004 choice [ quoted inlineParser, apostrophe, dash, ellipses ]
1005
1005
1006−apostrophe :: Parser [Char] ParserState Inline
1006+apostrophe :: Parser [Char] ParserState Inlines
1007−apostrophe = (char '\'' <|> char '\8217') >> return (Str "\x2019")
1007+apostrophe = (char '\'' <|> char '\8217') >> return (B.str "\x2019")
1008
1008
1009−quoted :: Parser [Char] ParserState Inline
1009+quoted :: Parser [Char] ParserState Inlines
1010− -> Parser [Char] ParserState Inline
1010+ -> Parser [Char] ParserState Inlines
1011quoted inlineParser = doubleQuoted inlineParser <|> singleQuoted inlineParser
1011quoted inlineParser = doubleQuoted inlineParser <|> singleQuoted inlineParser
1012
1012
1013withQuoteContext :: QuoteContext
1013withQuoteContext :: QuoteContext
@@ -1022,20 +1022,19 @@ withQuoteContext context parser = do
1022 setState newState { stateQuoteContext = oldQuoteContext }
1022 setState newState { stateQuoteContext = oldQuoteContext }
1023 return result
1023 return result
1024
1024
1025−singleQuoted :: Parser [Char] ParserState Inline
1025+singleQuoted :: Parser [Char] ParserState Inlines
1026− -> Parser [Char] ParserState Inline
1026+ -> Parser [Char] ParserState Inlines
1027singleQuoted inlineParser = try $ do
1027singleQuoted inlineParser = try $ do
1028 singleQuoteStart
1028 singleQuoteStart
1029 withQuoteContext InSingleQuote $ many1Till inlineParser singleQuoteEnd >>=
1029 withQuoteContext InSingleQuote $ many1Till inlineParser singleQuoteEnd >>=
1030− return . Quoted SingleQuote . normalizeSpaces
1030+ return . B.singleQuoted . mconcat
1031
1031
1032−doubleQuoted :: Parser [Char] ParserState Inline
1032+doubleQuoted :: Parser [Char] ParserState Inlines
1033− -> Parser [Char] ParserState Inline
1033+ -> Parser [Char] ParserState Inlines
1034doubleQuoted inlineParser = try $ do
1034doubleQuoted inlineParser = try $ do
1035 doubleQuoteStart
1035 doubleQuoteStart
1036− withQuoteContext InDoubleQuote $ do
1037− contents <- manyTill inlineParser doubleQuoteEnd
1036+ withQuoteContext InDoubleQuote $ manyTill inlineParser doubleQuoteEnd >>=
1038− return . Quoted DoubleQuote . normalizeSpaces $ contents
1037+ return . B.doubleQuoted . mconcat
1039
1038
1040failIfInQuoteContext :: QuoteContext -> Parser [tok] ParserState ()
1039failIfInQuoteContext :: QuoteContext -> Parser [tok] ParserState ()
1041failIfInQuoteContext context = do
1040failIfInQuoteContext context = do
@@ -1079,17 +1078,17 @@ doubleQuoteEnd = do
1079 charOrRef "\"\8221\148"
1078 charOrRef "\"\8221\148"
1080 return ()
1079 return ()
1081
1080
1082−ellipses :: Parser [Char] st Inline
1081+ellipses :: Parser [Char] st Inlines
1083ellipses = do
1082ellipses = do
1084 try (charOrRef "\8230\133") <|> try (string "..." >> return '…')
1083 try (charOrRef "\8230\133") <|> try (string "..." >> return '…')
1085− return (Str "\8230")
1084+ return (B.str "\8230")
1086
1085
1087−dash :: Parser [Char] ParserState Inline
1086+dash :: Parser [Char] ParserState Inlines
1088dash = do
1087dash = do
1089 oldDashes <- getOption readerOldDashes
1088 oldDashes <- getOption readerOldDashes
1090 if oldDashes
1089 if oldDashes
1091 then emDashOld <|> enDashOld
1090 then emDashOld <|> enDashOld
1092− else Str `fmap` (hyphenDash <|> emDash <|> enDash)
1091+ else B.str `fmap` (hyphenDash <|> emDash <|> enDash)
1093
1092
1094-- Two hyphens = en-dash, three = em-dash
1093-- Two hyphens = en-dash, three = em-dash
1095hyphenDash :: Parser [Char] st String
1094hyphenDash :: Parser [Char] st String
@@ -1107,16 +1106,16 @@ enDash = do
1107 try (charOrRef "\8212\151")
1106 try (charOrRef "\8212\151")
1108 return "\8211"
1107 return "\8211"
1109
1108
1110−enDashOld :: Parser [Char] st Inline
1109+enDashOld :: Parser [Char] st Inlines
1111enDashOld = do
1110enDashOld = do
1112 try (charOrRef "\8211\150") <|>
1111 try (charOrRef "\8211\150") <|>
1113 try (char '-' >> lookAhead (satisfy isDigit) >> return '–')
1112 try (char '-' >> lookAhead (satisfy isDigit) >> return '–')
1114− return (Str "\8211")
1113+ return (B.str "\8211")
1115
1114
1116−emDashOld :: Parser [Char] st Inline
1115+emDashOld :: Parser [Char] st Inlines
1117emDashOld = do
1116emDashOld = do
1118 try (charOrRef "\8212\151") <|> (try $ string "--" >> optional (char '-') >> return '-')
1117 try (charOrRef "\8212\151") <|> (try $ string "--" >> optional (char '-') >> return '-')
1119− return (Str "\8212")
1118+ return (B.str "\8212")
1120
1119
1121-- This is used to prevent exponential blowups for things like:
1120-- This is used to prevent exponential blowups for things like:
1122-- a**a*a**a*a**a*a**a*a**a*a**a*a**
1121-- a**a*a**a*a**a*a**a*a**a*a**a*a**
src/Text/Pandoc/Readers/HTML.hs+126−109
@@ -40,6 +40,7 @@ import Text.HTML.TagSoup
40import Text.HTML.TagSoup.Match
40import Text.HTML.TagSoup.Match
41import Text.Pandoc.Definition
41import Text.Pandoc.Definition
42import qualified Text.Pandoc.Builder as B
42import qualified Text.Pandoc.Builder as B
43+import Text.Pandoc.Builder (Blocks, Inlines, trimInlines)
43import Text.Pandoc.Shared
44import Text.Pandoc.Shared
44import Text.Pandoc.Options
45import Text.Pandoc.Options
45import Text.Pandoc.Parsing
46import Text.Pandoc.Parsing
@@ -48,6 +49,8 @@ import Data.List ( intercalate )
48import Data.Char ( isDigit )
49import Data.Char ( isDigit )
49import Control.Monad ( liftM, guard, when, mzero )
50import Control.Monad ( liftM, guard, when, mzero )
50import Control.Applicative ( (<$>), (<$), (<*) )
51import Control.Applicative ( (<$>), (<$), (<*) )
52+import Data.Monoid
53+import Data.Sequence (ViewL(..), ViewR(..), viewr, viewl)
51
54
52isSpace :: Char -> Bool
55isSpace :: Char -> Bool
53isSpace ' ' = True
56isSpace ' ' = True
@@ -66,30 +69,30 @@ readHtml opts inp =
66 where tags = canonicalizeTags $
69 where tags = canonicalizeTags $
67 parseTagsOptions parseOptions{ optTagPosition = True } inp
70 parseTagsOptions parseOptions{ optTagPosition = True } inp
68 parseDoc = do
71 parseDoc = do
69− blocks <- (fixPlains False . concat) <$> manyTill block eof
72+ blocks <- (fixPlains False) . mconcat <$> manyTill block eof
70 meta <- stateMeta <$> getState
73 meta <- stateMeta <$> getState
71− return $ Pandoc meta blocks
74+ return $ Pandoc meta (B.toList blocks)
72
75
73type TagParser = Parser [Tag String] ParserState
76type TagParser = Parser [Tag String] ParserState
74
77
75−pBody :: TagParser [Block]
78+pBody :: TagParser Blocks
76pBody = pInTags "body" block
79pBody = pInTags "body" block
77
80
78−pHead :: TagParser [Block]
81+pHead :: TagParser Blocks
79−pHead = pInTags "head" $ pTitle <|> pMetaTag <|> ([] <$ pAnyTag)
82+pHead = pInTags "head" $ pTitle <|> pMetaTag <|> (mempty <$ pAnyTag)
80− where pTitle = pInTags "title" inline >>= setTitle . normalizeSpaces
83+ where pTitle = pInTags "title" inline >>= setTitle . trimInlines
81− setTitle t = [] <$ (updateState $ B.setMeta "title" (B.fromList t))
84+ setTitle t = mempty <$ (updateState $ B.setMeta "title" t)
82 pMetaTag = do
85 pMetaTag = do
83 mt <- pSatisfy (~== TagOpen "meta" [])
86 mt <- pSatisfy (~== TagOpen "meta" [])
84 let name = fromAttrib "name" mt
87 let name = fromAttrib "name" mt
85 if null name
88 if null name
86− then return []
89+ then return mempty
87 else do
90 else do
88 let content = fromAttrib "content" mt
91 let content = fromAttrib "content" mt
89 updateState $ B.setMeta name (B.text content)
92 updateState $ B.setMeta name (B.text content)
90− return []
93+ return mempty
91
94
92−block :: TagParser [Block]
95+block :: TagParser Blocks
93block = choice
96block = choice
94 [ pPara
97 [ pPara
95 , pHeader
98 , pHeader
@@ -105,10 +108,10 @@ block = choice
105 , pRawHtmlBlock
108 , pRawHtmlBlock
106 ]
109 ]
107
110
108−pList :: TagParser [Block]
111+pList :: TagParser Blocks
109pList = pBulletList <|> pOrderedList <|> pDefinitionList
112pList = pBulletList <|> pOrderedList <|> pDefinitionList
110
113
111−pBulletList :: TagParser [Block]
114+pBulletList :: TagParser Blocks
112pBulletList = try $ do
115pBulletList = try $ do
113 pSatisfy (~== TagOpen "ul" [])
116 pSatisfy (~== TagOpen "ul" [])
114 let nonItem = pSatisfy (\t ->
117 let nonItem = pSatisfy (\t ->
@@ -118,9 +121,9 @@ pBulletList = try $ do
118 -- treat it as a list item, though it's not valid xhtml...
121 -- treat it as a list item, though it's not valid xhtml...
119 skipMany nonItem
122 skipMany nonItem
120 items <- manyTill (pInTags "li" block >>~ skipMany nonItem) (pCloses "ul")
123 items <- manyTill (pInTags "li" block >>~ skipMany nonItem) (pCloses "ul")
121− return [BulletList $ map (fixPlains True) items]
124+ return $ B.bulletList $ map (fixPlains True) items
122
125
123−pOrderedList :: TagParser [Block]
126+pOrderedList :: TagParser Blocks
124pOrderedList = try $ do
127pOrderedList = try $ do
125 TagOpen _ attribs <- pSatisfy (~== TagOpen "ol" [])
128 TagOpen _ attribs <- pSatisfy (~== TagOpen "ol" [])
126 let (start, style) = (sta', sty')
129 let (start, style) = (sta', sty')
@@ -146,27 +149,27 @@ pOrderedList = try $ do
146 -- treat it as a list item, though it's not valid xhtml...
149 -- treat it as a list item, though it's not valid xhtml...
147 skipMany nonItem
150 skipMany nonItem
148 items <- manyTill (pInTags "li" block >>~ skipMany nonItem) (pCloses "ol")
151 items <- manyTill (pInTags "li" block >>~ skipMany nonItem) (pCloses "ol")
149− return [OrderedList (start, style, DefaultDelim) $ map (fixPlains True) items]
152+ return $ B.orderedListWith (start, style, DefaultDelim) $ map (fixPlains True) items
150
153
151−pDefinitionList :: TagParser [Block]
154+pDefinitionList :: TagParser Blocks
152pDefinitionList = try $ do
155pDefinitionList = try $ do
153 pSatisfy (~== TagOpen "dl" [])
156 pSatisfy (~== TagOpen "dl" [])
154 items <- manyTill pDefListItem (pCloses "dl")
157 items <- manyTill pDefListItem (pCloses "dl")
155− return [DefinitionList items]
158+ return $ B.definitionList items
156
159
157−pDefListItem :: TagParser ([Inline],[[Block]])
160+pDefListItem :: TagParser (Inlines, [Blocks])
158pDefListItem = try $ do
161pDefListItem = try $ do
159 let nonItem = pSatisfy (\t -> not (t ~== TagOpen "dt" []) &&
162 let nonItem = pSatisfy (\t -> not (t ~== TagOpen "dt" []) &&
160 not (t ~== TagOpen "dd" []) && not (t ~== TagClose "dl"))
163 not (t ~== TagOpen "dd" []) && not (t ~== TagClose "dl"))
161 terms <- many1 (try $ skipMany nonItem >> pInTags "dt" inline)
164 terms <- many1 (try $ skipMany nonItem >> pInTags "dt" inline)
162 defs <- many1 (try $ skipMany nonItem >> pInTags "dd" block)
165 defs <- many1 (try $ skipMany nonItem >> pInTags "dd" block)
163 skipMany nonItem
166 skipMany nonItem
164− let term = intercalate [LineBreak] terms
167+ let term = foldl1 (\x y -> x <> B.linebreak <> y) terms
165 return (term, map (fixPlains True) defs)
168 return (term, map (fixPlains True) defs)
166
169
167−fixPlains :: Bool -> [Block] -> [Block]
170+fixPlains :: Bool -> Blocks -> Blocks
168−fixPlains inList bs = if any isParaish bs
171+fixPlains inList bs = if any isParaish bs'
169− then map plainToPara bs
172+ then B.fromList $ map plainToPara bs'
170 else bs
173 else bs
171 where isParaish (Para _) = True
174 where isParaish (Para _) = True
172 isParaish (CodeBlock _ _) = True
175 isParaish (CodeBlock _ _) = True
@@ -178,6 +181,7 @@ fixPlains inList bs = if any isParaish bs
178 isParaish _ = False
181 isParaish _ = False
179 plainToPara (Plain xs) = Para xs
182 plainToPara (Plain xs) = Para xs
180 plainToPara x = x
183 plainToPara x = x
184+ bs' = B.toList bs
181
185
182pRawTag :: TagParser String
186pRawTag :: TagParser String
183pRawTag = do
187pRawTag = do
@@ -187,20 +191,20 @@ pRawTag = do
187 then return []
191 then return []
188 else return $ renderTags' [tag]
192 else return $ renderTags' [tag]
189
193
190−pDiv :: TagParser [Block]
194+pDiv :: TagParser Blocks
191pDiv = try $ do
195pDiv = try $ do
192 getOption readerParseRaw >>= guard
196 getOption readerParseRaw >>= guard
193 TagOpen _ attr <- lookAhead $ pSatisfy $ tagOpen (=="div") (const True)
197 TagOpen _ attr <- lookAhead $ pSatisfy $ tagOpen (=="div") (const True)
194 contents <- pInTags "div" block
198 contents <- pInTags "div" block
195− return [Div (mkAttr attr) contents]
199+ return $ B.divWith (mkAttr attr) contents
196
200
197−pRawHtmlBlock :: TagParser [Block]
201+pRawHtmlBlock :: TagParser Blocks
198pRawHtmlBlock = do
202pRawHtmlBlock = do
199 raw <- pHtmlBlock "script" <|> pHtmlBlock "style" <|> pRawTag
203 raw <- pHtmlBlock "script" <|> pHtmlBlock "style" <|> pRawTag
200 parseRaw <- getOption readerParseRaw
204 parseRaw <- getOption readerParseRaw
201 if parseRaw && not (null raw)
205 if parseRaw && not (null raw)
202− then return [RawBlock (Format "html") raw]
206+ then return $ B.rawBlock "html" raw
203− else return []
207+ else return mempty
204
208
205pHtmlBlock :: String -> TagParser String
209pHtmlBlock :: String -> TagParser String
206pHtmlBlock t = try $ do
210pHtmlBlock t = try $ do
@@ -208,35 +212,34 @@ pHtmlBlock t = try $ do
208 contents <- manyTill pAnyTag (pSatisfy (~== TagClose t))
212 contents <- manyTill pAnyTag (pSatisfy (~== TagClose t))
209 return $ renderTags' $ [open] ++ contents ++ [TagClose t]
213 return $ renderTags' $ [open] ++ contents ++ [TagClose t]
210
214
211−pHeader :: TagParser [Block]
215+pHeader :: TagParser Blocks
212pHeader = try $ do
216pHeader = try $ do
213 TagOpen tagtype attr <- pSatisfy $
217 TagOpen tagtype attr <- pSatisfy $
214 tagOpen (`elem` ["h1","h2","h3","h4","h5","h6"])
218 tagOpen (`elem` ["h1","h2","h3","h4","h5","h6"])
215 (const True)
219 (const True)
216 let bodyTitle = TagOpen tagtype attr ~== TagOpen "h1" [("class","title")]
220 let bodyTitle = TagOpen tagtype attr ~== TagOpen "h1" [("class","title")]
217 let level = read (drop 1 tagtype)
221 let level = read (drop 1 tagtype)
218− contents <- liftM concat $ manyTill inline (pCloses tagtype <|> eof)
222+ contents <- trimInlines . mconcat <$> manyTill inline (pCloses tagtype <|> eof)
219 let ident = fromMaybe "" $ lookup "id" attr
223 let ident = fromMaybe "" $ lookup "id" attr
220 let classes = maybe [] words $ lookup "class" attr
224 let classes = maybe [] words $ lookup "class" attr
221 let keyvals = [(k,v) | (k,v) <- attr, k /= "class", k /= "id"]
225 let keyvals = [(k,v) | (k,v) <- attr, k /= "class", k /= "id"]
222 return $ if bodyTitle
226 return $ if bodyTitle
223− then [] -- skip a representation of the title in the body
227+ then mempty -- skip a representation of the title in the body
224− else [Header level (ident, classes, keyvals) $
228+ else B.headerWith (ident, classes, keyvals) level contents
225− normalizeSpaces contents]
226
229
227−pHrule :: TagParser [Block]
230+pHrule :: TagParser Blocks
228pHrule = do
231pHrule = do
229 pSelfClosing (=="hr") (const True)
232 pSelfClosing (=="hr") (const True)
230− return [HorizontalRule]
233+ return B.horizontalRule
231
234
232−pTable :: TagParser [Block]
235+pTable :: TagParser Blocks
233pTable = try $ do
236pTable = try $ do
234 TagOpen _ _ <- pSatisfy (~== TagOpen "table" [])
237 TagOpen _ _ <- pSatisfy (~== TagOpen "table" [])
235 skipMany pBlank
238 skipMany pBlank
236− caption <- option [] $ pInTags "caption" inline >>~ skipMany pBlank
239+ caption <- option mempty $ pInTags "caption" inline >>~ skipMany pBlank
237 -- TODO actually read these and take width information from them
240 -- TODO actually read these and take width information from them
238 widths' <- pColgroup <|> many pCol
241 widths' <- pColgroup <|> many pCol
239− head' <- option [] $ pOptInTag "thead" $ pInTags "tr" (pCell "th")
242+ head' <- option mempty $ pOptInTag "thead" $ pInTags "tr" (pCell "th")
240 skipMany pBlank
243 skipMany pBlank
241 rows <- pOptInTag "tbody"
244 rows <- pOptInTag "tbody"
242 $ many1 $ try $ skipMany pBlank >> pInTags "tr" (pCell "td")
245 $ many1 $ try $ skipMany pBlank >> pInTags "tr" (pCell "td")
@@ -245,19 +248,21 @@ pTable = try $ do
245 let isSinglePlain [] = True
248 let isSinglePlain [] = True
246 isSinglePlain [Plain _] = True
249 isSinglePlain [Plain _] = True
247 isSinglePlain _ = False
250 isSinglePlain _ = False
251+ let lHead = B.toList head'
252+ let lRows = map B.toList rows
248− let isSimple = all isSinglePlain $ concat (head':rows)
253+ let isSimple = all isSinglePlain (lHead:lRows)
249− let cols = length $ if null head'
254+ let cols = length $ if null lHead
250− then head rows
255+ then head lRows
251− else head'
256+ else lHead
252 -- fail if there are colspans or rowspans
257 -- fail if there are colspans or rowspans
253− guard $ all (\r -> length r == cols) rows
258+ guard $ all (\r -> length r == cols) lRows
254 let aligns = replicate cols AlignLeft
259 let aligns = replicate cols AlignLeft
255 let widths = if null widths'
260 let widths = if null widths'
256 then if isSimple
261 then if isSimple
257 then replicate cols 0
262 then replicate cols 0
258 else replicate cols (1.0 / fromIntegral cols)
263 else replicate cols (1.0 / fromIntegral cols)
259 else widths'
264 else widths'
260− return [Table caption aligns widths head' rows]
265+ return $ B.table caption (zip aligns widths) [head'] [rows]
261
266
262pCol :: TagParser Double
267pCol :: TagParser Double
263pCol = try $ do
268pCol = try $ do
@@ -275,31 +280,31 @@ pColgroup = try $ do
275 skipMany pBlank
280 skipMany pBlank
276 manyTill pCol (pCloses "colgroup" <|> eof) <* skipMany pBlank
281 manyTill pCol (pCloses "colgroup" <|> eof) <* skipMany pBlank
277
282
278−pCell :: String -> TagParser [TableCell]
283+pCell :: String -> TagParser Blocks
279pCell celltype = try $ do
284pCell celltype = try $ do
280 skipMany pBlank
285 skipMany pBlank
281 res <- pInTags celltype block
286 res <- pInTags celltype block
282 skipMany pBlank
287 skipMany pBlank
283− return [res]
288+ return res
284
289
285−pBlockQuote :: TagParser [Block]
290+pBlockQuote :: TagParser Blocks
286pBlockQuote = do
291pBlockQuote = do
287 contents <- pInTags "blockquote" block
292 contents <- pInTags "blockquote" block
288− return [BlockQuote $ fixPlains False contents]
293+ return $ B.blockQuote $ fixPlains False contents
289
294
290−pPlain :: TagParser [Block]
295+pPlain :: TagParser Blocks
291pPlain = do
296pPlain = do
292− contents <- liftM (normalizeSpaces . concat) $ many1 inline
297+ contents <- trimInlines . mconcat <$> many1 inline
293− if null contents
298+ if B.isNull contents
294− then return []
299+ then return mempty
295− else return [Plain contents]
300+ else return $ B.plain contents
296
301
297−pPara :: TagParser [Block]
302+pPara :: TagParser Blocks
298pPara = do
303pPara = do
299− contents <- pInTags "p" inline
304+ contents <- trimInlines <$> pInTags "p" inline
300− return [Para $ normalizeSpaces contents]
305+ return $ B.para contents
301
306
302−pCodeBlock :: TagParser [Block]
307+pCodeBlock :: TagParser Blocks
303pCodeBlock = try $ do
308pCodeBlock = try $ do
304 TagOpen _ attr <- pSatisfy (~== TagOpen "pre" [])
309 TagOpen _ attr <- pSatisfy (~== TagOpen "pre" [])
305 contents <- manyTill pAnyTag (pCloses "pre" <|> eof)
310 contents <- manyTill pAnyTag (pCloses "pre" <|> eof)
@@ -312,9 +317,9 @@ pCodeBlock = try $ do
312 let result = case reverse result' of
317 let result = case reverse result' of
313 '\n':_ -> init result'
318 '\n':_ -> init result'
314 _ -> result'
319 _ -> result'
315− return [CodeBlock (mkAttr attr) result]
320+ return $ B.codeBlockWith (mkAttr attr) result
316
321
317−inline :: TagParser [Inline]
322+inline :: TagParser Inlines
318inline = choice
323inline = choice
319 [ pTagText
324 [ pTagText
320 , pQ
325 , pQ
@@ -354,7 +359,7 @@ pSelfClosing f g = do
354 optional $ pSatisfy (tagClose f)
359 optional $ pSatisfy (tagClose f)
355 return open
360 return open
356
361
357−pQ :: TagParser [Inline]
362+pQ :: TagParser Inlines
358pQ = do
363pQ = do
359 quoteContext <- stateQuoteContext `fmap` getState
364 quoteContext <- stateQuoteContext `fmap` getState
360 let quoteType = case quoteContext of
365 let quoteType = case quoteContext of
@@ -363,82 +368,93 @@ pQ = do
363 let innerQuoteContext = if quoteType == SingleQuote
368 let innerQuoteContext = if quoteType == SingleQuote
364 then InSingleQuote
369 then InSingleQuote
365 else InDoubleQuote
370 else InDoubleQuote
371+ let constructor = case quoteType of
372+ SingleQuote -> B.singleQuoted
373+ DoubleQuote -> B.doubleQuoted
366− withQuoteContext innerQuoteContext $ pInlinesInTags "q" (Quoted quoteType)
374+ withQuoteContext innerQuoteContext $
375+ pInlinesInTags "q" constructor
367
376
368−pEmph :: TagParser [Inline]
377+pEmph :: TagParser Inlines
369−pEmph = pInlinesInTags "em" Emph <|> pInlinesInTags "i" Emph
378+pEmph = pInlinesInTags "em" B.emph <|> pInlinesInTags "i" B.emph
370
379
371−pStrong :: TagParser [Inline]
380+pStrong :: TagParser Inlines
372−pStrong = pInlinesInTags "strong" Strong <|> pInlinesInTags "b" Strong
381+pStrong = pInlinesInTags "strong" B.strong <|> pInlinesInTags "b" B.strong
373
382
374−pSuperscript :: TagParser [Inline]
383+pSuperscript :: TagParser Inlines
375−pSuperscript = pInlinesInTags "sup" Superscript
384+pSuperscript = pInlinesInTags "sup" B.superscript
376
385
377−pSubscript :: TagParser [Inline]
386+pSubscript :: TagParser Inlines
378−pSubscript = pInlinesInTags "sub" Subscript
387+pSubscript = pInlinesInTags "sub" B.subscript
379
388
380−pStrikeout :: TagParser [Inline]
389+pStrikeout :: TagParser Inlines
381pStrikeout = do
390pStrikeout = do
382− pInlinesInTags "s" Strikeout <|>
391+ pInlinesInTags "s" B.strikeout <|>
383− pInlinesInTags "strike" Strikeout <|>
392+ pInlinesInTags "strike" B.strikeout <|>
384− pInlinesInTags "del" Strikeout <|>
393+ pInlinesInTags "del" B.strikeout <|>
385 try (do pSatisfy (~== TagOpen "span" [("class","strikeout")])
394 try (do pSatisfy (~== TagOpen "span" [("class","strikeout")])
386− contents <- liftM concat $ manyTill inline (pCloses "span")
395+ contents <- mconcat <$> manyTill inline (pCloses "span")
387− return [Strikeout contents])
396+ return $ B.strikeout contents)
388
397
389−pLineBreak :: TagParser [Inline]
398+pLineBreak :: TagParser Inlines
390pLineBreak = do
399pLineBreak = do
391 pSelfClosing (=="br") (const True)
400 pSelfClosing (=="br") (const True)
392− return [LineBreak]
401+ return B.linebreak
393
402
394−pLink :: TagParser [Inline]
403+pLink :: TagParser Inlines
395pLink = try $ do
404pLink = try $ do
396 tag <- pSatisfy (tagOpenLit "a" (isJust . lookup "href"))
405 tag <- pSatisfy (tagOpenLit "a" (isJust . lookup "href"))
397 let url = fromAttrib "href" tag
406 let url = fromAttrib "href" tag
398 let title = fromAttrib "title" tag
407 let title = fromAttrib "title" tag
399− lab <- liftM concat $ manyTill inline (pCloses "a")
408+ lab <- trimInlines . mconcat <$> manyTill inline (pCloses "a")
400− return [Link (normalizeSpaces lab) (escapeURI url, title)]
409+ return $ B.link (escapeURI url) title lab
401
410
402−pImage :: TagParser [Inline]
411+pImage :: TagParser Inlines
403pImage = do
412pImage = do
404 tag <- pSelfClosing (=="img") (isJust . lookup "src")
413 tag <- pSelfClosing (=="img") (isJust . lookup "src")
405 let url = fromAttrib "src" tag
414 let url = fromAttrib "src" tag
406 let title = fromAttrib "title" tag
415 let title = fromAttrib "title" tag
407 let alt = fromAttrib "alt" tag
416 let alt = fromAttrib "alt" tag
408− return [Image (B.toList $ B.text alt) (escapeURI url, title)]
417+ return $ B.image (escapeURI url) title (B.text alt)
409
418
410−pCode :: TagParser [Inline]
419+pCode :: TagParser Inlines
411pCode = try $ do
420pCode = try $ do
412 (TagOpen open attr) <- pSatisfy $ tagOpen (`elem` ["code","tt"]) (const True)
421 (TagOpen open attr) <- pSatisfy $ tagOpen (`elem` ["code","tt"]) (const True)
413 result <- manyTill pAnyTag (pCloses open)
422 result <- manyTill pAnyTag (pCloses open)
414− return [Code (mkAttr attr) $ intercalate " " $ lines $ innerText result]
423+ return $ B.codeWith (mkAttr attr) $ intercalate " " $ lines $ innerText result
415
424
416−pSpan :: TagParser [Inline]
425+pSpan :: TagParser Inlines
417pSpan = try $ do
426pSpan = try $ do
418 getOption readerParseRaw >>= guard
427 getOption readerParseRaw >>= guard
419 TagOpen _ attr <- lookAhead $ pSatisfy $ tagOpen (=="span") (const True)
428 TagOpen _ attr <- lookAhead $ pSatisfy $ tagOpen (=="span") (const True)
420 contents <- pInTags "span" inline
429 contents <- pInTags "span" inline
421− return [Span (mkAttr attr) contents]
430+ return $ B.spanWith (mkAttr attr) contents
422
431
423−pRawHtmlInline :: TagParser [Inline]
432+pRawHtmlInline :: TagParser Inlines
424pRawHtmlInline = do
433pRawHtmlInline = do
425 result <- pSatisfy (tagComment (const True)) <|> pSatisfy isInlineTag
434 result <- pSatisfy (tagComment (const True)) <|> pSatisfy isInlineTag
426 parseRaw <- getOption readerParseRaw
435 parseRaw <- getOption readerParseRaw
427 if parseRaw
436 if parseRaw
428− then return [RawInline (Format "html") $ renderTags' [result]]
437+ then return $ B.rawInline "html" $ renderTags' [result]
429− else return []
438+ else return mempty
430
439
431−pInlinesInTags :: String -> ([Inline] -> Inline)
440+pInlinesInTags :: String -> (Inlines -> Inlines)
432− -> TagParser [Inline]
441+ -> TagParser Inlines
433pInlinesInTags tagtype f = do
442pInlinesInTags tagtype f = do
434− contents <- pInTags tagtype inline
443+ contents <- B.unMany <$> pInTags tagtype inline
444+ let left = case viewl contents of
445+ EmptyL -> mempty
446+ (a :< _) -> padSpace a
447+ let right = case viewr contents of
448+ EmptyR -> mempty
449+ (_ :> a) -> padSpace a
435− return [f $ normalizeSpaces contents]
450+ return (left <> f (trimInlines . B.Many $ contents) <> right)
436−
451+ where padSpace a = if a == Space then B.space else mempty
452+
437−pInTags :: String -> TagParser [a]
453+pInTags :: (Monoid a) => String -> TagParser a
438− -> TagParser [a]
454+ -> TagParser a
439pInTags tagtype parser = try $ do
455pInTags tagtype parser = try $ do
440 pSatisfy (~== TagOpen tagtype [])
456 pSatisfy (~== TagOpen tagtype [])
441− liftM concat $ manyTill parser (pCloses tagtype <|> eof)
457+ mconcat <$> manyTill parser (pCloses tagtype <|> eof)
442
458
443pOptInTag :: String -> TagParser a
459pOptInTag :: String -> TagParser a
444 -> TagParser a
460 -> TagParser a
@@ -461,36 +477,36 @@ pCloses tagtype = try $ do
461 (TagClose "dl") | tagtype == "li" -> return ()
477 (TagClose "dl") | tagtype == "li" -> return ()
462 _ -> mzero
478 _ -> mzero
463
479
464−pTagText :: TagParser [Inline]
480+pTagText :: TagParser Inlines
465pTagText = try $ do
481pTagText = try $ do
466 (TagText str) <- pSatisfy isTagText
482 (TagText str) <- pSatisfy isTagText
467 st <- getState
483 st <- getState
468 case runParser (many pTagContents) st "text" str of
484 case runParser (many pTagContents) st "text" str of
469 Left _ -> fail $ "Could not parse `" ++ str ++ "'"
485 Left _ -> fail $ "Could not parse `" ++ str ++ "'"
470− Right result -> return result
486+ Right result -> return $ mconcat result
471
487
472pBlank :: TagParser ()
488pBlank :: TagParser ()
473pBlank = try $ do
489pBlank = try $ do
474 (TagText str) <- pSatisfy isTagText
490 (TagText str) <- pSatisfy isTagText
475 guard $ all isSpace str
491 guard $ all isSpace str
476
492
477−pTagContents :: Parser [Char] ParserState Inline
493+pTagContents :: Parser [Char] ParserState Inlines
478pTagContents =
494pTagContents =
479− Math DisplayMath `fmap` mathDisplay
495+ B.displayMath <$> mathDisplay
480− <|> Math InlineMath `fmap` mathInline
496+ <|> B.math <$> mathInline
481 <|> pStr
497 <|> pStr
482 <|> pSpace
498 <|> pSpace
483 <|> smartPunctuation pTagContents
499 <|> smartPunctuation pTagContents
484 <|> pSymbol
500 <|> pSymbol
485 <|> pBad
501 <|> pBad
486
502
487−pStr :: Parser [Char] ParserState Inline
503+pStr :: Parser [Char] ParserState Inlines
488pStr = do
504pStr = do
489 result <- many1 $ satisfy $ \c ->
505 result <- many1 $ satisfy $ \c ->
490 not (isSpace c) && not (isSpecial c) && not (isBad c)
506 not (isSpace c) && not (isSpecial c) && not (isBad c)
491 pos <- getPosition
507 pos <- getPosition
492 updateState $ \s -> s{ stateLastStrPos = Just pos }
508 updateState $ \s -> s{ stateLastStrPos = Just pos }
493− return $ Str result
509+ return $ B.str result
494
510
495isSpecial :: Char -> Bool
511isSpecial :: Char -> Bool
496isSpecial '"' = True
512isSpecial '"' = True
@@ -504,13 +520,13 @@ isSpecial '\8220' = True
504isSpecial '\8221' = True
520isSpecial '\8221' = True
505isSpecial _ = False
521isSpecial _ = False
506
522
507−pSymbol :: Parser [Char] ParserState Inline
523+pSymbol :: Parser [Char] ParserState Inlines
508−pSymbol = satisfy isSpecial >>= return . Str . (:[])
524+pSymbol = satisfy isSpecial >>= return . B.str . (:[])
509
525
510isBad :: Char -> Bool
526isBad :: Char -> Bool
511isBad c = c >= '\128' && c <= '\159' -- not allowed in HTML
527isBad c = c >= '\128' && c <= '\159' -- not allowed in HTML
512
528
513−pBad :: Parser [Char] ParserState Inline
529+pBad :: Parser [Char] ParserState Inlines
514pBad = do
530pBad = do
515 c <- satisfy isBad
531 c <- satisfy isBad
516 let c' = case c of
532 let c' = case c of
@@ -542,10 +558,10 @@ pBad = do
542 '\158' -> '\382'
558 '\158' -> '\382'
543 '\159' -> '\376'
559 '\159' -> '\376'
544 _ -> '?'
560 _ -> '?'
545− return $ Str [c']
561+ return $ B.str [c']
546
562
547−pSpace :: Parser [Char] ParserState Inline
563+pSpace :: Parser [Char] ParserState Inlines
548−pSpace = many1 (satisfy isSpace) >> return Space
564+pSpace = many1 (satisfy isSpace) >> return B.space
549
565
550--
566--
551-- Constants
567-- Constants
@@ -679,3 +695,4 @@ mkAttr attr = (attribsId, attribsClasses, attribsKV)
679 attribsClasses = words $ fromMaybe "" $ lookup "class" attr
695 attribsClasses = words $ fromMaybe "" $ lookup "class" attr
680 attribsKV = filter (\(k,_) -> k /= "class" && k /= "id") attr
696 attribsKV = filter (\(k,_) -> k /= "class" && k /= "id") attr
681
697
698+
src/Text/Pandoc/Readers/Markdown.hs+1−1
@@ -1873,7 +1873,7 @@ smart :: MarkdownParser (F Inlines)
1873smart = do
1873smart = do
1874 getOption readerSmart >>= guard
1874 getOption readerSmart >>= guard
1875 doubleQuoted <|> singleQuoted <|>
1875 doubleQuoted <|> singleQuoted <|>
1876− choice (map (return . B.singleton <$>) [apostrophe, dash, ellipses])
1876+ choice (map (return <$>) [apostrophe, dash, ellipses])
1877
1877
1878singleQuoted :: MarkdownParser (F Inlines)
1878singleQuoted :: MarkdownParser (F Inlines)
1879singleQuoted = try $ do
1879singleQuoted = try $ do
src/Text/Pandoc/Readers/RST.hs+1−1
@@ -1140,7 +1140,7 @@ smart :: RSTParser Inlines
1140smart = do
1140smart = do
1141 getOption readerSmart >>= guard
1141 getOption readerSmart >>= guard
1142 doubleQuoted <|> singleQuoted <|>
1142 doubleQuoted <|> singleQuoted <|>
1143− choice (map (B.singleton <$>) [apostrophe, dash, ellipses])
1143+ choice [apostrophe, dash, ellipses]
1144
1144
1145singleQuoted :: RSTParser Inlines
1145singleQuoted :: RSTParser Inlines
1146singleQuoted = try $ do
1146singleQuoted = try $ do
src/Text/Pandoc/Readers/Textile.hs+165−134
@@ -50,20 +50,20 @@ TODO : refactor common patterns across readers :
50
50
51
51
52module Text.Pandoc.Readers.Textile ( readTextile) where
52module Text.Pandoc.Readers.Textile ( readTextile) where
53−
54import Text.Pandoc.Definition
53import Text.Pandoc.Definition
54+import Text.Pandoc.Builder (Inlines, Blocks, trimInlines)
55import qualified Text.Pandoc.Builder as B
55import qualified Text.Pandoc.Builder as B
56−import Text.Pandoc.Shared
57import Text.Pandoc.Options
56import Text.Pandoc.Options
58−import Text.Pandoc.Parsing
57+import Text.Pandoc.Parsing
59import Text.Pandoc.Readers.HTML ( htmlTag, isInlineTag, isBlockTag )
58import Text.Pandoc.Readers.HTML ( htmlTag, isInlineTag, isBlockTag )
60import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
59import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
61import Text.HTML.TagSoup (parseTags, innerText, fromAttrib, Tag(..))
60import Text.HTML.TagSoup (parseTags, innerText, fromAttrib, Tag(..))
62import Text.HTML.TagSoup.Match
61import Text.HTML.TagSoup.Match
63import Data.List ( intercalate )
62import Data.List ( intercalate )
64−import Data.Char ( digitToInt, isUpper )
63+import Data.Char ( digitToInt, isUpper)
65import Control.Monad ( guard, liftM )
64import Control.Monad ( guard, liftM )
66import Control.Applicative ((<$>), (*>), (<*))
65import Control.Applicative ((<$>), (*>), (<*))
66+import Data.Monoid
67
67
68-- | Parse a Textile text and return a Pandoc document.
68-- | Parse a Textile text and return a Pandoc document.
69readTextile :: ReaderOptions -- ^ Reader options
69readTextile :: ReaderOptions -- ^ Reader options
@@ -95,7 +95,7 @@ parseTextile = do
95 updateState $ \s -> s { stateNotes = reverse reversedNotes }
95 updateState $ \s -> s { stateNotes = reverse reversedNotes }
96 -- now parse it for real...
96 -- now parse it for real...
97 blocks <- parseBlocks
97 blocks <- parseBlocks
98− return $ Pandoc nullMeta blocks -- FIXME
98+ return $ Pandoc nullMeta (B.toList blocks) -- FIXME
99
99
100noteMarker :: Parser [Char] ParserState [Char]
100noteMarker :: Parser [Char] ParserState [Char]
101noteMarker = skipMany spaceChar >> string "fn" >> manyTill digit (char '.')
101noteMarker = skipMany spaceChar >> string "fn" >> manyTill digit (char '.')
@@ -115,11 +115,11 @@ noteBlock = try $ do
115 return $ replicate (sourceLine endPos - sourceLine startPos) '\n'
115 return $ replicate (sourceLine endPos - sourceLine startPos) '\n'
116
116
117-- | Parse document blocks
117-- | Parse document blocks
118−parseBlocks :: Parser [Char] ParserState [Block]
118+parseBlocks :: Parser [Char] ParserState Blocks
119−parseBlocks = manyTill block eof
119+parseBlocks = mconcat <$> manyTill block eof
120
120
121-- | Block parsers list tried in definition order
121-- | Block parsers list tried in definition order
122−blockParsers :: [Parser [Char] ParserState Block]
122+blockParsers :: [Parser [Char] ParserState Blocks]
123blockParsers = [ codeBlock
123blockParsers = [ codeBlock
124 , header
124 , header
125 , blockQuote
125 , blockQuote
@@ -130,29 +130,32 @@ blockParsers = [ codeBlock
130 , rawLaTeXBlock'
130 , rawLaTeXBlock'
131 , maybeExplicitBlock "table" table
131 , maybeExplicitBlock "table" table
132 , maybeExplicitBlock "p" para
132 , maybeExplicitBlock "p" para
133+ , endBlock
133 ]
134 ]
134
135
136+endBlock :: Parser [Char] ParserState Blocks
137+endBlock = string "\n\n" >> return mempty
135-- | Any block in the order of definition of blockParsers
138-- | Any block in the order of definition of blockParsers
136−block :: Parser [Char] ParserState Block
139+block :: Parser [Char] ParserState Blocks
137block = choice blockParsers <?> "block"
140block = choice blockParsers <?> "block"
138
141
139−commentBlock :: Parser [Char] ParserState Block
142+commentBlock :: Parser [Char] ParserState Blocks
140commentBlock = try $ do
143commentBlock = try $ do
141 string "###."
144 string "###."
142 manyTill anyLine blanklines
145 manyTill anyLine blanklines
143− return Null
146+ return mempty
144
147
145−codeBlock :: Parser [Char] ParserState Block
148+codeBlock :: Parser [Char] ParserState Blocks
146codeBlock = codeBlockBc <|> codeBlockPre
149codeBlock = codeBlockBc <|> codeBlockPre
147
150
148−codeBlockBc :: Parser [Char] ParserState Block
151+codeBlockBc :: Parser [Char] ParserState Blocks
149codeBlockBc = try $ do
152codeBlockBc = try $ do
150 string "bc. "
153 string "bc. "
151 contents <- manyTill anyLine blanklines
154 contents <- manyTill anyLine blanklines
152− return $ CodeBlock ("",[],[]) $ unlines contents
155+ return $ B.codeBlock (unlines contents)
153
156
154-- | Code Blocks in Textile are between <pre> and </pre>
157-- | Code Blocks in Textile are between <pre> and </pre>
155−codeBlockPre :: Parser [Char] ParserState Block
158+codeBlockPre :: Parser [Char] ParserState Blocks
156codeBlockPre = try $ do
159codeBlockPre = try $ do
157 (t@(TagOpen _ attrs),_) <- htmlTag (tagOpen (=="pre") (const True))
160 (t@(TagOpen _ attrs),_) <- htmlTag (tagOpen (=="pre") (const True))
158 result' <- (innerText . parseTags) `fmap` -- remove internal tags
161 result' <- (innerText . parseTags) `fmap` -- remove internal tags
@@ -169,29 +172,29 @@ codeBlockPre = try $ do
169 let classes = words $ fromAttrib "class" t
172 let classes = words $ fromAttrib "class" t
170 let ident = fromAttrib "id" t
173 let ident = fromAttrib "id" t
171 let kvs = [(k,v) | (k,v) <- attrs, k /= "id" && k /= "class"]
174 let kvs = [(k,v) | (k,v) <- attrs, k /= "id" && k /= "class"]
172− return $ CodeBlock (ident,classes,kvs) result'''
175+ return $ B.codeBlockWith (ident,classes,kvs) result'''
173
176
174-- | Header of the form "hN. content" with N in 1..6
177-- | Header of the form "hN. content" with N in 1..6
175−header :: Parser [Char] ParserState Block
178+header :: Parser [Char] ParserState Blocks
176header = try $ do
179header = try $ do
177 char 'h'
180 char 'h'
178 level <- digitToInt <$> oneOf "123456"
181 level <- digitToInt <$> oneOf "123456"
179 attr <- attributes
182 attr <- attributes
180 char '.'
183 char '.'
181− whitespace
184+ lookAhead whitespace
182− name <- normalizeSpaces <$> manyTill inline blockBreak
185+ name <- trimInlines . mconcat <$> manyTill inline blockBreak
183− attr' <- registerHeader attr (B.fromList name)
186+ attr' <- registerHeader attr name
184− return $ Header level attr' name
187+ return $ B.headerWith attr' level name
185
188
186-- | Blockquote of the form "bq. content"
189-- | Blockquote of the form "bq. content"
187−blockQuote :: Parser [Char] ParserState Block
190+blockQuote :: Parser [Char] ParserState Blocks
188blockQuote = try $ do
191blockQuote = try $ do
189 string "bq" >> attributes >> char '.' >> whitespace
192 string "bq" >> attributes >> char '.' >> whitespace
190− BlockQuote . singleton <$> para
193+ B.blockQuote <$> para
191
194
192-- Horizontal rule
195-- Horizontal rule
193
196
194−hrule :: Parser [Char] st Block
197+hrule :: Parser [Char] st Blocks
195hrule = try $ do
198hrule = try $ do
196 skipSpaces
199 skipSpaces
197 start <- oneOf "-*"
200 start <- oneOf "-*"
@@ -199,62 +202,62 @@ hrule = try $ do
199 skipMany (spaceChar <|> char start)
202 skipMany (spaceChar <|> char start)
200 newline
203 newline
201 optional blanklines
204 optional blanklines
202− return HorizontalRule
205+ return B.horizontalRule
203
206
204-- Lists handling
207-- Lists handling
205
208
206-- | Can be a bullet list or an ordered list. This implementation is
209-- | Can be a bullet list or an ordered list. This implementation is
207-- strict in the nesting, sublist must start at exactly "parent depth
210-- strict in the nesting, sublist must start at exactly "parent depth
208-- plus one"
211-- plus one"
209−anyList :: Parser [Char] ParserState Block
212+anyList :: Parser [Char] ParserState Blocks
210anyList = try $ anyListAtDepth 1 <* blanklines
213anyList = try $ anyListAtDepth 1 <* blanklines
211
214
212-- | This allow one type of list to be nested into an other type,
215-- | This allow one type of list to be nested into an other type,
213-- provided correct nesting
216-- provided correct nesting
214−anyListAtDepth :: Int -> Parser [Char] ParserState Block
217+anyListAtDepth :: Int -> Parser [Char] ParserState Blocks
215anyListAtDepth depth = choice [ bulletListAtDepth depth,
218anyListAtDepth depth = choice [ bulletListAtDepth depth,
216 orderedListAtDepth depth,
219 orderedListAtDepth depth,
217 definitionList ]
220 definitionList ]
218
221
219-- | Bullet List of given depth, depth being the number of leading '*'
222-- | Bullet List of given depth, depth being the number of leading '*'
220−bulletListAtDepth :: Int -> Parser [Char] ParserState Block
223+bulletListAtDepth :: Int -> Parser [Char] ParserState Blocks
221−bulletListAtDepth depth = try $ BulletList <$> many1 (bulletListItemAtDepth depth)
224+bulletListAtDepth depth = try $ B.bulletList <$> many1 (bulletListItemAtDepth depth)
222
225
223-- | Bullet List Item of given depth, depth being the number of
226-- | Bullet List Item of given depth, depth being the number of
224-- leading '*'
227-- leading '*'
225−bulletListItemAtDepth :: Int -> Parser [Char] ParserState [Block]
228+bulletListItemAtDepth :: Int -> Parser [Char] ParserState Blocks
226bulletListItemAtDepth = genericListItemAtDepth '*'
229bulletListItemAtDepth = genericListItemAtDepth '*'
227
230
228-- | Ordered List of given depth, depth being the number of
231-- | Ordered List of given depth, depth being the number of
229-- leading '#'
232-- leading '#'
230−orderedListAtDepth :: Int -> Parser [Char] ParserState Block
233+orderedListAtDepth :: Int -> Parser [Char] ParserState Blocks
231orderedListAtDepth depth = try $ do
234orderedListAtDepth depth = try $ do
232 items <- many1 (orderedListItemAtDepth depth)
235 items <- many1 (orderedListItemAtDepth depth)
233− return (OrderedList (1, DefaultStyle, DefaultDelim) items)
236+ return $ B.orderedList items
234
237
235-- | Ordered List Item of given depth, depth being the number of
238-- | Ordered List Item of given depth, depth being the number of
236-- leading '#'
239-- leading '#'
237−orderedListItemAtDepth :: Int -> Parser [Char] ParserState [Block]
240+orderedListItemAtDepth :: Int -> Parser [Char] ParserState Blocks
238orderedListItemAtDepth = genericListItemAtDepth '#'
241orderedListItemAtDepth = genericListItemAtDepth '#'
239
242
240-- | Common implementation of list items
243-- | Common implementation of list items
241−genericListItemAtDepth :: Char -> Int -> Parser [Char] ParserState [Block]
244+genericListItemAtDepth :: Char -> Int -> Parser [Char] ParserState Blocks
242genericListItemAtDepth c depth = try $ do
245genericListItemAtDepth c depth = try $ do
243 count depth (char c) >> attributes >> whitespace
246 count depth (char c) >> attributes >> whitespace
244− p <- many listInline
247+ p <- mconcat <$> many listInline
245 newline
248 newline
246− sublist <- option [] (singleton <$> anyListAtDepth (depth + 1))
249+ sublist <- option mempty (anyListAtDepth (depth + 1))
247− return (Plain p : sublist)
250+ return $ (B.plain p) <> sublist
248
251
249-- | A definition list is a set of consecutive definition items
252-- | A definition list is a set of consecutive definition items
250−definitionList :: Parser [Char] ParserState Block
253+definitionList :: Parser [Char] ParserState Blocks
251−definitionList = try $ DefinitionList <$> many1 definitionListItem
254+definitionList = try $ B.definitionList <$> many1 definitionListItem
252
255
253-- | List start character.
256-- | List start character.
254listStart :: Parser [Char] st Char
257listStart :: Parser [Char] st Char
255listStart = oneOf "*#-"
258listStart = oneOf "*#-"
256
259
257−listInline :: Parser [Char] ParserState Inline
260+listInline :: Parser [Char] ParserState Inlines
258listInline = try (notFollowedBy newline >> inline)
261listInline = try (notFollowedBy newline >> inline)
259 <|> try (endline <* notFollowedBy listStart)
262 <|> try (endline <* notFollowedBy listStart)
260
263
@@ -262,16 +265,16 @@ listInline = try (notFollowedBy newline >> inline)
262-- the term defined, then spaces and ":=". The definition follows, on
265-- the term defined, then spaces and ":=". The definition follows, on
263-- the same single line, or spaned on multiple line, after a line
266-- the same single line, or spaned on multiple line, after a line
264-- break.
267-- break.
265−definitionListItem :: Parser [Char] ParserState ([Inline], [[Block]])
268+definitionListItem :: Parser [Char] ParserState (Inlines, [Blocks])
266definitionListItem = try $ do
269definitionListItem = try $ do
267 string "- "
270 string "- "
268− term <- many1Till inline (try (whitespace >> string ":="))
271+ term <- mconcat <$> many1Till inline (try (whitespace >> string ":="))
269 def' <- multilineDef <|> inlineDef
272 def' <- multilineDef <|> inlineDef
270 return (term, def')
273 return (term, def')
271− where inlineDef :: Parser [Char] ParserState [[Block]]
274+ where inlineDef :: Parser [Char] ParserState [Blocks]
272− inlineDef = liftM (\d -> [[Plain d]])
275+ inlineDef = liftM (\d -> [B.plain d])
273− $ optional whitespace >> many listInline <* newline
276+ $ optional whitespace >> (trimInlines . mconcat <$> many listInline) <* newline
274− multilineDef :: Parser [Char] ParserState [[Block]]
277+ multilineDef :: Parser [Char] ParserState [Blocks]
275 multilineDef = try $ do
278 multilineDef = try $ do
276 optional whitespace >> newline
279 optional whitespace >> newline
277 s <- many1Till anyChar (try (string "=:" >> newline))
280 s <- many1Till anyChar (try (string "=:" >> newline))
@@ -288,59 +291,57 @@ blockBreak = try (newline >> blanklines >> return ()) <|>
288-- raw content
291-- raw content
289
292
290-- | A raw Html Block, optionally followed by blanklines
293-- | A raw Html Block, optionally followed by blanklines
291−rawHtmlBlock :: Parser [Char] ParserState Block
294+rawHtmlBlock :: Parser [Char] ParserState Blocks
292rawHtmlBlock = try $ do
295rawHtmlBlock = try $ do
293 (_,b) <- htmlTag isBlockTag
296 (_,b) <- htmlTag isBlockTag
294 optional blanklines
297 optional blanklines
295− return $ RawBlock (Format "html") b
298+ return $ B.rawBlock "html" b
296
299
297-- | Raw block of LaTeX content
300-- | Raw block of LaTeX content
298−rawLaTeXBlock' :: Parser [Char] ParserState Block
301+rawLaTeXBlock' :: Parser [Char] ParserState Blocks
299rawLaTeXBlock' = do
302rawLaTeXBlock' = do
300 guardEnabled Ext_raw_tex
303 guardEnabled Ext_raw_tex
301− RawBlock (Format "latex") <$> (rawLaTeXBlock <* spaces)
304+ B.rawBlock "latex" <$> (rawLaTeXBlock <* spaces)
302
305
303
306
304-- | In textile, paragraphs are separated by blank lines.
307-- | In textile, paragraphs are separated by blank lines.
305−para :: Parser [Char] ParserState Block
308+para :: Parser [Char] ParserState Blocks
306−para = try $ Para . normalizeSpaces <$> manyTill inline blockBreak
309+para = B.para . trimInlines . mconcat <$> manyTill inline blockBreak
307−
308
310
309-- Tables
311-- Tables
310
312
311-- | A table cell spans until a pipe |
313-- | A table cell spans until a pipe |
312−tableCell :: Parser [Char] ParserState TableCell
314+tableCell :: Parser [Char] ParserState Blocks
313tableCell = do
315tableCell = do
314 c <- many1 (noneOf "|\n")
316 c <- many1 (noneOf "|\n")
315− content <- parseFromString (many1 inline) c
317+ content <- trimInlines . mconcat <$> parseFromString (many1 inline) c
316− return $ [ Plain $ normalizeSpaces content ]
318+ return $ B.plain content
317
319
318-- | A table row is made of many table cells
320-- | A table row is made of many table cells
319−tableRow :: Parser [Char] ParserState [TableCell]
321+tableRow :: Parser [Char] ParserState [Blocks]
320tableRow = try $ ( char '|' *>
322tableRow = try $ ( char '|' *>
321 (endBy1 tableCell (optional blankline *> char '|')) <* newline)
323 (endBy1 tableCell (optional blankline *> char '|')) <* newline)
322
324
323-- | Many table rows
325-- | Many table rows
324−tableRows :: Parser [Char] ParserState [[TableCell]]
326+tableRows :: Parser [Char] ParserState [[Blocks]]
325tableRows = many1 tableRow
327tableRows = many1 tableRow
326
328
327-- | Table headers are made of cells separated by a tag "|_."
329-- | Table headers are made of cells separated by a tag "|_."
328−tableHeaders :: Parser [Char] ParserState [TableCell]
330+tableHeaders :: Parser [Char] ParserState [Blocks]
329tableHeaders = let separator = (try $ string "|_.") in
331tableHeaders = let separator = (try $ string "|_.") in
330 try $ ( separator *> (sepBy1 tableCell separator) <* char '|' <* newline )
332 try $ ( separator *> (sepBy1 tableCell separator) <* char '|' <* newline )
331
333
332-- | A table with an optional header. Current implementation can
334-- | A table with an optional header. Current implementation can
333-- handle tables with and without header, but will parse cells
335-- handle tables with and without header, but will parse cells
334-- alignment attributes as content.
336-- alignment attributes as content.
335−table :: Parser [Char] ParserState Block
337+table :: Parser [Char] ParserState Blocks
336table = try $ do
338table = try $ do
337− headers <- option [] tableHeaders
339+ headers <- option mempty tableHeaders
338 rows <- tableRows
340 rows <- tableRows
339 blanklines
341 blanklines
340 let nbOfCols = max (length headers) (length $ head rows)
342 let nbOfCols = max (length headers) (length $ head rows)
341− return $ Table []
343+ return $ B.table mempty
342− (replicate nbOfCols AlignDefault)
344+ (zip (replicate nbOfCols AlignDefault) (replicate nbOfCols 0.0))
343− (replicate nbOfCols 0.0)
344 headers
345 headers
345 rows
346 rows
346
347
@@ -348,8 +349,8 @@ table = try $ do
348-- | Blocks like 'p' and 'table' do not need explicit block tag.
349-- | Blocks like 'p' and 'table' do not need explicit block tag.
349-- However, they can be used to set HTML/CSS attributes when needed.
350-- However, they can be used to set HTML/CSS attributes when needed.
350maybeExplicitBlock :: String -- ^ block tag name
351maybeExplicitBlock :: String -- ^ block tag name
351− -> Parser [Char] ParserState Block -- ^ implicit block
352+ -> Parser [Char] ParserState Blocks -- ^ implicit block
352− -> Parser [Char] ParserState Block
353+ -> Parser [Char] ParserState Blocks
353maybeExplicitBlock name blk = try $ do
354maybeExplicitBlock name blk = try $ do
354 optional $ try $ string name >> attributes >> char '.' >>
355 optional $ try $ string name >> attributes >> char '.' >>
355 optional whitespace >> optional endline
356 optional whitespace >> optional endline
@@ -363,12 +364,14 @@ maybeExplicitBlock name blk = try $ do
363
364
364
365
365-- | Any inline element
366-- | Any inline element
366−inline :: Parser [Char] ParserState Inline
367+inline :: Parser [Char] ParserState Inlines
368+inline = do
367−inline = choice inlineParsers <?> "inline"
369+ choice inlineParsers <?> "inline"
368
370
369-- | Inline parsers tried in order
371-- | Inline parsers tried in order
370−inlineParsers :: [Parser [Char] ParserState Inline]
372+inlineParsers :: [Parser [Char] ParserState Inlines]
371−inlineParsers = [ str
373+inlineParsers = [ inlineMarkup
374+ , str
372 , whitespace
375 , whitespace
373 , endline
376 , endline
374 , code
377 , code
@@ -378,58 +381,57 @@ inlineParsers = [ str
378 , rawLaTeXInline'
381 , rawLaTeXInline'
379 , note
382 , note
380 , try $ (char '[' *> inlineMarkup <* char ']')
383 , try $ (char '[' *> inlineMarkup <* char ']')
381− , inlineMarkup
382 , link
384 , link
383 , image
385 , image
384 , mark
386 , mark
385− , (Str . (:[])) <$> characterReference
387+ , (B.str . (:[])) <$> characterReference
386 , smartPunctuation inline
388 , smartPunctuation inline
387 , symbol
389 , symbol
388 ]
390 ]
389
391
390-- | Inline markups
392-- | Inline markups
391−inlineMarkup :: Parser [Char] ParserState Inline
393+inlineMarkup :: Parser [Char] ParserState Inlines
392−inlineMarkup = choice [ simpleInline (string "??") (Cite [])
394+inlineMarkup = choice [ simpleInline (string "??") (B.cite [])
393− , simpleInline (string "**") Strong
395+ , simpleInline (string "**") B.strong
394− , simpleInline (string "__") Emph
396+ , simpleInline (string "__") B.emph
395− , simpleInline (char '*') Strong
397+ , simpleInline (char '*') B.strong
396− , simpleInline (char '_') Emph
398+ , simpleInline (char '_') B.emph
397− , simpleInline (char '+') Emph -- approximates underline
399+ , simpleInline (char '+') B.emph -- approximates underline
398− , simpleInline (char '-' <* notFollowedBy (char '-')) Strikeout
400+ , simpleInline (char '-' <* notFollowedBy (char '-')) B.strikeout
399− , simpleInline (char '^') Superscript
401+ , simpleInline (char '^') B.superscript
400− , simpleInline (char '~') Subscript
402+ , simpleInline (char '~') B.subscript
401 ]
403 ]
402
404
403-- | Trademark, registered, copyright
405-- | Trademark, registered, copyright
404−mark :: Parser [Char] st Inline
406+mark :: Parser [Char] st Inlines
405mark = try $ char '(' >> (try tm <|> try reg <|> copy)
407mark = try $ char '(' >> (try tm <|> try reg <|> copy)
406
408
407−reg :: Parser [Char] st Inline
409+reg :: Parser [Char] st Inlines
408reg = do
410reg = do
409 oneOf "Rr"
411 oneOf "Rr"
410 char ')'
412 char ')'
411− return $ Str "\174"
413+ return $ B.str "\174"
412
414
413−tm :: Parser [Char] st Inline
415+tm :: Parser [Char] st Inlines
414tm = do
416tm = do
415 oneOf "Tt"
417 oneOf "Tt"
416 oneOf "Mm"
418 oneOf "Mm"
417 char ')'
419 char ')'
418− return $ Str "\8482"
420+ return $ B.str "\8482"
419
421
420−copy :: Parser [Char] st Inline
422+copy :: Parser [Char] st Inlines
421copy = do
423copy = do
422 oneOf "Cc"
424 oneOf "Cc"
423 char ')'
425 char ')'
424− return $ Str "\169"
426+ return $ B.str "\169"
425
427
426−note :: Parser [Char] ParserState Inline
428+note :: Parser [Char] ParserState Inlines
427note = try $ do
429note = try $ do
428 ref <- (char '[' *> many1 digit <* char ']')
430 ref <- (char '[' *> many1 digit <* char ']')
429 notes <- stateNotes <$> getState
431 notes <- stateNotes <$> getState
430 case lookup ref notes of
432 case lookup ref notes of
431 Nothing -> fail "note not found"
433 Nothing -> fail "note not found"
432− Just raw -> liftM Note $ parseFromString parseBlocks raw
434+ Just raw -> B.note <$> parseFromString parseBlocks raw
433
435
434-- | Special chars
436-- | Special chars
435markupChars :: [Char]
437markupChars :: [Char]
@@ -450,7 +452,7 @@ wordBoundaries = markupChars ++ stringBreakers
450hyphenedWords :: Parser [Char] ParserState String
452hyphenedWords :: Parser [Char] ParserState String
451hyphenedWords = do
453hyphenedWords = do
452 x <- wordChunk
454 x <- wordChunk
453− xs <- many (try $ char '-' >> wordChunk)
455+ xs <- many (try $ char '-' >> wordChunk)
454 return $ intercalate "-" (x:xs)
456 return $ intercalate "-" (x:xs)
455
457
456wordChunk :: Parser [Char] ParserState String
458wordChunk :: Parser [Char] ParserState String
@@ -462,7 +464,7 @@ wordChunk = try $ do
462 return $ hd:tl
464 return $ hd:tl
463
465
464-- | Any string
466-- | Any string
465−str :: Parser [Char] ParserState Inline
467+str :: Parser [Char] ParserState Inlines
466str = do
468str = do
467 baseStr <- hyphenedWords
469 baseStr <- hyphenedWords
468 -- RedCloth compliance : if parsed word is uppercase and immediatly
470 -- RedCloth compliance : if parsed word is uppercase and immediatly
@@ -472,89 +474,89 @@ str = do
472 acro <- enclosed (char '(') (char ')') anyChar
474 acro <- enclosed (char '(') (char ')') anyChar
473 return $ concat [baseStr, " (", acro, ")"]
475 return $ concat [baseStr, " (", acro, ")"]
474 updateLastStrPos
476 updateLastStrPos
475− return $ Str fullStr
477+ return $ B.str fullStr
476
478
477-- | Textile allows HTML span infos, we discard them
479-- | Textile allows HTML span infos, we discard them
478−htmlSpan :: Parser [Char] ParserState Inline
480+htmlSpan :: Parser [Char] ParserState Inlines
479−htmlSpan = try $ Str <$> ( char '%' *> attributes *> manyTill anyChar (char '%') )
481+htmlSpan = try $ B.str <$> ( char '%' *> attributes *> manyTill anyChar (char '%') )
480
482
481-- | Some number of space chars
483-- | Some number of space chars
482−whitespace :: Parser [Char] ParserState Inline
484+whitespace :: Parser [Char] ParserState Inlines
483−whitespace = many1 spaceChar >> return Space <?> "whitespace"
485+whitespace = many1 spaceChar >> return B.space <?> "whitespace"
484
486
485-- | In Textile, an isolated endline character is a line break
487-- | In Textile, an isolated endline character is a line break
486−endline :: Parser [Char] ParserState Inline
488+endline :: Parser [Char] ParserState Inlines
487endline = try $ do
489endline = try $ do
488 newline >> notFollowedBy blankline
490 newline >> notFollowedBy blankline
489− return LineBreak
491+ return B.linebreak
490
492
491−rawHtmlInline :: Parser [Char] ParserState Inline
493+rawHtmlInline :: Parser [Char] ParserState Inlines
492−rawHtmlInline = RawInline (Format "html") . snd <$> htmlTag isInlineTag
494+rawHtmlInline = B.rawInline "html" . snd <$> htmlTag isInlineTag
493
495
494-- | Raw LaTeX Inline
496-- | Raw LaTeX Inline
495−rawLaTeXInline' :: Parser [Char] ParserState Inline
497+rawLaTeXInline' :: Parser [Char] ParserState Inlines
496rawLaTeXInline' = try $ do
498rawLaTeXInline' = try $ do
497 guardEnabled Ext_raw_tex
499 guardEnabled Ext_raw_tex
498− rawLaTeXInline
500+ B.singleton <$> rawLaTeXInline
499
501
500-- | Textile standard link syntax is "label":target. But we
502-- | Textile standard link syntax is "label":target. But we
501-- can also have ["label":target].
503-- can also have ["label":target].
502−link :: Parser [Char] ParserState Inline
504+link :: Parser [Char] ParserState Inlines
503link = linkB <|> linkNoB
505link = linkB <|> linkNoB
504
506
505−linkNoB :: Parser [Char] ParserState Inline
507+linkNoB :: Parser [Char] ParserState Inlines
506linkNoB = try $ do
508linkNoB = try $ do
507− name <- surrounded (char '"') inline
509+ name <- mconcat <$> surrounded (char '"') (withQuoteContext InDoubleQuote inline)
508 char ':'
510 char ':'
509 let stopChars = "!.,;:"
511 let stopChars = "!.,;:"
510 url <- manyTill nonspaceChar (lookAhead $ space <|> try (oneOf stopChars >> (space <|> newline)))
512 url <- manyTill nonspaceChar (lookAhead $ space <|> try (oneOf stopChars >> (space <|> newline)))
511− let name' = if name == [Str "$"] then [Str url] else name
513+ let name' = if B.toList name == [Str "$"] then B.str url else name
512− return $ Link name' (url, "")
514+ return $ B.link url "" name'
513
515
514−linkB :: Parser [Char] ParserState Inline
516+linkB :: Parser [Char] ParserState Inlines
515linkB = try $ do
517linkB = try $ do
516 char '['
518 char '['
517− name <- surrounded (char '"') inline
519+ name <- mconcat <$> surrounded (char '"') inline
518 char ':'
520 char ':'
519 url <- manyTill nonspaceChar (char ']')
521 url <- manyTill nonspaceChar (char ']')
520− let name' = if name == [Str "$"] then [Str url] else name
522+ let name' = if B.toList name == [Str "$"] then B.str url else name
521− return $ Link name' (url, "")
523+ return $ B.link url "" name'
522
524
523-- | image embedding
525-- | image embedding
524−image :: Parser [Char] ParserState Inline
526+image :: Parser [Char] ParserState Inlines
525image = try $ do
527image = try $ do
526 char '!' >> notFollowedBy space
528 char '!' >> notFollowedBy space
527 src <- manyTill anyChar (lookAhead $ oneOf "!(")
529 src <- manyTill anyChar (lookAhead $ oneOf "!(")
528 alt <- option "" (try $ (char '(' >> manyTill anyChar (char ')')))
530 alt <- option "" (try $ (char '(' >> manyTill anyChar (char ')')))
529 char '!'
531 char '!'
530− return $ Image [Str alt] (src, alt)
532+ return $ B.image src alt (B.str alt)
531
533
532−escapedInline :: Parser [Char] ParserState Inline
534+escapedInline :: Parser [Char] ParserState Inlines
533escapedInline = escapedEqs <|> escapedTag
535escapedInline = escapedEqs <|> escapedTag
534
536
535−escapedEqs :: Parser [Char] ParserState Inline
537+escapedEqs :: Parser [Char] ParserState Inlines
536−escapedEqs = Str <$> (try $ string "==" *> manyTill anyChar (try $ string "=="))
538+escapedEqs = B.str <$> (try $ string "==" *> manyTill anyChar (try $ string "=="))
537
539
538-- | literal text escaped btw <notextile> tags
540-- | literal text escaped btw <notextile> tags
539−escapedTag :: Parser [Char] ParserState Inline
541+escapedTag :: Parser [Char] ParserState Inlines
540−escapedTag = Str <$>
542+escapedTag = B.str <$>
541 (try $ string "<notextile>" *> manyTill anyChar (try $ string "</notextile>"))
543 (try $ string "<notextile>" *> manyTill anyChar (try $ string "</notextile>"))
542
544
543-- | Any special symbol defined in wordBoundaries
545-- | Any special symbol defined in wordBoundaries
544−symbol :: Parser [Char] ParserState Inline
546+symbol :: Parser [Char] ParserState Inlines
545−symbol = Str . singleton <$> (oneOf wordBoundaries <|> oneOf markupChars)
547+symbol = B.str . singleton <$> (oneOf wordBoundaries <|> oneOf markupChars)
546
548
547-- | Inline code
549-- | Inline code
548−code :: Parser [Char] ParserState Inline
550+code :: Parser [Char] ParserState Inlines
549code = code1 <|> code2
551code = code1 <|> code2
550
552
551−code1 :: Parser [Char] ParserState Inline
553+code1 :: Parser [Char] ParserState Inlines
552−code1 = Code nullAttr <$> surrounded (char '@') anyChar
554+code1 = B.code <$> surrounded (char '@') anyChar
553
555
554−code2 :: Parser [Char] ParserState Inline
556+code2 :: Parser [Char] ParserState Inlines
555code2 = do
557code2 = do
556 htmlTag (tagOpen (=="tt") null)
558 htmlTag (tagOpen (=="tt") null)
557− Code nullAttr <$> manyTill anyChar (try $ htmlTag $ tagClose (=="tt"))
559+ B.code <$> manyTill anyChar (try $ htmlTag $ tagClose (=="tt"))
558
560
559-- | Html / CSS attributes
561-- | Html / CSS attributes
560attributes :: Parser [Char] ParserState Attr
562attributes :: Parser [Char] ParserState Attr
@@ -581,7 +583,7 @@ styleAttr = do
581
583
582langAttr :: Parser [Char] ParserState (Attr -> Attr)
584langAttr :: Parser [Char] ParserState (Attr -> Attr)
583langAttr = do
585langAttr = do
584− lang <- try $ enclosed (char '[') (char ']') anyChar
586+ lang <- try $ enclosed (char '[') (char ']') alphaNum
585 return $ \(id',classes,keyvals) -> (id',classes,("lang",lang):keyvals)
587 return $ \(id',classes,keyvals) -> (id',classes,("lang",lang):keyvals)
586
588
587-- | Parses material surrounded by a parser.
589-- | Parses material surrounded by a parser.
@@ -590,14 +592,43 @@ surrounded :: Parser [Char] st t -- ^ surrounding parser
590 -> Parser [Char] st [a]
592 -> Parser [Char] st [a]
591surrounded border = enclosed (border *> notFollowedBy (oneOf " \t\n\r")) (try border)
593surrounded border = enclosed (border *> notFollowedBy (oneOf " \t\n\r")) (try border)
592
594
593−-- | Inlines are most of the time of the same form
595+
594simpleInline :: Parser [Char] ParserState t -- ^ surrounding parser
596simpleInline :: Parser [Char] ParserState t -- ^ surrounding parser
597+ -> (Inlines -> Inlines) -- ^ Inline constructor
598+ -> Parser [Char] ParserState Inlines -- ^ content parser (to be used repeatedly)
599+simpleInline border construct = groupedSimpleInline border construct <|> ungroupedSimpleInline border construct
600+
601+ungroupedSimpleInline :: Parser [Char] ParserState t -- ^ surrounding parser
595− -> ([Inline] -> Inline) -- ^ Inline constructor
602+ -> (Inlines -> Inlines) -- ^ Inline constructor
596− -> Parser [Char] ParserState Inline -- ^ content parser (to be used repeatedly)
603+ -> Parser [Char] ParserState Inlines -- ^ content parser (to be used repeatedly)
604+ungroupedSimpleInline border construct = try $ do
605+ st <- getState
606+ pos <- getPosition
607+ isWhitespace <- option False (whitespace >> return True)
608+ guard $ (stateQuoteContext st /= NoQuote)
609+ || (sourceColumn pos == 1)
610+ || isWhitespace
597−simpleInline border construct = surrounded border inlineWithAttribute >>=
611+ body <- surrounded border inlineWithAttribute
598− return . construct . normalizeSpaces
612+ lookAhead (notFollowedBy alphaNum)
613+ let result = construct $ mconcat body
614+ return $ if isWhitespace then B.space <> result
615+ else result
616+ where
599− where inlineWithAttribute = (try $ optional attributes) >> inline
617+ inlineWithAttribute = (try $ optional attributes) >> notFollowedBy (string "\n\n")
618+ >> (withQuoteContext InSingleQuote inline)
619+
620+
621+groupedSimpleInline :: Parser [Char] ParserState t
622+ -> (Inlines -> Inlines)
623+ -> Parser [Char] ParserState Inlines
624+groupedSimpleInline border construct = try $ do
625+ char '['
626+ withQuoteContext InSingleQuote (simpleInline border construct) >>~ char ']'
627+
628+
629+
600
630
601-- | Create a singleton list
631-- | Create a singleton list
602singleton :: a -> [a]
632singleton :: a -> [a]
603singleton x = [x]
633singleton x = [x]
634+
tests/html-reader.html+5
@@ -426,5 +426,10 @@ An e-mail address: nobody [at] nowhere.net<blockquote>
426<pre><code> { &lt;code> }
426<pre><code> { &lt;code> }
427</code></pre>
427</code></pre>
428<p>If you want, you can use a caret at the beginning of every line, as with blockquotes, but all that you need is a caret at the beginning of the first line of the block and any preceding blank lines.</p>
428<p>If you want, you can use a caret at the beginning of every line, as with blockquotes, but all that you need is a caret at the beginning of the first line of the block and any preceding blank lines.</p>
429+<p>text<em> Leading space</em></p>
430+<p><em>Trailing space </em>text</p>
431+<p>text<em> Leading spaces</em></p>
432+<p><em>Trailing spaces </em>text</p>
433+
429</body>
434</body>
430</html>
435</html>
tests/html-reader.native+78−74
@@ -1,5 +1,5 @@
1Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("title",MetaInlines [Str "Pandoc",Space,Str "Test",Space,Str "Suite"])]})
1Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("title",MetaInlines [Str "Pandoc",Space,Str "Test",Space,Str "Suite"])]})
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",Str "'",Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."]
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's",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
3,HorizontalRule
3,HorizontalRule
4,Header 1 ("",[],[]) [Str "Headers"]
4,Header 1 ("",[],[]) [Str "Headers"]
5,Header 2 ("",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embedded",Space,Str "link"] ("/url","")]
5,Header 2 ("",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embedded",Space,Str "link"] ("/url","")]
@@ -14,15 +14,15 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
14,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
14,Para [Str "with",Space,Str "no",Space,Str "blank",Space,Str "line"]
15,HorizontalRule
15,HorizontalRule
16,Header 1 ("",[],[]) [Str "Paragraphs"]
16,Header 1 ("",[],[]) [Str "Paragraphs"]
17−,Para [Str "Here",Str "'",Str "s",Space,Str "a",Space,Str "regular",Space,Str "paragraph",Str "."]
17+,Para [Str "Here's",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
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 "."]
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",Str "'",Str "s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet",Str ".",Space,Str "*",Space,Str "criminey",Str "."]
19+,Para [Str "Here's",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,Space,Str "here",Str "."]
20+,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "hard",Space,Str "line",Space,Str "break",LineBreak,Space,Str "here."]
21,HorizontalRule
21,HorizontalRule
22,Header 1 ("",[],[]) [Str "Block",Space,Str "Quotes"]
22,Header 1 ("",[],[]) [Str "Block",Space,Str "Quotes"]
23−,Para [Str "E",Str "-",Str "mail",Space,Str "style:"]
23+,Para [Str "E-mail",Space,Str "style:"]
24,BlockQuote
24,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."]]
26,BlockQuote
26,BlockQuote
27 [Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
27 [Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
28 ,CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}"
28 ,CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}"
@@ -35,8 +35,8 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
35 [Para [Str "nested"]]
35 [Para [Str "nested"]]
36 ,BlockQuote
36 ,BlockQuote
37 [Para [Str "nested"]]]
37 [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:",Space,Str "2",Space,Str ">",Space,Str "1",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 "Box",Str "-",Str "style:"]
39+,Para [Str "Box-style:"]
40,BlockQuote
40,BlockQuote
41 [Para [Str "Example:"]
41 [Para [Str "Example:"]
42 ,CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}"]
42 ,CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}"]
@@ -44,12 +44,12 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
44 [OrderedList (1,DefaultStyle,DefaultDelim)
44 [OrderedList (1,DefaultStyle,DefaultDelim)
45 [[Plain [Str "do",Space,Str "laundry"]]
45 [[Plain [Str "do",Space,Str "laundry"]]
46 ,[Plain [Str "take",Space,Str "out",Space,Str "the",Space,Str "trash"]]]]
46 ,[Plain [Str "take",Space,Str "out",Space,Str "the",Space,Str "trash"]]]]
47−,Para [Str "Here",Str "'",Str "s",Space,Str "a",Space,Str "nested",Space,Str "one:"]
47+,Para [Str "Here's",Space,Str "a",Space,Str "nested",Space,Str "one:"]
48,BlockQuote
48,BlockQuote
49 [Para [Str "Joe",Space,Str "said:"]
49 [Para [Str "Joe",Space,Str "said:"]
50 ,BlockQuote
50 ,BlockQuote
51− [Para [Str "Don",Str "'",Str "t",Space,Str "quote",Space,Str "me",Str "."]]]
51+ [Para [Str "Don't",Space,Str "quote",Space,Str "me."]]]
52−,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph",Str "."]
52+,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
53,HorizontalRule
53,HorizontalRule
54,Header 1 ("",[],[]) [Str "Code",Space,Str "Blocks"]
54,Header 1 ("",[],[]) [Str "Code",Space,Str "Blocks"]
55,Para [Str "Code:"]
55,Para [Str "Code:"]
@@ -112,10 +112,10 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
112 ,[Para [Str "Three"]]]
112 ,[Para [Str "Three"]]]
113,Para [Str "Multiple",Space,Str "paragraphs:"]
113,Para [Str "Multiple",Space,Str "paragraphs:"]
114,OrderedList (1,DefaultStyle,DefaultDelim)
114,OrderedList (1,DefaultStyle,DefaultDelim)
115− [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one",Str "."]
115+ [[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
116− ,Para [Str "Item",Space,Str "1",Str ".",Space,Str "graf",Space,Str "two",Str ".",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog",Str "'",Str "s",Space,Str "back",Str "."]]
116+ ,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's",Space,Str "back."]]
117− ,[Para [Str "Item",Space,Str "2",Str "."]]
117+ ,[Para [Str "Item",Space,Str "2."]]
118− ,[Para [Str "Item",Space,Str "3",Str "."]]]
118+ ,[Para [Str "Item",Space,Str "3."]]]
119,Header 2 ("",[],[]) [Str "Nested"]
119,Header 2 ("",[],[]) [Str "Nested"]
120,BulletList
120,BulletList
121 [[Plain [Str "Tab"]
121 [[Plain [Str "Tab"]
@@ -123,7 +123,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
123 [[Plain [Str "Tab"]
123 [[Plain [Str "Tab"]
124 ,BulletList
124 ,BulletList
125 [[Plain [Str "Tab"]]]]]]]
125 [[Plain [Str "Tab"]]]]]]]
126−,Para [Str "Here",Str "'",Str "s",Space,Str "another:"]
126+,Para [Str "Here's",Space,Str "another:"]
127,OrderedList (1,DefaultStyle,DefaultDelim)
127,OrderedList (1,DefaultStyle,DefaultDelim)
128 [[Plain [Str "First"]]
128 [[Plain [Str "First"]]
129 ,[Plain [Str "Second:"]
129 ,[Plain [Str "Second:"]
@@ -163,63 +163,63 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
163,OrderedList (1,UpperAlpha,DefaultDelim)
163,OrderedList (1,UpperAlpha,DefaultDelim)
164 [[Plain [Str "Upper",Space,Str "Alpha"]
164 [[Plain [Str "Upper",Space,Str "Alpha"]
165 ,OrderedList (1,UpperRoman,DefaultDelim)
165 ,OrderedList (1,UpperRoman,DefaultDelim)
166− [[Plain [Str "Upper",Space,Str "Roman",Str "."]
166+ [[Plain [Str "Upper",Space,Str "Roman."]
167 ,OrderedList (6,Decimal,DefaultDelim)
167 ,OrderedList (6,Decimal,DefaultDelim)
168 [[Plain [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
168 [[Plain [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
169 ,OrderedList (3,LowerAlpha,DefaultDelim)
169 ,OrderedList (3,LowerAlpha,DefaultDelim)
170 [[Plain [Str "Lower",Space,Str "alpha",Space,Str "with",Space,Str "paren"]]]]]]]]]
170 [[Plain [Str "Lower",Space,Str "alpha",Space,Str "with",Space,Str "paren"]]]]]]]]]
171,Para [Str "Autonumbering:"]
171,Para [Str "Autonumbering:"]
172,OrderedList (1,DefaultStyle,DefaultDelim)
172,OrderedList (1,DefaultStyle,DefaultDelim)
173− [[Plain [Str "Autonumber",Str "."]]
173+ [[Plain [Str "Autonumber."]]
174− ,[Plain [Str "More",Str "."]
174+ ,[Plain [Str "More."]
175 ,OrderedList (1,DefaultStyle,DefaultDelim)
175 ,OrderedList (1,DefaultStyle,DefaultDelim)
176− [[Plain [Str "Nested",Str "."]]]]]
176+ [[Plain [Str "Nested."]]]]]
177,HorizontalRule
177,HorizontalRule
178,Header 2 ("",[],[]) [Str "Definition"]
178,Header 2 ("",[],[]) [Str "Definition"]
179,DefinitionList
179,DefinitionList
180 [([Str "Violin"],
180 [([Str "Violin"],
181− [[Plain [Str "Stringed",Space,Str "musical",Space,Str "instrument",Str "."]]
181+ [[Plain [Str "Stringed",Space,Str "musical",Space,Str "instrument."]]
182− ,[Plain [Str "Torture",Space,Str "device",Str "."]]])
182+ ,[Plain [Str "Torture",Space,Str "device."]]])
183 ,([Str "Cello",LineBreak,Str "Violoncello"],
183 ,([Str "Cello",LineBreak,Str "Violoncello"],
184− [[Plain [Str "Low",Str "-",Str "voiced",Space,Str "stringed",Space,Str "instrument",Str "."]]])]
184+ [[Plain [Str "Low-voiced",Space,Str "stringed",Space,Str "instrument."]]])]
185,HorizontalRule
185,HorizontalRule
186,Header 1 ("",[],[]) [Str "Inline",Space,Str "Markup"]
186,Header 1 ("",[],[]) [Str "Inline",Space,Str "Markup"]
187,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 "."]
187,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 "."]
188,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 "."]
188,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 "."]
189,Para [Str "An",Space,Emph [Link [Str "emphasized",Space,Str "link"] ("/url","")],Str "."]
189,Para [Str "An",Space,Emph [Link [Str "emphasized",Space,Str "link"] ("/url","")],Str "."]
190−,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em",Str "."]]]
190+,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
191−,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word",Str "."]
191+,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
192−,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em",Str "."]]]
192+,Para [Strong [Emph [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]]]
193−,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word",Str "."]
193+,Para [Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word."]
194,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 "."]
194,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 "."]
195,HorizontalRule
195,HorizontalRule
196,Header 1 ("",[],[]) [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
196,Header 1 ("",[],[]) [Str "Smart",Space,Str "quotes,",Space,Str "ellipses,",Space,Str "dashes"]
197−,Para [Str "\"",Str "Hello,",Str "\"",Space,Str "said",Space,Str "the",Space,Str "spider",Str ".",Space,Str "\"",Str "'",Str "Shelob",Str "'",Space,Str "is",Space,Str "my",Space,Str "name",Str ".",Str "\""]
197+,Para [Str "\"Hello,\"",Space,Str "said",Space,Str "the",Space,Str "spider.",Space,Str "\"'Shelob'",Space,Str "is",Space,Str "my",Space,Str "name.\""]
198−,Para [Str "'",Str "A",Str "'",Str ",",Space,Str "'",Str "B",Str "'",Str ",",Space,Str "and",Space,Str "'",Str "C",Str "'",Space,Str "are",Space,Str "letters",Str "."]
198+,Para [Str "'A',",Space,Str "'B',",Space,Str "and",Space,Str "'C'",Space,Str "are",Space,Str "letters."]
199−,Para [Str "'",Str "Oak,",Str "'",Space,Str "'",Str "elm,",Str "'",Space,Str "and",Space,Str "'",Str "beech",Str "'",Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees",Str ".",Space,Str "So",Space,Str "is",Space,Str "'",Str "pine",Str ".",Str "'"]
199+,Para [Str "'Oak,'",Space,Str "'elm,'",Space,Str "and",Space,Str "'beech'",Space,Str "are",Space,Str "names",Space,Str "of",Space,Str "trees.",Space,Str "So",Space,Str "is",Space,Str "'pine.'"]
200−,Para [Str "'",Str "He",Space,Str "said,",Space,Str "\"",Str "I",Space,Str "want",Space,Str "to",Space,Str "go",Str ".",Str "\"",Str "'",Space,Str "Were",Space,Str "you",Space,Str "alive",Space,Str "in",Space,Str "the",Space,Str "70",Str "'",Str "s?"]
200+,Para [Str "'He",Space,Str "said,",Space,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's?"]
201−,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Str "'",Code ("",[],[]) "code",Str "'",Space,Str "and",Space,Str "a",Space,Str "\"",Link [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2",""),Str "\"",Str "."]
201+,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Str "quoted",Space,Str "'",Code ("",[],[]) "code",Str "'",Space,Str "and",Space,Str "a",Space,Str "\"",Link [Str "quoted",Space,Str "link"] ("http://example.com/?foo=1&bar=2",""),Str "\"."]
202−,Para [Str "Some",Space,Str "dashes:",Space,Str "one",Str "-",Str "-",Str "-",Str "two",Space,Str "-",Str "-",Str "-",Space,Str "three",Str "-",Str "-",Str "four",Space,Str "-",Str "-",Space,Str "five",Str "."]
202+,Para [Str "Some",Space,Str "dashes:",Space,Str "one---two",Space,Str "---",Space,Str "three--four",Space,Str "--",Space,Str "five."]
203−,Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5",Str "-",Str "7,",Space,Str "255",Str "-",Str "66,",Space,Str "1987",Str "-",Str "1999",Str "."]
203+,Para [Str "Dashes",Space,Str "between",Space,Str "numbers:",Space,Str "5-7,",Space,Str "255-66,",Space,Str "1987-1999."]
204−,Para [Str "Ellipses",Str ".",Str ".",Str ".",Str "and",Str ".",Space,Str ".",Space,Str ".",Str "and",Space,Str ".",Space,Str ".",Space,Str ".",Space,Str "."]
204+,Para [Str "Ellipses...and.",Space,Str ".",Space,Str ".and",Space,Str ".",Space,Str ".",Space,Str ".",Space,Str "."]
205,HorizontalRule
205,HorizontalRule
206,Header 1 ("",[],[]) [Str "LaTeX"]
206,Header 1 ("",[],[]) [Str "LaTeX"]
207,BulletList
207,BulletList
208− [[Plain [Str "\\cite[22",Str "-",Str "23]{smith",Str ".",Str "1899}"]]
208+ [[Plain [Str "\\cite[22-23]{smith.1899}"]]
209 ,[Plain [Str "\\doublespacing"]]
209 ,[Plain [Str "\\doublespacing"]]
210− ,[Plain [Str "$",Str "2+2=4",Str "$"]]
210+ ,[Plain [Str "$2+2=4$"]]
211− ,[Plain [Str "$",Str "x",Space,Str "\\in",Space,Str "y",Str "$"]]
211+ ,[Plain [Str "$x",Space,Str "\\in",Space,Str "y$"]]
212− ,[Plain [Str "$",Str "\\alpha",Space,Str "\\wedge",Space,Str "\\omega",Str "$"]]
212+ ,[Plain [Str "$\\alpha",Space,Str "\\wedge",Space,Str "\\omega$"]]
213− ,[Plain [Str "$",Str "223",Str "$"]]
213+ ,[Plain [Str "$223$"]]
214− ,[Plain [Str "$",Str "p",Str "$",Str "-",Str "Tree"]]
214+ ,[Plain [Str "$p$-Tree"]]
215− ,[Plain [Str "$",Str "\\frac{d}{dx}f(x)=\\lim_{h\\to",Space,Str "0}\\frac{f(x+h)",Str "-",Str "f(x)}{h}",Str "$"]]
215+ ,[Plain [Str "$\\frac{d}{dx}f(x)=\\lim_{h\\to",Space,Str "0}\\frac{f(x+h)-f(x)}{h}$"]]
216− ,[Plain [Str "Here",Str "'",Str "s",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,Str "$",Str "\\alpha",Space,Str "+",Space,Str "\\omega",Space,Str "\\times",Space,Str "x^2",Str "$",Str "."]]]
216+ ,[Plain [Str "Here's",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,Str "$\\alpha",Space,Str "+",Space,Str "\\omega",Space,Str "\\times",Space,Str "x^2$."]]]
217−,Para [Str "These",Space,Str "shouldn",Str "'",Str "t",Space,Str "be",Space,Str "math:"]
217+,Para [Str "These",Space,Str "shouldn't",Space,Str "be",Space,Str "math:"]
218,BulletList
218,BulletList
219 [[Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]]
219 [[Plain [Str "To",Space,Str "get",Space,Str "the",Space,Str "famous",Space,Str "equation,",Space,Str "write",Space,Code ("",[],[]) "$e = mc^2$",Str "."]]
220− ,[Plain [Str "$",Str "22,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,000",Str ".",Space,Str "(It",Space,Str "worked",Space,Str "if",Space,Str "\"",Str "lot",Str "\"",Space,Str "is",Space,Str "emphasized",Str ".",Str ")"]]
220+ ,[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,Str "\"lot\"",Space,Str "is",Space,Str "emphasized.)"]]
221− ,[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 "."]]]
221+ ,[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$."]]]
222−,Para [Str "Here",Str "'",Str "s",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
222+,Para [Str "Here's",Space,Str "a",Space,Str "LaTeX",Space,Str "table:"]
223,Para [Str "\\begin{tabular}{|l|l|}\\hline",Space,Str "Animal",Space,Str "&",Space,Str "Number",Space,Str "\\\\",Space,Str "\\hline",Space,Str "Dog",Space,Str "&",Space,Str "2",Space,Str "\\\\",Space,Str "Cat",Space,Str "&",Space,Str "1",Space,Str "\\\\",Space,Str "\\hline",Space,Str "\\end{tabular}"]
223,Para [Str "\\begin{tabular}{|l|l|}\\hline",Space,Str "Animal",Space,Str "&",Space,Str "Number",Space,Str "\\\\",Space,Str "\\hline",Space,Str "Dog",Space,Str "&",Space,Str "2",Space,Str "\\\\",Space,Str "Cat",Space,Str "&",Space,Str "1",Space,Str "\\\\",Space,Str "\\hline",Space,Str "\\end{tabular}"]
224,HorizontalRule
224,HorizontalRule
225,Header 1 ("",[],[]) [Str "Special",Space,Str "Characters"]
225,Header 1 ("",[],[]) [Str "Special",Space,Str "Characters"]
@@ -230,11 +230,11 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
230 ,[Plain [Str "section:",Space,Str "\167"]]
230 ,[Plain [Str "section:",Space,Str "\167"]]
231 ,[Plain [Str "set",Space,Str "membership:",Space,Str "\8712"]]
231 ,[Plain [Str "set",Space,Str "membership:",Space,Str "\8712"]]
232 ,[Plain [Str "copyright:",Space,Str "\169"]]]
232 ,[Plain [Str "copyright:",Space,Str "\169"]]]
233−,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name",Str "."]
233+,Para [Str "AT&T",Space,Str "has",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "their",Space,Str "name."]
234−,Para [Str "AT&T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it",Str "."]
234+,Para [Str "AT&T",Space,Str "is",Space,Str "another",Space,Str "way",Space,Str "to",Space,Str "write",Space,Str "it."]
235−,Para [Str "This",Space,Str "&",Space,Str "that",Str "."]
235+,Para [Str "This",Space,Str "&",Space,Str "that."]
236−,Para [Str "4",Space,Str "<",Space,Str "5",Str "."]
236+,Para [Str "4",Space,Str "<",Space,Str "5."]
237−,Para [Str "6",Space,Str ">",Space,Str "5",Str "."]
237+,Para [Str "6",Space,Str ">",Space,Str "5."]
238,Para [Str "Backslash:",Space,Str "\\"]
238,Para [Str "Backslash:",Space,Str "\\"]
239,Para [Str "Backtick:",Space,Str "`"]
239,Para [Str "Backtick:",Space,Str "`"]
240,Para [Str "Asterisk:",Space,Str "*"]
240,Para [Str "Asterisk:",Space,Str "*"]
@@ -245,7 +245,7 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
245,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
245,Para [Str "Right",Space,Str "bracket:",Space,Str "]"]
246,Para [Str "Left",Space,Str "paren:",Space,Str "("]
246,Para [Str "Left",Space,Str "paren:",Space,Str "("]
247,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
247,Para [Str "Right",Space,Str "paren:",Space,Str ")"]
248−,Para [Str "Greater",Str "-",Str "than:",Space,Str ">"]
248+,Para [Str "Greater-than:",Space,Str ">"]
249,Para [Str "Hash:",Space,Str "#"]
249,Para [Str "Hash:",Space,Str "#"]
250,Para [Str "Period:",Space,Str "."]
250,Para [Str "Period:",Space,Str "."]
251,Para [Str "Bang:",Space,Str "!"]
251,Para [Str "Bang:",Space,Str "!"]
@@ -260,47 +260,51 @@ Pandoc (Meta {unMeta = fromList [("generator",MetaInlines [Str "pandoc"]),("titl
260,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title preceded by a tab"),Str "."]
260,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title preceded by a tab"),Str "."]
261,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with \"quotes\" in it")]
261,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with \"quotes\" in it")]
262,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with single quotes")]
262,Para [Link [Str "URL",Space,Str "and",Space,Str "title"] ("/url/","title with single quotes")]
263−,Para [Str "Email",Space,Str "link",Space,Str "(nobody",Space,Str "[at]",Space,Str "nowhere",Str ".",Str "net)"]
263+,Para [Str "Email",Space,Str "link",Space,Str "(nobody",Space,Str "[at]",Space,Str "nowhere.net)"]
264,Para [Link [Str "Empty"] ("",""),Str "."]
264,Para [Link [Str "Empty"] ("",""),Str "."]
265,Header 2 ("",[],[]) [Str "Reference"]
265,Header 2 ("",[],[]) [Str "Reference"]
266,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
266,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
267,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
267,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
268,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
268,Para [Str "Foo",Space,Link [Str "bar"] ("/url/",""),Str "."]
269,Para [Str "With",Space,Link [Str "embedded",Space,Str "[brackets]"] ("/url/",""),Str "."]
269,Para [Str "With",Space,Link [Str "embedded",Space,Str "[brackets]"] ("/url/",""),Str "."]
270−,Para [Link [Str "b"] ("/url/",""),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link",Str "."]
270+,Para [Link [Str "b"] ("/url/",""),Space,Str "by",Space,Str "itself",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "link."]
271,Para [Str "Indented",Space,Link [Str "once"] ("/url",""),Str "."]
271,Para [Str "Indented",Space,Link [Str "once"] ("/url",""),Str "."]
272,Para [Str "Indented",Space,Link [Str "twice"] ("/url",""),Str "."]
272,Para [Str "Indented",Space,Link [Str "twice"] ("/url",""),Str "."]
273,Para [Str "Indented",Space,Link [Str "thrice"] ("/url",""),Str "."]
273,Para [Str "Indented",Space,Link [Str "thrice"] ("/url",""),Str "."]
274−,Para [Str "This",Space,Str "should",Space,Str "[not]",Space,Str "be",Space,Str "a",Space,Str "link",Str "."]
274+,Para [Str "This",Space,Str "should",Space,Str "[not]",Space,Str "be",Space,Str "a",Space,Str "link."]
275,CodeBlock ("",[],[]) "[not]: /url"
275,CodeBlock ("",[],[]) "[not]: /url"
276,Para [Str "Foo",Space,Link [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."]
276,Para [Str "Foo",Space,Link [Str "bar"] ("/url/","Title with \"quotes\" inside"),Str "."]
277,Para [Str "Foo",Space,Link [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."]
277,Para [Str "Foo",Space,Link [Str "biz"] ("/url/","Title with \"quote\" inside"),Str "."]
278,Header 2 ("",[],[]) [Str "With",Space,Str "ampersands"]
278,Header 2 ("",[],[]) [Str "With",Space,Str "ampersands"]
279−,Para [Str "Here",Str "'",Str "s",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."]
279+,Para [Str "Here's",Space,Str "a",Space,Link [Str "link",Space,Str "with",Space,Str "an",Space,Str "ampersand",Space,Str "in",Space,Str "the",Space,Str "URL"] ("http://example.com/?foo=1&bar=2",""),Str "."]
280−,Para [Str "Here",Str "'",Str "s",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link [Str "AT&T"] ("http://att.com/","AT&T"),Str "."]
280+,Para [Str "Here's",Space,Str "a",Space,Str "link",Space,Str "with",Space,Str "an",Space,Str "amersand",Space,Str "in",Space,Str "the",Space,Str "link",Space,Str "text:",Space,Link [Str "AT&T"] ("http://att.com/","AT&T"),Str "."]
281−,Para [Str "Here",Str "'",Str "s",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."]
281+,Para [Str "Here's",Space,Str "an",Space,Link [Str "inline",Space,Str "link"] ("/script?foo=1&bar=2",""),Str "."]
282−,Para [Str "Here",Str "'",Str "s",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 "."]
282+,Para [Str "Here's",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 "."]
283,Header 2 ("",[],[]) [Str "Autolinks"]
283,Header 2 ("",[],[]) [Str "Autolinks"]
284−,Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link [Str "http://example",Str ".",Str "com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
284+,Para [Str "With",Space,Str "an",Space,Str "ampersand:",Space,Link [Str "http://example.com/?foo=1&bar=2"] ("http://example.com/?foo=1&bar=2","")]
285,BulletList
285,BulletList
286 [[Plain [Str "In",Space,Str "a",Space,Str "list?"]]
286 [[Plain [Str "In",Space,Str "a",Space,Str "list?"]]
287− ,[Plain [Link [Str "http://example",Str ".",Str "com/"] ("http://example.com/","")]]
287+ ,[Plain [Link [Str "http://example.com/"] ("http://example.com/","")]]
288− ,[Plain [Str "It",Space,Str "should",Str "."]]]
288+ ,[Plain [Str "It",Space,Str "should."]]]
289−,Para [Str "An",Space,Str "e",Str "-",Str "mail",Space,Str "address:",Space,Str "nobody",Space,Str "[at]",Space,Str "nowhere",Str ".",Str "net"]
289+,Para [Str "An",Space,Str "e-mail",Space,Str "address:",Space,Str "nobody",Space,Str "[at]",Space,Str "nowhere.net"]
290,BlockQuote
290,BlockQuote
291− [Para [Str "Blockquoted:",Space,Link [Str "http://example",Str ".",Str "com/"] ("http://example.com/","")]]
291+ [Para [Str "Blockquoted:",Space,Link [Str "http://example.com/"] ("http://example.com/","")]]
292−,Para [Str "Auto",Str "-",Str "links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code ("",[],[]) "<http://example.com/>"]
292+,Para [Str "Auto-links",Space,Str "should",Space,Str "not",Space,Str "occur",Space,Str "here:",Space,Code ("",[],[]) "<http://example.com/>"]
293,CodeBlock ("",[],[]) "or here: <http://example.com/>"
293,CodeBlock ("",[],[]) "or here: <http://example.com/>"
294,HorizontalRule
294,HorizontalRule
295,Header 1 ("",[],[]) [Str "Images"]
295,Header 1 ("",[],[]) [Str "Images"]
296−,Para [Str "From",Space,Str "\"",Str "Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune",Str "\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
296+,Para [Str "From",Space,Str "\"Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune\"",Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
297,Para [Image [Str "lalune"] ("lalune.jpg","Voyage dans la Lune")]
297,Para [Image [Str "lalune"] ("lalune.jpg","Voyage dans la Lune")]
298−,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon",Str "."]
298+,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
299,HorizontalRule
299,HorizontalRule
300,Header 1 ("",[],[]) [Str "Footnotes"]
300,Header 1 ("",[],[]) [Str "Footnotes"]
301−,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",Link [Str "(1)"] ("#note_1",""),Str ",",Space,Str "and",Space,Str "another",Link [Str "(longnote)"] ("#note_longnote",""),Str ".",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)",Str "."]
301+,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference",Link [Str "(1)"] ("#note_1",""),Str ",",Space,Str "and",Space,Str "another",Link [Str "(longnote)"] ("#note_longnote",""),Str ".",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)."]
302−,Para [Link [Str "(1)"] ("#ref_1",""),Space,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 "in",Space,Str "the",Space,Str "document,",Space,Str "not",Space,Str "just",Space,Str "at",Space,Str "the",Space,Str "end",Str "."]
302+,Para [Link [Str "(1)"] ("#ref_1",""),Space,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 "in",Space,Str "the",Space,Str "document,",Space,Str "not",Space,Str "just",Space,Str "at",Space,Str "the",Space,Str "end."]
303−,Para [Link [Str "(longnote)"] ("#ref_longnote",""),Space,Str "Here",Str "'",Str "s",Space,Str "the",Space,Str "other",Space,Str "note",Str ".",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks",Str "."]
303+,Para [Link [Str "(longnote)"] ("#ref_longnote",""),Space,Str "Here's",Space,Str "the",Space,Str "other",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."]
304−,Para [Str "Caret",Space,Str "characters",Space,Str "are",Space,Str "used",Space,Str "to",Space,Str "indicate",Space,Str "that",Space,Str "the",Space,Str "blocks",Space,Str "all",Space,Str "belong",Space,Str "to",Space,Str "a",Space,Str "single",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "block",Space,Str "quotes)",Str "."]
304+,Para [Str "Caret",Space,Str "characters",Space,Str "are",Space,Str "used",Space,Str "to",Space,Str "indicate",Space,Str "that",Space,Str "the",Space,Str "blocks",Space,Str "all",Space,Str "belong",Space,Str "to",Space,Str "a",Space,Str "single",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "block",Space,Str "quotes)."]
305,CodeBlock ("",[],[]) " { <code> }"
305,CodeBlock ("",[],[]) " { <code> }"
306−,Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "use",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "every",Space,Str "line,",Space,Str "as",Space,Str "with",Space,Str "blockquotes,",Space,Str "but",Space,Str "all",Space,Str "that",Space,Str "you",Space,Str "need",Space,Str "is",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "the",Space,Str "block",Space,Str "and",Space,Str "any",Space,Str "preceding",Space,Str "blank",Space,Str "lines",Str "."]]
306+,Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "use",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "every",Space,Str "line,",Space,Str "as",Space,Str "with",Space,Str "blockquotes,",Space,Str "but",Space,Str "all",Space,Str "that",Space,Str "you",Space,Str "need",Space,Str "is",Space,Str "a",Space,Str "caret",Space,Str "at",Space,Str "the",Space,Str "beginning",Space,Str "of",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "the",Space,Str "block",Space,Str "and",Space,Str "any",Space,Str "preceding",Space,Str "blank",Space,Str "lines."]
307+,Para [Str "text",Space,Emph [Str "Leading",Space,Str "space"]]
308+,Para [Emph [Str "Trailing",Space,Str "space"],Space,Str "text"]
309+,Para [Str "text",Space,Emph [Str "Leading",Space,Str "spaces"]]
310+,Para [Emph [Str "Trailing",Space,Str "spaces"],Space,Str "text"]]
tests/opml-reader.native+1−1
@@ -19,7 +19,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "Dave",Spa
19,Header 3 ("",[],[]) [Str "North",Space,Str "Dakota"]
19,Header 3 ("",[],[]) [Str "North",Space,Str "Dakota"]
20,Header 3 ("",[],[]) [Str "Oklahoma"]
20,Header 3 ("",[],[]) [Str "Oklahoma"]
21,Header 3 ("",[],[]) [Str "South",Space,Str "Dakota"]
21,Header 3 ("",[],[]) [Str "South",Space,Str "Dakota"]
22−,Header 2 ("",[],[]) [Str "Mid",Str "-",Str "Atlantic"]
22+,Header 2 ("",[],[]) [Str "Mid-Atlantic"]
23,Header 3 ("",[],[]) [Str "Delaware"]
23,Header 3 ("",[],[]) [Str "Delaware"]
24,Header 3 ("",[],[]) [Str "Maryland"]
24,Header 3 ("",[],[]) [Str "Maryland"]
25,Header 3 ("",[],[]) [Str "New",Space,Str "Jersey"]
25,Header 3 ("",[],[]) [Str "New",Space,Str "Jersey"]
tests/textile-reader.native+45−46
@@ -1,5 +1,5 @@
1Pandoc (Meta {unMeta = fromList []})
1Pandoc (Meta {unMeta = fromList []})
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 "Textile",Space,Str "Reader",Str ".",Space,Str "Part",Space,Str "of",Space,Str "it",Space,Str "comes",LineBreak,Str "from",Space,Str "John",Space,Str "Gruber",Str "\8217",Str "s",Space,Str "markdown",Space,Str "test",Space,Str "suite",Str "."]
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 "Textile",Space,Str "Reader.",Space,Str "Part",Space,Str "of",Space,Str "it",Space,Str "comes",LineBreak,Str "from",Space,Str "John",Space,Str "Gruber\8217s",Space,Str "markdown",Space,Str "test",Space,Str "suite."]
3,HorizontalRule
3,HorizontalRule
4,Header 1 ("headers",[],[]) [Str "Headers"]
4,Header 1 ("headers",[],[]) [Str "Headers"]
5,Header 2 ("level-2-with-an-embeded-link",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embeded",Space,Str "link"] ("http://www.example.com","")]
5,Header 2 ("level-2-with-an-embeded-link",[],[]) [Str "Level",Space,Str "2",Space,Str "with",Space,Str "an",Space,Link [Str "embeded",Space,Str "link"] ("http://www.example.com","")]
@@ -8,42 +8,42 @@ Pandoc (Meta {unMeta = fromList []})
8,Header 5 ("level-5",[],[]) [Str "Level",Space,Str "5"]
8,Header 5 ("level-5",[],[]) [Str "Level",Space,Str "5"]
9,Header 6 ("level-6",[],[]) [Str "Level",Space,Str "6"]
9,Header 6 ("level-6",[],[]) [Str "Level",Space,Str "6"]
10,Header 1 ("paragraphs",[],[]) [Str "Paragraphs"]
10,Header 1 ("paragraphs",[],[]) [Str "Paragraphs"]
11−,Para [Str "Here",Str "\8217",Str "s",Space,Str "a",Space,Str "regular",Space,Str "paragraph",Str "."]
11+,Para [Str "Here\8217s",Space,Str "a",Space,Str "regular",Space,Str "paragraph."]
12−,Para [Str "Line",Space,Str "breaks",Space,Str "are",Space,Str "preserved",Space,Str "in",Space,Str "textile",Str ",",Space,Str "so",Space,Str "you",Space,Str "can",Space,Str "not",Space,Str "wrap",Space,Str "your",Space,Str "very",LineBreak,Str "long",Space,Str "paragraph",Space,Str "with",Space,Str "your",Space,Str "favourite",Space,Str "text",Space,Str "editor",Space,Str "and",Space,Str "have",Space,Str "it",Space,Str "rendered",LineBreak,Str "with",Space,Str "no",Space,Str "break",Str "."]
12+,Para [Str "Line",Space,Str "breaks",Space,Str "are",Space,Str "preserved",Space,Str "in",Space,Str "textile,",Space,Str "so",Space,Str "you",Space,Str "can",Space,Str "not",Space,Str "wrap",Space,Str "your",Space,Str "very",LineBreak,Str "long",Space,Str "paragraph",Space,Str "with",Space,Str "your",Space,Str "favourite",Space,Str "text",Space,Str "editor",Space,Str "and",Space,Str "have",Space,Str "it",Space,Str "rendered",LineBreak,Str "with",Space,Str "no",Space,Str "break."]
13−,Para [Str "Here",Str "\8217",Str "s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet",Str "."]
13+,Para [Str "Here\8217s",Space,Str "one",Space,Str "with",Space,Str "a",Space,Str "bullet."]
14,BulletList
14,BulletList
15− [[Plain [Str "criminey",Str "."]]]
15+ [[Plain [Str "criminey."]]]
16,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "paragraph",Space,Str "break",Space,Str "between",Space,Str "here"]
16,Para [Str "There",Space,Str "should",Space,Str "be",Space,Str "a",Space,Str "paragraph",Space,Str "break",Space,Str "between",Space,Str "here"]
17−,Para [Str "and",Space,Str "here",Str "."]
17+,Para [Str "and",Space,Str "here."]
18−,Para [Str "pandoc",Space,Str "converts",Space,Str "textile",Str "."]
18+,Para [Str "pandoc",Space,Str "converts",Space,Str "textile."]
19,Header 1 ("block-quotes",[],[]) [Str "Block",Space,Str "Quotes"]
19,Header 1 ("block-quotes",[],[]) [Str "Block",Space,Str "Quotes"]
20,BlockQuote
20,BlockQuote
21− [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "famous",Space,Str "quote",Space,Str "from",Space,Str "somebody",Str ".",Space,Str "He",Space,Str "had",Space,Str "a",Space,Str "lot",Space,Str "of",Space,Str "things",Space,Str "to",LineBreak,Str "say",Str ",",Space,Str "so",Space,Str "the",Space,Str "text",Space,Str "is",Space,Str "really",Space,Str "really",Space,Str "long",Space,Str "and",Space,Str "spans",Space,Str "on",Space,Str "multiple",Space,Str "lines",Str "."]]
21+ [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "famous",Space,Str "quote",Space,Str "from",Space,Str "somebody.",Space,Str "He",Space,Str "had",Space,Str "a",Space,Str "lot",Space,Str "of",Space,Str "things",Space,Str "to",LineBreak,Str "say,",Space,Str "so",Space,Str "the",Space,Str "text",Space,Str "is",Space,Str "really",Space,Str "really",Space,Str "long",Space,Str "and",Space,Str "spans",Space,Str "on",Space,Str "multiple",Space,Str "lines."]]
22−,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph",Str "."]
22+,Para [Str "And",Space,Str "a",Space,Str "following",Space,Str "paragraph."]
23,Header 1 ("code-blocks",[],[]) [Str "Code",Space,Str "Blocks"]
23,Header 1 ("code-blocks",[],[]) [Str "Code",Space,Str "Blocks"]
24−,Para [Str "Code",Str ":"]
24+,Para [Str "Code:"]
25,CodeBlock ("",[],[]) " ---- (should be four hyphens)\n\n sub status {\n print \"working\";\n }\n\n this code block is indented by one tab"
25,CodeBlock ("",[],[]) " ---- (should be four hyphens)\n\n sub status {\n print \"working\";\n }\n\n this code block is indented by one tab"
26−,Para [Str "And",Str ":"]
26+,Para [Str "And:"]
27,CodeBlock ("",[],[]) " this code block is indented by two tabs\n\n These should not be escaped: \\$ \\\\ \\> \\[ \\{"
27,CodeBlock ("",[],[]) " this code block is indented by two tabs\n\n These should not be escaped: \\$ \\\\ \\> \\[ \\{"
28,CodeBlock ("",[],[]) "Code block with .bc\n continued\n @</\\\n"
28,CodeBlock ("",[],[]) "Code block with .bc\n continued\n @</\\\n"
29−,Para [Str "Inline",Space,Str "code",Str ":",Space,Code ("",[],[]) "<tt>",Str ",",Space,Code ("",[],[]) "@",Str "."]
29+,Para [Str "Inline",Space,Str "code:",Space,Code ("",[],[]) "<tt>",Str ",",Space,Code ("",[],[]) "@",Str "."]
30,Header 1 ("notextile",[],[]) [Str "Notextile"]
30,Header 1 ("notextile",[],[]) [Str "Notextile"]
31,Para [Str "A",Space,Str "block",Space,Str "of",Space,Str "text",Space,Str "can",Space,Str "be",Space,Str "protected",Space,Str "with",Space,Str "notextile",Space,Str ":"]
31,Para [Str "A",Space,Str "block",Space,Str "of",Space,Str "text",Space,Str "can",Space,Str "be",Space,Str "protected",Space,Str "with",Space,Str "notextile",Space,Str ":"]
32,Para [Str "\nNo *bold* and\n* no bullet\n"]
32,Para [Str "\nNo *bold* and\n* no bullet\n"]
33−,Para [Str "and",Space,Str "inlines",Space,Str "can",Space,Str "be",Space,Str "protected",Space,Str "with",Space,Str "double *equals (=)* markup",Str "."]
33+,Para [Str "and",Space,Str "inlines",Space,Str "can",Space,Str "be",Space,Str "protected",Space,Str "with",Space,Str "double *equals (=)* markup."]
34,Header 1 ("lists",[],[]) [Str "Lists"]
34,Header 1 ("lists",[],[]) [Str "Lists"]
35,Header 2 ("unordered",[],[]) [Str "Unordered"]
35,Header 2 ("unordered",[],[]) [Str "Unordered"]
36−,Para [Str "Asterisks",Space,Str "tight",Str ":"]
36+,Para [Str "Asterisks",Space,Str "tight:"]
37,BulletList
37,BulletList
38 [[Plain [Str "asterisk",Space,Str "1"]]
38 [[Plain [Str "asterisk",Space,Str "1"]]
39 ,[Plain [Str "asterisk",Space,Str "2"]]
39 ,[Plain [Str "asterisk",Space,Str "2"]]
40 ,[Plain [Str "asterisk",Space,Str "3"]]]
40 ,[Plain [Str "asterisk",Space,Str "3"]]]
41−,Para [Str "With",Space,Str "line",Space,Str "breaks",Str ":"]
41+,Para [Str "With",Space,Str "line",Space,Str "breaks:"]
42,BulletList
42,BulletList
43 [[Plain [Str "asterisk",Space,Str "1",LineBreak,Str "newline"]]
43 [[Plain [Str "asterisk",Space,Str "1",LineBreak,Str "newline"]]
44 ,[Plain [Str "asterisk",Space,Str "2"]]]
44 ,[Plain [Str "asterisk",Space,Str "2"]]]
45,Header 2 ("ordered",[],[]) [Str "Ordered"]
45,Header 2 ("ordered",[],[]) [Str "Ordered"]
46−,Para [Str "Tight",Str ":"]
46+,Para [Str "Tight:"]
47,OrderedList (1,DefaultStyle,DefaultDelim)
47,OrderedList (1,DefaultStyle,DefaultDelim)
48 [[Plain [Str "First"]]
48 [[Plain [Str "First"]]
49 ,[Plain [Str "Second"]]
49 ,[Plain [Str "Second"]]
@@ -52,42 +52,42 @@ Pandoc (Meta {unMeta = fromList []})
52,BulletList
52,BulletList
53 [[Plain [Str "ui",Space,Str "1"]
53 [[Plain [Str "ui",Space,Str "1"]
54 ,BulletList
54 ,BulletList
55− [[Plain [Str "ui",Space,Str "1",Str ".",Str "1"]
55+ [[Plain [Str "ui",Space,Str "1.1"]
56 ,OrderedList (1,DefaultStyle,DefaultDelim)
56 ,OrderedList (1,DefaultStyle,DefaultDelim)
57− [[Plain [Str "oi",Space,Str "1",Str ".",Str "1",Str ".",Str "1"]]
57+ [[Plain [Str "oi",Space,Str "1.1.1"]]
58− ,[Plain [Str "oi",Space,Str "1",Str ".",Str "1",Str ".",Str "2"]]]]
58+ ,[Plain [Str "oi",Space,Str "1.1.2"]]]]
59− ,[Plain [Str "ui",Space,Str "1",Str ".",Str "2"]]]]
59+ ,[Plain [Str "ui",Space,Str "1.2"]]]]
60 ,[Plain [Str "ui",Space,Str "2"]
60 ,[Plain [Str "ui",Space,Str "2"]
61 ,OrderedList (1,DefaultStyle,DefaultDelim)
61 ,OrderedList (1,DefaultStyle,DefaultDelim)
62− [[Plain [Str "oi",Space,Str "2",Str ".",Str "1"]
62+ [[Plain [Str "oi",Space,Str "2.1"]
63 ,BulletList
63 ,BulletList
64− [[Plain [Str "ui",Space,Str "2",Str ".",Str "1",Str ".",Str "1"]]
64+ [[Plain [Str "ui",Space,Str "2.1.1"]]
65− ,[Plain [Str "ui",Space,Str "2",Str ".",Str "1",Str ".",Str "2"]]]]]]]
65+ ,[Plain [Str "ui",Space,Str "2.1.2"]]]]]]]
66,Header 2 ("definition-list",[],[]) [Str "Definition",Space,Str "List"]
66,Header 2 ("definition-list",[],[]) [Str "Definition",Space,Str "List"]
67,DefinitionList
67,DefinitionList
68 [([Str "coffee"],
68 [([Str "coffee"],
69 [[Plain [Str "Hot",Space,Str "and",Space,Str "black"]]])
69 [[Plain [Str "Hot",Space,Str "and",Space,Str "black"]]])
70 ,([Str "tea"],
70 ,([Str "tea"],
71− [[Plain [Str "Also",Space,Str "hot",Str ",",Space,Str "but",Space,Str "a",Space,Str "little",Space,Str "less",Space,Str "black"]]])
71+ [[Plain [Str "Also",Space,Str "hot,",Space,Str "but",Space,Str "a",Space,Str "little",Space,Str "less",Space,Str "black"]]])
72 ,([Str "milk"],
72 ,([Str "milk"],
73− [[Para [Str "Nourishing",Space,Str "beverage",Space,Str "for",Space,Str "baby",Space,Str "cows",Str "."]
73+ [[Para [Str "Nourishing",Space,Str "beverage",Space,Str "for",Space,Str "baby",Space,Str "cows."]
74− ,Para [Str "Cold",Space,Str "drink",Space,Str "that",Space,Str "goes",Space,Str "great",Space,Str "with",Space,Str "cookies",Str "."]]])
74+ ,Para [Str "Cold",Space,Str "drink",Space,Str "that",Space,Str "goes",Space,Str "great",Space,Str "with",Space,Str "cookies."]]])
75 ,([Str "beer"],
75 ,([Str "beer"],
76 [[Plain [Str "fresh",Space,Str "and",Space,Str "bitter"]]])]
76 [[Plain [Str "fresh",Space,Str "and",Space,Str "bitter"]]])]
77,Header 1 ("inline-markup",[],[]) [Str "Inline",Space,Str "Markup"]
77,Header 1 ("inline-markup",[],[]) [Str "Inline",Space,Str "Markup"]
78−,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 ".",LineBreak,Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str ".",LineBreak,Str "Hyphenated-words-are-ok",Str ",",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "strange_underscore_notation",Str ".",LineBreak,Str "A",Space,Link [Strong [Str "strong",Space,Str "link"]] ("http://www.foobar.com",""),Str "."]
78+,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 ".",LineBreak,Str "This",Space,Str "is",Space,Strong [Str "strong"],Str ",",Space,Str "and",Space,Str "so",Space,Strong [Str "is",Space,Str "this"],Str ".",LineBreak,Str "Hyphenated-words-are-ok,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "strange_underscore_notation.",LineBreak,Str "A",Space,Link [Strong [Str "strong",Space,Str "link"]] ("http://www.foobar.com",""),Str "."]
79−,Para [Emph [Strong [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em",Str "."]],LineBreak,Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word",Space,Str "and",Space,Emph [Strong [Str "that",Space,Str "one"]],Str ".",LineBreak,Strikeout [Str "This",Space,Str "is",Space,Str "strikeout",Space,Str "and",Space,Strong [Str "strong"]]]
79+,Para [Emph [Strong [Str "This",Space,Str "is",Space,Str "strong",Space,Str "and",Space,Str "em."]],LineBreak,Str "So",Space,Str "is",Space,Strong [Emph [Str "this"]],Space,Str "word",Space,Str "and",Space,Emph [Strong [Str "that",Space,Str "one"]],Str ".",LineBreak,Strikeout [Str "This",Space,Str "is",Space,Str "strikeout",Space,Str "and",Space,Strong [Str "strong"]]]
80−,Para [Str "Superscripts",Str ":",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Superscript [Strong [Str "hello"]],Space,Str "a",Superscript [Str "hello",Space,Str "there"],Str ".",LineBreak,Str "Subscripts",Str ":",Space,Subscript [Str "here"],Space,Str "H",Subscript [Str "2"],Str "O",Str ",",Space,Str "H",Subscript [Str "23"],Str "O",Str ",",Space,Str "H",Subscript [Str "many",Space,Str "of",Space,Str "them"],Str "O",Str "."]
80+,Para [Str "Superscripts:",Space,Str "a",Superscript [Str "bc"],Str "d",Space,Str "a",Space,Superscript [Strong [Str "hello"]],Space,Str "a",Superscript [Str "hello",Space,Str "there"],Str ".",LineBreak,Str "Subscripts:",Space,Subscript [Str "here"],Space,Str "H",Space,Subscript [Str "2"],Str "O,",Space,Str "H",Space,Subscript [Str "23"],Str "O,",Space,Str "H",Space,Subscript [Str "many",Space,Str "of",Space,Str "them"],Str "O."]
81−,Para [Str "Dashes",Space,Str ":",Space,Str "How",Space,Str "cool",Space,Str "\8212",Space,Str "automatic",Space,Str "dashes",Str "."]
81+,Para [Str "Dashes",Space,Str ":",Space,Str "How",Space,Str "cool",Space,Str "\8212",Space,Str "automatic",Space,Str "dashes."]
82−,Para [Str "Elipses",Space,Str ":",Space,Str "He",Space,Str "thought",Space,Str "and",Space,Str "thought",Space,Str "\8230",Space,Str "and",Space,Str "then",Space,Str "thought",Space,Str "some",Space,Str "more",Str "."]
82+,Para [Str "Elipses",Space,Str ":",Space,Str "He",Space,Str "thought",Space,Str "and",Space,Str "thought",Space,Str "\8230",Space,Str "and",Space,Str "then",Space,Str "thought",Space,Str "some",Space,Str "more."]
83−,Para [Str "Quotes",Space,Str "and",Space,Str "apostrophes",Space,Str ":",Space,Quoted DoubleQuote [Str "I",Str "\8217",Str "d",Space,Str "like",Space,Str "to",Space,Str "thank",Space,Str "you"],Space,Str "for",Space,Str "example",Str "."]
83+,Para [Str "Quotes",Space,Str "and",Space,Str "apostrophes",Space,Str ":",Space,Quoted DoubleQuote [Str "I\8217d",Space,Str "like",Space,Str "to",Space,Str "thank",Space,Str "you"],Space,Str "for",Space,Str "example."]
84,Header 1 ("links",[],[]) [Str "Links"]
84,Header 1 ("links",[],[]) [Str "Links"]
85,Header 2 ("explicit",[],[]) [Str "Explicit"]
85,Header 2 ("explicit",[],[]) [Str "Explicit"]
86,Para [Str "Just",Space,Str "a",Space,Link [Str "url"] ("http://www.url.com","")]
86,Para [Str "Just",Space,Str "a",Space,Link [Str "url"] ("http://www.url.com","")]
87,Para [Link [Str "Email",Space,Str "link"] ("mailto:nobody@nowhere.net","")]
87,Para [Link [Str "Email",Space,Str "link"] ("mailto:nobody@nowhere.net","")]
88,Para [Str "Automatic",Space,Str "linking",Space,Str "to",Space,Link [Str "http://www.example.com"] ("http://www.example.com",""),Str "."]
88,Para [Str "Automatic",Space,Str "linking",Space,Str "to",Space,Link [Str "http://www.example.com"] ("http://www.example.com",""),Str "."]
89−,Para [Link [Str "Example"] ("http://www.example.com/",""),Str ":",Space,Str "Example",Space,Str "of",Space,Str "a",Space,Str "link",Space,Str "followed",Space,Str "by",Space,Str "a",Space,Str "colon",Str "."]
89+,Para [Link [Str "Example"] ("http://www.example.com/",""),Str ":",Space,Str "Example",Space,Str "of",Space,Str "a",Space,Str "link",Space,Str "followed",Space,Str "by",Space,Str "a",Space,Str "colon."]
90−,Para [Str "A",Space,Str "link",Link [Str "with",Space,Str "brackets"] ("http://www.example.com",""),Str "and",Space,Str "no",Space,Str "spaces",Str "."]
90+,Para [Str "A",Space,Str "link",Link [Str "with",Space,Str "brackets"] ("http://www.example.com",""),Str "and",Space,Str "no",Space,Str "spaces."]
91,Header 1 ("tables",[],[]) [Str "Tables"]
91,Header 1 ("tables",[],[]) [Str "Tables"]
92,Para [Str "Textile",Space,Str "allows",Space,Str "tables",Space,Str "with",Space,Str "and",Space,Str "without",Space,Str "headers",Space,Str ":"]
92,Para [Str "Textile",Space,Str "allows",Space,Str "tables",Space,Str "with",Space,Str "and",Space,Str "without",Space,Str "headers",Space,Str ":"]
93,Header 2 ("without-headers",[],[]) [Str "Without",Space,Str "headers"]
93,Header 2 ("without-headers",[],[]) [Str "Without",Space,Str "headers"]
@@ -121,11 +121,11 @@ Pandoc (Meta {unMeta = fromList []})
121 ,[Plain [Str "45"]]
121 ,[Plain [Str "45"]]
122 ,[Plain [Str "f"]]]]
122 ,[Plain [Str "f"]]]]
123,Header 1 ("images",[],[]) [Str "Images"]
123,Header 1 ("images",[],[]) [Str "Images"]
124−,Para [Str "Textile",Space,Str "inline",Space,Str "image",Space,Str "syntax",Str ",",Space,Str "like",Space,LineBreak,Str "here",Space,Image [Str "this is the alt text"] ("this_is_an_image.png","this is the alt text"),LineBreak,Str "and",Space,Str "here",Space,Image [Str ""] ("this_is_an_image.png",""),Str "."]
124+,Para [Str "Textile",Space,Str "inline",Space,Str "image",Space,Str "syntax,",Space,Str "like",LineBreak,Str "here",Space,Image [Str "this is the alt text"] ("this_is_an_image.png","this is the alt text"),LineBreak,Str "and",Space,Str "here",Space,Image [Str ""] ("this_is_an_image.png",""),Str "."]
125,Header 1 ("attributes",[],[]) [Str "Attributes"]
125,Header 1 ("attributes",[],[]) [Str "Attributes"]
126−,Header 2 ("ident",["bar","foo"],[("style","color:red"),("lang","en")]) [Str "HTML",Space,Str "and",Space,Str "CSS",Space,Str "attributes",Space,Str "are",Space,Str "parsed",Space,Str "in",Space,Str "headers",Str "."]
126+,Header 2 ("ident",["bar","foo"],[("style","color:red"),("lang","en")]) [Str "HTML",Space,Str "and",Space,Str "CSS",Space,Str "attributes",Space,Str "are",Space,Str "parsed",Space,Str "in",Space,Str "headers."]
127,Para [Str "as",Space,Str "well",Space,Str "as",Space,Strong [Str "inline",Space,Str "attributes"],Space,Str "of",Space,Str " all kind"]
127,Para [Str "as",Space,Str "well",Space,Str "as",Space,Strong [Str "inline",Space,Str "attributes"],Space,Str "of",Space,Str " all kind"]
128−,Para [Str "and",Space,Str "paragraph",Space,Str "attributes",Str ",",Space,Str "and",Space,Str "table",Space,Str "attributes",Str "."]
128+,Para [Str "and",Space,Str "paragraph",Space,Str "attributes,",Space,Str "and",Space,Str "table",Space,Str "attributes."]
129,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
129,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
130 []
130 []
131 [[[Plain [Str "name"]]
131 [[[Plain [Str "name"]]
@@ -137,7 +137,7 @@ Pandoc (Meta {unMeta = fromList []})
137,Header 1 ("entities",[],[]) [Str "Entities"]
137,Header 1 ("entities",[],[]) [Str "Entities"]
138,Para [Str "*",LineBreak,Str "&"]
138,Para [Str "*",LineBreak,Str "&"]
139,Header 1 ("raw-html",[],[]) [Str "Raw",Space,Str "HTML"]
139,Header 1 ("raw-html",[],[]) [Str "Raw",Space,Str "HTML"]
140−,Para [Str "However",Str ",",Space,RawInline (Format "html") "<strong>",Space,Str "raw",Space,Str "HTML",Space,Str "inlines",Space,RawInline (Format "html") "</strong>",Space,Str "are",Space,Str "accepted",Str ",",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str ":"]
140+,Para [Str "However,",Space,RawInline (Format "html") "<strong>",Space,Str "raw",Space,Str "HTML",Space,Str "inlines",Space,RawInline (Format "html") "</strong>",Space,Str "are",Space,Str "accepted,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str ":"]
141,RawBlock (Format "html") "<div class=\"foobar\">"
141,RawBlock (Format "html") "<div class=\"foobar\">"
142,Para [Str "any",Space,Strong [Str "Raw",Space,Str "HTML",Space,Str "Block"],Space,Str "with",Space,Str "bold"]
142,Para [Str "any",Space,Strong [Str "Raw",Space,Str "HTML",Space,Str "Block"],Space,Str "with",Space,Str "bold"]
143,RawBlock (Format "html") "</div>"
143,RawBlock (Format "html") "</div>"
@@ -145,9 +145,9 @@ Pandoc (Meta {unMeta = fromList []})
145,RawBlock (Format "html") "<div>"
145,RawBlock (Format "html") "<div>"
146,Para [Str "inlined"]
146,Para [Str "inlined"]
147,RawBlock (Format "html") "</div>"
147,RawBlock (Format "html") "</div>"
148−,Para [Str "as",Space,Str "well",Str "."]
148+,Para [Str "as",Space,Str "well."]
149,BulletList
149,BulletList
150− [[Plain [Str "this",Space,Str "<",Str "div",Str ">",Space,Str "won",Str "\8217",Str "t",Space,Str "produce",Space,Str "raw",Space,Str "html",Space,Str "blocks",Space,Str "<",Str "/div",Str ">"]]
150+ [[Plain [Str "this",Space,Str "<div>",Space,Str "won\8217t",Space,Str "produce",Space,Str "raw",Space,Str "html",Space,Str "blocks",Space,Str "</div>"]]
151 ,[Plain [Str "but",Space,Str "this",Space,RawInline (Format "html") "<strong>",Space,Str "will",Space,Str "produce",Space,Str "inline",Space,Str "html",Space,RawInline (Format "html") "</strong>"]]]
151 ,[Plain [Str "but",Space,Str "this",Space,RawInline (Format "html") "<strong>",Space,Str "will",Space,Str "produce",Space,Str "inline",Space,Str "html",Space,RawInline (Format "html") "</strong>"]]]
152,Para [Str "Can",Space,Str "you",Space,Str "prove",Space,Str "that",Space,Str "2",Space,Str "<",Space,Str "3",Space,Str "?"]
152,Para [Str "Can",Space,Str "you",Space,Str "prove",Space,Str "that",Space,Str "2",Space,Str "<",Space,Str "3",Space,Str "?"]
153,Header 1 ("raw-latex",[],[]) [Str "Raw",Space,Str "LaTeX"]
153,Header 1 ("raw-latex",[],[]) [Str "Raw",Space,Str "LaTeX"]
@@ -156,12 +156,11 @@ Pandoc (Meta {unMeta = fromList []})
156,Para [Str "and",Space,Str "for",Space,RawInline (Format "latex") "\\emph{inlines}",Str "."]
156,Para [Str "and",Space,Str "for",Space,RawInline (Format "latex") "\\emph{inlines}",Str "."]
157,Header 1 ("acronyms-and-marks",[],[]) [Str "Acronyms",Space,Str "and",Space,Str "marks"]
157,Header 1 ("acronyms-and-marks",[],[]) [Str "Acronyms",Space,Str "and",Space,Str "marks"]
158,Para [Str "PBS (Public Broadcasting System)"]
158,Para [Str "PBS (Public Broadcasting System)"]
159−,Para [Str "Hi",Str "\8482"]
159+,Para [Str "Hi\8482"]
160,Para [Str "Hi",Space,Str "\8482"]
160,Para [Str "Hi",Space,Str "\8482"]
161−,Para [Str "\174",Space,Str "Hi",Str "\174"]
161+,Para [Str "\174",Space,Str "Hi\174"]
162−,Para [Str "Hi",Str "\169",Str "2008",Space,Str "\169",Space,Str "2008"]
162+,Para [Str "Hi\169\&2008",Space,Str "\169",Space,Str "2008"]
163,Header 1 ("footnotes",[],[]) [Str "Footnotes"]
163,Header 1 ("footnotes",[],[]) [Str "Footnotes"]
164−,Para [Str "A",Space,Str "note",Str ".",Note [Para [Str "The",Space,Str "note",LineBreak,Str "is",Space,Str "here",Str "!"]],Space,Str "Another",Space,Str "note",Note [Para [Str "Other",Space,Str "note",Str "."]],Str "."]
164+,Para [Str "A",Space,Str "note.",Note [Para [Str "The",Space,Str "note",LineBreak,Str "is",Space,Str "here!"]],Space,Str "Another",Space,Str "note",Note [Para [Str "Other",Space,Str "note."]],Str "."]
165,Header 1 ("comment-blocks",[],[]) [Str "Comment",Space,Str "blocks"]
165,Header 1 ("comment-blocks",[],[]) [Str "Comment",Space,Str "blocks"]
166−,Null
167−,Para [Str "not",Space,Str "a",Space,Str "comment",Str "."]]
166+,Para [Str "not",Space,Str "a",Space,Str "comment."]]
tests/textile-reader.textile+3−3
@@ -139,8 +139,8 @@ _*This is strong and em.*_
139So is *_this_* word and __**that one**__.
139So is *_this_* word and __**that one**__.
140-This is strikeout and *strong*-
140-This is strikeout and *strong*-
141
141
142−Superscripts: a[^bc^]d a^*hello*^ a[^hello there^].
142+Superscripts: a[^bc^]d a ^*hello*^ a[^hello there^].
143−Subscripts: ~here~ H[~2~]O, H[~23~]O, H[~many of them~]O.
143+Subscripts: ~here~ H[ ~2~]O, H[ ~23~]O, H[ ~many of them~]O.
144
144
145Dashes : How cool -- automatic dashes.
145Dashes : How cool -- automatic dashes.
146
146
@@ -187,7 +187,7 @@ h2. With headers
187
187
188h1. Images
188h1. Images
189
189
190−Textile inline image syntax, like
190+Textile inline image syntax, like
191here !this_is_an_image.png(this is the alt text)!
191here !this_is_an_image.png(this is the alt text)!
192and here !this_is_an_image.png!.
192and here !this_is_an_image.png!.
193
193