git.iko.soy/typeable/pandoc
on master help sign in
Support orderedlist and ulink in docbook reader.
f0a1760John MacFarlane
src/Text/Pandoc/Readers/DocBook.hs+6−1
@@ -3,6 +3,7 @@ import Text.Pandoc.Parsing (ParserState(..))
3import Text.Pandoc.Definition
3import Text.Pandoc.Definition
4import Text.Pandoc.Builder
4import Text.Pandoc.Builder
5import Text.XML.Light
5import Text.XML.Light
6+import Data.Maybe (fromMaybe)
6import Data.Monoid
7import Data.Monoid
7import Data.Char (isSpace)
8import Data.Char (isSpace)
8import Control.Monad.State
9import Control.Monad.State
@@ -45,8 +46,9 @@ parseBlock (Elem e) =
45 "sect6" -> sect 6
46 "sect6" -> sect 6
46 "section" -> gets dbSectionLevel >>= sect . (+1)
47 "section" -> gets dbSectionLevel >>= sect . (+1)
47 "itemizedlist" -> bulletList <$> listitems
48 "itemizedlist" -> bulletList <$> listitems
49+ "orderedlist" -> orderedList <$> listitems -- TODO list attributes
48 "articleinfo" -> getTitle >> getAuthors >> getDate >> return mempty
50 "articleinfo" -> getTitle >> getAuthors >> getDate >> return mempty
49− "programlisting" -> return $ codeBlock $ strContent e
51+ "programlisting" -> return $ codeBlock $ strContent e -- TODO attrs
50 "?xml" -> return mempty
52 "?xml" -> return mempty
51 _ -> getBlocks e
53 _ -> getBlocks e
52 where getBlocks e' = mconcat <$> (mapM parseBlock $ elContent e')
54 where getBlocks e' = mconcat <$> (mapM parseBlock $ elContent e')
@@ -93,6 +95,9 @@ parseInline (Elem e) =
93 case qName (elName e) of
95 case qName (elName e) of
94 "subscript" -> subscript <$> innerInlines
96 "subscript" -> subscript <$> innerInlines
95 "superscript" -> superscript <$> innerInlines
97 "superscript" -> superscript <$> innerInlines
98+ "ulink" -> link
99+ (fromMaybe "" (lookupAttrBy (\attr -> qName attr == "url")
100+ (elAttribs e))) "" <$> innerInlines
96 "emphasis" -> case lookupAttrBy (\attr -> qName attr == "role")
101 "emphasis" -> case lookupAttrBy (\attr -> qName attr == "role")
97 (elAttribs e) of
102 (elAttribs e) of
98 Just "strong" -> strong <$> innerInlines
103 Just "strong" -> strong <$> innerInlines