mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-13 02:55:55 +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 :: RSTParser Blocks
|
||||||
block = choice [ codeBlock
|
block = choice [ codeBlock
|
||||||
, rawBlock
|
|
||||||
, blockQuote
|
, blockQuote
|
||||||
, fieldList
|
, fieldList
|
||||||
, directive
|
, directive
|
||||||
@@ -353,18 +352,6 @@ lhsCodeBlock = try $ do
|
|||||||
birdTrackLine :: Parser [Char] st [Char]
|
birdTrackLine :: Parser [Char] st [Char]
|
||||||
birdTrackLine = char '>' >> manyTill anyChar newline
|
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
|
-- block quotes
|
||||||
--
|
--
|
||||||
@@ -501,10 +488,8 @@ directive = try $ do
|
|||||||
directive'
|
directive'
|
||||||
|
|
||||||
-- TODO: line-block, parsed-literal, table, csv-table, list-table
|
-- TODO: line-block, parsed-literal, table, csv-table, list-table
|
||||||
-- replace, unicode
|
|
||||||
-- date
|
-- date
|
||||||
-- include
|
-- include
|
||||||
-- raw (consolidate)
|
|
||||||
-- class
|
-- class
|
||||||
-- title
|
-- title
|
||||||
directive' :: RSTParser Blocks
|
directive' :: RSTParser Blocks
|
||||||
@@ -523,6 +508,7 @@ directive' = do
|
|||||||
optional blanklines
|
optional blanklines
|
||||||
let body' = body ++ "\n\n"
|
let body' = body ++ "\n\n"
|
||||||
case label of
|
case label of
|
||||||
|
"raw" -> return $ B.rawBlock (trim top) (stripTrailingNewlines body)
|
||||||
"container" -> parseFromString parseBlocks body'
|
"container" -> parseFromString parseBlocks body'
|
||||||
"replace" -> B.para <$> -- consumed by substKey
|
"replace" -> B.para <$> -- consumed by substKey
|
||||||
parseFromString (trimInlines . mconcat <$> many inline)
|
parseFromString (trimInlines . mconcat <$> many inline)
|
||||||
|
|||||||
@@ -175,11 +175,11 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":
|
|||||||
[[Para [Str "123-4567"]]])]
|
[[Para [Str "123-4567"]]])]
|
||||||
,Header 1 [Str "HTML",Space,Str "Blocks"]
|
,Header 1 [Str "HTML",Space,Str "Blocks"]
|
||||||
,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
|
,Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line:"]
|
||||||
,RawBlock "html" "<div>foo</div>\n"
|
,RawBlock "html" "<div>foo</div>"
|
||||||
,Para [Str "Now,",Space,Str "nested:"]
|
,Para [Str "Now,",Space,Str "nested:"]
|
||||||
,RawBlock "html" "<div>\n <div>\n <div>\n foo\n </div>\n </div>\n</div>\n"
|
,RawBlock "html" "<div>\n <div>\n <div>\n foo\n </div>\n </div>\n</div>"
|
||||||
,Header 1 [Str "LaTeX",Space,Str "Block"]
|
,Header 1 [Str "LaTeX",Space,Str "Block"]
|
||||||
,RawBlock "latex" "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}\n"
|
,RawBlock "latex" "\\begin{tabular}{|l|l|}\\hline\nAnimal & Number \\\\ \\hline\nDog & 2 \\\\\nCat & 1 \\\\ \\hline\n\\end{tabular}"
|
||||||
,Header 1 [Str "Inline",Space,Str "Markup"]
|
,Header 1 [Str "Inline",Space,Str "Markup"]
|
||||||
,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ".",Space,Str "This",Space,Str "is",Space,Strong [Str "strong"],Str "."]
|
,Para [Str "This",Space,Str "is",Space,Emph [Str "emphasized"],Str ".",Space,Str "This",Space,Str "is",Space,Strong [Str "strong"],Str "."]
|
||||||
,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 "."]
|
,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 "."]
|
||||||
|
|||||||
Reference in New Issue
Block a user