DocBook reader: Support language attribute in programlisting.
This commit is contained in:
parent
4d9a1324ae
commit
79e83749bf
1 changed files with 10 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue