@@ -177,28 +177,14 @@ para = try $ do
180−-- TODO : DOC and factorizing cellInlines
180+-- | A table cell spans until a pipe |
182tableCell :: GenParser Char ParserState TableCell
181tableCell :: GenParser Char ParserState TableCell
183+ c <- many1 (noneOf "|\n")
184+ content <- parseFromString (many1 inline) c
183−tableCell = many1 cellInline >>= return . (:[]) . Plain . normalizeSpaces
185+ return $ [ Plain $ normalizeSpaces content ]
184− where cellInline = choice [ str
187− , simpleInline (string "??") (Cite [])
188− , simpleInline (char '*') Strong
189− , simpleInline (char '_') Emph
190− , simpleInline (string "**") Strong
191− , simpleInline (string "__") Emph
192− , simpleInline (char '-') Strikeout
193− , simpleInline (char '+') Inserted
194− , simpleInline (char '^') Superscript
195− , simpleInline (char '~') Subscript
187+-- | A table row is made of many table cells
202tableRow :: GenParser Char ParserState [TableCell]
188tableRow :: GenParser Char ParserState [TableCell]
203tableRow = try $ do
189tableRow = try $ do
@@ -206,9 +192,11 @@ tableRow = try $ do
207 return cells
193 return cells
209tableRows :: GenParser Char ParserState [[TableCell]]
196tableRows :: GenParser Char ParserState [[TableCell]]
210tableRows = many1 tableRow
197tableRows = many1 tableRow
199+-- | Table headers are made of cells separated by a tag "|_."
212tableHeaders :: GenParser Char ParserState [TableCell]
200tableHeaders :: GenParser Char ParserState [TableCell]
213tableHeaders = try $ do
201tableHeaders = try $ do
214 let separator = (try $ string "|_.")
202 let separator = (try $ string "|_.")
@@ -218,6 +206,7 @@ tableHeaders = try $ do
219 return headers
207 return headers
209+-- | A table with an optional header
221table :: GenParser Char ParserState Block
210table :: GenParser Char ParserState Block
222table = try $ do
211table = try $ do
223 headers <- option [] tableHeaders
212 headers <- option [] tableHeaders
@@ -251,10 +240,10 @@ inlineParsers = [ str
251 , endline
240 , endline
253 , simpleInline (string "??") (Cite [])
242 , simpleInline (string "??") (Cite [])
254− , simpleInline (char '*') Strong
255− , simpleInline (char '_') Emph
256 , simpleInline (string "**") Strong
243 , simpleInline (string "**") Strong
257 , simpleInline (string "__") Emph
244 , simpleInline (string "__") Emph
245+ , simpleInline (char '*') Strong
246+ , simpleInline (char '_') Emph
258 , simpleInline (char '-') Strikeout
247 , simpleInline (char '-') Strikeout
259 , simpleInline (char '+') Inserted
248 , simpleInline (char '+') Inserted
260 , simpleInline (char '^') Superscript
249 , simpleInline (char '^') Superscript
@@ -311,7 +300,6 @@ simpleInline border construct = surrounded border inline >>=
311-- - Pandoc Meta Information
300-- - Pandoc Meta Information
312-- - footnotes
301-- - footnotes
313-- - hyperlink "label":target
302-- - hyperlink "label":target
314−-- - tables
303+-- - tables alignments
316-- - tests
304-- - tests
317-- - Inserted inline handling in writers
305-- - Inserted inline handling in writers