aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-11-29 09:43:11 -0800
committerJohn MacFarlane <[email protected]>2022-11-29 09:43:11 -0800
commit6191be11ff81c8fce8509ebf1543e867d8501ba3 (patch)
tree8dca39890428b7463418e08802d84b98011ac34a
parent6a23ac0d1dc91260fb86abd517cfbdf24b0dfe1b (diff)
DocBook writer: don't indent contents of title element.
-rw-r--r--src/Text/Pandoc/Readers/DocBook.hs2
-rw-r--r--src/Text/Pandoc/Writers/DocBook.hs8
-rw-r--r--test/tables.docbook412
-rw-r--r--test/tables.docbook512
4 files changed, 11 insertions, 23 deletions
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
index 1522de628..50faa9cd4 100644
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -809,7 +809,7 @@ getMediaobject e = do
case filterElements (named "imageobject") e of
[] -> (mempty, mempty, nullAttr)
(z:_) ->
- let tit' = maybe "" (T.strip . strContent) $
+ let tit' = maybe "" strContent $
filterChild (named "objectinfo") z >>=
filterChild (named "title")
(imageUrl', attr') =
diff --git a/src/Text/Pandoc/Writers/DocBook.hs b/src/Text/Pandoc/Writers/DocBook.hs
index c7db4c699..9f494c21f 100644
--- a/src/Text/Pandoc/Writers/DocBook.hs
+++ b/src/Text/Pandoc/Writers/DocBook.hs
@@ -212,7 +212,7 @@ blockToDocBook opts (Div (ident,classes,_) bs) = do
admonitionTitle <- case mTitleBs of
Nothing -> return mempty
-- id will be attached to the admonition so let’s pass empty identAttrs.
- Just titleBs -> inTags False "title" [] <$> titleBs
+ Just titleBs -> inTagsSimple "title" <$> titleBs
admonitionBody <- handleDivBody [] bodyBs
return (inTags True l identAttribs (admonitionTitle $$ admonitionBody))
_ -> handleDivBody identAttribs bs
@@ -308,7 +308,7 @@ blockToDocBook opts (Table _ blkCapt specs thead tbody tfoot) = do
let (caption, aligns, widths, headers, rows) = toLegacyTable blkCapt specs thead tbody tfoot
captionDoc <- if null caption
then return empty
- else inTagsIndented "title" <$>
+ else inTagsSimple "title" <$>
inlinesToDocBook opts caption
let tableType = if isEmpty captionDoc then "informaltable" else "table"
percent w = tshow (truncate (100*w) :: Integer) <> "*"
@@ -442,11 +442,11 @@ inlineToDocBook opts (Image attr ils (src, tit)) = return $
let titleDoc = if T.null tit
then empty
else inTagsIndented "objectinfo" $
- inTagsIndented "title" (literal $ escapeStringForXML tit)
+ inTagsSimple "title" (literal $ escapeStringForXML tit)
alt = if null ils
then mempty
else inTagsIndented "textobject" $
- inTags False "phrase" [] $ literal (stringify ils)
+ inTagsSimple "phrase" $ literal (stringify ils)
in inTagsIndented "inlinemediaobject" $ inTagsIndented "imageobject" $
titleDoc $$ imageToDocBook opts attr src $$ alt
inlineToDocBook opts (Note contents) =
diff --git a/test/tables.docbook4 b/test/tables.docbook4
index a661805e5..6ef281fc2 100644
--- a/test/tables.docbook4
+++ b/test/tables.docbook4
@@ -2,9 +2,7 @@
Simple table with caption:
</para>
<table>
- <title>
- Demonstration of simple table syntax.
- </title>
+ <title>Demonstration of simple table syntax.</title>
<tgroup cols="4">
<colspec align="right" />
<colspec align="left" />
@@ -147,9 +145,7 @@
Simple table indented two spaces:
</para>
<table>
- <title>
- Demonstration of simple table syntax.
- </title>
+ <title>Demonstration of simple table syntax.</title>
<tgroup cols="4">
<colspec align="right" />
<colspec align="left" />
@@ -221,9 +217,7 @@
Multiline table with caption:
</para>
<table>
- <title>
- Here’s the caption. It may span multiple lines.
- </title>
+ <title>Here’s the caption. It may span multiple lines.</title>
<tgroup cols="4">
<colspec colwidth="15*" align="center" />
<colspec colwidth="13*" align="left" />
diff --git a/test/tables.docbook5 b/test/tables.docbook5
index a661805e5..6ef281fc2 100644
--- a/test/tables.docbook5
+++ b/test/tables.docbook5
@@ -2,9 +2,7 @@
Simple table with caption:
</para>
<table>
- <title>
- Demonstration of simple table syntax.
- </title>
+ <title>Demonstration of simple table syntax.</title>
<tgroup cols="4">
<colspec align="right" />
<colspec align="left" />
@@ -147,9 +145,7 @@
Simple table indented two spaces:
</para>
<table>
- <title>
- Demonstration of simple table syntax.
- </title>
+ <title>Demonstration of simple table syntax.</title>
<tgroup cols="4">
<colspec align="right" />
<colspec align="left" />
@@ -221,9 +217,7 @@
Multiline table with caption:
</para>
<table>
- <title>
- Here’s the caption. It may span multiple lines.
- </title>
+ <title>Here’s the caption. It may span multiple lines.</title>
<tgroup cols="4">
<colspec colwidth="15*" align="center" />
<colspec colwidth="13*" align="left" />