mirror of
https://github.com/jgm/pandoc.git
synced 2026-10-02 12:18:02 +00:00
RST reader: Consolidated rawBlock into directive.
This commit is contained in:
@@ -132,7 +132,6 @@ parseBlocks = mconcat <$> manyTill block eof
|
||||
|
||||
block :: RSTParser Blocks
|
||||
block = choice [ codeBlock
|
||||
, rawBlock
|
||||
, blockQuote
|
||||
, fieldList
|
||||
, directive
|
||||
@@ -353,18 +352,6 @@ lhsCodeBlock = try $ do
|
||||
birdTrackLine :: Parser [Char] st [Char]
|
||||
birdTrackLine = char '>' >> manyTill anyChar newline
|
||||
|
||||
--
|
||||
-- raw html/latex/etc
|
||||
--
|
||||
|
||||
rawBlock :: Parser [Char] st Blocks
|
||||
rawBlock = try $ do
|
||||
string ".. raw:: "
|
||||
lang <- many1 (letter <|> digit)
|
||||
blanklines
|
||||
result <- indentedBlock
|
||||
return $ B.rawBlock lang result
|
||||
|
||||
--
|
||||
-- block quotes
|
||||
--
|
||||
@@ -501,10 +488,8 @@ directive = try $ do
|
||||
directive'
|
||||
|
||||
-- TODO: line-block, parsed-literal, table, csv-table, list-table
|
||||
-- replace, unicode
|
||||
-- date
|
||||
-- include
|
||||
-- raw (consolidate)
|
||||
-- class
|
||||
-- title
|
||||
directive' :: RSTParser Blocks
|
||||
@@ -523,6 +508,7 @@ directive' = do
|
||||
optional blanklines
|
||||
let body' = body ++ "\n\n"
|
||||
case label of
|
||||
"raw" -> return $ B.rawBlock (trim top) (stripTrailingNewlines body)
|
||||
"container" -> parseFromString parseBlocks body'
|
||||
"replace" -> B.para <$> -- consumed by substKey
|
||||
parseFromString (trimInlines . mconcat <$> many inline)
|
||||
|
||||
Reference in New Issue
Block a user