DocBook reader: Better handle elements inside code environments.
Of course, we can't include structure in the code block, but this way we at least preserve the text. Closes #1449.
This commit is contained in:
parent
5089bc8fe2
commit
9c3f7688ee
3 changed files with 10 additions and 1 deletions
|
@ -769,7 +769,12 @@ parseBlock (Elem e) =
|
|||
"" -> []
|
||||
x -> [x]
|
||||
return $ codeBlockWith (attrValue "id" e, classes', [])
|
||||
$ trimNl $ strContent e
|
||||
$ trimNl $ strContentRecursive e
|
||||
strContentRecursive = strContent . (\e' -> e'{ elContent =
|
||||
map elementToStr $ elContent e' })
|
||||
elementToStr :: Content -> Content
|
||||
elementToStr (Elem e') = Text $ CData CDataText (strContentRecursive e') Nothing
|
||||
elementToStr x = x
|
||||
parseBlockquote = do
|
||||
attrib <- case filterChild (named "attribution") e of
|
||||
Nothing -> return mempty
|
||||
|
|
|
@ -89,6 +89,9 @@ sub status {
|
|||
print "working";
|
||||
}
|
||||
</programlisting>
|
||||
<screen>
|
||||
% <command>ls</command>
|
||||
</screen>
|
||||
<para>
|
||||
A list:
|
||||
</para>
|
||||
|
|
|
@ -23,6 +23,7 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Spa
|
|||
,BlockQuote
|
||||
[Para [Str "Code",Space,Str "in",Space,Str "a",Space,Str "block",Space,Str "quote:"]
|
||||
,CodeBlock ("",[],[]) "sub status {\n print \"working\";\n}"
|
||||
,CodeBlock ("",[],[]) "% ls"
|
||||
,Para [Str "A",Space,Str "list:"]
|
||||
,OrderedList (1,Decimal,DefaultDelim)
|
||||
[[Para [Str "item",Space,Str "one"]]
|
||||
|
|
Loading…
Add table
Reference in a new issue