aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-11-01 00:38:02 -0400
committerGitHub <noreply@github.com>2017-11-01 00:38:02 -0400
commiteef8118af0bb353f38e8b6ae0f2881ca4d7f71d3 (patch)
tree151d793dd8755cb5b6ee832170bc862a41aab2b0 /src/Text
parent1f393f1a8b4ffba6f4b81a42e5f1b51e6b771f63 (diff)
parent94d02a6efa29ce24ddf8ebbccac29d5acabbd84f (diff)
downloadpandoc-eef8118af0bb353f38e8b6ae0f2881ca4d7f71d3.tar.gz
Merge pull request #4008 from labdsf/fb2-bullets
FB2 writer: make bullet lists consistent with ordered lists
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/FB2.hs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Writers/FB2.hs b/src/Text/Pandoc/Writers/FB2.hs
index 0a8ae17bb..666b67e52 100644
--- a/src/Text/Pandoc/Writers/FB2.hs
+++ b/src/Text/Pandoc/Writers/FB2.hs
@@ -64,7 +64,6 @@ data FbRenderState = FbRenderState
{ footnotes :: [ (Int, String, [Content]) ] -- ^ #, ID, text
, imagesToFetch :: [ (String, String) ] -- ^ filename, URL or path
, parentListMarker :: String -- ^ list marker of the parent ordered list
- , parentBulletLevel :: Int -- ^ nesting level of the unordered list
, writerOptions :: WriterOptions
} deriving (Show)
@@ -73,7 +72,7 @@ type FBM m = StateT FbRenderState m
newFB :: FbRenderState
newFB = FbRenderState { footnotes = [], imagesToFetch = []
- , parentListMarker = "", parentBulletLevel = 0
+ , parentListMarker = ""
, writerOptions = def }
data ImageMode = NormalImage | InlineImage deriving (Eq)
@@ -347,15 +346,12 @@ blockToXml (OrderedList a bss) = do
concat <$> zipWithM mkitem markers bss
blockToXml (BulletList bss) = do
state <- get
- let level = parentBulletLevel state
let pmrk = parentListMarker state
- let prefix = replicate (length pmrk) ' '
- let bullets = ["\x2022", "\x25e6", "*", "\x2043", "\x2023"]
- let mrk = prefix ++ bullets !! (level `mod` length bullets)
+ let mrk = pmrk ++ "•"
let mkitem bs = do
- modify (\s -> s { parentBulletLevel = level+1 })
+ modify (\s -> s { parentListMarker = mrk ++ " "})
item <- cMapM blockToXml $ plainToPara $ indentBlocks (mrk ++ " ") bs
- modify (\s -> s { parentBulletLevel = level }) -- restore bullet level
+ modify (\s -> s { parentListMarker = pmrk }) -- old parent marker
return item
cMapM mkitem bss
blockToXml (DefinitionList defs) =