@@ -63,7 +63,7 @@ readTextile state s = (readWith parseTextile) state (s ++ "\n\n")
64-- | Special chars border strings parsing
64-- | Special chars border strings parsing
65specialChars :: [Char]
65specialChars :: [Char]
66−specialChars = "\\[]*#_@~<>!?-+^&'\";:"
66+specialChars = "\\[]*#_@~<>!?-+^&'\";:|"
68-- | Generate a Pandoc ADT from a textile document
68-- | Generate a Pandoc ADT from a textile document
69parseTextile :: GenParser Char ParserState Pandoc
69parseTextile :: GenParser Char ParserState Pandoc
@@ -82,6 +82,7 @@ blockParsers = [ codeBlock
83 , blockQuote
83 , blockQuote
86 , nullBlock ]
87 , nullBlock ]
@@ -173,6 +174,68 @@ para = try $ do
173 content <- manyTill inline blockBreak
174 content <- manyTill inline blockBreak
174 return $ Para $ normalizeSpaces content
175 return $ Para $ normalizeSpaces content
180+-- TODO : DOC and factorizing cellInlines
182+tableCell :: GenParser Char ParserState TableCell
183+tableCell = many1 cellInline >>= return . (:[]) . Plain . normalizeSpaces
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
202+tableRow :: GenParser Char ParserState [TableCell]
205+ cells <- endBy1 tableCell (char '|')
209+tableRows :: GenParser Char ParserState [[TableCell]]
210+tableRows = many1 tableRow
212+tableHeaders :: GenParser Char ParserState [TableCell]
213+tableHeaders = try $ do
214+ let separator = (try $ string "|_.")
216+ headers <- sepBy1 tableCell separator
221+table :: GenParser Char ParserState Block
223+ headers <- option [] tableHeaders
226+ (replicate (length headers) AlignDefault)
227+ (replicate (length headers) 0.0)
176-- | Any inline element
239-- | Any inline element
177inline :: GenParser Char ParserState Inline
240inline :: GenParser Char ParserState Inline
178inline = choice inlineParsers <?> "inline"
241inline = choice inlineParsers <?> "inline"