aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorIvo Clarysse <ivo@bcdevices.com>2016-04-29 15:43:15 -0700
committerIvo Clarysse <ivo@bcdevices.com>2016-04-29 15:43:15 -0700
commit987ec3a7523f4fe529575004d76d93680f127fa3 (patch)
treeed586cb0f568b98faa8596ed413aea45e0b69096 /src/Text/Pandoc/Writers
parent271cb4d8457b2252cddc76a476f3681e8b2a1486 (diff)
downloadpandoc-987ec3a7523f4fe529575004d76d93680f127fa3.tar.gz
Write out Docbook 5 namespace
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/Docbook.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs
index 5528714a2..79ccde9af 100644
--- a/src/Text/Pandoc/Writers/Docbook.hs
+++ b/src/Text/Pandoc/Writers/Docbook.hs
@@ -112,12 +112,15 @@ elementToDocbook opts lvl (Sec _ _num (id',_,_) title elements) =
else elements
tag = case lvl of
n | n == 0 -> "chapter"
- | n >= 1 && n <= 5 -> if writerDocBook5 opts
+ | n >= 1 && n <= 5 -> if writerDocbook5 opts
then "section"
else "sect" ++ show n
| otherwise -> "simplesect"
- in inTags True tag [("id", writerIdentifierPrefix opts ++ id') |
- not (null id')] $
+ idAttr = [("id", writerIdentifierPrefix opts ++ id') | not (null id')]
+ nsAttr = if writerDocbook5 opts && lvl == 0 then [("xmlns", "http://docbook.org/ns/docbook")]
+ else []
+ attribs = nsAttr ++ idAttr
+ in inTags True tag attribs $
inTagsSimple "title" (inlinesToDocbook opts title) $$
vcat (map (elementToDocbook opts (lvl + 1)) elements')
@@ -231,7 +234,7 @@ blockToDocbook opts (DefinitionList lst) =
in inTags True "variablelist" attribs $ deflistItemsToDocbook opts lst
blockToDocbook opts (RawBlock f str)
| f == "docbook" = text str -- raw XML block
- | f == "html" = if writerDocBook5 opts
+ | f == "html" = if writerDocbook5 opts
then empty -- No html in Docbook5
else text str -- allow html for backwards compatibility
| otherwise = empty