Skip to content

Commit

Permalink
DocBook writer: Small tweaks to last commit.
Browse files Browse the repository at this point in the history
* Use isTightList from Shared.
* Adjust writer test, since isTightList is a bit different from what
  was used before.

Closes #1250.
  • Loading branch information
jgm committed May 4, 2014
1 parent ccbf4fc commit abd3a03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions src/Text/Pandoc/Writers/Docbook.hs
Expand Up @@ -185,9 +185,7 @@ blockToDocbook _ (CodeBlock (_,classes,_) str) =
else languagesByExtension . map toLower $ s
langs = concatMap langsFrom classes
blockToDocbook opts (BulletList lst) =
let attribs = case lst of
((Plain _:_):_) -> [("spacing", "compact")]
_ -> []
let attribs = [("spacing", "compact") | isTightList lst]
in inTags True "itemizedlist" attribs $ listItemsToDocbook opts lst
blockToDocbook _ (OrderedList _ []) = empty
blockToDocbook opts (OrderedList (start, numstyle, _) (first:rest)) =
Expand All @@ -199,9 +197,7 @@ blockToDocbook opts (OrderedList (start, numstyle, _) (first:rest)) =
LowerAlpha -> [("numeration", "loweralpha")]
UpperRoman -> [("numeration", "upperroman")]
LowerRoman -> [("numeration", "lowerroman")]
spacing = case first of
(Plain _:_) -> [("spacing", "compact")]
_ -> []
spacing = [("spacing", "compact") | isTightList (first:rest)]
attribs = numeration ++ spacing
items = if start == 1
then listItemsToDocbook opts (first:rest)
Expand All @@ -210,9 +206,7 @@ blockToDocbook opts (OrderedList (start, numstyle, _) (first:rest)) =
listItemsToDocbook opts rest
in inTags True "orderedlist" attribs items
blockToDocbook opts (DefinitionList lst) =
let attribs = case lst of
((_, (Plain _:_):_):_) -> [("spacing", "compact")]
_ -> []
let attribs = [("spacing", "compact") | isTightList $ concatMap snd lst]
in inTags True "variablelist" attribs $ deflistItemsToDocbook opts lst
blockToDocbook _ (RawBlock f str)
| f == "docbook" = text str -- raw XML block
Expand Down
2 changes: 1 addition & 1 deletion tests/writer.docbook
Expand Up @@ -508,7 +508,7 @@ These should not be escaped: \$ \\ \> \[ \{
</sect2>
<sect2 id="fancy-list-markers">
<title>Fancy list markers</title>
<orderedlist numeration="arabic" spacing="compact">
<orderedlist numeration="arabic">
<listitem override="2">
<para>
begins with 2
Expand Down

0 comments on commit abd3a03

Please sign in to comment.