mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-26 10:16:32 +00:00
Added support for definition lists to RST reader.
Added a relevant test to the test suite. git-svn-id: https://pandoc.googlecode.com/svn/trunk@782 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
@@ -355,7 +355,21 @@ blockQuote = try (do
|
||||
-- list blocks
|
||||
--
|
||||
|
||||
list = choice [ bulletList, orderedList ] <?> "list"
|
||||
list = choice [ bulletList, orderedList, definitionList ] <?> "list"
|
||||
|
||||
definitionListItem = try $ do
|
||||
term <- many1Till inline endline
|
||||
raw <- indentedBlock True
|
||||
-- parse the extracted block, which may contain various block elements:
|
||||
rest <- getInput
|
||||
setInput $ raw ++ "\n\n"
|
||||
contents <- parseBlocks
|
||||
setInput rest
|
||||
return (normalizeSpaces term, contents)
|
||||
|
||||
definitionList = try $ do
|
||||
items <- many1 definitionListItem
|
||||
return (DefinitionList items)
|
||||
|
||||
-- parses bullet list start and returns its length (inc. following whitespace)
|
||||
bulletListStart = try (do
|
||||
|
||||
@@ -117,6 +117,17 @@ Pandoc (Meta [Str "Pandoc",Space,Str "Test",Space,Str "Suite",Str ":",Space,Str
|
||||
[ [ Plain [Str "Fee"] ]
|
||||
, [ Plain [Str "Fie"] ]
|
||||
, [ Plain [Str "Foe"] ] ] ] ], [ Para [Str "Third"] ] ]
|
||||
, Header 2 [Str "Definition"]
|
||||
, DefinitionList
|
||||
[ ([Str "term",Space,Str "1"],
|
||||
[ Para [Str "Definition",Space,Str "1."] ]
|
||||
),
|
||||
([Str "term",Space,Str "2"],
|
||||
[ Para [Str "Definition",Space,Str "2,",Space,Str "paragraph",Space,Str "1."]
|
||||
, Para [Str "Definition",Space,Str "2,",Space,Str "paragraph",Space,Str "2."] ] ),
|
||||
([Str "term",Space,Str "with",Space,Emph [Str "emphasis"]],
|
||||
[ Para [Str "Definition",Space,Str "3."] ]
|
||||
) ]
|
||||
, Header 1 [Str "HTML",Space,Str "Blocks"]
|
||||
, Para [Str "Simple",Space,Str "block",Space,Str "on",Space,Str "one",Space,Str "line",Str ":"]
|
||||
, RawHtml "<div>foo</div>\n"
|
||||
|
||||
@@ -211,6 +211,20 @@ Here's another:
|
||||
|
||||
3. Third
|
||||
|
||||
Definition
|
||||
----------
|
||||
|
||||
term 1
|
||||
Definition 1.
|
||||
|
||||
term 2
|
||||
Definition 2, paragraph 1.
|
||||
|
||||
Definition 2, paragraph 2.
|
||||
|
||||
term with *emphasis*
|
||||
Definition 3.
|
||||
|
||||
HTML Blocks
|
||||
===========
|
||||
|
||||
|
||||
Reference in New Issue
Block a user