mirror of
https://github.com/jgm/pandoc.git
synced 2026-10-29 17:52:33 +08:00
Fixed parsing of RST comment blocks.
Modified 'unknown directive' in RST reader. Added RST reader tests for comment blocks. Resolves Issue #86 and Debian Bug#500662. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1484 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
@@ -367,6 +367,8 @@ list = choice [ bulletList, orderedList, definitionList ] <?> "list"
|
||||
|
||||
definitionListItem :: GenParser Char ParserState ([Inline], [Block])
|
||||
definitionListItem = try $ do
|
||||
-- avoid capturing a directive or comment
|
||||
notFollowedBy (try $ char '.' >> char '.')
|
||||
term <- many1Till inline endline
|
||||
raw <- indentedBlock
|
||||
-- parse the extracted block, which may contain various block elements:
|
||||
@@ -464,11 +466,10 @@ bulletList = many1 (listItem bulletListStart) >>=
|
||||
|
||||
unknownDirective :: GenParser Char st Block
|
||||
unknownDirective = try $ do
|
||||
string ".. "
|
||||
string ".."
|
||||
notFollowedBy (noneOf " \t\n")
|
||||
manyTill anyChar newline
|
||||
many (string " :" >> many1 (noneOf "\n:") >> char ':' >>
|
||||
many1 (noneOf "\n") >> newline)
|
||||
optional blanklines
|
||||
many $ blanklines <|> (oneOf " \t" >> manyTill anyChar newline)
|
||||
return Null
|
||||
|
||||
--
|
||||
|
||||
@@ -230,5 +230,9 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":",Space,Str
|
||||
, 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)",Str ":"]
|
||||
, Plain [Image [Str "image"] ("lalune.jpg","")]
|
||||
, Plain [Image [Str "Voyage dans la Lune"] ("lalune.jpg","Voyage dans la Lune")]
|
||||
, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon."] ]
|
||||
, Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
|
||||
, Header 1 [Str "Comments"]
|
||||
, Para [Str "First",Space,Str "paragraph"]
|
||||
, Para [Str "Another",Space,Str "paragraph"]
|
||||
, Para [Str "A",Space,Str "third",Space,Str "paragraph"] ]
|
||||
|
||||
|
||||
@@ -402,3 +402,29 @@ From "Voyage dans la Lune" by Georges Melies (1902):
|
||||
Here is a movie |movie| icon.
|
||||
|
||||
.. |movie| image:: movie.jpg
|
||||
|
||||
Comments
|
||||
========
|
||||
|
||||
First paragraph
|
||||
|
||||
.. comment
|
||||
|
||||
..
|
||||
Comment block, should not appear in output
|
||||
as defined by reStructuredText
|
||||
|
||||
Another paragraph
|
||||
|
||||
..
|
||||
Another comment block.
|
||||
|
||||
This one spans several
|
||||
text elements.
|
||||
|
||||
It doesn't end until
|
||||
indentation is restored to the
|
||||
preceding level.
|
||||
|
||||
A third paragraph
|
||||
|
||||
|
||||
Reference in New Issue
Block a user