DocBook reader: Improved def lists with multiple defs.
This commit is contained in:
parent
b1cba4ae8e
commit
8ba8a720ed
2 changed files with 15 additions and 17 deletions
|
@ -651,13 +651,11 @@ parseBlock (Elem e) =
|
|||
deflistitems = mapM parseVarListEntry $ filterChildren
|
||||
(named "varlistentry") e
|
||||
parseVarListEntry e' = do
|
||||
let defs = filterChildren (named "term") e'
|
||||
let terms = filterChildren (named "term") e'
|
||||
let items = filterChildren (named "listitem") e'
|
||||
defs' <- mapM ((mconcat <$>) . mapM parseInline)
|
||||
$ map elContent defs
|
||||
items' <- mapM ((mconcat <$>) . mapM parseBlock)
|
||||
$ map elContent items
|
||||
return (trimInlines $ mconcat $ intersperse (str "; ") defs', items')
|
||||
terms' <- mapM ((trimInlines . mconcat <$>) . mapM parseInline . elContent) terms
|
||||
items' <- mapM ((mconcat <$>) . mapM parseBlock . elContent) items
|
||||
return (mconcat $ intersperse (str "; ") terms', items')
|
||||
getTitle = case filterChild (named "title") e of
|
||||
Just t -> do
|
||||
tit <- getInlines t
|
||||
|
|
|
@ -24,7 +24,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
|
|||
[Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
|
||||
,CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}"
|
||||
,Para [Str "A",Space,Str "list:"]
|
||||
,OrderedList (1,Decimal,Period)
|
||||
,OrderedList (1,Decimal,DefaultDelim)
|
||||
[[Para [Str "item",Space,Str "one"]]
|
||||
,[Para [Str "item",Space,Str "two"]]]
|
||||
,Para [Str "Nested",Space,Str "block",Space,Str "quotes:"]
|
||||
|
@ -57,17 +57,17 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
|
|||
,[Para [Str "Minus",Space,Str "2"]]
|
||||
,[Para [Str "Minus",Space,Str "3"]]]
|
||||
,Header 2 [Str "Ordered"]
|
||||
,OrderedList (1,Decimal,Period)
|
||||
,OrderedList (1,Decimal,DefaultDelim)
|
||||
[[Para [Str "First"]]
|
||||
,[Para [Str "Second"]]
|
||||
,[Para [Str "Third"]]]
|
||||
,Para [Str "and",Space,Str "using",Space,Str "spaces:"]
|
||||
,OrderedList (1,Decimal,Period)
|
||||
,OrderedList (1,Decimal,DefaultDelim)
|
||||
[[Para [Str "One"]]
|
||||
,[Para [Str "Two"]]
|
||||
,[Para [Str "Three"]]]
|
||||
,Para [Str "Multiple",Space,Str "paragraphs:"]
|
||||
,OrderedList (1,Decimal,Period)
|
||||
,OrderedList (1,Decimal,DefaultDelim)
|
||||
[[Para [Str "Item",Space,Str "1,",Space,Str "graf",Space,Str "one."]
|
||||
,Para [Str "Item",Space,Str "1.",Space,Str "graf",Space,Str "two.",Space,Str "The",Space,Str "quick",Space,Str "brown",Space,Str "fox",Space,Str "jumped",Space,Str "over",Space,Str "the",Space,Str "lazy",Space,Str "dog\8217s",Space,Str "back."]]
|
||||
,[Para [Str "Item",Space,Str "2."]]
|
||||
|
@ -80,7 +80,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
|
|||
,BulletList
|
||||
[[Para [Str "Tab"]]]]]]]
|
||||
,Para [Str "Here\8217s",Space,Str "another:"]
|
||||
,OrderedList (1,Decimal,Period)
|
||||
,OrderedList (1,Decimal,DefaultDelim)
|
||||
[[Para [Str "First"]]
|
||||
,[Para [Str "Second:"]
|
||||
,BulletList
|
||||
|
@ -89,7 +89,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
|
|||
,[Para [Str "Foe"]]]]
|
||||
,[Para [Str "Third"]]]
|
||||
,Para [Str "Same",Space,Str "thing",Space,Str "but",Space,Str "with",Space,Str "paragraphs:"]
|
||||
,OrderedList (1,Decimal,Period)
|
||||
,OrderedList (1,Decimal,DefaultDelim)
|
||||
[[Para [Str "First"]]
|
||||
,[Para [Str "Second:"]
|
||||
,BulletList
|
||||
|
@ -109,16 +109,16 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
|
|||
[[Para [Str "begins",Space,Str "with",Space,Str "2"]]
|
||||
,[Para [Str "and",Space,Str "now",Space,Str "3"]
|
||||
,Para [Str "with",Space,Str "a",Space,Str "continuation"]
|
||||
,OrderedList (4,LowerRoman,Period)
|
||||
,OrderedList (4,LowerRoman,DefaultDelim)
|
||||
[[Para [Str "sublist",Space,Str "with",Space,Str "roman",Space,Str "numerals,",Space,Str "starting",Space,Str "with",Space,Str "4"]]
|
||||
,[Para [Str "more",Space,Str "items"]
|
||||
,OrderedList (1,UpperAlpha,TwoParens)
|
||||
[[Para [Str "a",Space,Str "subsublist"]]
|
||||
,[Para [Str "a",Space,Str "subsublist"]]]]]]]
|
||||
,Para [Str "Nesting:"]
|
||||
,OrderedList (1,UpperAlpha,Period)
|
||||
,OrderedList (1,UpperAlpha,DefaultDelim)
|
||||
[[Para [Str "Upper",Space,Str "Alpha"]
|
||||
,OrderedList (1,UpperRoman,Period)
|
||||
,OrderedList (1,UpperRoman,DefaultDelim)
|
||||
[[Para [Str "Upper",Space,Str "Roman."]
|
||||
,OrderedList (6,Decimal,TwoParens)
|
||||
[[Para [Str "Decimal",Space,Str "start",Space,Str "with",Space,Str "6"]
|
||||
|
@ -166,7 +166,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
|
|||
,[Para [Str "computer"]]])
|
||||
,([Str "orange"],
|
||||
[[Para [Str "orange",Space,Str "fruit"]
|
||||
,OrderedList (1,Decimal,Period)
|
||||
,OrderedList (1,Decimal,DefaultDelim)
|
||||
[[Para [Str "sublist"]]
|
||||
,[Para [Str "sublist"]]]]])]
|
||||
,Header 1 [Str "Inline",Space,Str "Markup"]
|
||||
|
@ -268,7 +268,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
|
|||
,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Note [Para [Str "Here",Space,Str "is",Space,Str "the",Space,Str "footnote.",Space,Str "It",Space,Str "can",Space,Str "go",Space,Str "anywhere",Space,Str "after",Space,Str "the",Space,Str "footnote",Space,Str "reference.",Space,Str "It",Space,Str "need",Space,Str "not",Space,Str "be",Space,Str "placed",Space,Str "at",Space,Str "the",Space,Str "end",Space,Str "of",Space,Str "the",Space,Str "document."]],Space,Str "and",Space,Str "another.",Note [Para [Str "Here\8217s",Space,Str "the",Space,Str "long",Space,Str "note.",Space,Str "This",Space,Str "one",Space,Str "contains",Space,Str "multiple",Space,Str "blocks."],Para [Str "Subsequent",Space,Str "blocks",Space,Str "are",Space,Str "indented",Space,Str "to",Space,Str "show",Space,Str "that",Space,Str "they",Space,Str "belong",Space,Str "to",Space,Str "the",Space,Str "footnote",Space,Str "(as",Space,Str "with",Space,Str "list",Space,Str "items)."],CodeBlock ("",[],[]) " { <code> }",Para [Str "If",Space,Str "you",Space,Str "want,",Space,Str "you",Space,Str "can",Space,Str "indent",Space,Str "every",Space,Str "line,",Space,Str "but",Space,Str "you",Space,Str "can",Space,Str "also",Space,Str "be",Space,Str "lazy",Space,Str "and",Space,Str "just",Space,Str "indent",Space,Str "the",Space,Str "first",Space,Str "line",Space,Str "of",Space,Str "each",Space,Str "block."]],Space,Str "This",Space,Str "should",Space,Emph [Str "not"],Space,Str "be",Space,Str "a",Space,Str "footnote",Space,Str "reference,",Space,Str "because",Space,Str "it",Space,Str "contains",Space,Str "a",Space,Str "space.[^my",Space,Str "note]",Space,Str "Here",Space,Str "is",Space,Str "an",Space,Str "inline",Space,Str "note.",Note [Para [Str "This",Space,Str "is",Space,Emph [Str "easier"],Space,Str "to",Space,Str "type.",Space,Str "Inline",Space,Str "notes",Space,Str "may",Space,Str "contain",Space,Link [Str "links"] ("http://google.com",""),Space,Str "and",Space,Code ("",[],[]) "]",Space,Str "verbatim",Space,Str "characters,",Space,Str "as",Space,Str "well",Space,Str "as",Space,Str "[bracketed",Space,Str "text]."]]]
|
||||
,BlockQuote
|
||||
[Para [Str "Notes",Space,Str "can",Space,Str "go",Space,Str "in",Space,Str "quotes.",Note [Para [Str "In",Space,Str "quote."]]]]
|
||||
,OrderedList (1,Decimal,Period)
|
||||
,OrderedList (1,Decimal,DefaultDelim)
|
||||
[[Para [Str "And",Space,Str "in",Space,Str "list",Space,Str "items.",Note [Para [Str "In",Space,Str "list."]]]]]
|
||||
,Para [Str "This",Space,Str "paragraph",Space,Str "should",Space,Str "not",Space,Str "be",Space,Str "part",Space,Str "of",Space,Str "the",Space,Str "note,",Space,Str "as",Space,Str "it",Space,Str "is",Space,Str "not",Space,Str "indented."]
|
||||
,Header 1 [Str "Tables"]
|
||||
|
|
Loading…
Reference in a new issue