aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/DocBook.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
index 0d0adf649..aed7b5977 100644
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -650,13 +650,19 @@ parseBlock (Elem e) =
"book" -> modify (\st -> st{ dbBook = True }) >> getTitle >> getBlocks e
"table" -> parseTable
"informaltable" -> parseTable
- "literallayout" -> return $ codeBlock $ trimNl . strContent $ e -- TODO attrs
- "computeroutput" -> return $ codeBlock $ trimNl . strContent $ e -- TODO attrs
- "screen" -> return $ codeBlock $ trimNl . strContent $ e -- TODO attrs
- "programlisting" -> return $ codeBlock $ trimNl . strContent $ e -- TODO attrs
+ "literallayout" -> codeBlockWithLang ["literallayout"]
+ "computeroutput" -> codeBlockWithLang ["computeroutput"]
+ "screen" -> codeBlockWithLang ["screen"]
+ "programlisting" -> codeBlockWithLang []
"?xml" -> return mempty
_ -> getBlocks e
where getBlocks e' = mconcat <$> (mapM parseBlock $ elContent e')
+ codeBlockWithLang classes = do
+ let classes' = case attrValue "language" e of
+ "" -> classes
+ x -> x:classes
+ return $ codeBlockWith (attrValue "id" e, classes', [])
+ $ trimNl $ strContent e
skipWhite (Text (CData _ s _):xs) | all isSpace s = skipWhite xs
| otherwise = xs
skipWhite xs = xs